adding dialer, sms messenger and voice recorder to default apps

This commit is contained in:
tibbi 2020-05-24 20:08:15 +02:00
parent c9f000a988
commit 301fbc12fe
3 changed files with 43 additions and 25 deletions

View File

@ -11,13 +11,16 @@ fun Resources.getLauncherDrawable(packageName: String): Drawable {
"com.simplemobiletools.camera" -> R.drawable.ic_launcher_camera
"com.simplemobiletools.clock" -> R.drawable.ic_launcher_clock
"com.simplemobiletools.contacts.pro" -> R.drawable.ic_launcher_contacts
"com.simplemobiletools.dialer" -> R.drawable.ic_dialer
"com.simplemobiletools.draw.pro" -> R.drawable.ic_launcher_draw
"com.simplemobiletools.filemanager.pro" -> R.drawable.ic_launcher_filemanager
"com.simplemobiletools.flashlight" -> R.drawable.ic_launcher_flashlight
"com.simplemobiletools.gallery.pro" -> R.drawable.ic_launcher_gallery
"com.simplemobiletools.musicplayer" -> R.drawable.ic_launcher_musicplayer
"com.simplemobiletools.notes.pro" -> R.drawable.ic_launcher_notes
"com.simplemobiletools.smsmessenger" -> R.drawable.ic_sms_messenger
"com.simplemobiletools.thankyou" -> R.drawable.ic_launcher_thankyou
"com.simplemobiletools.voicerecorder" -> R.drawable.ic_voice_recorder
else -> throw RuntimeException("Invalid launcher package name $packageName")
})
}

View File

@ -4,16 +4,19 @@ const val WAS_REMOVE_INFO_SHOWN = "was_remove_info_shown"
const val CLOSE_APP = "close_app"
val predefinedPackageNames = arrayListOf(
"com.simplemobiletools.calculator",
"com.simplemobiletools.calendar.pro",
"com.simplemobiletools.camera",
"com.simplemobiletools.clock",
"com.simplemobiletools.contacts.pro",
"com.simplemobiletools.draw.pro",
"com.simplemobiletools.filemanager.pro",
"com.simplemobiletools.flashlight",
"com.simplemobiletools.gallery.pro",
"com.simplemobiletools.musicplayer",
"com.simplemobiletools.notes.pro",
"com.simplemobiletools.thankyou"
"com.simplemobiletools.calculator",
"com.simplemobiletools.calendar.pro",
"com.simplemobiletools.camera",
"com.simplemobiletools.clock",
"com.simplemobiletools.contacts.pro",
"com.simplemobiletools.dialer",
"com.simplemobiletools.draw.pro",
"com.simplemobiletools.filemanager.pro",
"com.simplemobiletools.flashlight",
"com.simplemobiletools.gallery.pro",
"com.simplemobiletools.musicplayer",
"com.simplemobiletools.notes.pro",
"com.simplemobiletools.smsmessenger",
"com.simplemobiletools.thankyou",
"com.simplemobiletools.voicerecorder"
)

View File

@ -28,7 +28,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
private val mDb = writableDatabase
companion object {
private const val DB_VERSION = 6
private const val DB_VERSION = 7
val DB_NAME = "applaunchers.db"
var dbInstance: DBHelper? = null
@ -65,22 +65,34 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
if (oldVersion < 6) {
db.execSQL("ALTER TABLE $MAIN_TABLE_NAME ADD COLUMN $COL_APP_ORDER INTEGER NOT NULL DEFAULT 0")
}
if (oldVersion < 7) {
val dialer = AppLauncher(0, context.getString(R.string.dialer_short), "com.simplemobiletools.dialer")
val smsMessenger = AppLauncher(0, context.getString(R.string.sms_messenger_short), "com.simplemobiletools.smsmessenger")
val voiceRecorder = AppLauncher(0, context.getString(R.string.voice_recorder_short), "com.simplemobiletools.voicerecorder")
addAppLauncher(dialer, db)
addAppLauncher(smsMessenger, db)
addAppLauncher(voiceRecorder, db)
}
}
private fun addInitialLaunchers(db: SQLiteDatabase) {
val titles = arrayListOf(
R.string.calculator_short,
R.string.calendar_short,
R.string.camera_short,
R.string.clock_short,
R.string.contacts_short,
R.string.draw_short,
R.string.file_manager_short,
R.string.flashlight_short,
R.string.gallery_short,
R.string.music_player_short,
R.string.notes_short,
R.string.thank_you_short
R.string.calculator_short,
R.string.calendar_short,
R.string.camera_short,
R.string.clock_short,
R.string.contacts_short,
R.string.dialer_short,
R.string.draw_short,
R.string.file_manager_short,
R.string.flashlight_short,
R.string.gallery_short,
R.string.music_player_short,
R.string.notes_short,
R.string.sms_messenger_short,
R.string.thank_you_short,
R.string.voice_recorder_short
)
val cnt = titles.size