summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2023-04-14 00:27:23 -0700
committerLinux Build Service Account <lnxbuild@localhost>2023-04-14 00:27:23 -0700
commit308c98f901f540b2a61bde5363434d613b27fd0b (patch)
treea009a2d5eb74f021d5f20fbb36c221a124def03d /packages/SystemUI/src/com/android/systemui/SwipeHelper.java
parentb77f39e30b9df5c24ec1d8428bf1b5f2946560b5 (diff)
parent5a47c505d9dd08c276dad9d6fbd157f7207fbb56 (diff)
Merge 5a47c505d9dd08c276dad9d6fbd157f7207fbb56 on remote branch
Change-Id: Ic8a4252f1c0cdf4a82e9dadcce37606fdcaa68cd
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/SwipeHelper.java')
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index fe6dbe5de8f0..873a695ecd93 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -38,6 +38,8 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
+import androidx.annotation.VisibleForTesting;
+
import com.android.systemui.animation.Interpolators;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags;
@@ -66,7 +68,7 @@ public class SwipeHelper implements Gefingerpoken {
private static final int MAX_DISMISS_VELOCITY = 4000; // dp/sec
private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms
- static final float SWIPE_PROGRESS_FADE_END = 0.5f; // fraction of thumbnail width
+ public static final float SWIPE_PROGRESS_FADE_END = 0.6f; // fraction of thumbnail width
// beyond which swipe progress->0
public static final float SWIPED_FAR_ENOUGH_SIZE_FRACTION = 0.6f;
static final float MAX_SCROLL_SIZE_FRACTION = 0.3f;
@@ -235,7 +237,11 @@ public class SwipeHelper implements Gefingerpoken {
return Math.min(Math.max(mMinSwipeProgress, result), mMaxSwipeProgress);
}
- private float getSwipeAlpha(float progress) {
+ /**
+ * Returns the alpha value depending on the progress of the swipe.
+ */
+ @VisibleForTesting
+ public float getSwipeAlpha(float progress) {
if (mFadeDependingOnAmountSwiped) {
// The more progress has been fade, the lower the alpha value so that the view fades.
return Math.max(1 - progress, 0);
@@ -260,7 +266,7 @@ public class SwipeHelper implements Gefingerpoken {
animView.setLayerType(View.LAYER_TYPE_NONE, null);
}
}
- animView.setAlpha(getSwipeAlpha(swipeProgress));
+ updateSwipeProgressAlpha(animView, getSwipeAlpha(swipeProgress));
}
}
invalidateGlobalRegion(animView);
@@ -561,6 +567,14 @@ public class SwipeHelper implements Gefingerpoken {
mCallback.onChildSnappedBack(animView, targetLeft);
}
+
+ /**
+ * Called to update the content alpha while the view is swiped
+ */
+ protected void updateSwipeProgressAlpha(View animView, float alpha) {
+ animView.setAlpha(alpha);
+ }
+
/**
* Give the swipe helper itself a chance to do something on snap back so NSSL doesn't have
* to tell us what to do