Bug 764812 - Only close tabs is dragged to the left or right edge of the tab. r=mfinkle a=akeybl
authorWes Johnston <wjohnston@mozilla.com>
Thu, 21 Jun 2012 09:53:48 -0700
changeset 98281 f6f345b6dc68c294d57cc084ef4622e12ac85b72
parent 98280 7bb8c28d88795a67914ff84060412715496923bf
child 98282 aba0a991437952ca9abae9c7c1f1566d67caa464
push id1601
push userwjohnston@mozilla.com
push dateWed, 27 Jun 2012 23:53:05 +0000
treeherdermozilla-aurora@424d62d5fdf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, akeybl
bugs764812
milestone15.0a2
Bug 764812 - Only close tabs is dragged to the left or right edge of the tab. r=mfinkle a=akeybl
mobile/android/base/TabsTray.java
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -312,21 +312,22 @@ public class TabsTray extends LinearLayo
             return false;
         }
 
         public boolean onTouchEnd(MotionEvent e) {
             if (mView != null) {
 
                 // if the user was dragging horizontally, check to see if we should close the tab
                 if (dir == DragDirection.HORIZONTAL) {
-    
                     int finalPos = 0;
-                    if ((start.x > mList.getWidth()/2 && e.getX() < mList.getWidth()/2)) {
+                    // if the swipe started on the left and ended in the right 1/4 of the tray
+                    // or vice versa, close the tab
+                    if ((start.x > mList.getWidth() / 2 && e.getX() < mList.getWidth() / 4)) {
                         finalPos = -1 * mView.getWidth();
-                    } else if (start.x < mList.getWidth()/2 && e.getX() > mList.getWidth()/2) {
+                    } else if (start.x < mList.getWidth() / 2 && e.getX() > mList.getWidth() * (3 / 4)) {
                         finalPos = mView.getWidth();
                     }
     
                     animateTo(mView, finalPos, MAX_ANIMATION_TIME);
                 } else if (mView != null && dir == DragDirection.UNKNOWN) {
                     // the user didn't attempt to scroll the view, so select the row
                     TabRow tab = (TabRow)mView.getTag();
                     int tabId = tab.id;