Bug 860326 - Don't update BrowserToolbar after editing a top site on about:home. r=wesj
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 16 Apr 2013 17:39:47 -0700
changeset 129016 098faa24c569d858bcbbc39e2d48f43668fde64d
parent 129015 cad82c3b69bceb547a2627fdfb54d4ce14128a8b
child 129017 3721d3ca4095af401c547dc4c88883572a254558
push id24553
push userryanvm@gmail.com
push dateWed, 17 Apr 2013 16:44:13 +0000
treeherdermozilla-central@3607139bd503 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs860326
milestone23.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
Bug 860326 - Don't update BrowserToolbar after editing a top site on about:home. r=wesj
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -787,18 +787,28 @@ abstract public class BrowserApp extends
         invalidateOptionsMenu();
         updateSideBarState();
         mTabsPanel.refresh();
     }
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
-        String url = resultCode == Activity.RESULT_OK ? data.getStringExtra(AwesomeBar.URL_KEY) : null;
-        mBrowserToolbar.fromAwesomeBarSearch(url);
+
+        // Don't update the url in the toolbar if the activity was cancelled, or if it was launched to pick
+        //  a site. The order of these checks matters because data will be null if the activity was cancelled.
+        if (resultCode != Activity.RESULT_OK ||
+            data.getStringExtra(AwesomeBar.TARGET_KEY).equals(AwesomeBar.Target.PICK_SITE.toString())) {
+            // We still need to call fromAwesomeBarSearch to perform the toolbar animation.
+            mBrowserToolbar.fromAwesomeBarSearch(null);
+            return;
+        }
+
+        // Otherwise, update the toolbar with the url that was just entered.
+        mBrowserToolbar.fromAwesomeBarSearch(data.getStringExtra(AwesomeBar.URL_KEY));
     }
 
     public View getActionBarLayout() {
         int actionBarRes;
 
         if (!HardwareUtils.hasMenuButton() || HardwareUtils.isTablet())
            actionBarRes = R.layout.browser_toolbar_menu;
         else