Bug 764812 - Only close tabs is dragged to the left or right edge of the tab. r=mfinkle

This commit is contained in:
Wes Johnston 2012-06-21 09:53:48 -07:00
parent c7221b4636
commit 6991562d16

View File

@ -328,11 +328,12 @@ public class TabsTray extends LinearLayout
// 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();
}