diff options
Diffstat (limited to 'packages/SystemUI/src')
7 files changed, 55 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 8e603ba..0d393bf 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -412,7 +412,7 @@ public class SwipeHelper implements Gefingerpoken { if (mCurrView != null) { float delta = getPos(ev) - mInitialTouchPos; float absDelta = Math.abs(delta); - if (absDelta >= mFalsingThreshold) { + if (absDelta >= getFalsingThreshold()) { mTouchAboveFalsingThreshold = true; } // don't let items that can't be dismissed be dragged more than @@ -466,6 +466,11 @@ public class SwipeHelper implements Gefingerpoken { return true; } + private int getFalsingThreshold() { + float factor = mCallback.getFalsingThresholdFactor(); + return (int) (mFalsingThreshold * factor); + } + public interface Callback { View getChildAtPosition(MotionEvent ev); @@ -489,6 +494,11 @@ public class SwipeHelper implements Gefingerpoken { * @return if true, prevents the default alpha fading. */ boolean updateSwipeProgress(View animView, boolean dismissable, float swipeProgress); + + /** + * @return The factor the falsing threshold should be multiplied with + */ + float getFalsingThresholdFactor(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index bdb0ad3..330333a 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -196,6 +196,11 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView return false; } + @Override + public float getFalsingThresholdFactor() { + return 1.0f; + } + public void dismissChild(View v) { mSwipeHelper.dismissChild(v, 0); } diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java index 47c096f..1e247be 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java @@ -204,6 +204,11 @@ public class RecentsVerticalScrollView extends ScrollView return false; } + @Override + public float getFalsingThresholdFactor() { + return 1.0f; + } + public void dismissChild(View v) { mSwipeHelper.dismissChild(v, 0); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java index a9c701a..6653254 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java @@ -303,8 +303,12 @@ public class KeyguardAffordanceHelper { } private boolean isBelowFalsingThreshold() { - return Math.abs(mTranslation) < Math.abs(mTranslationOnDown) - + mMinTranslationAmount; + return Math.abs(mTranslation) < Math.abs(mTranslationOnDown) + getMinTranslationAmount(); + } + + private int getMinTranslationAmount() { + float factor = mCallback.getAffordanceFalsingFactor(); + return (int) (mMinTranslationAmount * factor); } private void fling(float vel, final boolean snapBack) { @@ -339,14 +343,14 @@ public class KeyguardAffordanceHelper { translation = rightSwipePossible() ? translation : Math.max(0, translation); translation = leftSwipePossible() ? translation : Math.min(0, translation); float absTranslation = Math.abs(translation); - if (absTranslation > Math.abs(mTranslationOnDown) + mMinTranslationAmount || + if (absTranslation > Math.abs(mTranslationOnDown) + getMinTranslationAmount() || mMotionPerformedByUser) { mMotionPerformedByUser = true; } if (translation != mTranslation || isReset) { KeyguardAffordanceView targetView = translation > 0 ? mLeftIcon : mRightIcon; KeyguardAffordanceView otherView = translation > 0 ? mRightIcon : mLeftIcon; - float alpha = absTranslation / mMinTranslationAmount; + float alpha = absTranslation / getMinTranslationAmount(); // We interpolate the alpha of the other icons to 0 float fadeOutAlpha = SWIPE_RESTING_ALPHA_AMOUNT * (1.0f - alpha); @@ -482,5 +486,10 @@ public class KeyguardAffordanceHelper { View getLeftPreview(); View getRightPreview(); + + /** + * @return The factor the minimum swipe amount should be multiplied with. + */ + float getAffordanceFalsingFactor(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 80e9663..2efa84a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -706,7 +706,7 @@ public class NotificationPanelView extends PanelView implements case MotionEvent.ACTION_MOVE: final float h = y - mInitialTouchY; setQsExpansion(h + mInitialHeightOnTouch); - if (h >= mQsFalsingThreshold) { + if (h >= getFalsingThreshold()) { mQsTouchAboveFalsingThreshold = true; } trackMovement(event); @@ -732,6 +732,11 @@ public class NotificationPanelView extends PanelView implements } } + private int getFalsingThreshold() { + float factor = mStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f; + return (int) (mQsFalsingThreshold * factor); + } + @Override public void onOverscrolled(float lastTouchX, float lastTouchY, int amount) { if (mIntercepting && shouldQuickSettingsIntercept(lastTouchX, lastTouchY, @@ -1633,6 +1638,11 @@ public class NotificationPanelView extends PanelView implements } @Override + public float getAffordanceFalsingFactor() { + return mStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f; + } + + @Override protected float getPeekHeight() { if (mNotificationStackScroller.getNotGoneChildCount() > 0) { return mNotificationStackScroller.getPeekHeight(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java index 7f155a1..84216a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java @@ -316,6 +316,11 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper. } @Override + public float getFalsingThresholdFactor() { + return 1.0f; + } + + @Override public void onChildDismissed(View v) { Log.v(TAG, "User swiped heads up to dismiss"); mBar.onHeadsUpDismissed(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 67ba8d2..4a20406 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -547,6 +547,11 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } + @Override + public float getFalsingThresholdFactor() { + return mPhoneStatusBar.isScreenOnComingFromTouch() ? 1.5f : 1.0f; + } + public void onBeginDrag(View v) { setSwipingInProgress(true); mAmbientState.onBeginDrag(v); |
