Bug 764812 - Only close tabs is dragged to the left or right edge of the tab. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Thu, 21 Jun 2012 09:53:48 -0700
changeset 97290 cc426bd053fe7a214b1d3b99ccefdf74c0ce1524
parent 97289 6f0cb242f0e623dba6fc79d92fa6832bcdac336f
child 97291 859048b45a64b22ddf84b6cdcdfe5248559bb94f
push id10966
push userwjohnston@mozilla.com
push dateThu, 21 Jun 2012 16:54:08 +0000
treeherdermozilla-inbound@859048b45a64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs764812
milestone16.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 764812 - Only close tabs is dragged to the left or right edge of the tab. r=mfinkle
mobile/android/base/TabsTray.java
--- a/mobile/android/base/TabsTray.java
+++ b/mobile/android/base/TabsTray.java
@@ -323,21 +323,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;