From 7cdbae322cd4f5269c6c05f4f25b5b633ebb623e Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 23 Oct 2013 15:18:22 -0700 Subject: [PATCH] Bug 915918 - Part 1.5: Refactor hiding of BrowserSearch and HomePager into onStopEditing. r=lucasr --- mobile/android/base/BrowserApp.java | 31 +++++++++++------------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index de313f86922..1c1bb03c018 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -491,6 +491,8 @@ abstract public class BrowserApp extends GeckoApp mBrowserToolbar.setOnStopEditingListener(new BrowserToolbar.OnStopEditingListener() { public void onStopEditing() { selectTargetTabForEditingMode(); + hideHomePager(); + hideBrowserSearch(); // Re-enable doorhanger notifications. They may trigger on the selected tab above. mDoorHangerPopup.enable(); @@ -1312,17 +1314,11 @@ abstract public class BrowserApp extends GeckoApp return false; } - // If this tab is already selected, just hide the home pager. - if (tabs.isSelectedTabId(tabId)) { - hideHomePager(); - } else { - // Set the target tab to null so it does not get selected (on editing - // mode exit) in lieu of the tab we are about to select. - mTargetTabForEditingMode = null; - Tabs.getInstance().selectTab(tabId); - } + // Set the target tab to null so it does not get selected (on editing + // mode exit) in lieu of the tab we are about to select. + mTargetTabForEditingMode = null; + Tabs.getInstance().selectTab(tabId); - hideBrowserSearch(); mBrowserToolbar.cancelEdit(); return true; @@ -1350,7 +1346,6 @@ abstract public class BrowserApp extends GeckoApp Tabs.getInstance().loadUrl(url, searchEngine, -1, flags); - hideBrowserSearch(); mBrowserToolbar.cancelEdit(); } @@ -1451,8 +1446,6 @@ abstract public class BrowserApp extends GeckoApp } final String url = mBrowserToolbar.commitEdit(); - hideHomePager(); - hideBrowserSearch(); // Don't do anything if the user entered an empty URL. if (TextUtils.isEmpty(url)) { @@ -1526,13 +1519,13 @@ abstract public class BrowserApp extends GeckoApp return false; } - mBrowserToolbar.cancelEdit(); - - // Resetting the visibility of HomePager, which might have been hidden - // by the filterEditingMode(). + // cancelEdit will call hideHomePager. If we're on web content, this is fine. If we're on + // about:home, the HomePager needs to be visible in the end (note that hideHomePager will + // not hide the HomePager on about:home). However, filterEditingMode may have hidden the + // HomePager so we set it visible here. mHomePager.setVisibility(View.VISIBLE); - hideHomePager(); - hideBrowserSearch(); + + mBrowserToolbar.cancelEdit(); return true; }