Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b350c66b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I358a6020,I202ed999 into ub-launcher3-master

* changes:
  Inline INDEX_PAUSE_TO_OVERVIEW_ANIM
  Allow pause during quick switch for any horizontal displacement
parents 8cfecbd4 1c3150fa
Loading
Loading
Loading
Loading
+1 −24
Original line number Original line Diff line number Diff line
@@ -36,13 +36,10 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_TRANSLATE_X;
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_OVERVIEW_TRANSLATE_Y;
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_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_TRANSLATE;
@@ -64,7 +61,6 @@ import com.android.launcher3.LauncherState.ScaleAndTranslation;
import com.android.launcher3.Workspace;
import com.android.launcher3.Workspace;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode;
@@ -81,10 +77,8 @@ public class QuickstepAtomicAnimationFactory extends
    private static final float RECENTS_PREPARE_SCALE = 1.33f;
    private static final float RECENTS_PREPARE_SCALE = 1.33f;


    public static final int INDEX_SHELF_ANIM = RecentsAtomicAnimationFactory.NEXT_INDEX + 0;
    public static final int INDEX_SHELF_ANIM = RecentsAtomicAnimationFactory.NEXT_INDEX + 0;
    public static final int INDEX_PAUSE_TO_OVERVIEW_ANIM =
            RecentsAtomicAnimationFactory.NEXT_INDEX + 1;


    private static final int MY_ANIM_COUNT = 2;
    private static final int MY_ANIM_COUNT = 1;
    protected static final int NEXT_INDEX = RecentsAtomicAnimationFactory.NEXT_INDEX
    protected static final int NEXT_INDEX = RecentsAtomicAnimationFactory.NEXT_INDEX
            + MY_ANIM_COUNT;
            + MY_ANIM_COUNT;


@@ -92,8 +86,6 @@ public class QuickstepAtomicAnimationFactory extends
    // cache the value.
    // cache the value.
    private int mHintToNormalDuration = -1;
    private int mHintToNormalDuration = -1;


    public static final long ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW = 300;

    public QuickstepAtomicAnimationFactory(QuickstepLauncher activity) {
    public QuickstepAtomicAnimationFactory(QuickstepLauncher activity) {
        super(activity, MY_ANIM_COUNT);
        super(activity, MY_ANIM_COUNT);
    }
    }
@@ -132,21 +124,6 @@ public class QuickstepAtomicAnimationFactory extends


                return springAnim;
                return springAnim;
            }
            }
            case INDEX_PAUSE_TO_OVERVIEW_ANIM: {
                StateAnimationConfig config = new StateAnimationConfig();
                config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;

                config.setInterpolator(ANIM_VERTICAL_PROGRESS, OVERSHOOT_1_2);
                config.setInterpolator(ANIM_ALL_APPS_FADE, DEACCEL_3);
                if ((OVERVIEW.getVisibleElements(mActivity) & HOTSEAT_ICONS) != 0) {
                    config.setInterpolator(ANIM_HOTSEAT_SCALE, OVERSHOOT_1_2);
                    config.setInterpolator(ANIM_HOTSEAT_TRANSLATE, OVERSHOOT_1_2);
                }

                StateManager<LauncherState> stateManager = mActivity.getStateManager();
                return stateManager.createAtomicAnimation(
                        stateManager.getCurrentStableState(), OVERVIEW, config);
            }
            default:
            default:
                return super.createStateElementAnimation(index, values);
                return super.createStateElementAnimation(index, values);
        }
        }
+6 −8
Original line number Original line Diff line number Diff line
@@ -35,7 +35,6 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_T
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW;
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT;
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_RIGHT;
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP;
import static com.android.launcher3.touch.BothAxesSwipeDetector.DIRECTION_UP;
import static com.android.launcher3.uioverrides.states.QuickstepAtomicAnimationFactory.INDEX_PAUSE_TO_OVERVIEW_ANIM;
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.DisplayController.getSingleFrameMs;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
import static com.android.launcher3.util.VibratorWrapper.OVERVIEW_HAPTIC;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
@@ -87,6 +86,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
    private static final Interpolator FADE_OUT_INTERPOLATOR = DEACCEL_5;
    private static final Interpolator FADE_OUT_INTERPOLATOR = DEACCEL_5;
    private static final Interpolator TRANSLATE_OUT_INTERPOLATOR = ACCEL_0_75;
    private static final Interpolator TRANSLATE_OUT_INTERPOLATOR = ACCEL_0_75;
    private static final Interpolator SCALE_DOWN_INTERPOLATOR = LINEAR;
    private static final Interpolator SCALE_DOWN_INTERPOLATOR = LINEAR;
    private static final long ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW = 300;


    private final BaseQuickstepLauncher mLauncher;
    private final BaseQuickstepLauncher mLauncher;
    private final BothAxesSwipeDetector mSwipeDetector;
    private final BothAxesSwipeDetector mSwipeDetector;
@@ -270,11 +270,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        mIsHomeScreenVisible = FADE_OUT_INTERPOLATOR.getInterpolation(xProgress)
        mIsHomeScreenVisible = FADE_OUT_INTERPOLATOR.getInterpolation(xProgress)
                <= 1 - ALPHA_CUTOFF_THRESHOLD;
                <= 1 - ALPHA_CUTOFF_THRESHOLD;



        mMotionPauseDetector.setDisallowPause(-displacement.y < mMotionPauseMinDisplacement);
        // Only allow motion pause if the home screen is invisible, since some
        // home screen elements will appear in the shelf on motion pause.
        mMotionPauseDetector.setDisallowPause(mIsHomeScreenVisible
                || -displacement.y < mMotionPauseMinDisplacement);
        mMotionPauseDetector.addPosition(ev);
        mMotionPauseDetector.addPosition(ev);


        if (mXOverviewAnim != null) {
        if (mXOverviewAnim != null) {
@@ -295,8 +291,10 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        if (mMotionPauseDetector.isPaused() && noFling) {
        if (mMotionPauseDetector.isPaused() && noFling) {
            cancelAnimations();
            cancelAnimations();


            Animator overviewAnim = mLauncher.createAtomicAnimationFactory()
            StateAnimationConfig config = new StateAnimationConfig();
                    .createStateElementAnimation(INDEX_PAUSE_TO_OVERVIEW_ANIM);
            config.duration = ATOMIC_DURATION_FROM_PAUSED_TO_OVERVIEW;
            Animator overviewAnim = mLauncher.getStateManager().createAtomicAnimation(
                    mStartState, OVERVIEW, config);
            overviewAnim.addListener(new AnimatorListenerAdapter() {
            overviewAnim.addListener(new AnimatorListenerAdapter() {
                @Override
                @Override
                public void onAnimationEnd(Animator animation) {
                public void onAnimationEnd(Animator animation) {