diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7b00c6490..eee4b80d0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,6 +42,7 @@ android:name=".MainActivity" android:exported="true" android:alwaysRetainTaskState="true" + android:maxRecents="1" android:theme="@style/SplashTheme"> diff --git a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt index caff2c3e6..f63da1551 100644 --- a/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/MainActivity.kt @@ -212,7 +212,10 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { super.onCreate(savedInstanceState) // make sure MainActivity doesn't hide other activities when launcher icon is clicked again - if ((intent.flags and Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { + if (!isTaskRoot && + intent.hasCategory(Intent.CATEGORY_LAUNCHER) && + intent.action == Intent.ACTION_MAIN + ) { finish() return } @@ -582,7 +585,6 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { } } startActivity(composeIntent) - finish() } private fun setupDrawer( @@ -1006,6 +1008,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider { intent.action = forward.action intent.putExtras(forward) } + intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK finish() startActivity(intent) }