diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bc42bdf..83f564d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,8 +40,6 @@ android:theme="@style/AppTheme"> - - - - , context: Context) { val positions = HashMap>().withDefault { HashMap() } - val filePath = "${context.dataDir}/appPositions2.json" + val filePath = "${context.dataDir}/appPositions.json" val mapping = appList.map { it.asKey() to it }.toMap().toMutableMap() diff --git a/app/src/main/java/com/agronick/launcher/MainActivity.kt b/app/src/main/java/com/agronick/launcher/MainActivity.kt index 616476a..041d12a 100644 --- a/app/src/main/java/com/agronick/launcher/MainActivity.kt +++ b/app/src/main/java/com/agronick/launcher/MainActivity.kt @@ -70,13 +70,11 @@ class MainActivity : Activity(), GestureDetector.OnGestureListener { private fun getInstalledApps(): List { val mainIntent = Intent(Intent.ACTION_MAIN, null) mainIntent.addCategory(Intent.CATEGORY_LAUNCHER) - return packageManager.queryIntentActivities(mainIntent, 0).mapNotNull { - /* This is commented out because the line of code hides both the launcher and settings - application. This bug would need to be fixed before uncommenting */ - - // if (it.activityInfo.packageName.startsWith("com.agronick.launcher")) { - // return@mapNotNull null - // } + val appName = applicationContext.packageName + val packages = packageManager.queryIntentActivities(mainIntent, 0).mapNotNull { + if (it.activityInfo.packageName == appName) { + return@mapNotNull null + } PInfo( appname = it.activityInfo.packageName, @@ -84,7 +82,24 @@ class MainActivity : Activity(), GestureDetector.OnGestureListener { icon = it.activityInfo.loadIcon(packageManager), activityName = it.activityInfo.name, ) - } + }.toMutableList() + packages.add( + PInfo( + appname = appName, + pname = appName, + icon = getDrawable(R.mipmap.clock), + activityName = "${appName}.presentation.BackToClock", + ) + ) + packages.add( + PInfo( + appname = appName, + pname = appName, + icon = getDrawable(R.mipmap.ic_settings), + activityName = "${appName}.presentation.LauncherSettings", + ) + ) + return packages } override fun onSaveInstanceState(outState: Bundle) {