am f2dcb390: Merge "Limit swipe dismiss progress to positive values" into klp-modular-dev
* commit 'f2dcb390444ffb42cf8637c99f53d821917554e6': Limit swipe dismiss progress to positive values
This commit is contained in:
@@ -45,10 +45,9 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
/**
|
/**
|
||||||
* Called when the layout has been swiped and the position of the window should change.
|
* Called when the layout has been swiped and the position of the window should change.
|
||||||
*
|
*
|
||||||
* @param progress A number in [-1, 1] representing how far to the left
|
* @param progress A number in [0, 1] representing how far to the
|
||||||
* or right the window has been swiped. Negative values are swipes
|
* right the window has been swiped
|
||||||
* left, and positives are right.
|
* @param translate A number in [0, w], where w is the width of the
|
||||||
* @param translate A number in [-w, w], where w is the width of the
|
|
||||||
* layout. This is equivalent to progress * layout.getWidth().
|
* layout. This is equivalent to progress * layout.getWidth().
|
||||||
*/
|
*/
|
||||||
void onSwipeProgressChanged(SwipeDismissLayout layout, float progress, float translate);
|
void onSwipeProgressChanged(SwipeDismissLayout layout, float progress, float translate);
|
||||||
@@ -207,7 +206,7 @@ public class SwipeDismissLayout extends FrameLayout {
|
|||||||
|
|
||||||
private void setProgress(float deltaX) {
|
private void setProgress(float deltaX) {
|
||||||
mTranslationX = deltaX;
|
mTranslationX = deltaX;
|
||||||
if (mProgressListener != null) {
|
if (mProgressListener != null && deltaX >= 0) {
|
||||||
mProgressListener.onSwipeProgressChanged(this, deltaX / getWidth(), deltaX);
|
mProgressListener.onSwipeProgressChanged(this, deltaX / getWidth(), deltaX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user