File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
app/src/main/java/org/fcitx/fcitx5/android/utils Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,7 @@ object AppUtil {
21
21
fun launchMain (context : Context ) {
22
22
context.startActivity(
23
23
Intent (context, MainActivity ::class .java).apply {
24
- addFlags(Intent .FLAG_ACTIVITY_NEW_TASK )
25
- addFlags(Intent .FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS )
24
+ addFlags(Intent .FLAG_ACTIVITY_NEW_TASK or Intent .FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS )
26
25
}
27
26
)
28
27
}
@@ -32,11 +31,16 @@ object AppUtil {
32
31
.setComponentName(MainActivity ::class .java)
33
32
.setGraph(R .navigation.settings_nav)
34
33
.addDestination(dest, arguments)
35
- .createPendingIntent()
36
- .send(context, 0 , Intent ().apply {
37
- addFlags(Intent .FLAG_ACTIVITY_NEW_TASK )
38
- addFlags(Intent .FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS )
39
- })
34
+ .createTaskStackBuilder()
35
+ /* *
36
+ * [androidx.core.app.TaskStackBuilder.getIntents] would add unwanted flags
37
+ * [Intent.FLAG_ACTIVITY_CLEAR_TASK] and [Intent.FLAG_ACTIVITY_TASK_ON_HOME]
38
+ * so we must launch the Intent by ourselves
39
+ */
40
+ .editIntentAt(0 )?.apply {
41
+ addFlags(Intent .FLAG_ACTIVITY_NEW_TASK or Intent .FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS )
42
+ context.startActivity(this )
43
+ }
40
44
}
41
45
42
46
fun launchMainToKeyboard (context : Context ) =
You can’t perform that action at this time.
0 commit comments