Bug 915918 - Part 1.5: Refactor hiding of BrowserSearch and HomePager into onStopEditing. r=lucasr

This commit is contained in:
Michael Comella 2013-10-23 15:18:22 -07:00
parent 64eff6c004
commit 7cdbae322c

View File

@ -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;
}