Bug 1216489 - 3. Remove unnecessary touch intercept code for TabsPanel. r?sebastian
MozReview-Commit-ID: 7pf9GRLgHXg
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3070,66 +3070,29 @@ public class BrowserApp extends GeckoApp
getSupportFragmentManager().beginTransaction()
.hide(mBrowserSearch).commitAllowingStateLoss();
mBrowserSearch.setUserVisibleHint(false);
getWindow().setBackgroundDrawable(null);
}
/**
- * Hides certain UI elements (e.g. button toast, tabs panel) when the
- * user touches the main layout.
+ * Hides certain UI elements (e.g. button toast) when the user touches the main layout.
*/
private class HideOnTouchListener implements TouchEventInterceptor {
- private boolean mIsHidingTabs;
- private final Rect mTempRect = new Rect();
-
@Override
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
SnackbarBuilder.dismissCurrentSnackbar();
}
-
-
-
- // We need to account for scroll state for the touched view otherwise
- // tapping on an "empty" part of the view will still be considered a
- // valid touch event.
- if (view.getScrollX() != 0 || view.getScrollY() != 0) {
- view.getHitRect(mTempRect);
- mTempRect.offset(-view.getScrollX(), -view.getScrollY());
-
- int[] viewCoords = new int[2];
- view.getLocationOnScreen(viewCoords);
-
- int x = (int) event.getRawX() - viewCoords[0];
- int y = (int) event.getRawY() - viewCoords[1];
-
- if (!mTempRect.contains(x, y))
- return false;
- }
-
- // If the tabs panel is showing, hide the tab panel and don't send the event to content.
- if (event.getActionMasked() == MotionEvent.ACTION_DOWN && autoHideTabs()) {
- mIsHidingTabs = true;
- return true;
- }
return false;
}
@Override
public boolean onTouch(View view, MotionEvent event) {
- if (mIsHidingTabs) {
- // Keep consuming events until the gesture finishes.
- int action = event.getActionMasked();
- if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
- mIsHidingTabs = false;
- }
- return true;
- }
return false;
}
}
private static Menu findParentMenu(Menu menu, MenuItem item) {
final int itemId = item.getItemId();
final int count = (menu != null) ? menu.size() : 0;