Merge "Fix end state when animating launcher after swipe up from an app" into ub-launcher3-master
This commit is contained in:
@@ -243,7 +243,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
|
||||
fling = false;
|
||||
}
|
||||
float progress = mCurrentAnimation.getProgressFraction();
|
||||
float interpolatedProgress = mCurrentAnimation.getInterpolator().getInterpolation(progress);
|
||||
float interpolatedProgress = mCurrentAnimation.getInterpolatedProgress();
|
||||
if (fling) {
|
||||
logAction = Touch.FLING;
|
||||
boolean goingUp = velocity < 0;
|
||||
|
||||
@@ -29,6 +29,7 @@ import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB;
|
||||
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_BACK;
|
||||
import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ROTATION;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
@@ -43,8 +44,7 @@ import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
@@ -77,6 +77,9 @@ import java.util.Objects;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
/**
|
||||
* Utility class which abstracts out the logical differences between Launcher and RecentsActivity.
|
||||
*/
|
||||
@@ -305,9 +308,10 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
AnimatorPlaybackController.wrap(anim, transitionLength * 2);
|
||||
|
||||
// Since we are changing the start position of the UI, reapply the state, at the end
|
||||
controller.setEndAction(() ->
|
||||
controller.setEndAction(() -> {
|
||||
activity.getStateManager().goToState(
|
||||
controller.getProgressFraction() > 0.5 ? endState : fromState, false));
|
||||
controller.getInterpolatedProgress() > 0.5 ? endState : fromState, false);
|
||||
});
|
||||
callback.accept(controller);
|
||||
}
|
||||
|
||||
|
||||
@@ -825,6 +825,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
return;
|
||||
}
|
||||
if (start == end || duration <= 0) {
|
||||
mLauncherTransitionController.dispatchSetInterpolator(t -> end);
|
||||
mLauncherTransitionController.getAnimationPlayer().end();
|
||||
} else {
|
||||
// Adjust start progress and duration in case we are on a different thread.
|
||||
|
||||
@@ -154,6 +154,10 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
|
||||
return mCurrentFraction;
|
||||
}
|
||||
|
||||
public float getInterpolatedProgress() {
|
||||
return getInterpolator().getInterpolation(mCurrentFraction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the action to be called when the animation is completed. Also clears any
|
||||
* previously set action.
|
||||
|
||||
@@ -372,8 +372,7 @@ public abstract class AbstractStateChangeTouchController
|
||||
|
||||
final LauncherState targetState;
|
||||
final float progress = mCurrentAnimation.getProgressFraction();
|
||||
final float interpolatedProgress = mCurrentAnimation.getInterpolator()
|
||||
.getInterpolation(progress);
|
||||
final float interpolatedProgress = mCurrentAnimation.getInterpolatedProgress();
|
||||
if (fling) {
|
||||
targetState =
|
||||
Float.compare(Math.signum(velocity), Math.signum(mProgressMultiplier)) == 0
|
||||
|
||||
Reference in New Issue
Block a user