Snap for 8534862 from 2816e738f2 to udc-release
Change-Id: I35f2b86b98694ca27fc1ef61382b6acdcb8057fe
This commit is contained in:
commit
a3a28afbaa
33 files changed
+129
-74
No files matched your search
@@ -70,7 +70,8 @@ public interface QuickstepSystemShortcut {
|
||||
|
||||
RecentsView recentsView = mTarget.getOverviewPanel();
|
||||
recentsView.initiateSplitSelect(
|
||||
new SplitSelectSource(view, new BitmapDrawable(bitmap), intent, mPosition));
|
||||
new SplitSelectSource(mOriginalView, new BitmapDrawable(bitmap), intent,
|
||||
mPosition));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static android.view.HapticFeedbackConstants.LONG_PRESS;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW;
|
||||
import static com.android.launcher3.taskbar.Utilities.appendFlag;
|
||||
@@ -34,7 +35,6 @@ import android.view.WindowInsets;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
@@ -564,7 +564,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, false);
|
||||
if (applyState) {
|
||||
applyState(TaskbarAllAppsSlideInView.DEFAULT_CLOSE_DURATION);
|
||||
applyState(ALL_APPS.getTransitionDuration(
|
||||
mControllers.taskbarActivityContext, false /* isToState */));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -263,12 +263,14 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
View child = mTaskbarView.getChildAt(i);
|
||||
|
||||
int positionInHotseat = -1;
|
||||
if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get() && i == count - 1) {
|
||||
boolean isRtl = Utilities.isRtl(child.getResources());
|
||||
if (FeatureFlags.ENABLE_ALL_APPS_IN_TASKBAR.get()
|
||||
&& ((isRtl && i == 0) || (!isRtl && i == count - 1))) {
|
||||
// Note that there is no All Apps button in the hotseat, this position is only used
|
||||
// as its convenient for animation purposes.
|
||||
positionInHotseat = Utilities.isRtl(child.getResources())
|
||||
positionInHotseat = isRtl
|
||||
? -1
|
||||
: mActivity.getDeviceProfile().inv.numShownHotseatIcons;
|
||||
: mActivity.getDeviceProfile().numShownHotseatIcons;
|
||||
|
||||
setter.setViewAlpha(child, 0, LINEAR);
|
||||
} else if (child.getTag() instanceof ItemInfo) {
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE;
|
||||
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Insettable;
|
||||
@@ -33,9 +36,6 @@ import java.util.Optional;
|
||||
/** Wrapper for taskbar all apps with slide-in behavior. */
|
||||
public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllAppsContext>
|
||||
implements Insettable, DeviceProfile.OnDeviceProfileChangeListener {
|
||||
static final int DEFAULT_OPEN_DURATION = 500;
|
||||
public static final int DEFAULT_CLOSE_DURATION = 200;
|
||||
|
||||
private TaskbarAllAppsContainerView mAppsView;
|
||||
private OnCloseListener mOnCloseBeginListener;
|
||||
private float mShiftRange;
|
||||
@@ -61,7 +61,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
|
||||
mOpenCloseAnimator.setValues(
|
||||
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
|
||||
mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
|
||||
mOpenCloseAnimator.setDuration(DEFAULT_OPEN_DURATION).start();
|
||||
mOpenCloseAnimator.setDuration(
|
||||
ALL_APPS.getTransitionDuration(mContext, true /* isToState */)).start();
|
||||
} else {
|
||||
mTranslationShift = TRANSLATION_SHIFT_OPENED;
|
||||
}
|
||||
@@ -80,7 +81,12 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
|
||||
@Override
|
||||
protected void handleClose(boolean animate) {
|
||||
Optional.ofNullable(mOnCloseBeginListener).ifPresent(OnCloseListener::onSlideInViewClosed);
|
||||
handleClose(animate, DEFAULT_CLOSE_DURATION);
|
||||
handleClose(animate, ALL_APPS.getTransitionDuration(mContext, false /* isToState */));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Interpolator getIdleInterpolator() {
|
||||
return EMPHASIZED_ACCELERATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar.allapps;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_ALL_APPS;
|
||||
import static com.android.launcher3.taskbar.allapps.TaskbarAllAppsSlideInView.DEFAULT_OPEN_DURATION;
|
||||
import static com.android.launcher3.util.OnboardingPrefs.ALL_APPS_VISITED_COUNT;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
@@ -81,7 +81,8 @@ final class TaskbarAllAppsViewController {
|
||||
|
||||
private void setUpTaskbarStashing() {
|
||||
mTaskbarStashController.updateStateForFlag(FLAG_STASHED_IN_APP_ALL_APPS, true);
|
||||
mTaskbarStashController.applyState(DEFAULT_OPEN_DURATION);
|
||||
mTaskbarStashController.applyState(
|
||||
ALL_APPS.getTransitionDuration(mContext, true /* isToState */));
|
||||
mSlideInView.setOnCloseBeginListener(() -> {
|
||||
AbstractFloatingView.closeOpenContainer(
|
||||
mContext, AbstractFloatingView.TYPE_ACTION_POPUP);
|
||||
|
||||
@@ -118,7 +118,7 @@ public final class RecentsViewStateController extends
|
||||
if (toState == OVERVIEW_SPLIT_SELECT) {
|
||||
// Animation to "dismiss" selected taskView
|
||||
PendingAnimation splitSelectInitAnimation = mRecentsView.createSplitSelectInitAnimation(
|
||||
toState.getTransitionDuration(mLauncher));
|
||||
toState.getTransitionDuration(mLauncher, true /* isToState */));
|
||||
// Add properties to shift remaining taskViews to get out of placeholder view
|
||||
splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first,
|
||||
toState.getSplitSelectTranslation(mLauncher), LINEAR);
|
||||
|
||||
@@ -33,12 +33,12 @@ import com.android.systemui.shared.plugins.PluginInstance;
|
||||
import com.android.systemui.shared.plugins.PluginManager;
|
||||
import com.android.systemui.shared.plugins.PluginManagerImpl;
|
||||
import com.android.systemui.shared.plugins.PluginPrefs;
|
||||
import com.android.systemui.shared.system.UncaughtExceptionPreHandlerManager;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class PluginManagerWrapper {
|
||||
@@ -48,6 +48,9 @@ public class PluginManagerWrapper {
|
||||
|
||||
public static final String PLUGIN_CHANGED = PluginManager.PLUGIN_CHANGED;
|
||||
|
||||
private static final UncaughtExceptionPreHandlerManager UNCAUGHT_EXCEPTION_PRE_HANDLER_MANAGER =
|
||||
new UncaughtExceptionPreHandlerManager();
|
||||
|
||||
private final Context mContext;
|
||||
private final PluginManager mPluginManager;
|
||||
private final PluginEnablerImpl mPluginEnabler;
|
||||
@@ -67,7 +70,7 @@ public class PluginManagerWrapper {
|
||||
|
||||
mPluginManager = new PluginManagerImpl(c, instanceManagerFactory,
|
||||
Utilities.IS_DEBUG_DEVICE,
|
||||
Optional.ofNullable(Thread.getDefaultUncaughtExceptionHandler()), mPluginEnabler,
|
||||
UNCAUGHT_EXCEPTION_PRE_HANDLER_MANAGER, mPluginEnabler,
|
||||
new PluginPrefs(c), privilegedPlugins);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public class AllAppsState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
return 150;
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return isToState ? 500 : 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class OverviewModalTaskState extends OverviewState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context launcher) {
|
||||
public int getTransitionDuration(Context launcher, boolean isToState) {
|
||||
return 300;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public class OverviewState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
// In gesture modes, overview comes in all the way from the side, so give it more time.
|
||||
return DisplayController.getNavigationMode(context).hasGestures ? 380 : 250;
|
||||
}
|
||||
|
||||
+12
-4
@@ -42,6 +42,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SC
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_Y;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
|
||||
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
|
||||
@@ -50,6 +51,8 @@ import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesT
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_OPAQUE_THRESHOLD;
|
||||
import static com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController.ALL_APPS_SCRIM_VISIBLE_THRESHOLD;
|
||||
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED_ACCELERATE;
|
||||
import static com.android.systemui.animation.Interpolators.EMPHASIZED_DECELERATE;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
|
||||
@@ -179,12 +182,17 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
}
|
||||
config.duration = Math.max(config.duration, mHintToNormalDuration);
|
||||
} else if (fromState == ALL_APPS && toState == NORMAL) {
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL,
|
||||
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
|
||||
boolean isTablet = mActivity.getDeviceProfile().isTablet;
|
||||
config.setInterpolator(ANIM_ALL_APPS_FADE,
|
||||
isTablet ? FINAL_FRAME : Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
|
||||
config.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
|
||||
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_ACCELERATE);
|
||||
} else if (fromState == NORMAL && toState == ALL_APPS) {
|
||||
config.setInterpolator(ANIM_VERTICAL_PROGRESS, EMPHASIZED_DECELERATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -180,7 +180,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
|
||||
// Normally we compute the duration based on the velocity and distance to the given
|
||||
// state, but since the hint state tracks the entire screen without a clear endpoint, we
|
||||
// need to manually set the duration to a reasonable value.
|
||||
animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher));
|
||||
animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher, true /* isToState */));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-6
@@ -21,10 +21,9 @@ import static com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.FINAL_FRAME;
|
||||
import static com.android.launcher3.anim.Interpolators.INSTANT;
|
||||
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;
|
||||
|
||||
@@ -131,10 +130,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
boolean isTablet = mLauncher.getDeviceProfile().isTablet;
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
|
||||
? INSTANT
|
||||
: Interpolators.clampToProgress(ACCEL,
|
||||
: Interpolators.clampToProgress(LINEAR,
|
||||
ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD,
|
||||
ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL,
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR,
|
||||
ALL_APPS_SCRIM_VISIBLE_THRESHOLD,
|
||||
ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
|
||||
return builder;
|
||||
@@ -145,10 +144,10 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
|
||||
boolean isTablet = mLauncher.getDeviceProfile().isTablet;
|
||||
builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet
|
||||
? FINAL_FRAME
|
||||
: Interpolators.clampToProgress(DEACCEL,
|
||||
: Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD,
|
||||
1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL,
|
||||
builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR,
|
||||
1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD,
|
||||
1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
|
||||
return builder;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class FallbackRecentsStateController implements StateHandler<RecentsState
|
||||
RecentsState currentState = mActivity.getStateManager().getState();
|
||||
if (isSplitSelectionState(state) && !isSplitSelectionState(currentState)) {
|
||||
setter.add(mRecentsView.createSplitSelectInitAnimation(
|
||||
state.getTransitionDuration(mActivity)).buildAnim());
|
||||
state.getTransitionDuration(mActivity, true /* isToState */)).buildAnim());
|
||||
}
|
||||
|
||||
Pair<FloatProperty, FloatProperty> taskViewsFloat =
|
||||
|
||||
@@ -77,7 +77,7 @@ public class RecentsState implements BaseState<RecentsState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return 250;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public class OverviewToHomeAnim {
|
||||
// WorkspaceRevealAnim handles the depth, so don't interfere.
|
||||
config.animFlags |= StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
|
||||
}
|
||||
config.duration = startState.getTransitionDuration(mLauncher);
|
||||
config.duration = startState.getTransitionDuration(mLauncher, false /* isToState */);
|
||||
AnimatorSet stateAnim = stateManager.createAtomicAnimation(
|
||||
startState, NORMAL, config);
|
||||
stateAnim.addListener(new AnimationSuccessListener() {
|
||||
|
||||
@@ -196,6 +196,13 @@ public class FloatingTaskView extends FrameLayout {
|
||||
0, 1, ACCEL);
|
||||
animation.addFloat(mThumbnailView, LauncherAnimUtils.VIEW_ALPHA,
|
||||
1, 0, DEACCEL_3);
|
||||
} else if (isStagedTask) {
|
||||
// Fade in the placeholder view when split is initiated from homescreen / all apps
|
||||
// icons.
|
||||
if (mSplitPlaceholderView.getAlpha() == 0) {
|
||||
animation.addFloat(mSplitPlaceholderView, SplitPlaceholderView.ALPHA_FLOAT,
|
||||
0.3f, 1, ACCEL);
|
||||
}
|
||||
}
|
||||
|
||||
MultiValueUpdateListener listener = new MultiValueUpdateListener() {
|
||||
|
||||
@@ -2757,16 +2757,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
mSplitHiddenTaskView.getThumbnail().getThumbnail(),
|
||||
mSplitHiddenTaskView.getIconView().getDrawable(), startingTaskRect);
|
||||
mFirstFloatingTaskView.setAlpha(1);
|
||||
mFirstFloatingTaskView.addAnimation(anim, startingTaskRect,
|
||||
mTempRect, true /* fadeWithThumbnail */, true /* isStagedTask */);
|
||||
mFirstFloatingTaskView.addAnimation(anim, startingTaskRect, mTempRect,
|
||||
true /* fadeWithThumbnail */, true /* isStagedTask */);
|
||||
} else {
|
||||
mSplitSelectSource.view.setVisibility(INVISIBLE);
|
||||
mFirstFloatingTaskView = FloatingTaskView.getFloatingTaskView(mActivity,
|
||||
mSplitSelectSource.view, null,
|
||||
mSplitSelectSource.view, null /* thumbnail */,
|
||||
mSplitSelectSource.drawable, startingTaskRect);
|
||||
mFirstFloatingTaskView.setAlpha(1);
|
||||
mFirstFloatingTaskView.addAnimation(anim, startingTaskRect,
|
||||
mTempRect, true /* fadeWithThumbnail */, true /* isStagedTask */);
|
||||
mFirstFloatingTaskView.addAnimation(anim, startingTaskRect, mTempRect,
|
||||
false /* fadeWithThumbnail */, true /* isStagedTask */);
|
||||
}
|
||||
InteractionJankMonitorWrapper.begin(this,
|
||||
InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "First tile selected");
|
||||
@@ -4059,7 +4058,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// TODO(194414938) starting bounds seem slightly off, investigate
|
||||
Rect firstTaskStartingBounds = new Rect();
|
||||
Rect firstTaskEndingBounds = mTempRect;
|
||||
int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext());
|
||||
int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext(),
|
||||
false /* isToState */);
|
||||
PendingAnimation pendingAnimation = new PendingAnimation(duration);
|
||||
|
||||
int halfDividerSize = getResources()
|
||||
|
||||
@@ -113,7 +113,7 @@ public abstract class LauncherState implements BaseState<LauncherState> {
|
||||
FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON |
|
||||
FLAG_HAS_SYS_UI_SCRIM) {
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
// Arbitrary duration, when going to NORMAL we use the state we're coming from instead.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ public class ResourceUtils {
|
||||
public static final String NAVBAR_HEIGHT = "navigation_bar_height";
|
||||
public static final String NAVBAR_HEIGHT_LANDSCAPE = "navigation_bar_height_landscape";
|
||||
|
||||
public static final String STATUS_BAR_HEIGHT = "status_bar_height";
|
||||
public static final String STATUS_BAR_HEIGHT_LANDSCAPE = "status_bar_height_landscape";
|
||||
public static final String STATUS_BAR_HEIGHT_PORTRAIT = "status_bar_height_portrait";
|
||||
|
||||
public static int getNavbarSize(String resName, Resources res) {
|
||||
return getDimenByName(resName, res, DEFAULT_NAVBAR_VALUE);
|
||||
}
|
||||
|
||||
@@ -2118,7 +2118,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
|
||||
final Runnable onCompleteCallback = onCompleteRunnable;
|
||||
mLauncher.getDragController().animateDragViewToOriginalPosition(
|
||||
/* onComplete= */ callbackList::executeAllAndDestroy, cell,
|
||||
SPRING_LOADED.getTransitionDuration(mLauncher));
|
||||
SPRING_LOADED.getTransitionDuration(mLauncher, true /* isToState */));
|
||||
mLauncher.getStateManager().goToState(NORMAL, /* delay= */ 0,
|
||||
onCompleteCallback == null
|
||||
? null
|
||||
|
||||
@@ -255,8 +255,6 @@ public class AllAppsTransitionController
|
||||
anim.setInterpolator(verticalProgressInterpolator);
|
||||
anim.addListener(getProgressAnimatorListener());
|
||||
builder.add(anim);
|
||||
// Use ANIM_VERTICAL_PROGRESS's interpolator to determine state transition threshold.
|
||||
builder.setInterpolator(verticalProgressInterpolator);
|
||||
|
||||
setAlphas(toState, config, builder);
|
||||
|
||||
|
||||
@@ -47,13 +47,6 @@ public class Interpolators {
|
||||
public static final Interpolator DEACCEL_2_5 = new DecelerateInterpolator(2.5f);
|
||||
public static final Interpolator DEACCEL_3 = new DecelerateInterpolator(3f);
|
||||
|
||||
/**
|
||||
* The decelerating emphasized interpolator. Used for hero / emphasized movement of content that
|
||||
* is appearing e.g. when coming from off screen
|
||||
*/
|
||||
public static final Interpolator EMPHASIZED_DECELERATE = new PathInterpolator(
|
||||
0.05f, 0.7f, 0.1f, 1f);
|
||||
|
||||
public static final Interpolator ACCEL_DEACCEL = new AccelerateDecelerateInterpolator();
|
||||
|
||||
public static final Interpolator FAST_OUT_SLOW_IN = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
|
||||
|
||||
@@ -87,7 +87,8 @@ class PinShortcutRequestActivityInfo extends ShortcutConfigActivityInfo {
|
||||
// Total duration for the drop animation to complete.
|
||||
long duration = mContext.getResources().getInteger(R.integer.config_dropAnimMaxDuration) +
|
||||
LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY +
|
||||
LauncherState.SPRING_LOADED.getTransitionDuration(Launcher.getLauncher(mContext));
|
||||
LauncherState.SPRING_LOADED.getTransitionDuration(Launcher.getLauncher(mContext),
|
||||
true /* isToState */);
|
||||
// Delay the actual accept() call until the drop animation is complete.
|
||||
return PinRequestHelper.createWorkspaceItemFromPinItemRequest(
|
||||
mContext, mRequest, duration);
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface BaseState<T extends BaseState> {
|
||||
/**
|
||||
* @return How long the animation to this state should take (or from this state to NORMAL).
|
||||
*/
|
||||
int getTransitionDuration(Context context);
|
||||
int getTransitionDuration(Context context, boolean isToState);
|
||||
|
||||
/**
|
||||
* Returns the state to go back to from this state
|
||||
|
||||
@@ -253,8 +253,8 @@ public class StateManager<STATE_TYPE extends BaseState<STATE_TYPE>> {
|
||||
// Since state mBaseState can be reached from multiple states, just assume that the
|
||||
// transition plays in reverse and use the same duration as previous state.
|
||||
mConfig.duration = state == mBaseState
|
||||
? fromState.getTransitionDuration(mActivity)
|
||||
: state.getTransitionDuration(mActivity);
|
||||
? fromState.getTransitionDuration(mActivity, false /* isToState */)
|
||||
: state.getTransitionDuration(mActivity, true /* isToState */);
|
||||
prepareForAtomicAnimation(fromState, state, mConfig);
|
||||
AnimatorSet animation = createAnimationToNewWorkspaceInternal(state).buildAnim();
|
||||
if (listener != null) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class HintState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return 80;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SpringLoadedState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return 150;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ import static com.android.launcher3.ResourceUtils.INVALID_RESOURCE_HANDLE;
|
||||
import static com.android.launcher3.ResourceUtils.NAVBAR_HEIGHT;
|
||||
import static com.android.launcher3.ResourceUtils.NAVBAR_HEIGHT_LANDSCAPE;
|
||||
import static com.android.launcher3.ResourceUtils.NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE;
|
||||
import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT;
|
||||
import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT_LANDSCAPE;
|
||||
import static com.android.launcher3.ResourceUtils.STATUS_BAR_HEIGHT_PORTRAIT;
|
||||
import static com.android.launcher3.Utilities.dpiFromPx;
|
||||
import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
|
||||
import static com.android.launcher3.util.RotationUtils.deltaRotation;
|
||||
@@ -152,20 +155,26 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
|
||||
boolean isTablet = config.smallestScreenWidthDp > MIN_TABLET_WIDTH;
|
||||
boolean isGesture = isGestureNav(context);
|
||||
boolean isPortrait = config.screenHeightDp > config.screenWidthDp;
|
||||
|
||||
int bottomNav = isTablet
|
||||
? 0
|
||||
: (config.screenHeightDp > config.screenWidthDp
|
||||
? getDimenByName(NAVBAR_HEIGHT, systemRes)
|
||||
: (isPortrait
|
||||
? getDimenByName(systemRes, NAVBAR_HEIGHT)
|
||||
: (isGesture
|
||||
? getDimenByName(NAVBAR_HEIGHT_LANDSCAPE, systemRes)
|
||||
? getDimenByName(systemRes, NAVBAR_HEIGHT_LANDSCAPE)
|
||||
: 0));
|
||||
Insets newNavInsets = Insets.of(navInsets.left, navInsets.top, navInsets.right, bottomNav);
|
||||
insetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets);
|
||||
insetsBuilder.setInsetsIgnoringVisibility(WindowInsets.Type.navigationBars(), newNavInsets);
|
||||
|
||||
Insets statusBarInsets = oldInsets.getInsets(WindowInsets.Type.statusBars());
|
||||
int statusBarHeight = getDimenByName("status_bar_height", systemRes);
|
||||
|
||||
|
||||
int statusBarHeight = getDimenByName(systemRes,
|
||||
(isPortrait) ? STATUS_BAR_HEIGHT_PORTRAIT : STATUS_BAR_HEIGHT_LANDSCAPE,
|
||||
STATUS_BAR_HEIGHT);
|
||||
|
||||
Insets newStatusBarInsets = Insets.of(
|
||||
statusBarInsets.left,
|
||||
Math.max(statusBarInsets.top, statusBarHeight),
|
||||
@@ -221,23 +230,26 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
boolean isTabletOrGesture = isTablet
|
||||
|| (Utilities.ATLEAST_R && isGestureNav(context));
|
||||
|
||||
int statusBarHeight = getDimenByName("status_bar_height", systemRes);
|
||||
int statusBarHeightPortrait = getDimenByName(systemRes,
|
||||
STATUS_BAR_HEIGHT_PORTRAIT, STATUS_BAR_HEIGHT);
|
||||
int statusBarHeightLandscape = getDimenByName(systemRes,
|
||||
STATUS_BAR_HEIGHT_LANDSCAPE, STATUS_BAR_HEIGHT);
|
||||
|
||||
int navBarHeightPortrait, navBarHeightLandscape, navbarWidthLandscape;
|
||||
|
||||
navBarHeightPortrait = isTablet
|
||||
? (mTaskbarDrawnInProcess
|
||||
? 0 : systemRes.getDimensionPixelSize(R.dimen.taskbar_size))
|
||||
: getDimenByName(NAVBAR_HEIGHT, systemRes);
|
||||
: getDimenByName(systemRes, NAVBAR_HEIGHT);
|
||||
|
||||
navBarHeightLandscape = isTablet
|
||||
? (mTaskbarDrawnInProcess
|
||||
? 0 : systemRes.getDimensionPixelSize(R.dimen.taskbar_size))
|
||||
: (isTabletOrGesture
|
||||
? getDimenByName(NAVBAR_HEIGHT_LANDSCAPE, systemRes) : 0);
|
||||
? getDimenByName(systemRes, NAVBAR_HEIGHT_LANDSCAPE) : 0);
|
||||
navbarWidthLandscape = isTabletOrGesture
|
||||
? 0
|
||||
: getDimenByName(NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE, systemRes);
|
||||
: getDimenByName(systemRes, NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE);
|
||||
|
||||
WindowBounds[] result = new WindowBounds[4];
|
||||
Point tempSize = new Point();
|
||||
@@ -247,13 +259,15 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
rotateSize(tempSize, rotationChange);
|
||||
Rect bounds = new Rect(0, 0, tempSize.x, tempSize.y);
|
||||
|
||||
int navBarHeight, navbarWidth;
|
||||
int navBarHeight, navbarWidth, statusBarHeight;
|
||||
if (tempSize.y > tempSize.x) {
|
||||
navBarHeight = navBarHeightPortrait;
|
||||
navbarWidth = 0;
|
||||
statusBarHeight = statusBarHeightPortrait;
|
||||
} else {
|
||||
navBarHeight = navBarHeightLandscape;
|
||||
navbarWidth = navbarWidthLandscape;
|
||||
statusBarHeight = statusBarHeightLandscape;
|
||||
}
|
||||
|
||||
Rect insets = new Rect(safeCutout);
|
||||
@@ -276,10 +290,18 @@ public class WindowManagerProxy implements ResourceBasedOverride {
|
||||
/**
|
||||
* Wrapper around the utility method for easier emulation
|
||||
*/
|
||||
protected int getDimenByName(String resName, Resources res) {
|
||||
protected int getDimenByName(Resources res, String resName) {
|
||||
return ResourceUtils.getDimenByName(resName, res, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around the utility method for easier emulation
|
||||
*/
|
||||
protected int getDimenByName(Resources res, String resName, String fallback) {
|
||||
int dimen = ResourceUtils.getDimenByName(resName, res, -1);
|
||||
return dimen > -1 ? dimen : getDimenByName(res, fallback);
|
||||
}
|
||||
|
||||
protected boolean isGestureNav(Context context) {
|
||||
return ResourceUtils.getIntegerByName("config_navBarInteractionMode",
|
||||
context.getResources(), INVALID_RESOURCE_HANDLE) == 2;
|
||||
|
||||
@@ -231,13 +231,17 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
|
||||
if (mSwipeDetector.isIdleState()) {
|
||||
mOpenCloseAnimator
|
||||
.setDuration(defaultDuration)
|
||||
.setInterpolator(Interpolators.ACCEL);
|
||||
.setInterpolator(getIdleInterpolator());
|
||||
} else {
|
||||
mOpenCloseAnimator.setInterpolator(mScrollInterpolator);
|
||||
}
|
||||
mOpenCloseAnimator.start();
|
||||
}
|
||||
|
||||
protected Interpolator getIdleInterpolator() {
|
||||
return Interpolators.ACCEL;
|
||||
}
|
||||
|
||||
protected void onCloseComplete() {
|
||||
mIsOpen = false;
|
||||
getPopupContainer().removeView(this);
|
||||
|
||||
@@ -39,8 +39,8 @@ public class AllAppsState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
return 320;
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return isToState ? 500 : 300;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class OverviewState extends LauncherState {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTransitionDuration(Context context) {
|
||||
public int getTransitionDuration(Context context, boolean isToState) {
|
||||
return 250;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,14 @@ public class TestWindowManagerProxy extends WindowManagerProxy {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDimenByName(String resName, Resources res) {
|
||||
protected int getDimenByName(Resources res, String resName) {
|
||||
Integer mock = mDevice.resourceOverrides.get(resName);
|
||||
return mock != null ? mock : super.getDimenByName(resName, res);
|
||||
return mock != null ? mock : super.getDimenByName(res, resName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDimenByName(Resources res, String resName, String fallback) {
|
||||
return getDimenByName(res, resName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user