diff options
Diffstat (limited to 'quickstep/recents_ui_overrides')
5 files changed, 64 insertions, 28 deletions
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 151ceb834..93d4de17d 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 @@ -32,6 +32,7 @@ import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE; +import android.content.Context; import android.graphics.Rect; import android.view.View; @@ -159,11 +160,15 @@ public class OverviewState extends LauncherState { } public static float getDefaultSwipeHeight(Launcher launcher) { - return getDefaultSwipeHeight(launcher.getDeviceProfile()); + return getDefaultSwipeHeight(launcher, launcher.getDeviceProfile()); } - public static float getDefaultSwipeHeight(DeviceProfile dp) { - return dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; + public static float getDefaultSwipeHeight(Context context, DeviceProfile dp) { + float swipeHeight = dp.allAppsCellHeightPx - dp.allAppsIconTextSizePx; + if (SysUINavigationMode.getMode(context) == SysUINavigationMode.Mode.NO_BUTTON) { + swipeHeight -= dp.getInsets().bottom; + } + return swipeHeight; } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index 4f971809f..25cc33df0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -172,8 +172,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe AnimatorSetBuilder builder = new AnimatorSetBuilder(); // setRecentsAttachedToAppWindow() will animate recents out. builder.addFlag(AnimatorSetBuilder.FLAG_DONT_ANIMATE_OVERVIEW); - // We want to keep all apps content as GONE to avoid relayout during home animation. - builder.addFlag(AnimatorSetBuilder.FLAG_DONT_UPDATE_ALL_APPS_VISIBILITY); stateManager.createAtomicAnimation(BACKGROUND_APP, NORMAL, builder, ANIM_ALL, 0); builder.build().start(); @@ -202,9 +200,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe // This ensures then the next swipe up to all-apps starts from scroll 0. activity.getAppsView().reset(false /* animate */); - // Optimization, hide the all apps view to prevent layout while initializing - activity.getAppsView().getContentView().setVisibility(View.GONE); - return new AnimationFactory() { private ShelfAnimState mShelfState; private boolean mIsAttachedToWindow; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java index 4eb9df2cb..da4642636 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -24,7 +24,7 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { switch (method) { case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: { final float swipeHeight = - OverviewState.getDefaultSwipeHeight(mDeviceProfile); + OverviewState.getDefaultSwipeHeight(mContext, mDeviceProfile); response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, (int) swipeHeight); return response; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java index 38b5a137c..346969e59 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/AssistantTouchConsumer.java @@ -1,3 +1,4 @@ + /* * Copyright (C) 2019 The Android Open Source Project * @@ -82,7 +83,8 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private int mDirection; private ActivityControlHelper mActivityControlHelper; - private final float mDistThreshold; + private final float mDragDistThreshold; + private final float mFlingDistThreshold; private final long mTimeThreshold; private final int mAngleThreshold; private final float mSquaredSlop; @@ -97,7 +99,8 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { final Resources res = context.getResources(); mContext = context; mSysUiProxy = systemUiProxy; - mDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); + mDragDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold); + mFlingDistThreshold = res.getDimension(R.dimen.gestures_assistant_fling_threshold); mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold); mAngleThreshold = res.getInteger(R.integer.assistant_gesture_corner_deg_threshold); @@ -117,8 +120,6 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { @Override public void onMotionEvent(MotionEvent ev) { // TODO add logging - mGestureDetector.onTouchEvent(ev); - switch (ev.getActionMasked()) { case ACTION_DOWN: { mActivePointerId = ev.getPointerId(0); @@ -213,6 +214,8 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { break; } + mGestureDetector.onTouchEvent(ev); + if (mState != STATE_ACTIVE) { mDelegate.onMotionEvent(ev); } @@ -220,9 +223,9 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { private void updateAssistantProgress() { if (!mLaunchedAssistant) { - mLastProgress = Math.min(mDistance * 1f / mDistThreshold, 1) * mTimeFraction; + mLastProgress = Math.min(mDistance * 1f / mDragDistThreshold, 1) * mTimeFraction; try { - if (mDistance >= mDistThreshold && mTimeFraction >= 1) { + if (mDistance >= mDragDistThreshold && mTimeFraction >= 1) { mSysUiProxy.onAssistantGestureCompletion(0); startAssistantInternal(SWIPE); @@ -271,7 +274,9 @@ public class AssistantTouchConsumer extends DelegateInputConsumer { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (isValidAssistantGestureAngle(velocityX, -velocityY) - && !mLaunchedAssistant && mState != STATE_DELEGATE_ACTIVE) { + && mDistance >= mFlingDistThreshold + && !mLaunchedAssistant + && mState != STATE_DELEGATE_ACTIVE) { mLastProgress = 1; try { mSysUiProxy.onAssistantGestureCompletion( 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 1069bed59..1aa5365fd 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 @@ -29,6 +29,7 @@ import android.view.ViewGroup; import androidx.annotation.Nullable; +import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; @@ -40,7 +41,9 @@ 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.folder.FolderIcon; import com.android.launcher3.graphics.OverviewScrim; +import com.android.launcher3.views.IconLabelDotView; import java.util.ArrayList; import java.util.List; @@ -62,7 +65,9 @@ public class StaggeredWorkspaceAnim { private final float mVelocity; private final float mSpringTransY; - private final View mViewToIgnore; + + // The original view of the {@link FloatingIconView}. + private final View mOriginalView; private final List<Animator> mAnimators = new ArrayList<>(); @@ -72,9 +77,7 @@ public class StaggeredWorkspaceAnim { public StaggeredWorkspaceAnim(Launcher launcher, @Nullable View floatingViewOriginalView, float velocity) { mVelocity = velocity; - // We ignore this view since it's visibility and position is controlled by - // the FloatingIconView. - mViewToIgnore = floatingViewOriginalView; + mOriginalView = floatingViewOriginalView; // Scale the translationY based on the initial velocity to better sync the workspace items // with the floating view. @@ -86,16 +89,21 @@ public class StaggeredWorkspaceAnim { Workspace workspace = launcher.getWorkspace(); CellLayout cellLayout = (CellLayout) workspace.getChildAt(workspace.getCurrentPage()); ShortcutAndWidgetContainer currentPage = cellLayout.getShortcutsAndWidgets(); + ViewGroup hotseat = launcher.getHotseat(); boolean workspaceClipChildren = workspace.getClipChildren(); boolean workspaceClipToPadding = workspace.getClipToPadding(); boolean cellLayoutClipChildren = cellLayout.getClipChildren(); boolean cellLayoutClipToPadding = cellLayout.getClipToPadding(); + boolean hotseatClipChildren = hotseat.getClipChildren(); + boolean hotseatClipToPadding = hotseat.getClipToPadding(); workspace.setClipChildren(false); workspace.setClipToPadding(false); cellLayout.setClipChildren(false); cellLayout.setClipToPadding(false); + hotseat.setClipChildren(false); + hotseat.setClipToPadding(false); // Hotseat and QSB takes up two additional rows. int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2); @@ -108,16 +116,18 @@ public class StaggeredWorkspaceAnim { } // Set up springs for the hotseat and qsb. + ViewGroup hotseatChild = (ViewGroup) hotseat.getChildAt(0); if (grid.isVerticalBarLayout()) { - ViewGroup hotseat = (ViewGroup) launcher.getHotseat().getChildAt(0); - for (int i = hotseat.getChildCount() - 1; i >= 0; i--) { - View child = hotseat.getChildAt(i); + for (int i = hotseatChild.getChildCount() - 1; i >= 0; i--) { + View child = hotseatChild.getChildAt(i); CellLayout.LayoutParams lp = ((CellLayout.LayoutParams) child.getLayoutParams()); addStaggeredAnimationForView(child, lp.cellY + 1, totalRows); } } else { - View hotseat = launcher.getHotseat().getChildAt(0); - addStaggeredAnimationForView(hotseat, grid.inv.numRows + 1, totalRows); + for (int i = hotseatChild.getChildCount() - 1; i >= 0; i--) { + View child = hotseatChild.getChildAt(i); + addStaggeredAnimationForView(child, grid.inv.numRows + 1, totalRows); + } View qsb = launcher.findViewById(R.id.search_container_all_apps); addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows); @@ -140,6 +150,8 @@ public class StaggeredWorkspaceAnim { workspace.setClipToPadding(workspaceClipToPadding); cellLayout.setClipChildren(cellLayoutClipChildren); cellLayout.setClipToPadding(cellLayoutClipToPadding); + hotseat.setClipChildren(hotseatClipChildren); + hotseat.setClipToPadding(hotseatClipToPadding); } }; @@ -180,16 +192,35 @@ public class StaggeredWorkspaceAnim { springTransY.setStartDelay(startDelay); mAnimators.add(springTransY); - if (v == mViewToIgnore) { - return; + ObjectAnimator alpha = getAlphaAnimator(v, startDelay); + if (v == mOriginalView) { + // For IconLabelDotViews, we just want the label to fade in. + // Icon, badge, and dots will animate in separately (controlled via FloatingIconView) + if (v instanceof IconLabelDotView) { + alpha.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationStart(Animator animation) { + IconLabelDotView view = (IconLabelDotView) v; + view.setIconVisible(false); + view.setForceHideDot(true); + } + }); + } else { + return; + } } v.setAlpha(0); + mAnimators.add(alpha); + } + + private ObjectAnimator getAlphaAnimator(View v, long startDelay) { ObjectAnimator alpha = ObjectAnimator.ofFloat(v, View.ALPHA, 0f, 1f); alpha.setInterpolator(LINEAR); alpha.setDuration(ALPHA_DURATION_MS); alpha.setStartDelay(startDelay); - mAnimators.add(alpha); + return alpha; + } private void addScrimAnimationForState(Launcher launcher, LauncherState state, long duration) { |