add Simple Launchers settings as an icon

This commit is contained in:
tibbi
2022-09-25 18:45:50 +02:00
parent 012e0bdfc4
commit d86d35aa96
2 changed files with 13 additions and 0 deletions

View File

@ -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)