Merge "Improve swiping to reveal gear for ongoing notifications with time check" into nyc-mr1-dev
This commit is contained in:
@@ -3900,6 +3900,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
private class NotificationSwipeHelper extends SwipeHelper {
|
private class NotificationSwipeHelper extends SwipeHelper {
|
||||||
private static final long SHOW_GEAR_DELAY = 60;
|
private static final long SHOW_GEAR_DELAY = 60;
|
||||||
private static final long COVER_GEAR_DELAY = 4000;
|
private static final long COVER_GEAR_DELAY = 4000;
|
||||||
|
private static final long SWIPE_GEAR_TIMING = 200;
|
||||||
private CheckForDrag mCheckForDrag;
|
private CheckForDrag mCheckForDrag;
|
||||||
private Runnable mFalsingCheck;
|
private Runnable mFalsingCheck;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
@@ -4016,6 +4017,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
|
|
||||||
boolean gestureTowardsGear = isTowardsGear(velocity, mCurrIconRow.isIconOnLeft());
|
boolean gestureTowardsGear = isTowardsGear(velocity, mCurrIconRow.isIconOnLeft());
|
||||||
boolean gestureFastEnough = Math.abs(velocity) > getEscapeVelocity();
|
boolean gestureFastEnough = Math.abs(velocity) > getEscapeVelocity();
|
||||||
|
final double timeForGesture = ev.getEventTime() - ev.getDownTime();
|
||||||
|
final boolean showGearForSlowOnGoing = !canChildBeDismissed(animView)
|
||||||
|
&& timeForGesture >= SWIPE_GEAR_TIMING;
|
||||||
|
|
||||||
if (mGearSnappedTo && mCurrIconRow.isVisible()) {
|
if (mGearSnappedTo && mCurrIconRow.isVisible()) {
|
||||||
if (mGearSnappedOnLeft == mCurrIconRow.isIconOnLeft()) {
|
if (mGearSnappedOnLeft == mCurrIconRow.isIconOnLeft()) {
|
||||||
@@ -4040,7 +4044,8 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
} else {
|
} else {
|
||||||
dismissOrSnapBack(animView, velocity, ev);
|
dismissOrSnapBack(animView, velocity, ev);
|
||||||
}
|
}
|
||||||
} else if ((!gestureFastEnough && swipedEnoughToShowGear(animView))
|
} else if (((!gestureFastEnough || showGearForSlowOnGoing)
|
||||||
|
&& swipedEnoughToShowGear(animView))
|
||||||
|| gestureTowardsGear) {
|
|| gestureTowardsGear) {
|
||||||
// Gear has not been snapped to previously and this is gear revealing gesture
|
// Gear has not been snapped to previously and this is gear revealing gesture
|
||||||
snapToGear(animView, velocity);
|
snapToGear(animView, velocity);
|
||||||
@@ -4092,13 +4097,9 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
final float multiplier = canChildBeDismissed(animView) ? 0.4f : 0.2f;
|
final float multiplier = canChildBeDismissed(animView) ? 0.4f : 0.2f;
|
||||||
final float snapBackThreshold = getSpaceForGear(animView) * multiplier;
|
final float snapBackThreshold = getSpaceForGear(animView) * multiplier;
|
||||||
final float translation = getTranslation(animView);
|
final float translation = getTranslation(animView);
|
||||||
final boolean fromLeft = translation > 0;
|
return !swipedFarEnough() && mCurrIconRow.isVisible() && (mCurrIconRow.isIconOnLeft()
|
||||||
final float absTrans = Math.abs(translation);
|
? translation > snapBackThreshold
|
||||||
final float notiThreshold = getSize(mTranslatingParentView) * 0.4f;
|
: translation < -snapBackThreshold);
|
||||||
|
|
||||||
return mCurrIconRow.isVisible() && (mCurrIconRow.isIconOnLeft()
|
|
||||||
? (translation > snapBackThreshold && translation <= notiThreshold)
|
|
||||||
: (translation < -snapBackThreshold && translation >= -notiThreshold));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user