mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 14:15:30 +00:00
Backed out changeset 71d1bd406c7e (bug 849845) and changeset af753b784e28 (bug 849958) to see if it fixes robocop timeouts on a CLOSED TREE.
This commit is contained in:
parent
3f7c404fca
commit
34709ea94d
@ -99,14 +99,11 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
// Variables used for scrolling the toolbar on/off the page.
|
||||
private static final int TOOLBAR_ONLOAD_HIDE_DELAY = 2000;
|
||||
private static final float TOOLBAR_MOVEMENT_THRESHOLD = 0.3f;
|
||||
private boolean mDynamicToolbarEnabled = false;
|
||||
private View mToolbarSpacer = null;
|
||||
private float mLastTouchX = 0.0f;
|
||||
private float mLastTouchY = 0.0f;
|
||||
private float mToolbarSubpixelAccumulation = 0.0f;
|
||||
private boolean mToolbarLocked = false;
|
||||
private boolean mToolbarThresholdPassed = false;
|
||||
private boolean mToolbarLocked = true;
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
@ -124,6 +121,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
if (mDynamicToolbarEnabled) {
|
||||
// Show the toolbar immediately.
|
||||
mBrowserToolbar.animateVisibility(true, 0);
|
||||
mToolbarLocked = true;
|
||||
}
|
||||
} else {
|
||||
hideAboutHome();
|
||||
@ -216,12 +214,14 @@ abstract public class BrowserApp extends GeckoApp
|
||||
if (action == MotionEvent.ACTION_DOWN ||
|
||||
action == MotionEvent.ACTION_POINTER_DOWN) {
|
||||
if (pointerCount == 1) {
|
||||
mToolbarLocked = mToolbarThresholdPassed = false;
|
||||
mToolbarLocked = false;
|
||||
mToolbarSubpixelAccumulation = 0.0f;
|
||||
mLastTouchX = event.getX();
|
||||
mLastTouchY = event.getY();
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
}
|
||||
//
|
||||
// Lock the toolbar until we're back down to one pointer.
|
||||
mToolbarLocked = true;
|
||||
|
||||
// Animate the toolbar to the fully on/off position.
|
||||
mBrowserToolbar.animateVisibility(
|
||||
@ -229,10 +229,9 @@ abstract public class BrowserApp extends GeckoApp
|
||||
false : true, 0);
|
||||
}
|
||||
|
||||
// If more than one pointer has been tracked, or we've locked the
|
||||
// toolbar movement, let the event pass through and be handled by the
|
||||
// PanZoomController for zooming.
|
||||
if (pointerCount > 1 || mToolbarLocked) {
|
||||
// If more than one pointer has been tracked, let the event pass
|
||||
// through and be handled by the PanZoomController for zooming.
|
||||
if (pointerCount > 1) {
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
}
|
||||
|
||||
@ -240,47 +239,22 @@ abstract public class BrowserApp extends GeckoApp
|
||||
// unlock the toolbar and track that remaining pointer.
|
||||
if (pointerCount == 1 && action == MotionEvent.ACTION_POINTER_UP) {
|
||||
mLastTouchY = event.getY(1 - event.getActionIndex());
|
||||
mToolbarLocked = false;
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
}
|
||||
|
||||
// Don't bother doing anything with the events if we're loading -
|
||||
// the toolbar will be permanently visible in this case.
|
||||
float eventX = event.getX();
|
||||
float eventY = event.getY();
|
||||
if (Tabs.getInstance().getSelectedTab().getState() != Tab.STATE_LOADING) {
|
||||
int toolbarHeight = toolbarView.getHeight();
|
||||
float deltaX = mLastTouchX - eventX;
|
||||
float deltaY = mLastTouchY - eventY;
|
||||
int toolbarY = toolbarView.getScrollY();
|
||||
|
||||
// Check if we've passed the toolbar movement threshold
|
||||
if (!mToolbarThresholdPassed) {
|
||||
float threshold = toolbarHeight * TOOLBAR_MOVEMENT_THRESHOLD;
|
||||
if (Math.abs(deltaY) > threshold) {
|
||||
mToolbarThresholdPassed = true;
|
||||
// If we're scrolling downwards and the toolbar was hidden
|
||||
// when we started scrolling, lock it.
|
||||
if (deltaY > 0 && toolbarY == toolbarHeight) {
|
||||
mToolbarLocked = true;
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
}
|
||||
} else if (Math.abs(deltaX) > threshold) {
|
||||
// Any horizontal scrolling past the threshold should
|
||||
// initiate toolbar lock.
|
||||
mToolbarLocked = true;
|
||||
mToolbarThresholdPassed = true;
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
} else {
|
||||
// The threshold hasn't been passed. We don't want to update
|
||||
// the stored last touch position, so return here.
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
}
|
||||
} else if (action == MotionEvent.ACTION_MOVE) {
|
||||
if (action == MotionEvent.ACTION_MOVE && !mToolbarLocked) {
|
||||
// Cancel any ongoing animation before we start moving the toolbar.
|
||||
mBrowserToolbar.cancelVisibilityAnimation();
|
||||
|
||||
// Move the toolbar by the amount the touch event has moved,
|
||||
// clamping to fully visible or fully hidden.
|
||||
float deltaY = mLastTouchY - eventY;
|
||||
|
||||
// Don't let the toolbar scroll off the top if it's just exposing
|
||||
// overscroll area.
|
||||
@ -290,6 +264,7 @@ abstract public class BrowserApp extends GeckoApp
|
||||
Math.max(0, toolbarHeight - (metrics.pageRectTop -
|
||||
metrics.viewportRectTop)));
|
||||
|
||||
int toolbarY = toolbarView.getScrollY();
|
||||
float newToolbarYf = Math.max(0, Math.min(toolbarMaxY,
|
||||
toolbarY + deltaY + mToolbarSubpixelAccumulation));
|
||||
int newToolbarY = Math.round(newToolbarYf);
|
||||
@ -306,13 +281,12 @@ abstract public class BrowserApp extends GeckoApp
|
||||
// Animate the toolbar to fully on or off, depending on how much
|
||||
// of it is hidden and the current swipe velocity.
|
||||
mBrowserToolbar.animateVisibilityWithVelocityBias(
|
||||
toolbarY > toolbarHeight / 2 ? false : true,
|
||||
toolbarView.getScrollY() > toolbarHeight / 2 ? false : true,
|
||||
mLayerView.getPanZoomController().getVelocityVector().y);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the last recorded position.
|
||||
mLastTouchX = eventX;
|
||||
// Update the last recorded y position.
|
||||
mLastTouchY = eventY;
|
||||
|
||||
return super.onInterceptTouchEvent(view, event);
|
||||
@ -326,34 +300,26 @@ abstract public class BrowserApp extends GeckoApp
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_BUTTON_Y:
|
||||
// Toggle/focus the address bar on gamepad-y button.
|
||||
if (mBrowserToolbar.isVisible()) {
|
||||
if (mDynamicToolbarEnabled &&
|
||||
Boolean.FALSE.equals(mAboutHomeShowing)) {
|
||||
mBrowserToolbar.animateVisibility(false, 0);
|
||||
mLayerView.requestFocus();
|
||||
} else {
|
||||
// Just focus the address bar when about:home is visible
|
||||
// or when the dynamic toolbar isn't enabled.
|
||||
mBrowserToolbar.requestFocusFromTouch();
|
||||
}
|
||||
} else {
|
||||
mBrowserToolbar.animateVisibility(true, 0);
|
||||
mBrowserToolbar.requestFocusFromTouch();
|
||||
}
|
||||
return true;
|
||||
case KeyEvent.KEYCODE_BUTTON_L1:
|
||||
// Go back on L1
|
||||
Tabs.getInstance().getSelectedTab().doBack();
|
||||
return true;
|
||||
case KeyEvent.KEYCODE_BUTTON_R1:
|
||||
// Go forward on R1
|
||||
Tabs.getInstance().getSelectedTab().doForward();
|
||||
return true;
|
||||
// Toggle/focus the address bar on gamepad-y button.
|
||||
if (keyCode == KeyEvent.KEYCODE_BUTTON_Y &&
|
||||
(event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
|
||||
mToolbarLocked = true;
|
||||
if (mBrowserToolbar.isVisible()) {
|
||||
if (mDynamicToolbarEnabled &&
|
||||
Boolean.FALSE.equals(mAboutHomeShowing)) {
|
||||
mBrowserToolbar.animateVisibility(false, 0);
|
||||
mLayerView.requestFocus();
|
||||
} else {
|
||||
// Just focus the address bar when about:home is visible
|
||||
// or when the dynamic toolbar isn't enabled.
|
||||
mBrowserToolbar.requestFocusFromTouch();
|
||||
}
|
||||
} else {
|
||||
mBrowserToolbar.animateVisibility(true, 0);
|
||||
mBrowserToolbar.requestFocusFromTouch();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user