Merge "swipe down to open noti shade fling support" into qt-r1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
2b9a187195
@@ -120,6 +120,8 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
private int mCurrentBoundedUserId = -1;
|
private int mCurrentBoundedUserId = -1;
|
||||||
private float mNavBarButtonAlpha;
|
private float mNavBarButtonAlpha;
|
||||||
private boolean mInputFocusTransferStarted;
|
private boolean mInputFocusTransferStarted;
|
||||||
|
private float mInputFocusTransferStartY;
|
||||||
|
private long mInputFocusTransferStartMillis;
|
||||||
private float mWindowCornerRadius;
|
private float mWindowCornerRadius;
|
||||||
private boolean mSupportsRoundedCornersOnWindows;
|
private boolean mSupportsRoundedCornersOnWindows;
|
||||||
private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
|
private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
|
||||||
@@ -180,12 +182,16 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
int action = event.getActionMasked();
|
int action = event.getActionMasked();
|
||||||
if (action == ACTION_DOWN) {
|
if (action == ACTION_DOWN) {
|
||||||
mInputFocusTransferStarted = true;
|
mInputFocusTransferStarted = true;
|
||||||
|
mInputFocusTransferStartY = event.getY();
|
||||||
|
mInputFocusTransferStartMillis = event.getEventTime();
|
||||||
|
bar.onInputFocusTransfer(mInputFocusTransferStarted, 0 /* velocity */);
|
||||||
}
|
}
|
||||||
if (action == ACTION_UP || action == ACTION_CANCEL) {
|
if (action == ACTION_UP || action == ACTION_CANCEL) {
|
||||||
mInputFocusTransferStarted = false;
|
mInputFocusTransferStarted = false;
|
||||||
|
bar.onInputFocusTransfer(mInputFocusTransferStarted,
|
||||||
|
(event.getY() - mInputFocusTransferStartY)
|
||||||
|
/ (event.getEventTime() - mInputFocusTransferStartMillis));
|
||||||
}
|
}
|
||||||
bar.onInputFocusTransfer(mInputFocusTransferStarted);
|
|
||||||
event.recycle();
|
event.recycle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -596,7 +602,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
|||||||
StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
|
StatusBar bar = SysUiServiceProvider.getComponent(mContext, StatusBar.class);
|
||||||
if (bar != null) {
|
if (bar != null) {
|
||||||
mInputFocusTransferStarted = false;
|
mInputFocusTransferStarted = false;
|
||||||
bar.onInputFocusTransfer(false);
|
bar.onInputFocusTransfer(false, 0 /* velocity */);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,7 +290,11 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
private boolean mIsFullWidth;
|
private boolean mIsFullWidth;
|
||||||
private boolean mBlockingExpansionForCurrentTouch;
|
private boolean mBlockingExpansionForCurrentTouch;
|
||||||
|
|
||||||
private boolean mExpectingOpenPanelGesture;
|
/**
|
||||||
|
* Following variables maintain state of events when input focus transfer may occur.
|
||||||
|
*/
|
||||||
|
private boolean mExpectingSynthesizedDown; // expecting to see synthesized DOWN event
|
||||||
|
private boolean mLastEventSynthesizedDown; // last event was synthesized DOWN event
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current dark amount that follows regular interpolation curve of animation.
|
* Current dark amount that follows regular interpolation curve of animation.
|
||||||
@@ -1059,6 +1063,15 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mDownY = event.getY();
|
mDownY = event.getY();
|
||||||
mCollapsedOnDown = isFullyCollapsed();
|
mCollapsedOnDown = isFullyCollapsed();
|
||||||
mListenForHeadsUp = mCollapsedOnDown && mHeadsUpManager.hasPinnedHeadsUp();
|
mListenForHeadsUp = mCollapsedOnDown && mHeadsUpManager.hasPinnedHeadsUp();
|
||||||
|
if (mExpectingSynthesizedDown) {
|
||||||
|
mLastEventSynthesizedDown = true;
|
||||||
|
} else {
|
||||||
|
// down but not synthesized motion event.
|
||||||
|
mLastEventSynthesizedDown = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// not down event at all.
|
||||||
|
mLastEventSynthesizedDown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1124,12 +1137,18 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
initDownStates(event);
|
|
||||||
// Make sure the next touch won't the blocked after the current ends.
|
// Make sure the next touch won't the blocked after the current ends.
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP
|
if (event.getAction() == MotionEvent.ACTION_UP
|
||||||
|| event.getAction() == MotionEvent.ACTION_CANCEL) {
|
|| event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||||
mBlockingExpansionForCurrentTouch = false;
|
mBlockingExpansionForCurrentTouch = false;
|
||||||
}
|
}
|
||||||
|
// When touch focus transfer happens, ACTION_DOWN->ACTION_UP may happen immediately
|
||||||
|
// without any ACTION_MOVE event.
|
||||||
|
// In such case, simply expand the panel instead of being stuck at the bottom bar.
|
||||||
|
if (mLastEventSynthesizedDown && event.getAction() == MotionEvent.ACTION_UP) {
|
||||||
|
expand(true /* animate */);
|
||||||
|
}
|
||||||
|
initDownStates(event);
|
||||||
if (!mIsExpanding && !shouldQuickSettingsIntercept(mDownX, mDownY, 0)
|
if (!mIsExpanding && !shouldQuickSettingsIntercept(mDownX, mDownY, 0)
|
||||||
&& mPulseExpansionHandler.onTouchEvent(event)) {
|
&& mPulseExpansionHandler.onTouchEvent(event)) {
|
||||||
// We're expanding all the other ones shouldn't get this anymore
|
// We're expanding all the other ones shouldn't get this anymore
|
||||||
@@ -1255,17 +1274,28 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
if (!isFullyCollapsed()) {
|
if (!isFullyCollapsed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mExpectingOpenPanelGesture = true;
|
mExpectingSynthesizedDown = true;
|
||||||
onTrackingStarted();
|
onTrackingStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input focus transfer has already happened as this view decided to intercept
|
* Called when this view is no longer waiting for input focus transfer.
|
||||||
* very first down event.
|
*
|
||||||
|
* There are two scenarios behind this function call. First, input focus transfer
|
||||||
|
* has successfully happened and this view already received synthetic DOWN event.
|
||||||
|
* (mExpectingSynthesizedDown == false). Do nothing.
|
||||||
|
*
|
||||||
|
* Second, before input focus transfer finished, user may have lifted finger
|
||||||
|
* in previous window and this window never received synthetic DOWN event.
|
||||||
|
* (mExpectingSynthesizedDown == true).
|
||||||
|
* In this case, we use the velocity to trigger fling event.
|
||||||
|
*
|
||||||
|
* @param velocity unit is in px / millis
|
||||||
*/
|
*/
|
||||||
public void stopWaitingForOpenPanelGesture() {
|
public void stopWaitingForOpenPanelGesture(float velocity) {
|
||||||
if (mExpectingOpenPanelGesture) {
|
if (mExpectingSynthesizedDown) {
|
||||||
mExpectingOpenPanelGesture = false;
|
mExpectingSynthesizedDown = false;
|
||||||
|
fling(velocity > 1f ? 1000f * velocity : 0, true /* animate */);
|
||||||
onTrackingStopped(false);
|
onTrackingStopped(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1283,8 +1313,8 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldGestureWaitForTouchSlop() {
|
protected boolean shouldGestureWaitForTouchSlop() {
|
||||||
if (mExpectingOpenPanelGesture) {
|
if (mExpectingSynthesizedDown) {
|
||||||
mExpectingOpenPanelGesture = false;
|
mExpectingSynthesizedDown = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isFullyCollapsed() || mBarState != StatusBarState.SHADE;
|
return isFullyCollapsed() || mBarState != StatusBarState.SHADE;
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ import android.metrics.LogMaker;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Debug;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -1932,7 +1931,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
/**
|
/**
|
||||||
* Called when another window is about to transfer it's input focus.
|
* Called when another window is about to transfer it's input focus.
|
||||||
*/
|
*/
|
||||||
public void onInputFocusTransfer(boolean start) {
|
public void onInputFocusTransfer(boolean start, float velocity) {
|
||||||
if (!mCommandQueue.panelsEnabled()) {
|
if (!mCommandQueue.panelsEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1940,7 +1939,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
if (start) {
|
if (start) {
|
||||||
mNotificationPanel.startWaitingForOpenPanelGesture();
|
mNotificationPanel.startWaitingForOpenPanelGesture();
|
||||||
} else {
|
} else {
|
||||||
mNotificationPanel.stopWaitingForOpenPanelGesture();
|
mNotificationPanel.stopWaitingForOpenPanelGesture(velocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user