author | Jan Henning <jh+bugzilla@buttercookie.de> |
Tue, 16 Oct 2018 16:17:18 +0000 | |
changeset 441488 | 7413b2c7cdb4f45da50d2130a9403978977a36ed |
parent 441487 | 6fa9b4e512fa5fadcf300634e5da2ae8b1d12ed2 |
child 441489 | f0952bbb167111d8939b718024e1ae133ca0dd8f |
push id | 34866 |
push user | shindli@mozilla.com |
push date | Wed, 17 Oct 2018 00:54:47 +0000 |
treeherder | mozilla-central@d4fe026dee75 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jchen |
bugs | 1498854, 1476710, 1093209 |
milestone | 64.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -1033,16 +1033,18 @@ public class BrowserApp extends GeckoApp for (BrowserAppDelegate delegate : delegates) { delegate.onResume(this); } } @Override public void onPause() { + dismissTabHistoryFragment(); + super.onPause(); if (mIsAbortingAppLaunch) { return; } if (mHasResumed) { // Register for Prompt:ShowTop so we can foreground this activity even if it's hidden. getAppEventDispatcher().registerUiThreadListener(this, "Prompt:ShowTop"); @@ -3113,20 +3115,17 @@ public class BrowserApp extends GeckoApp } @Override public boolean onPrepareOptionsMenu(Menu aMenu) { if (aMenu == null) return false; // Hide the tab history panel when hardware menu button is pressed. - TabHistoryFragment frag = (TabHistoryFragment) getSupportFragmentManager().findFragmentByTag(TAB_HISTORY_FRAGMENT_TAG); - if (frag != null) { - frag.dismiss(); - } + dismissTabHistoryFragment(); if (!GeckoThread.isRunning()) { aMenu.findItem(R.id.settings).setEnabled(false); aMenu.findItem(R.id.help).setEnabled(false); } Tab tab = Tabs.getInstance().getSelectedTab(); // Unlike other menu items, the bookmark star is not tinted. See {@link ThemedImageButton#setTintedDrawable}. @@ -4135,9 +4134,16 @@ public class BrowserApp extends GeckoApp } @Override public void onFinishedOnboarding(final boolean showBrowserHint) { if (showBrowserHint && !Tabs.hasHomepage(this)) { enterEditingMode(); } } + + private void dismissTabHistoryFragment() { + TabHistoryFragment frag = (TabHistoryFragment) getSupportFragmentManager().findFragmentByTag(TAB_HISTORY_FRAGMENT_TAG); + if (frag != null) { + frag.dismiss(); + } + } }
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabHistoryFragment.java +++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabHistoryFragment.java @@ -100,59 +100,61 @@ public class TabHistoryFragment extends // Since the fragment view fills the entire screen, any clicks outside of the history // ListView will end up here. dismiss(); } @Override public void onPause() { super.onPause(); - dismiss(); + onDismiss(); } @Override public void onDestroy() { super.onDestroy(); - dismiss(); GeckoApplication.watchReference(getActivity(), this); } @Override public void onSaveInstanceState(Bundle outState) { if (backStackId >= 0) { outState.putInt(BACK_STACK_ID, backStackId); } } // Function to add this fragment to activity state with containerViewId as parent. // This similar in functionality to DialogFragment.show() except that containerId is provided here. public void show(final int containerViewId, final FragmentTransaction transaction, final String tag) { dismissed = false; - transaction.add(containerViewId, this, tag); + transaction.replace(containerViewId, this, tag); transaction.addToBackStack(tag); // Populating the tab history requires a gecko call (which can be slow) - therefore the app // state by the time we try to show this fragment is unknown, and we could be in the // middle of shutting down: backStackId = transaction.commitAllowingStateLoss(); } // Pop the fragment from backstack if it exists. public void dismiss() { + if (backStackId >= 0) { + getFragmentManager().popBackStackImmediate(backStackId, FragmentManager.POP_BACK_STACK_INCLUSIVE); + backStackId = -1; + } + onDismiss(); + } + + private void onDismiss() { if (dismissed) { return; } dismissed = true; - if (backStackId >= 0) { - getChildFragmentManager().popBackStackImmediate(backStackId, FragmentManager.POP_BACK_STACK_INCLUSIVE); - backStackId = -1; - } - if (parent != null) { parent.setVisibility(View.GONE); } } private static class TabHistoryAdapter extends ArrayAdapter<TabHistoryPage> { private final List<TabHistoryPage> pages; private final Context context;