Merge "[Predictive Back] Fix bug where closing task bar's all apps will show scale animation even if predicitve back is disabled" into tm-qpr-dev am: 47c03be9fc am: d14b11ad3c am: d34c377ed6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21911161 Change-Id: I32aa5171d62faba40ee42489fda8ce4d06f85164 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -55,6 +55,11 @@ public class AnimatedFloat {
|
|||||||
mUpdateCallback = updateCallback;
|
mUpdateCallback = updateCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AnimatedFloat(Runnable updateCallback, float initialValue) {
|
||||||
|
this(updateCallback);
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an animation from the current value to the given value.
|
* Returns an animation from the current value to the given value.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
|||||||
};
|
};
|
||||||
protected static final float TRANSLATION_SHIFT_CLOSED = 1f;
|
protected static final float TRANSLATION_SHIFT_CLOSED = 1f;
|
||||||
protected static final float TRANSLATION_SHIFT_OPENED = 0f;
|
protected static final float TRANSLATION_SHIFT_OPENED = 0f;
|
||||||
|
private static final float VIEW_NO_SCALE = 1f;
|
||||||
|
|
||||||
protected final T mActivityContext;
|
protected final T mActivityContext;
|
||||||
|
|
||||||
@@ -93,7 +94,8 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
|||||||
protected @Nullable OnCloseListener mOnCloseBeginListener;
|
protected @Nullable OnCloseListener mOnCloseBeginListener;
|
||||||
protected List<OnCloseListener> mOnCloseListeners = new ArrayList<>();
|
protected List<OnCloseListener> mOnCloseListeners = new ArrayList<>();
|
||||||
|
|
||||||
private final AnimatedFloat mSlidInViewScale = new AnimatedFloat(this::onScaleProgressChanged);
|
private final AnimatedFloat mSlideInViewScale =
|
||||||
|
new AnimatedFloat(this::onScaleProgressChanged, VIEW_NO_SCALE);
|
||||||
private boolean mIsBackProgressing;
|
private boolean mIsBackProgressing;
|
||||||
@Nullable private Drawable mContentBackground;
|
@Nullable private Drawable mContentBackground;
|
||||||
|
|
||||||
@@ -184,12 +186,12 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
|||||||
float deceleratedProgress =
|
float deceleratedProgress =
|
||||||
Interpolators.PREDICTIVE_BACK_DECELERATED_EASE.getInterpolation(progress);
|
Interpolators.PREDICTIVE_BACK_DECELERATED_EASE.getInterpolation(progress);
|
||||||
mIsBackProgressing = progress > 0f;
|
mIsBackProgressing = progress > 0f;
|
||||||
mSlidInViewScale.updateValue(PREDICTIVE_BACK_MIN_SCALE
|
mSlideInViewScale.updateValue(PREDICTIVE_BACK_MIN_SCALE
|
||||||
+ (1 - PREDICTIVE_BACK_MIN_SCALE) * (1 - deceleratedProgress));
|
+ (1 - PREDICTIVE_BACK_MIN_SCALE) * (1 - deceleratedProgress));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onScaleProgressChanged() {
|
private void onScaleProgressChanged() {
|
||||||
float scaleProgress = mSlidInViewScale.value;
|
float scaleProgress = mSlideInViewScale.value;
|
||||||
SCALE_PROPERTY.set(this, scaleProgress);
|
SCALE_PROPERTY.set(this, scaleProgress);
|
||||||
setClipChildren(!mIsBackProgressing);
|
setClipChildren(!mIsBackProgressing);
|
||||||
mContent.setClipChildren(!mIsBackProgressing);
|
mContent.setClipChildren(!mIsBackProgressing);
|
||||||
@@ -209,7 +211,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void animateSlideInViewToNoScale() {
|
protected void animateSlideInViewToNoScale() {
|
||||||
mSlidInViewScale.animateToValue(1f)
|
mSlideInViewScale.animateToValue(1f)
|
||||||
.setDuration(REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS)
|
.setDuration(REVERT_SWIPE_ALL_APPS_TO_HOME_ANIMATION_DURATION_MS)
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user