Track window for 2 button nav as well as 0 button
This allows us to revert the change that fades in the shelf during swipe up in 2 button mode, since the shelf doesn't show up until the window is out of the way anyway. Bug: 129746879 Change-Id: I929d8095989f9eae32d71b5bc3f67997e9df4ba0
This commit is contained in:
parent
9bbbe9cc14
commit
8e5c13f360
|
@ -75,12 +75,4 @@ public class BackgroundAppState extends OverviewState {
|
|||
return new ScaleAndTranslation(scale, 0f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVisibleElements(Launcher launcher) {
|
||||
if (SysUINavigationMode.getMode(launcher) == Mode.NO_BUTTON) {
|
||||
return super.getVisibleElements(launcher);
|
||||
}
|
||||
// Hide shelf content (e.g. QSB) because we fade it in when swiping up.
|
||||
return ALL_APPS_HEADER_EXTRA;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import static com.android.launcher3.LauncherState.NORMAL;
|
|||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_DAMPING_RATIO;
|
||||
import static com.android.launcher3.allapps.AllAppsTransitionController.SPRING_STIFFNESS;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
|
||||
import android.animation.Animator;
|
||||
|
@ -44,11 +43,8 @@ import com.android.launcher3.Launcher;
|
|||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherInitListener;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.allapps.AllAppsTransitionController;
|
||||
import com.android.launcher3.allapps.DiscoveryBounce;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.SpringObjectAnimator;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
|
@ -220,7 +216,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
|
|||
: mShelfState == ShelfAnimState.PEEK
|
||||
? shelfPeekingProgress
|
||||
: shelfOverviewProgress;
|
||||
mShelfAnim = createShelfProgressAnim(activity, toProgress);
|
||||
mShelfAnim = createShelfAnim(activity, toProgress);
|
||||
mShelfAnim.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
|
@ -238,10 +234,10 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
|
|||
LauncherState fromState, long transitionLength,
|
||||
Consumer<AnimatorPlaybackController> callback) {
|
||||
LauncherState endState = OVERVIEW;
|
||||
DeviceProfile dp = activity.getDeviceProfile();
|
||||
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
|
||||
if (wasVisible && fromState != BACKGROUND_APP) {
|
||||
// If a translucent app was launched fom launcher, animate launcher states.
|
||||
DeviceProfile dp = activity.getDeviceProfile();
|
||||
long accuracy = 2 * Math.max(dp.widthPx, dp.heightPx);
|
||||
callback.accept(activity.getStateManager()
|
||||
.createAnimationToNewWorkspace(fromState, endState, accuracy));
|
||||
return;
|
||||
|
@ -254,11 +250,10 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
|
|||
if (!activity.getDeviceProfile().isVerticalBarLayout()
|
||||
&& SysUINavigationMode.getMode(activity) != Mode.NO_BUTTON) {
|
||||
// Don't animate the shelf when the mode is NO_BUTTON, because we update it atomically.
|
||||
Animator shiftAnim = createShelfProgressAnim(activity,
|
||||
Animator shiftAnim = createShelfAnim(activity,
|
||||
fromState.getVerticalProgress(activity),
|
||||
endState.getVerticalProgress(activity));
|
||||
anim.play(shiftAnim);
|
||||
anim.play(createShelfAlphaAnim(activity, endState, accuracy));
|
||||
}
|
||||
playScaleDownAnim(anim, activity, endState);
|
||||
|
||||
|
@ -275,7 +270,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
|
|||
callback.accept(controller);
|
||||
}
|
||||
|
||||
private Animator createShelfProgressAnim(Launcher activity, float ... progressValues) {
|
||||
private Animator createShelfAnim(Launcher activity, float ... progressValues) {
|
||||
Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(),
|
||||
"allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(),
|
||||
SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues);
|
||||
|
@ -283,19 +278,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
|
|||
return shiftAnim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Very quickly fade the alpha of shelf content.
|
||||
*/
|
||||
private Animator createShelfAlphaAnim(Launcher activity, LauncherState toState, long accuracy) {
|
||||
AllAppsTransitionController allAppsController = activity.getAllAppsController();
|
||||
AnimatorSetBuilder animBuilder = new AnimatorSetBuilder();
|
||||
animBuilder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, DEACCEL_3);
|
||||
LauncherStateManager.AnimationConfig config = new LauncherStateManager.AnimationConfig();
|
||||
config.duration = accuracy;
|
||||
allAppsController.setAlphas(toState.getVisibleElements(activity), config, animBuilder);
|
||||
return animBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale down recents from the center task being full screen to being in overview.
|
||||
*/
|
||||
|
|
|
@ -27,8 +27,6 @@ import androidx.annotation.IntDef;
|
|||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
|
@ -118,14 +116,10 @@ public class LayoutUtils {
|
|||
}
|
||||
|
||||
public static int getShelfTrackingDistance(Context context, DeviceProfile dp) {
|
||||
if (SysUINavigationMode.getMode(context) == Mode.NO_BUTTON) {
|
||||
// Track the bottom of the window rather than the top of the shelf.
|
||||
int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
|
||||
int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
|
||||
R.dimen.task_card_vert_space);
|
||||
return shelfHeight + spaceBetweenShelfAndRecents;
|
||||
}
|
||||
// Start from a third of bottom inset to provide some shelf overlap.
|
||||
return dp.hotseatBarSizePx + dp.getInsets().bottom / 3 - dp.edgeMarginPx * 2;
|
||||
// Track the bottom of the window.
|
||||
int shelfHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
|
||||
int spaceBetweenShelfAndRecents = (int) context.getResources().getDimension(
|
||||
R.dimen.task_card_vert_space);
|
||||
return shelfHeight + spaceBetweenShelfAndRecents;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue