add Simple Launchers settings as an icon
This commit is contained in:
parent
012e0bdfc4
commit
d86d35aa96
|
@ -364,6 +364,12 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||
allApps.add(AppLauncher(null, label, packageName, 0, placeholderColor, drawable))
|
||||
}
|
||||
|
||||
// add Simple Launchers settings as an app
|
||||
val drawable = getDrawableForPackageName(packageName)
|
||||
val placeholderColor = calculateAverageColor(drawable!!.toBitmap())
|
||||
val launcherSettings = AppLauncher(null, getString(R.string.launcher_settings), packageName, 0, placeholderColor, drawable)
|
||||
allApps.add(launcherSettings)
|
||||
|
||||
val launchers = allApps.distinctBy { it.packageName } as ArrayList<AppLauncher>
|
||||
launchersDB.insertAll(launchers)
|
||||
return launchers
|
||||
|
|
|
@ -5,9 +5,16 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||
import com.simplemobiletools.launcher.activities.SettingsActivity
|
||||
import com.simplemobiletools.launcher.helpers.UNINSTALL_APP_REQUEST_CODE
|
||||
|
||||
fun Activity.launchApp(packageName: String) {
|
||||
// if this is true, launch the app settings
|
||||
if (packageName == this.packageName) {
|
||||
startActivity(Intent(applicationContext, SettingsActivity::class.java))
|
||||
return
|
||||
}
|
||||
|
||||
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
|
||||
try {
|
||||
startActivity(launchIntent)
|
||||
|
|
Loading…
Reference in New Issue