Bug 1017276 - Do not close editing mode during animation. r=lucasr, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 30 May 2014 09:43:48 -0700
changeset 199389 d15101acd433b1bd30055a4c091d591a6720056f
parent 199388 8f1c95be79e6345adffe0221c6e83650cc769723
child 199390 1d0439f0c043a659a08760239217dc4b6ed94150
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr, sledru
bugs1017276
milestone31.0a2
Bug 1017276 - Do not close editing mode during animation. r=lucasr, a=sledru
mobile/android/base/toolbar/BrowserToolbar.java
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -370,20 +370,24 @@ public class BrowserToolbar extends Them
                 return Tabs.getInstance().getSelectedTab().showForwardHistory();
             }
         });
 
         if (editCancel != null) {
             editCancel.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL,
-                                          TelemetryContract.Method.ACTIONBAR,
-                                          getResources().getResourceEntryName(editCancel.getId()));
-                    cancelEdit();
+                    // If we exit editing mode during the animation,
+                    // we're put into an inconsistent state (bug 1017276).
+                    if (!isAnimatingEntry) {
+                        Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL,
+                                              TelemetryContract.Method.ACTIONBAR,
+                                              getResources().getResourceEntryName(editCancel.getId()));
+                        cancelEdit();
+                    }
                 }
             });
         }
 
         if (hasSoftMenuButton) {
             menuButton.setVisibility(View.VISIBLE);
             menuIcon.setVisibility(View.VISIBLE);
 
@@ -400,17 +404,19 @@ public class BrowserToolbar extends Them
         this.progressBar = progressBar;
     }
 
     public void refresh() {
         urlDisplayLayout.dismissSiteIdentityPopup();
     }
 
     public boolean onBackPressed() {
-        if (isEditing()) {
+        // If we exit editing mode during the animation,
+        // we're put into an inconsistent state (bug 1017276).
+        if (isEditing() && !isAnimatingEntry) {
             Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL,
                                   TelemetryContract.Method.BACK);
             cancelEdit();
             return true;
         }
 
         return urlDisplayLayout.dismissSiteIdentityPopup();
     }