Merge "Fix issue with side pages being visible momentarily when swiping up" into ub-launcher3-master

This commit is contained in:
Winson Chung 2018-10-15 17:31:57 +00:00 committed by Android (Google) Code Review
commit 0ac0be2e4f
3 changed files with 39 additions and 4 deletions

View File

@ -15,10 +15,14 @@
*/
package com.android.launcher3.uioverrides;
import android.os.RemoteException;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.quickstep.QuickScrubController;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.ISystemUiProxy;
/**
* State indicating that the Launcher is behind an app
@ -43,4 +47,27 @@ public class BackgroundAppState extends OverviewState {
float progressDelta = (transitionLength / scrollRange);
return super.getVerticalProgress(launcher) + progressDelta;
}
@Override
public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) {
// Initialize the recents view scale to what it would be when starting swipe up/quickscrub
RecentsView recentsView = launcher.getOverviewPanel();
recentsView.getTaskSize(sTempRect);
int appWidth = launcher.getDragLayer().getWidth();
if (recentsView.shouldUseMultiWindowTaskSizeStrategy()) {
ISystemUiProxy sysUiProxy = RecentsModel.INSTANCE.get(launcher).getSystemUiProxy();
if (sysUiProxy != null) {
try {
// Try to use the actual non-minimized app width (launcher will be resized to
// the non-minimized bounds, which differs from the app width in landscape
// multi-window mode
appWidth = sysUiProxy.getNonMinimizedSplitScreenSecondaryBounds().width();
} catch (RemoteException e) {
// Ignore, fall back to just using the drag layer width
}
}
}
float scale = (float) appWidth / sTempRect.width();
return new float[] { scale, 0f };
}
}

View File

@ -286,7 +286,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
}
if (interactionType == INTERACTION_NORMAL) {
playScaleDownAnim(anim, activity);
playScaleDownAnim(anim, activity, endState);
}
anim.setDuration(transitionLength * 2);
@ -304,14 +304,24 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
/**
* Scale down recents from the center task being full screen to being in overview.
*/
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher) {
private void playScaleDownAnim(AnimatorSet anim, Launcher launcher,
LauncherState endState) {
RecentsView recentsView = launcher.getOverviewPanel();
TaskView v = recentsView.getTaskViewAt(recentsView.getCurrentPage());
if (v == null) {
return;
}
// Setup the clip animation helper source/target rects in the final transformed state
// of the recents view (a scale may be applied prior to this animation starting to
// line up the side pages during swipe up)
float prevRvScale = recentsView.getScaleX();
float targetRvScale = endState.getOverviewScaleAndTranslationYFactor(launcher)[0];
SCALE_PROPERTY.set(recentsView, targetRvScale);
ClipAnimationHelper clipHelper = new ClipAnimationHelper();
clipHelper.fromTaskThumbnailView(v.getThumbnail(), (RecentsView) v.getParent(), null);
SCALE_PROPERTY.set(recentsView, prevRvScale);
if (!clipHelper.getSourceRect().isEmpty() && !clipHelper.getTargetRect().isEmpty()) {
float fromScale = clipHelper.getSourceRect().width()
/ clipHelper.getTargetRect().width();

View File

@ -90,8 +90,6 @@ public class ClipAnimationHelper {
// Whether to boost the opening animation target layers, or the closing
private int mBoostModeTargetLayers = -1;
// Wether or not applyTransform has been called yet since prepareAnimation()
private boolean mIsFirstFrame = true;
private BiFunction<RemoteAnimationTargetCompat, Float, Float> mTaskAlphaCallback =
(t, a1) -> a1;