material-components-android
material-components-android copied to clipboard
[SwipeDismissBehavior]Fixed drag view alpha not changing when swipeDirection is END_TO_START
Drag view alpha not changing when swipeDirection is END_TO_START.
final float startAlphaDistance =
originalCapturedViewLeft + child.getWidth() * alphaStartSwipeDistance;
final float endAlphaDistance =
originalCapturedViewLeft + child.getWidth() * alphaEndSwipeDistance;
if (left <= startAlphaDistance) {
child.setAlpha(1f);
} else if (left >= endAlphaDistance) {
child.setAlpha(0f);
} else {
// We're between the start and end distances
final float distance = fraction(startAlphaDistance, endAlphaDistance, left);
child.setAlpha(clamp(0f, 1f - distance, 1f));
}
the left is always < startAlphaDistance