diff options
Diffstat (limited to 'main/src/cgeo/geocaching/activity/ActivityMixin.java')
| -rw-r--r-- | main/src/cgeo/geocaching/activity/ActivityMixin.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/activity/ActivityMixin.java b/main/src/cgeo/geocaching/activity/ActivityMixin.java index b135358..14a2fbf 100644 --- a/main/src/cgeo/geocaching/activity/ActivityMixin.java +++ b/main/src/cgeo/geocaching/activity/ActivityMixin.java @@ -157,6 +157,15 @@ public final class ActivityMixin { editText.setSelection(newCursor); } + /** + * This is the exact code from Google to implement Up navigation, with one exception: activity.isTaskRoot() was + * added as {@link NavUtils#shouldUpRecreateTask(Activity, Intent)} seems not to handle the case, that this activity + * was created from an intent by another app, and our own app is not yet running. The bug seems to be fixed in + * Android 4.4.something, however. + * + * @param activity + * @return + */ public static boolean navigateUp(@NonNull final Activity activity) { // see http://developer.android.com/training/implementing-navigation/ancestral.html final Intent upIntent = NavUtils.getParentActivityIntent(activity); @@ -164,7 +173,7 @@ public final class ActivityMixin { activity.finish(); return true; } - if (NavUtils.shouldUpRecreateTask(activity, upIntent)) { + if (NavUtils.shouldUpRecreateTask(activity, upIntent) || activity.isTaskRoot()) { // This activity is NOT part of this app's task, so create a new task // when navigating up, with a synthesized back stack. TaskStackBuilder.create(activity) |
