diff options
author | Tony Wickham <twickham@google.com> | 2019-07-31 15:36:50 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-07-31 15:36:50 -0700 |
commit | 70f539cd45f940ffda90f5d56a174376e10e2192 (patch) | |
tree | 5f1ff683032431ae868a3a882afa2773b10d528d /quickstep | |
parent | 6b466783b70c4ab8511bdfbaf0a6939fafad3d5e (diff) | |
parent | 1343f03e2ed6de99bbb952017e3c6266679513d8 (diff) | |
download | android_packages_apps_Trebuchet-70f539cd45f940ffda90f5d56a174376e10e2192.tar.gz android_packages_apps_Trebuchet-70f539cd45f940ffda90f5d56a174376e10e2192.tar.bz2 android_packages_apps_Trebuchet-70f539cd45f940ffda90f5d56a174376e10e2192.zip |
Merge changes Ib3e373c2,Ia5d6f545 into ub-launcher3-qt-r1-dev
am: 1343f03e2e
Change-Id: Ie3f4c2c15e331c84f0f048c6337ae4e58111ec56
Diffstat (limited to 'quickstep')
9 files changed, 81 insertions, 43 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java index 311db2193..425fb1399 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java @@ -31,6 +31,9 @@ import android.util.AttributeSet; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; @@ -41,9 +44,6 @@ import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.util.Themes; -import androidx.annotation.ColorInt; -import androidx.core.content.ContextCompat; - /** * A view which shows a horizontal divider */ @@ -288,10 +288,10 @@ public class AppsDividerView extends View implements LauncherStateManager.StateL } @Override - public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator) { + public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { // Don't use setViewAlpha as we want to control the visibility ourselves. - setter.setFloat(this, ALPHA, hasContent ? 1 : 0, fadeInterpolator); + setter.setFloat(this, ALPHA, hasAllAppsContent ? 1 : 0, allAppsFade); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index cb5cbddd4..b406bec82 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -32,6 +32,9 @@ import android.view.View; import android.view.animation.Interpolator; import android.widget.LinearLayout; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; @@ -62,9 +65,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - @TargetApi(Build.VERSION_CODES.P) public class PredictionRowView extends LinearLayout implements LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow { @@ -103,6 +103,8 @@ public class PredictionRowView extends LinearLayout implements private final int mIconTextColor; private final int mIconFullTextAlpha; + private int mIconLastSetTextAlpha; + // Might use mIconFullTextAlpha instead of mIconLastSetTextAlpha if we are translucent. private int mIconCurrentTextAlpha; private FloatingHeaderView mParent; @@ -315,8 +317,14 @@ public class PredictionRowView extends LinearLayout implements } } - public void setTextAlpha(int alpha) { - mIconCurrentTextAlpha = alpha; + public void setTextAlpha(int textAlpha) { + mIconLastSetTextAlpha = textAlpha; + if (getAlpha() < 1 && textAlpha > 0) { + // If the entire header is translucent, make sure the text is at full opacity so it's + // not double-translucent. However, we support keeping the text invisible (alpha == 0). + textAlpha = mIconFullTextAlpha; + } + mIconCurrentTextAlpha = textAlpha; int iconColor = setColorAlphaBound(mIconTextColor, mIconCurrentTextAlpha); for (int i = 0; i < getChildCount(); i++) { ((BubbleTextView) getChildAt(i)).setTextColor(iconColor); @@ -324,6 +332,13 @@ public class PredictionRowView extends LinearLayout implements } @Override + public void setAlpha(float alpha) { + super.setAlpha(alpha); + // Reapply text alpha so that we update it to be full alpha if the row is now translucent. + setTextAlpha(mIconLastSetTextAlpha); + } + + @Override public boolean hasOverlappingRendering() { return false; } @@ -351,23 +366,15 @@ public class PredictionRowView extends LinearLayout implements } @Override - public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator) { - boolean isDrawn = getAlpha() > 0; - int textAlpha = hasHeaderExtra - ? (hasContent ? mIconFullTextAlpha : 0) // Text follows the content visibility - : mIconCurrentTextAlpha; // Leave as before - if (!isDrawn) { - // If the header is not drawn, no need to animate the text alpha - setTextAlpha(textAlpha); - } else { - setter.setInt(this, TEXT_ALPHA, textAlpha, fadeInterpolator); - } - + public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { + // Text follows all apps visibility + int textAlpha = hasHeaderExtra && hasAllAppsContent ? mIconFullTextAlpha : 0; + setter.setInt(this, TEXT_ALPHA, textAlpha, allAppsFade); setter.setFloat(mOverviewScrollFactor, AnimatedFloat.VALUE, - (hasHeaderExtra && !hasContent) ? 1 : 0, LINEAR); + (hasHeaderExtra && !hasAllAppsContent) ? 1 : 0, LINEAR); setter.setFloat(mContentAlphaFactor, AnimatedFloat.VALUE, hasHeaderExtra ? 1 : 0, - fadeInterpolator); + headerFade); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java index c95476283..427206a65 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java @@ -15,7 +15,9 @@ */ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X; +import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; @@ -43,6 +45,7 @@ public class OverviewPeekState extends OverviewState { if (this == OVERVIEW_PEEK && fromState == NORMAL) { builder.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7); + builder.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN); } } } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java index 5543860ee..151ceb834 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -43,7 +43,6 @@ import com.android.launcher3.R; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorSetBuilder; -import com.android.launcher3.uioverrides.UiFactory; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SysUINavigationMode; @@ -128,14 +127,15 @@ public class OverviewState extends LauncherState { if (launcher.getDeviceProfile().isVerticalBarLayout()) { return VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON; } else { + boolean hasAllAppsHeaderExtra = launcher.getAppsView() != null + && launcher.getAppsView().getFloatingHeaderView().hasVisibleContent(); return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON | - (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent() - ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS); + (hasAllAppsHeaderExtra ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS); } } @Override - public float getWorkspaceScrimAlpha(Launcher launcher) { + public float getOverviewScrimAlpha(Launcher launcher) { return 0.5f; } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java index f06b8a910..ab346c059 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java @@ -23,13 +23,17 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.LauncherStateManager.ANIM_ALL; import static com.android.launcher3.LauncherStateManager.ATOMIC_OVERVIEW_PEEK_COMPONENT; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_HEADER_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE; +import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; +import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; @@ -43,6 +47,7 @@ import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.anim.AnimatorSetBuilder; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.util.MotionPauseDetector; @@ -102,6 +107,9 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { mPeekAnim.start(); recentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + + mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(isPaused ? 0 : 1, + peekDuration, 0); }); } } @@ -120,6 +128,13 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { LauncherState toState) { if (fromState == NORMAL && toState == ALL_APPS) { AnimatorSetBuilder builder = new AnimatorSetBuilder(); + // Fade in prediction icons quickly, then rest of all apps after reaching overview. + float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) + - OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(ACCEL, + 0, ALL_APPS_CONTENT_FADE_THRESHOLD)); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(LINEAR, + progressToReachOverview, 1)); // Get workspace out of the way quickly, to prepare for potential pause. builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 1705c9712..1069bed59 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -15,6 +15,11 @@ */ package com.android.quickstep.util; +import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; +import static com.android.launcher3.LauncherState.BACKGROUND_APP; +import static com.android.launcher3.LauncherState.NORMAL; +import static com.android.launcher3.anim.Interpolators.LINEAR; + import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; @@ -35,15 +40,11 @@ import com.android.launcher3.Workspace; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.SpringObjectAnimator; +import com.android.launcher3.graphics.OverviewScrim; import java.util.ArrayList; import java.util.List; -import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; -import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.anim.Interpolators.LINEAR; - /** * Creates an animation where all the workspace items are moved into their final location, * staggered row by row from the bottom up. @@ -122,8 +123,8 @@ public class StaggeredWorkspaceAnim { addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows); } - addWorkspaceScrimAnimationForState(launcher, BACKGROUND_APP, 0); - addWorkspaceScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); + addScrimAnimationForState(launcher, BACKGROUND_APP, 0); + addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); AnimatorListener resetClipListener = new AnimatorListenerAdapter() { int numAnimations = mAnimators.size(); @@ -191,13 +192,17 @@ public class StaggeredWorkspaceAnim { mAnimators.add(alpha); } - private void addWorkspaceScrimAnimationForState(Launcher launcher, LauncherState state, - long duration) { + private void addScrimAnimationForState(Launcher launcher, LauncherState state, long duration) { AnimatorSetBuilder scrimAnimBuilder = new AnimatorSetBuilder(); AnimationConfig scrimAnimConfig = new AnimationConfig(); scrimAnimConfig.duration = duration; PropertySetter scrimPropertySetter = scrimAnimConfig.getPropertySetter(scrimAnimBuilder); launcher.getWorkspace().getStateTransitionAnimation().setScrim(scrimPropertySetter, state); mAnimators.add(scrimAnimBuilder.build()); + Animator fadeOverviewScrim = ObjectAnimator.ofFloat( + launcher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, + state.getOverviewScrimAlpha(launcher)); + fadeOverviewScrim.setDuration(duration); + mAnimators.add(fadeOverviewScrim); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index f0204b9ba..174e49b8d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -19,16 +19,20 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.anim.AnimatorSetBuilder.FLAG_DONT_ANIMATE_OVERVIEW; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS; import android.util.FloatProperty; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.NonNull; + import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherState.ScaleAndTranslation; @@ -36,8 +40,7 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; - -import androidx.annotation.NonNull; +import com.android.launcher3.graphics.OverviewScrim; /** * State handler for recents view. Manages UI changes and animations for recents view based off the @@ -67,6 +70,8 @@ public abstract class BaseRecentsViewStateController<T extends View> mRecentsView.setTranslationX(translationX); mRecentsView.setTranslationY(scaleAndTranslation.translationY); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); + OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); + SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher)); } @Override @@ -110,6 +115,9 @@ public abstract class BaseRecentsViewStateController<T extends View> translateYInterpolator); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, builder.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); + OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); + setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher), + builder.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); } /** diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 109d751c4..a55f36b78 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -62,7 +62,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr /** * The progress at which all apps content will be fully visible when swiping up from overview. */ - private static final float ALL_APPS_CONTENT_FADE_THRESHOLD = 0.08f; + protected static final float ALL_APPS_CONTENT_FADE_THRESHOLD = 0.08f; /** * The progress at which recents will begin fading out when swiping up from overview. diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index 5a2f5c162..3747f9a8b 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -98,7 +98,7 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis public ShelfScrimView(Context context, AttributeSet attrs) { super(context, attrs); - mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255); + mMaxScrimAlpha = Math.round(OVERVIEW.getOverviewScrimAlpha(mLauncher) * 255); mEndAlpha = Color.alpha(mEndScrim); mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context); |