Merge "[AllApps] NORMAL <-> ALL_APPS motion clean fixes for AOSP" into sc-v2-dev am: 0f4e4856a2
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15807632 Change-Id: I9362d09b6a65d09e7e39a5f9ca3cbc4b2673d29c
This commit is contained in:
@@ -714,6 +714,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
|
||||
|
||||
@Override
|
||||
public void drawOnScrim(Canvas canvas) {
|
||||
if (!mHeader.isHeaderProtectionSupported()) return;
|
||||
mHeaderPaint.setColor(mHeaderColor);
|
||||
mHeaderPaint.setAlpha((int) (getAlpha() * Color.alpha(mHeaderColor)));
|
||||
if (mHeaderPaint.getColor() != mScrimColor && mHeaderPaint.getColor() != 0) {
|
||||
|
||||
@@ -39,7 +39,6 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
@@ -61,7 +60,6 @@ public class AllAppsTransitionController
|
||||
implements StateHandler<LauncherState>, OnDeviceProfileChangeListener {
|
||||
// This constant should match the second derivative of the animator interpolator.
|
||||
public static final float INTERP_COEFF = 1.7f;
|
||||
private static final float CONTENT_VISIBLE_MAX_THRESHOLD = 0.5f;
|
||||
|
||||
public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PROGRESS =
|
||||
new FloatProperty<AllAppsTransitionController>("allAppsProgress") {
|
||||
@@ -188,8 +186,7 @@ public class AllAppsTransitionController
|
||||
int visibleElements = state.getVisibleElements(mLauncher);
|
||||
boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0;
|
||||
|
||||
Interpolator allAppsFade = config.getInterpolator(ANIM_ALL_APPS_FADE,
|
||||
Interpolators.clampToProgress(LINEAR, 0, CONTENT_VISIBLE_MAX_THRESHOLD));
|
||||
Interpolator allAppsFade = config.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
|
||||
setter.setViewAlpha(mAppsView, hasAllAppsContent ? 1 : 0, allAppsFade);
|
||||
|
||||
boolean shouldProtectHeader =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,18 +17,31 @@ package com.android.launcher3.touch;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.states.StateAnimationConfig;
|
||||
|
||||
/**
|
||||
* TouchController to switch between NORMAL and ALL_APPS state.
|
||||
*/
|
||||
public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
|
||||
private static final float ALLAPPS_STAGGERED_FADE_THRESHOLD = 0.5f;
|
||||
|
||||
public static final Interpolator ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER =
|
||||
Interpolators.clampToProgress(LINEAR, 0, ALLAPPS_STAGGERED_FADE_THRESHOLD);
|
||||
public static final Interpolator ALLAPPS_STAGGERED_FADE_LATE_RESPONDER =
|
||||
Interpolators.clampToProgress(LINEAR, ALLAPPS_STAGGERED_FADE_THRESHOLD, 1f);
|
||||
|
||||
public AllAppsSwipeController(Launcher l) {
|
||||
super(l, SingleAxisSwipeDetector.VERTICAL);
|
||||
}
|
||||
@@ -65,12 +78,28 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
|
||||
@Override
|
||||
protected float initCurrentAnimation() {
|
||||
float range = getShiftRange();
|
||||
long maxAccuracy = (long) (2 * range);
|
||||
StateAnimationConfig config = getConfigForStates(mFromState, mToState);
|
||||
config.duration = (long) (2 * range);
|
||||
|
||||
mCurrentAnimation = mLauncher.getStateManager()
|
||||
.createAnimationToNewWorkspace(mToState, maxAccuracy);
|
||||
.createAnimationToNewWorkspace(mToState, config);
|
||||
float startVerticalShift = mFromState.getVerticalProgress(mLauncher) * range;
|
||||
float endVerticalShift = mToState.getVerticalProgress(mLauncher) * range;
|
||||
float totalShift = endVerticalShift - startVerticalShift;
|
||||
return 1 / totalShift;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StateAnimationConfig getConfigForStates(LauncherState fromState,
|
||||
LauncherState toState) {
|
||||
StateAnimationConfig config = super.getConfigForStates(fromState, toState);
|
||||
if (fromState == NORMAL && toState == ALL_APPS) {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
|
||||
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, ALLAPPS_STAGGERED_FADE_LATE_RESPONDER);
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, ALLAPPS_STAGGERED_FADE_EARLY_RESPONDER);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user