mirror of
				https://github.com/SimpleMobileTools/Simple-Launcher.git
				synced 2025-06-05 21:59:15 +02:00 
			
		
		
		
	add Simple Launchers settings as an icon
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user