mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-15 10:27:28 +02:00
add Simple Clock on Android 10+
This commit is contained in:
parent
c6d692077a
commit
df9f021b64
@ -1,5 +1,5 @@
|
|||||||
package com.simplemobiletools.applauncher.extensions
|
package com.simplemobiletools.applauncher.extensions
|
||||||
|
|
||||||
import com.simplemobiletools.applauncher.helpers.predefinedPackageNames
|
import com.simplemobiletools.applauncher.helpers.getPredefinedPackageNames
|
||||||
|
|
||||||
fun String.isAPredefinedApp() = predefinedPackageNames.contains(this)
|
fun String.isAPredefinedApp() = getPredefinedPackageNames().contains(this)
|
||||||
|
@ -1,24 +1,34 @@
|
|||||||
package com.simplemobiletools.applauncher.helpers
|
package com.simplemobiletools.applauncher.helpers
|
||||||
|
|
||||||
|
import com.simplemobiletools.commons.helpers.isRPlus
|
||||||
|
|
||||||
const val WAS_REMOVE_INFO_SHOWN = "was_remove_info_shown"
|
const val WAS_REMOVE_INFO_SHOWN = "was_remove_info_shown"
|
||||||
const val CLOSE_APP = "close_app"
|
const val CLOSE_APP = "close_app"
|
||||||
const val PORTRAIT_COLUMN_COUNT = "portrait_column_count"
|
const val PORTRAIT_COLUMN_COUNT = "portrait_column_count"
|
||||||
const val LANDSCAPE_COLUMN_COUNT = "landscape_column_count"
|
const val LANDSCAPE_COLUMN_COUNT = "landscape_column_count"
|
||||||
const val SHOW_APP_NAME = "show_app_name"
|
const val SHOW_APP_NAME = "show_app_name"
|
||||||
|
|
||||||
val predefinedPackageNames = arrayListOf(
|
fun getPredefinedPackageNames(): ArrayList<String> {
|
||||||
"com.simplemobiletools.calculator",
|
val packages = arrayListOf(
|
||||||
"com.simplemobiletools.calendar.pro",
|
"com.simplemobiletools.calculator",
|
||||||
"com.simplemobiletools.contacts.pro",
|
"com.simplemobiletools.calendar.pro",
|
||||||
"com.simplemobiletools.dialer",
|
"com.simplemobiletools.contacts.pro",
|
||||||
"com.simplemobiletools.draw.pro",
|
"com.simplemobiletools.dialer",
|
||||||
"com.simplemobiletools.filemanager.pro",
|
"com.simplemobiletools.draw.pro",
|
||||||
"com.simplemobiletools.flashlight",
|
"com.simplemobiletools.filemanager.pro",
|
||||||
"com.simplemobiletools.gallery.pro",
|
"com.simplemobiletools.flashlight",
|
||||||
"com.simplemobiletools.keyboard",
|
"com.simplemobiletools.gallery.pro",
|
||||||
"com.simplemobiletools.musicplayer",
|
"com.simplemobiletools.keyboard",
|
||||||
"com.simplemobiletools.notes.pro",
|
"com.simplemobiletools.musicplayer",
|
||||||
"com.simplemobiletools.smsmessenger",
|
"com.simplemobiletools.notes.pro",
|
||||||
"com.simplemobiletools.thankyou",
|
"com.simplemobiletools.smsmessenger",
|
||||||
"com.simplemobiletools.voicerecorder"
|
"com.simplemobiletools.thankyou",
|
||||||
)
|
"com.simplemobiletools.voicerecorder"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isRPlus()) {
|
||||||
|
packages.add(2, "com.simplemobiletools.clock")
|
||||||
|
}
|
||||||
|
|
||||||
|
return packages
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ import com.simplemobiletools.applauncher.extensions.isAPredefinedApp
|
|||||||
import com.simplemobiletools.applauncher.models.AppLauncher
|
import com.simplemobiletools.applauncher.models.AppLauncher
|
||||||
import com.simplemobiletools.commons.extensions.getIntValue
|
import com.simplemobiletools.commons.extensions.getIntValue
|
||||||
import com.simplemobiletools.commons.extensions.getStringValue
|
import com.simplemobiletools.commons.extensions.getStringValue
|
||||||
|
import com.simplemobiletools.commons.helpers.isRPlus
|
||||||
|
|
||||||
class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
|
class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(context, DB_NAME, null, DB_VERSION) {
|
||||||
private val MAIN_TABLE_NAME = "launchers"
|
private val MAIN_TABLE_NAME = "launchers"
|
||||||
@ -102,9 +103,13 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
R.string.voice_recorder_short
|
R.string.voice_recorder_short
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (isRPlus()) {
|
||||||
|
titles.add(2, R.string.clock_short)
|
||||||
|
}
|
||||||
|
|
||||||
val cnt = titles.size
|
val cnt = titles.size
|
||||||
val resources = context.resources
|
val resources = context.resources
|
||||||
val packages = predefinedPackageNames
|
val packages = getPredefinedPackageNames()
|
||||||
for (i in 0 until cnt) {
|
for (i in 0 until cnt) {
|
||||||
val appLauncher = AppLauncher(0, resources.getString(titles[i]), packages[i], 0)
|
val appLauncher = AppLauncher(0, resources.getString(titles[i]), packages[i], 0)
|
||||||
addAppLauncher(appLauncher, db)
|
addAppLauncher(appLauncher, db)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user