Merge "Add task layer drawable class for Recents Go." into ub-launcher3-master
diff --git a/SecondaryDisplayLauncher/res/values/styles.xml b/SecondaryDisplayLauncher/res/values/styles.xml
index 4bfda6a..4e41a98 100644
--- a/SecondaryDisplayLauncher/res/values/styles.xml
+++ b/SecondaryDisplayLauncher/res/values/styles.xml
@@ -18,7 +18,7 @@
-->
<resources>
- <style name="SecondaryLauncherTheme" parent="Theme.AppCompat.Light.NoActionBar" >
+ <style name="SecondaryLauncherTheme" parent="Theme.MaterialComponents.NoActionBar" >
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
diff --git a/go/quickstep/src/com/android/quickstep/TaskListLoader.java b/go/quickstep/src/com/android/quickstep/TaskListLoader.java
index 1234989..51b73f1 100644
--- a/go/quickstep/src/com/android/quickstep/TaskListLoader.java
+++ b/go/quickstep/src/com/android/quickstep/TaskListLoader.java
@@ -68,16 +68,26 @@
}
/**
+ * Whether or not the loader needs to load data to be up to date. This can return true if the
+ * task list is already up to date OR there is already a load in progress for the task list to
+ * become up to date.
+ *
+ * @return true if already up to date or load in progress, false otherwise
+ */
+ public boolean needsToLoad() {
+ return !mRecentsModel.isTaskListValid(mTaskListChangeId);
+ }
+
+ /**
* Fetches the most recent tasks and updates the task list asynchronously. This call does not
* provide guarantees the task content (icon, thumbnail, label) are loaded but will fill in
* what it has. May run the callback immediately if there have been no changes in the task
- * list.
+ * list since the start of the last load.
*
* @param onLoadedCallback callback to run when task list is loaded
*/
public void loadTaskList(@Nullable Consumer<ArrayList<Task>> onLoadedCallback) {
- if (mRecentsModel.isTaskListValid(mTaskListChangeId)) {
- // Current task list is already up to date. No need to update.
+ if (!needsToLoad()) {
if (onLoadedCallback != null) {
onLoadedCallback.accept(mTaskList);
}
diff --git a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
index c579c8a..734425e 100644
--- a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -49,7 +49,6 @@
ISystemUiProxy iSystemUiProxy = ISystemUiProxy.Stub
.asInterface(bundle.getBinder(KEY_EXTRA_SYSUI_PROXY));
mRecentsModel.setSystemUiProxy(iSystemUiProxy);
- mRecentsModel.onInitializeSystemUI(bundle);
}
@Override
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index c742be3..c06b6ec 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -166,9 +166,13 @@
*/
public void onBeginTransitionToOverview() {
mTaskRecyclerView.scheduleLayoutAnimation();
+
+ // Load any task changes
+ if (!mTaskLoader.needsToLoad()) {
+ return;
+ }
mTaskAdapter.setIsShowingLoadingUi(true);
mTaskAdapter.notifyDataSetChanged();
- // Load any task changes
mTaskLoader.loadTaskList(tasks -> {
mTaskAdapter.setIsShowingLoadingUi(false);
// TODO: Animate the loading UI out and the loaded data in.
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index 673beff..21ddfc0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -15,74 +15,131 @@
*/
package com.android.launcher3.uioverrides.touchcontrollers;
+import static android.view.View.TRANSLATION_X;
+
+import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
+import static com.android.launcher3.AbstractFloatingView.TYPE_HIDE_BACK_BUTTON;
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.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
+import static com.android.launcher3.touch.AbstractStateChangeTouchController.SUCCESS_TRANSITION_PROGRESS;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
+import android.animation.ValueAnimator;
import android.view.MotionEvent;
-import android.view.View;
import android.view.animation.Interpolator;
+import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
+import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsTransitionController;
+import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Command;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
+import com.android.launcher3.util.TouchController;
import com.android.quickstep.views.RecentsView;
/**
- * Handles swiping up on the nav bar to go home from overview or all apps.
+ * Handles swiping up on the nav bar to go home from launcher, e.g. overview or all apps.
*/
-public class NavBarToHomeTouchController extends AbstractStateChangeTouchController {
+public class NavBarToHomeTouchController implements TouchController, SwipeDetector.Listener {
private static final Interpolator PULLBACK_INTERPOLATOR = DEACCEL_3;
+ private final Launcher mLauncher;
+ private final SwipeDetector mSwipeDetector;
+ private final float mPullbackDistance;
+
+ private boolean mNoIntercept;
+ private LauncherState mStartState;
+ private LauncherState mEndState = NORMAL;
+ private AnimatorPlaybackController mCurrentAnimation;
+
public NavBarToHomeTouchController(Launcher launcher) {
- super(launcher, SwipeDetector.VERTICAL);
+ mLauncher = launcher;
+ mSwipeDetector = new SwipeDetector(mLauncher, this, SwipeDetector.VERTICAL);
+ mPullbackDistance = mLauncher.getResources().getDimension(R.dimen.home_pullback_distance);
}
@Override
- protected boolean canInterceptTouch(MotionEvent ev) {
- boolean cameFromNavBar = (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) != 0;
- return cameFromNavBar && (mLauncher.isInState(OVERVIEW) || mLauncher.isInState(ALL_APPS));
- }
-
- @Override
- protected LauncherState getTargetState(LauncherState fromState, boolean isDragTowardPositive) {
- return isDragTowardPositive ? NORMAL : fromState;
- }
-
- @Override
- protected float initCurrentAnimation(int animComponents) {
- long accuracy = (long) (getShiftRange() * 2);
- final AnimatorSet anim;
- if (mFromState == OVERVIEW) {
- anim = new AnimatorSet();
- RecentsView recentsView = mLauncher.getOverviewPanel();
- float pullbackDistance = recentsView.getPaddingStart() / 2;
- if (!recentsView.isRtl()) {
- pullbackDistance = -pullbackDistance;
+ public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+ mStartState = mLauncher.getStateManager().getState();
+ mNoIntercept = !canInterceptTouch(ev);
+ if (mNoIntercept) {
+ return false;
}
- anim.play(ObjectAnimator.ofFloat(recentsView, View.TRANSLATION_X, pullbackDistance));
- anim.setInterpolator(PULLBACK_INTERPOLATOR);
- } else { // if (mFromState == ALL_APPS)
+ mSwipeDetector.setDetectableScrollConditions(SwipeDetector.DIRECTION_POSITIVE, false);
+ }
+
+ if (mNoIntercept) {
+ return false;
+ }
+
+ onControllerTouchEvent(ev);
+ return mSwipeDetector.isDraggingOrSettling();
+ }
+
+ private boolean canInterceptTouch(MotionEvent ev) {
+ boolean cameFromNavBar = (ev.getEdgeFlags() & Utilities.EDGE_NAV_BAR) != 0;
+ if (!cameFromNavBar) {
+ return false;
+ }
+ if (mStartState == OVERVIEW || mStartState == ALL_APPS) {
+ return true;
+ }
+ if (!mLauncher.hasWindowFocus()) {
+ return true;
+ }
+ if (AbstractFloatingView.getTopOpenView(mLauncher) != null) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public final boolean onControllerTouchEvent(MotionEvent ev) {
+ return mSwipeDetector.onTouchEvent(ev);
+ }
+
+ private float getShiftRange() {
+ return mLauncher.getDeviceProfile().heightPx;
+ }
+
+ @Override
+ public void onDragStart(boolean start) {
+ initCurrentAnimation();
+ }
+
+ private void initCurrentAnimation() {
+ long accuracy = (long) (getShiftRange() * 2);
+ final AnimatorSet anim = new AnimatorSet();
+ if (mStartState == OVERVIEW) {
+ RecentsView recentsView = mLauncher.getOverviewPanel();
+ float pullbackDist = mPullbackDistance;
+ if (!recentsView.isRtl()) {
+ pullbackDist = -pullbackDist;
+ }
+ Animator pullback = ObjectAnimator.ofFloat(recentsView, TRANSLATION_X, pullbackDist);
+ pullback.setInterpolator(PULLBACK_INTERPOLATOR);
+ anim.play(pullback);
+ } else if (mStartState == ALL_APPS) {
AnimatorSetBuilder builder = new AnimatorSetBuilder();
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
- final float pullbackDistance = mLauncher.getDeviceProfile().allAppsIconSizePx / 2;
Animator allAppsProgress = ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS,
- -pullbackDistance / allAppsController.getShiftRange());
+ -mPullbackDistance / allAppsController.getShiftRange());
allAppsProgress.setInterpolator(PULLBACK_INTERPOLATOR);
builder.play(allAppsProgress);
// Slightly fade out all apps content to further distinguish from scrolling.
@@ -90,52 +147,79 @@
.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
AnimationConfig config = new AnimationConfig();
config.duration = accuracy;
- allAppsController.setAlphas(mToState.getVisibleElements(mLauncher), config, builder);
- anim = builder.build();
+ allAppsController.setAlphas(mEndState.getVisibleElements(mLauncher), config, builder);
+ anim.play(builder.build());
+ }
+ AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
+ if (topView != null) {
+ Animator hintCloseAnim = topView.createHintCloseAnim(mPullbackDistance);
+ if (hintCloseAnim != null) {
+ hintCloseAnim.setInterpolator(PULLBACK_INTERPOLATOR);
+ anim.play(hintCloseAnim);
+ }
}
anim.setDuration(accuracy);
mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy, this::clearState);
- return -1 / getShiftRange();
+ }
+
+ private void clearState() {
+ mCurrentAnimation = null;
+ mSwipeDetector.finishedScrolling();
+ mSwipeDetector.setDetectableScrollConditions(0, false);
}
@Override
- public void onDragStart(boolean start) {
- super.onDragStart(start);
- mStartContainerType = LauncherLogProto.ContainerType.NAVBAR;
+ public boolean onDrag(float displacement) {
+ // Only allow swipe up.
+ displacement = Math.min(0, displacement);
+ float progress = Utilities.getProgress(displacement, 0, getShiftRange());
+ mCurrentAnimation.setPlayFraction(progress);
+ return true;
}
@Override
public void onDragEnd(float velocity, boolean fling) {
final int logAction = fling ? Touch.FLING : Touch.SWIPE;
- float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(
- mCurrentAnimation.getProgressFraction());
- if (interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS || velocity < 0 && fling) {
- mLauncher.getStateManager().goToState(mToState, true,
- () -> onSwipeInteractionCompleted(mToState, logAction));
+ float progress = mCurrentAnimation.getProgressFraction();
+ float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(progress);
+ boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS
+ || (velocity < 0 && fling);
+ if (success) {
+ mLauncher.getStateManager().goToState(mEndState, true,
+ () -> onSwipeInteractionCompleted(mEndState));
+ if (mStartState != mEndState) {
+ logStateChange(mStartState.containerType, logAction);
+ }
+ AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(mLauncher);
+ if (topOpenView != null) {
+ AbstractFloatingView.closeAllOpenViews(mLauncher);
+ logStateChange(topOpenView.getLogContainerType(), logAction);
+ }
} else {
// Quickly return to the state we came from (we didn't move far).
- AnimatorPlaybackController anim = mLauncher.getStateManager()
- .createAnimationToNewWorkspace(mFromState, 80);
- anim.setEndAction(() -> onSwipeInteractionCompleted(mFromState, logAction));
- anim.start();
+ ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
+ anim.setFloatValues(progress, 0);
+ anim.addListener(new AnimationSuccessListener() {
+ @Override
+ public void onAnimationSuccess(Animator animator) {
+ onSwipeInteractionCompleted(mStartState);
+ }
+ });
+ anim.setDuration(80).start();
}
- mCurrentAnimation.dispatchOnCancel();
}
- @Override
- protected int getDirectionForLog() {
- return LauncherLogProto.Action.Direction.UP;
+ private void onSwipeInteractionCompleted(LauncherState targetState) {
+ clearState();
+ mLauncher.getStateManager().goToState(targetState, false /* animated */);
}
- @Override
- protected boolean goingBetweenNormalAndOverview(LauncherState fromState,
- LauncherState toState) {
- // We don't want to create an atomic animation to/from overview.
- return false;
- }
-
- @Override
- protected int getLogContainerTypeForNormalState() {
- return LauncherLogProto.ContainerType.NAVBAR;
+ private void logStateChange(int startContainerType, int logAction) {
+ mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
+ LauncherLogProto.Action.Direction.UP,
+ LauncherLogProto.ContainerType.NAVBAR,
+ startContainerType,
+ mEndState.containerType,
+ mLauncher.getWorkspace().getCurrentPage());
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java
index 7794d8d..b803071 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewInputConsumer.java
@@ -136,17 +136,13 @@
}
private void sendEvent(MotionEvent ev) {
- if (mInvalidated || !mTarget.verifyTouchDispatch(this, ev)) {
- mInvalidated = true;
+ if (mInvalidated) {
return;
}
int flags = ev.getEdgeFlags();
ev.setEdgeFlags(flags | Utilities.EDGE_NAV_BAR);
ev.offsetLocation(-mLocationOnScreen[0], -mLocationOnScreen[1]);
- if (ev.getAction() == ACTION_DOWN) {
- mTarget.onInterceptTouchEvent(ev);
- }
- mTarget.onTouchEvent(ev);
+ mInvalidated = !mTarget.dispatchTouchEvent(this, ev);
ev.offsetLocation(mLocationOnScreen[0], mLocationOnScreen[1]);
ev.setEdgeFlags(flags);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index 87ae091..79f0c36 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -101,7 +101,6 @@
MAIN_THREAD_EXECUTOR.execute(TouchInteractionService.this::initInputMonitor);
runWhenUserUnlocked(() -> {
mRecentsModel.setSystemUiProxy(mISystemUiProxy);
- mRecentsModel.onInitializeSystemUI(bundle);
mOverviewInteractionState.setSystemUiProxy(mISystemUiProxy);
});
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index d2cd83f..cbac944 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -16,6 +16,8 @@
package com.android.quickstep.util;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
+import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
+import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -33,6 +35,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.views.RecentsView;
@@ -97,12 +100,9 @@
(t, a1) -> a1;
public ClipAnimationHelper(Context context) {
- mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
- mSupportsRoundedCornersOnWindows = RecentsModel.INSTANCE.get(context)
- .supportsRoundedCornersOnWindows();
- int taskCornerRadiusRes = mSupportsRoundedCornersOnWindows ?
- R.dimen.task_corner_radius : R.dimen.task_corner_radius_small;
- mTaskCornerRadius = context.getResources().getDimension(taskCornerRadiusRes);
+ mWindowCornerRadius = getWindowCornerRadius(context.getResources());
+ mSupportsRoundedCornersOnWindows = supportsRoundedCornersOnWindows(context.getResources());
+ mTaskCornerRadius = Themes.getDialogCornerRadius(context);
}
private void updateSourceStack(RemoteAnimationTargetCompat target) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
index d15a392..c47e943 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskMenuView.java
@@ -40,6 +40,7 @@
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.RoundedRectRevealOutlineProvider;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.TaskSystemShortcut;
import com.android.quickstep.TaskUtils;
@@ -270,7 +271,7 @@
}
private RoundedRectRevealOutlineProvider createOpenCloseOutlineProvider() {
- float radius = getResources().getDimension(R.dimen.task_corner_radius);
+ float radius = Themes.getDialogCornerRadius(getContext());
Rect fromRect = new Rect(0, 0, getWidth(), 0);
Rect toRect = new Rect(0, 0, getWidth(), getHeight());
return new RoundedRectRevealOutlineProvider(radius, radius, fromRect, toRect);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
index a9f6311..7905230 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskThumbnailView.java
@@ -46,11 +46,11 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.Themes;
-import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
+import com.android.systemui.shared.system.QuickStepContract;
/**
* A task in the Recents view.
@@ -108,7 +108,7 @@
public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- mCornerRadius = getResources().getDimension(R.dimen.task_corner_radius);
+ mCornerRadius = Themes.getDialogCornerRadius(context);
mOverlay = TaskOverlayFactory.INSTANCE.get(context).createOverlay(this);
mPaint.setFilterBitmap(true);
mBackgroundPaint.setColor(Color.WHITE);
@@ -116,7 +116,7 @@
mDimmingPaintAfterClearing.setColor(Color.BLACK);
mActivity = BaseActivity.fromContext(context);
mIsDarkTextTheme = Themes.getAttrBoolean(mActivity, R.attr.isWorkspaceDarkText);
- mWindowCornerRadius = RecentsModel.INSTANCE.get(context).getWindowCornerRadius();
+ mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context.getResources());
}
public void bind(Task task) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index bea705f..ec0112d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -52,6 +52,7 @@
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
+import com.android.launcher3.util.Themes;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskIconCache;
@@ -196,7 +197,7 @@
fromContext(context).getStatsLogManager().logTaskLaunch(getRecentsView(),
TaskUtils.getLaunchComponentKeyForTask(getTask().key));
});
- setOutlineProvider(new TaskOutlineProvider(getResources()));
+ setOutlineProvider(new TaskOutlineProvider(context, getResources()));
}
@Override
@@ -514,9 +515,9 @@
private final int mMarginTop;
private final float mRadius;
- TaskOutlineProvider(Resources res) {
+ TaskOutlineProvider(Context context, Resources res) {
mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
- mRadius = res.getDimension(R.dimen.task_corner_radius);
+ mRadius = Themes.getDialogCornerRadius(context);
}
@Override
diff --git a/quickstep/res/drawable/bg_wellbeing_toast.xml b/quickstep/res/drawable/bg_wellbeing_toast.xml
index 22d6f8a..65730f6 100644
--- a/quickstep/res/drawable/bg_wellbeing_toast.xml
+++ b/quickstep/res/drawable/bg_wellbeing_toast.xml
@@ -15,5 +15,5 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#E61A73E8" />
- <corners android:radius="@dimen/task_corner_radius" />
+ <corners android:radius="?android:attr/dialogCornerRadius" />
</shape>
\ No newline at end of file
diff --git a/quickstep/res/drawable/task_menu_bg.xml b/quickstep/res/drawable/task_menu_bg.xml
index d5597a9..7334d98 100644
--- a/quickstep/res/drawable/task_menu_bg.xml
+++ b/quickstep/res/drawable/task_menu_bg.xml
@@ -28,8 +28,8 @@
<!-- Background -->
<shape>
<corners
- android:topLeftRadius="@dimen/task_corner_radius"
- android:topRightRadius="@dimen/task_corner_radius"
+ android:topLeftRadius="?android:attr/dialogCornerRadius"
+ android:topRightRadius="?android:attr/dialogCornerRadius"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp" />
<solid android:color="?attr/popupColorPrimary" />
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index 97f2de7..6ec3bf6 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -19,9 +19,7 @@
<dimen name="task_thumbnail_top_margin">24dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
- <dimen name="task_corner_radius">8dp</dimen>
- <!-- For screens without rounded corners -->
- <dimen name="task_corner_radius_small">2dp</dimen>
+
<dimen name="recents_page_spacing">10dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<dimen name="overview_peek_distance">32dp</dimen>
@@ -61,11 +59,13 @@
docked_stack_divider_thickness - 2 * docked_stack_divider_insets -->
<dimen name="multi_window_task_divider_size">10dp</dimen>
- <dimen name="shelf_surface_radius">16dp</dimen>
<!-- same as vertical_drag_handle_size -->
<dimen name="shelf_surface_offset">24dp</dimen>
<!-- Assistant Gestures -->
<dimen name="gestures_assistant_size">28dp</dimen>
<dimen name="gestures_assistant_drag_threshold">70dp</dimen>
+
+ <!-- Distance to move elements when swiping up to go home from launcher -->
+ <dimen name="home_pullback_distance">28dp</dimen>
</resources>
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index f77bd65..cda9d4f 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -31,6 +31,7 @@
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
+import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -63,12 +64,12 @@
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.views.FloatingIconView;
-import com.android.quickstep.RecentsModel;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.ActivityCompat;
import com.android.systemui.shared.system.ActivityOptionsCompat;
+import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.RemoteAnimationAdapterCompat;
import com.android.systemui.shared.system.RemoteAnimationDefinitionCompat;
import com.android.systemui.shared.system.RemoteAnimationRunnerCompat;
@@ -473,6 +474,10 @@
});
float shapeRevealDuration = APP_LAUNCH_DURATION * SHAPE_PROGRESS_DURATION;
+
+ final float windowRadius = mDeviceProfile.isMultiWindowMode
+ ? 0 : getWindowCornerRadius(mLauncher.getResources());
+
appAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDx = new FloatProp(0, dX, 0, xDuration, AGGRESSIVE_EASE);
FloatProp mDy = new FloatProp(0, dY, 0, yDuration, AGGRESSIVE_EASE);
@@ -514,13 +519,6 @@
float transX0 = temp.left - offsetX;
float transY0 = temp.top - offsetY;
- float windowRadius = 0;
- if (!mDeviceProfile.isMultiWindowMode &&
- RecentsModel.INSTANCE.get(mLauncher).supportsRoundedCornersOnWindows()) {
- windowRadius = RecentsModel.INSTANCE.get(mLauncher)
- .getWindowCornerRadius();
- }
-
SurfaceParams[] params = new SurfaceParams[targets.length];
for (int i = targets.length - 1; i >= 0; i--) {
RemoteAnimationTargetCompat target = targets[i];
@@ -651,7 +649,7 @@
ValueAnimator unlockAnimator = ValueAnimator.ofFloat(0, 1);
unlockAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
float cornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
- RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
+ QuickStepContract.getWindowCornerRadius(mLauncher.getResources());
unlockAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
@@ -677,8 +675,8 @@
Matrix matrix = new Matrix();
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
int duration = CLOSING_TRANSITION_DURATION_MS;
- float windowCornerRadius = mDeviceProfile.isMultiWindowMode ? 0 :
- RecentsModel.INSTANCE.get(mLauncher).getWindowCornerRadius();
+ float windowCornerRadius = mDeviceProfile.isMultiWindowMode
+ ? 0 : getWindowCornerRadius(mLauncher.getResources());
closingAnimator.setDuration(duration);
closingAnimator.addUpdateListener(new MultiValueUpdateListener() {
FloatProp mDy = new FloatProp(0, mClosingWindowTransY, 0, duration, DEACCEL_1_7);
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
index ce50b68..0c29fcf 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
@@ -44,7 +44,6 @@
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SwipeDetector;
import com.android.launcher3.uioverrides.states.OverviewState;
-import com.android.launcher3.uioverrides.touchcontrollers.PortraitOverviewStateTouchHelper;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.RecentsModel;
@@ -114,8 +113,10 @@
return false;
}
} else {
+ // If we are swiping to all apps instead of overview, allow it from anywhere.
+ boolean interceptAnywhere = mLauncher.isInState(NORMAL) && !mAllowDragToOverview;
// For all other states, only listen if the event originated below the hotseat height
- if (!isTouchOverHotseat(mLauncher, ev)) {
+ if (!interceptAnywhere && !isTouchOverHotseat(mLauncher, ev)) {
return false;
}
}
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index a65bc33..675cfe2 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -35,6 +35,7 @@
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
import java.util.ArrayList;
@@ -62,9 +63,6 @@
private final TaskIconCache mIconCache;
private final TaskThumbnailCache mThumbnailCache;
- private float mWindowCornerRadius = 0;
- private boolean mSupportsRoundedCornersOnWindows;
-
private RecentsModel(Context context) {
mContext = context;
HandlerThread loaderThread = new HandlerThread("TaskThumbnailIconCache",
@@ -76,12 +74,6 @@
ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
}
- public void onInitializeSystemUI(Bundle params) {
- mWindowCornerRadius = params.getFloat(KEY_EXTRA_WINDOW_CORNER_RADIUS, 0);
- mSupportsRoundedCornersOnWindows =
- params.getBoolean(KEY_EXTRA_SUPPORTS_WINDOW_CORNERS, false);
- }
-
public TaskIconCache getIconCache() {
return mIconCache;
}
@@ -182,14 +174,6 @@
return mSystemUiProxy;
}
- public float getWindowCornerRadius() {
- return mWindowCornerRadius;
- }
-
- public boolean supportsRoundedCornersOnWindows() {
- return mSupportsRoundedCornersOnWindows;
- }
-
public void onTrimMemory(int level) {
if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
mThumbnailCache.getHighResLoadingState().setVisible(false);
diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
index d74e880..36521e5 100644
--- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
+++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java
@@ -53,6 +53,9 @@
// cover the whole screen
private static final float SCRIM_CATCHUP_THRESHOLD = 0.2f;
+ // Temporarily needed until android.R.attr.bottomDialogCornerRadius becomes public
+ private static final float BOTTOM_CORNER_RADIUS_RATIO = 2f;
+
// In transposed layout, we simply draw a flat color.
private boolean mDrawingFlatColor;
@@ -87,7 +90,7 @@
mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255);
mEndAlpha = Color.alpha(mEndScrim);
- mRadius = mLauncher.getResources().getDimension(R.dimen.shelf_surface_radius);
+ mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mShelfOffset = context.getResources().getDimension(R.dimen.shelf_surface_offset);
diff --git a/res/drawable-v28/round_rect_primary.xml b/res/drawable-v28/round_rect_primary.xml
new file mode 100644
index 0000000..53679ed
--- /dev/null
+++ b/res/drawable-v28/round_rect_primary.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?android:attr/colorPrimary" />
+ <corners android:radius="?android:attr/dialogCornerRadius" />
+</shape>
diff --git a/res/drawable-v28/top_round_rect_primary.xml b/res/drawable-v28/top_round_rect_primary.xml
new file mode 100644
index 0000000..5c40df7
--- /dev/null
+++ b/res/drawable-v28/top_round_rect_primary.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?android:attr/colorPrimary" />
+ <corners
+ android:topLeftRadius="?android:attr/dialogCornerRadius"
+ android:topRightRadius="?android:attr/dialogCornerRadius"
+ android:bottomLeftRadius="0dp"
+ android:bottomRightRadius="0dp"
+ />
+</shape>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index a471e50..008910d 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -33,7 +33,7 @@
<string name="long_accessible_way_to_add" msgid="4289502106628154155">"Tryk to gange, og hold fingeren nede for at vælge en widget eller bruge tilpassede handlinger."</string>
<string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
<string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d i bredden og %2$d i højden"</string>
- <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Tryk og hold fingeren nede for at placere manuelt"</string>
+ <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Tryk og hold nede for at placere manuelt"</string>
<string name="place_automatically" msgid="8064208734425456485">"Tilføj automatisk"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"Søg efter apps"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"Indlæser apps…"</string>
diff --git a/res/values-ml/strings.xml b/res/values-ml/strings.xml
index d4bfbc1..e03340b 100644
--- a/res/values-ml/strings.xml
+++ b/res/values-ml/strings.xml
@@ -33,7 +33,7 @@
<string name="long_accessible_way_to_add" msgid="4289502106628154155">"വിജറ്റ് തിരഞ്ഞെടുക്കാനോ ഇഷ്ടാനുസൃത പ്രവർത്തനങ്ങൾ ഉപയോഗിക്കാനോ രണ്ടുതവണ ടാപ്പുചെയ്ത് പിടിക്കുക."</string>
<string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
<string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d വീതിയും %2$d ഉയരവും"</string>
- <string name="add_item_request_drag_hint" msgid="5899764264480397019">"സ്വമേധയാ സ്ഥാപിക്കുന്നതിന് സ്പർശിച്ചുപിടിക്കുക"</string>
+ <string name="add_item_request_drag_hint" msgid="5899764264480397019">"നേരിട്ട് സ്ഥാപിക്കുന്നതിന് സ്പർശിച്ചുപിടിക്കുക"</string>
<string name="place_automatically" msgid="8064208734425456485">"സ്വയമേവ ചേർക്കുക"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"ആപ്പുകൾ തിരയുക"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"ആപ്പുകൾ ലോഡുചെയ്യുന്നു..."</string>
diff --git a/res/values-mr/strings.xml b/res/values-mr/strings.xml
index 60dc9a6..f6eac53 100644
--- a/res/values-mr/strings.xml
+++ b/res/values-mr/strings.xml
@@ -34,7 +34,7 @@
<string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
<string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d रूंद बाय %2$d उंच"</string>
<string name="add_item_request_drag_hint" msgid="5899764264480397019">"स्वतः ठेवण्यासाठी स्पर्श करा आणि धरून ठेवा"</string>
- <string name="place_automatically" msgid="8064208734425456485">"अापोआप जोडा"</string>
+ <string name="place_automatically" msgid="8064208734425456485">"आपोआप जोडा"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"अॅप्स शोधा"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"अॅप्स लोड करत आहे…"</string>
<string name="all_apps_no_search_results" msgid="3200346862396363786">"\"<xliff:g id="QUERY">%1$s</xliff:g>\" शी जुळणारे कोणतेही अॅप्स आढळले नाहीत"</string>
diff --git a/res/values-pa/strings.xml b/res/values-pa/strings.xml
index 0bd1911..d4cd5be 100644
--- a/res/values-pa/strings.xml
+++ b/res/values-pa/strings.xml
@@ -104,7 +104,7 @@
<string name="widgets_bottom_sheet_title" msgid="2904559530954183366">"<xliff:g id="NAME">%1$s</xliff:g> ਵਿਜੇਟ"</string>
<string name="widgets_list" msgid="796804551140113767">"ਵਿਜੇਟਾਂ ਦੀ ਸੂਚੀ"</string>
<string name="widgets_list_closed" msgid="6141506579418771922">"ਵਿਜੇਟਾਂ ਦੀ ਸੂਚੀ ਬੰਦ ਕੀਤੀ ਗਈ"</string>
- <string name="action_add_to_workspace" msgid="8902165848117513641">"ਹੋਮ ਸਕ੍ਰੀਨ ਵਿੱਚ ਸ਼ਾਮਲ ਕਰੋ"</string>
+ <string name="action_add_to_workspace" msgid="8902165848117513641">"ਹੋਮ ਸਕ੍ਰੀਨ \'ਤੇ ਸ਼ਾਮਲ ਕਰੋ"</string>
<string name="action_move_here" msgid="2170188780612570250">"ਆਈਟਮ ਨੂੰ ਇੱਥੇ ਮੂਵ ਕਰੋ"</string>
<string name="item_added_to_workspace" msgid="4211073925752213539">"ਆਈਟਮ ਨੂੰ ਹੋਮ ਸਕ੍ਰੀਨ ਵਿੱਚ ਜੋੜਿਆ ਗਿਆ"</string>
<string name="item_removed" msgid="851119963877842327">"ਅਈਟਮ ਹਟਾਈ ਗਈ"</string>
diff --git a/res/values-te/strings.xml b/res/values-te/strings.xml
index 1b74be1..528ce48 100644
--- a/res/values-te/strings.xml
+++ b/res/values-te/strings.xml
@@ -33,8 +33,8 @@
<string name="long_accessible_way_to_add" msgid="4289502106628154155">"విడ్జెట్ను ఎంచుకోవడానికి లేదా అనుకూల చర్యలను ఉపయోగించడానికి రెండుసార్లు నొక్కి, ఉంచండి."</string>
<string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
<string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d వెడల్పు X %2$d ఎత్తు"</string>
- <string name="add_item_request_drag_hint" msgid="5899764264480397019">"మాన్యువల్గా ఉంచడానికి నొక్కి &amp పట్టుకోండి"</string>
- <string name="place_automatically" msgid="8064208734425456485">"స్వయంచాలకంగా జోడించు"</string>
+ <string name="add_item_request_drag_hint" msgid="5899764264480397019">"మాన్యువల్గా ఉంచడానికి నొక్కి, పట్టుకోండి"</string>
+ <string name="place_automatically" msgid="8064208734425456485">"ఆటోమేటిక్గా జోడించు"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"అప్లికేషన్లను శోధించండి"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"అప్లికేషన్లను లోడ్ చేస్తోంది…"</string>
<string name="all_apps_no_search_results" msgid="3200346862396363786">"\"<xliff:g id="QUERY">%1$s</xliff:g>\"కి సరిపోలే అప్లికేషన్లేవీ కనుగొనబడలేదు"</string>
diff --git a/res/values-th/strings.xml b/res/values-th/strings.xml
index fee76e6..03c02ad 100644
--- a/res/values-th/strings.xml
+++ b/res/values-th/strings.xml
@@ -104,7 +104,7 @@
<string name="widgets_bottom_sheet_title" msgid="2904559530954183366">"วิดเจ็ตของ <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="widgets_list" msgid="796804551140113767">"รายการวิดเจ็ต"</string>
<string name="widgets_list_closed" msgid="6141506579418771922">"ปิดรายการวิดเจ็ตแล้ว"</string>
- <string name="action_add_to_workspace" msgid="8902165848117513641">"เพิ่มลงในหน้าแรก"</string>
+ <string name="action_add_to_workspace" msgid="8902165848117513641">"เพิ่มลงในหน้าจอหลัก"</string>
<string name="action_move_here" msgid="2170188780612570250">"ย้ายรายการมาที่นี่"</string>
<string name="item_added_to_workspace" msgid="4211073925752213539">"เพิ่มรายการไปยังหน้าจอหลักแล้ว"</string>
<string name="item_removed" msgid="851119963877842327">"นำออกรายการออกแล้ว"</string>
diff --git a/res/values-tl/strings.xml b/res/values-tl/strings.xml
index 359934e..f0c241e 100644
--- a/res/values-tl/strings.xml
+++ b/res/values-tl/strings.xml
@@ -33,7 +33,7 @@
<string name="long_accessible_way_to_add" msgid="4289502106628154155">"I-double tap nang matagal upang pumili ng widget o gumamit ng mga custom na pagkilos."</string>
<string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
<string name="widget_accessible_dims_format" msgid="3640149169885301790">"%1$d ang lapad at %2$d ang taas"</string>
- <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Pindutin nang matagal upang manual na ilagay"</string>
+ <string name="add_item_request_drag_hint" msgid="5899764264480397019">"Pindutin nang matagal para manual na ilagay"</string>
<string name="place_automatically" msgid="8064208734425456485">"Awtomatikong idagdag"</string>
<string name="all_apps_search_bar_hint" msgid="1390553134053255246">"Maghanap ng mga app"</string>
<string name="all_apps_loading_message" msgid="5813968043155271636">"Naglo-load ng mga app…"</string>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 7822e05..469b176 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -37,8 +37,6 @@
<dimen name="dynamic_grid_hotseat_side_padding">0dp</dimen>
<!-- Hotseat/all-apps scrim -->
- <dimen name="all_apps_scrim_radius">8dp</dimen>
- <dimen name="all_apps_scrim_margin">8dp</dimen>
<dimen name="all_apps_scrim_blur">4dp</dimen>
<dimen name="vertical_drag_handle_size">24dp</dimen>
<dimen name="vertical_drag_handle_overlap_workspace">0dp</dimen>
@@ -237,4 +235,8 @@
<!-- Hints -->
<dimen name="chip_hint_height">26dp</dimen>
<dimen name="chip_hint_bottom_margin">194dp</dimen>
+
+<!-- Theming related -->
+ <dimen name="default_dialog_corner_radius">8dp</dimen>
+
</resources>
diff --git a/robolectric_tests/src/com/android/launcher3/config/FlagOverrideSampleTest.java b/robolectric_tests/src/com/android/launcher3/config/FlagOverrideSampleTest.java
index 656d55c..ae81ff2 100644
--- a/robolectric_tests/src/com/android/launcher3/config/FlagOverrideSampleTest.java
+++ b/robolectric_tests/src/com/android/launcher3/config/FlagOverrideSampleTest.java
@@ -26,7 +26,6 @@
@Test
public void withFlagOn() {
assertTrue(FeatureFlags.EXAMPLE_FLAG.get());
- assertFalse(FeatureFlags.STYLE_WALLPAPER.get());
}
diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java
index 599a353..e7d7a69 100644
--- a/src/com/android/launcher3/AbstractFloatingView.java
+++ b/src/com/android/launcher3/AbstractFloatingView.java
@@ -19,9 +19,11 @@
import static android.view.accessibility.AccessibilityEvent.TYPE_VIEW_FOCUSED;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
+
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
+import android.animation.Animator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
@@ -30,7 +32,11 @@
import android.view.View;
import android.widget.LinearLayout;
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
@@ -38,8 +44,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import androidx.annotation.IntDef;
-
/**
* Base class for a View which shows a floating UI on top of the launcher UI.
*/
@@ -124,8 +128,20 @@
protected abstract void handleClose(boolean animate);
+ /**
+ * Creates a user-controlled animation to hint that the view will be closed if completed.
+ * @param distanceToMove The max distance that elements should move from their starting point.
+ */
+ public @Nullable Animator createHintCloseAnim(float distanceToMove) {
+ return null;
+ }
+
public abstract void logActionCommand(int command);
+ public int getLogContainerType() {
+ return ContainerType.DEFAULT_CONTAINERTYPE;
+ }
+
public final boolean isOpen() {
return mIsOpen;
}
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index cbd3fc0..4da7907 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -20,6 +20,7 @@
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.Gravity;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.ViewGroup;
@@ -98,4 +99,10 @@
setLayoutParams(lp);
InsettableFrameLayout.dispatchInsets(this, insets);
}
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ // Don't let if follow through to workspace
+ return true;
+ }
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index f8d9959..c14512a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -974,7 +974,6 @@
mDropTargetBar.setup(mDragController);
mAllAppsController.setupViews(mAppsView);
- mHotseat.setOnInterceptTouchListener(mWorkspace::onInterceptHotseatTouch);
}
/**
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d24a5a6..2ee537c 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -475,13 +475,6 @@
super.onViewAdded(child);
}
- protected boolean onInterceptHotseatTouch(View v, MotionEvent ev) {
- // We don't want any clicks to go through to the hotseat unless the workspace is in
- // the normal state or an accessible drag is in progress.
- return !workspaceIconsCanBeDragged()
- && !mLauncher.getAccessibilityDelegate().isInAccessibleDrag();
- }
-
/**
* Initializes and binds the first page
* @param qsb an existing qsb to recycle or null.
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index 5150b7c..a55ea82 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -90,10 +90,6 @@
// trying to make them fit the orientation the device is in.
public static final boolean OVERVIEW_USE_SCREENSHOT_ORIENTATION = true;
- public static final ToggleableGlobalSettingsFlag STYLE_WALLPAPER
- = new ToggleableGlobalSettingsFlag("STYLE_WALLPAPER", false,
- "Direct users to the new ThemePicker based WallpaperPicker");
-
/**
* Feature flag to handle define config changes dynamically instead of killing the process.
*/
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index bcddd03..2ce6634 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -1406,7 +1406,12 @@
@Override
public void logActionCommand(int command) {
mLauncher.getUserEventDispatcher().logActionCommand(
- command, getFolderIcon(), ContainerType.FOLDER);
+ command, getFolderIcon(), getLogContainerType());
+ }
+
+ @Override
+ public int getLogContainerType() {
+ return ContainerType.FOLDER;
}
@Override
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index 0d499c1..28000b9 100644
--- a/src/com/android/launcher3/popup/ArrowPopup.java
+++ b/src/com/android/launcher3/popup/ArrowPopup.java
@@ -82,7 +82,7 @@
public ArrowPopup(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mInflater = LayoutInflater.from(context);
- mOutlineRadius = getResources().getDimension(R.dimen.bg_round_rect_radius);
+ mOutlineRadius = Themes.getDialogCornerRadius(context);
mLauncher = Launcher.getLauncher(context);
mIsRtl = Utilities.isRtl(getResources());
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index 080a0cb..593dbd4 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -157,7 +157,12 @@
@Override
public void logActionCommand(int command) {
mLauncher.getUserEventDispatcher().logActionCommand(
- command, mOriginalIcon, ContainerType.DEEPSHORTCUTS);
+ command, mOriginalIcon, getLogContainerType());
+ }
+
+ @Override
+ public int getLogContainerType() {
+ return ContainerType.DEEPSHORTCUTS;
}
public OnClickListener getItemClickListener() {
diff --git a/src/com/android/launcher3/util/Themes.java b/src/com/android/launcher3/util/Themes.java
index 675e2f4..59fd859 100644
--- a/src/com/android/launcher3/util/Themes.java
+++ b/src/com/android/launcher3/util/Themes.java
@@ -25,11 +25,25 @@
import android.util.SparseArray;
import android.util.TypedValue;
+import com.android.launcher3.R;
+
/**
* Various utility methods associated with theming.
*/
public class Themes {
+ public static float getDialogCornerRadius(Context context) {
+ return getDimension(context, android.R.attr.dialogCornerRadius,
+ context.getResources().getDimension(R.dimen.default_dialog_corner_radius));
+ }
+
+ public static float getDimension(Context context, int attr, float defaultValue) {
+ TypedArray ta = context.obtainStyledAttributes(new int[]{attr});
+ float value = ta.getDimension(0, defaultValue);
+ ta.recycle();
+ return value;
+ }
+
public static int getColorAccent(Context context) {
return getAttrColor(context, android.R.attr.colorAccent);
}
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index bd6bfd6..ab72bbe 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -223,14 +223,18 @@
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
- return verifyTouchDispatch(this, ev) && super.dispatchTouchEvent(ev);
+ return dispatchTouchEvent(this, ev);
+ }
+
+ public boolean dispatchTouchEvent(Object caller, MotionEvent ev) {
+ return verifyTouchDispatch(caller, ev) && super.dispatchTouchEvent(ev);
}
/**
* Returns true if the {@param caller} is allowed to dispatch {@param ev} on this view,
* false otherwise.
*/
- public boolean verifyTouchDispatch(Object caller, MotionEvent ev) {
+ private boolean verifyTouchDispatch(Object caller, MotionEvent ev) {
int action = ev.getAction();
if (action == ACTION_DOWN) {
if (mCurrentTouchOwner != null) {
diff --git a/src/com/android/launcher3/views/BottomUserEducationView.java b/src/com/android/launcher3/views/BottomUserEducationView.java
index a291fc6..bdc69af 100644
--- a/src/com/android/launcher3/views/BottomUserEducationView.java
+++ b/src/com/android/launcher3/views/BottomUserEducationView.java
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.views;
+import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
+
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
@@ -28,8 +30,7 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
-
-import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
public class BottomUserEducationView extends AbstractSlideInView implements Insettable {
@@ -71,6 +72,11 @@
}
@Override
+ public int getLogContainerType() {
+ return ContainerType.TIP;
+ }
+
+ @Override
protected boolean isOfType(int type) {
return (type & TYPE_ON_BOARD_POPUP) != 0;
}
diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java
index 6a2f0ff..29866cf 100644
--- a/src/com/android/launcher3/views/OptionsPopupView.java
+++ b/src/com/android/launcher3/views/OptionsPopupView.java
@@ -152,7 +152,7 @@
RectF target = new RectF(x - halfSize, y - halfSize, x + halfSize, y + halfSize);
ArrayList<OptionItem> options = new ArrayList<>();
- int res = FeatureFlags.STYLE_WALLPAPER.get() && existsStyleWallpapers(launcher) ?
+ int res = existsStyleWallpapers(launcher) ?
R.string.styles_wallpaper_button_text : R.string.wallpaper_button_text;
options.add(new OptionItem(res, R.drawable.ic_wallpaper,
ControlType.WALLPAPER_BUTTON, OptionsPopupView::startWallpaperPicker));
@@ -210,7 +210,7 @@
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtra(EXTRA_WALLPAPER_OFFSET,
launcher.getWorkspace().getWallpaperOffsetForCenterPage());
- if (!FeatureFlags.STYLE_WALLPAPER.get()) {
+ if (!existsStyleWallpapers(launcher)) {
intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only");
}
String pickerPackage = launcher.getString(R.string.wallpaper_picker_package);
diff --git a/src/com/android/launcher3/widget/BaseWidgetSheet.java b/src/com/android/launcher3/widget/BaseWidgetSheet.java
index df82661..72cddc7 100644
--- a/src/com/android/launcher3/widget/BaseWidgetSheet.java
+++ b/src/com/android/launcher3/widget/BaseWidgetSheet.java
@@ -162,11 +162,16 @@
@Override
public final void logActionCommand(int command) {
- Target target = newContainerTarget(ContainerType.WIDGETS);
+ Target target = newContainerTarget(getLogContainerType());
target.cardinality = getElementsRowCount();
mLauncher.getUserEventDispatcher().logActionCommand(command, target);
}
+ @Override
+ public int getLogContainerType() {
+ return ContainerType.WIDGETS;
+ }
+
protected abstract int getElementsRowCount();
protected SystemUiController getSystemUiController() {
diff --git a/src/com/android/launcher3/widget/WidgetsBottomSheet.java b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
index 05368fa..3e2c0ae 100644
--- a/src/com/android/launcher3/widget/WidgetsBottomSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsBottomSheet.java
@@ -16,10 +16,13 @@
package com.android.launcher3.widget;
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.util.IntProperty;
import android.util.Pair;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -27,6 +30,8 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.annotation.Nullable;
+
import com.android.launcher3.Insettable;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppState;
@@ -43,6 +48,20 @@
*/
public class WidgetsBottomSheet extends BaseWidgetSheet implements Insettable {
+ private static final IntProperty<View> PADDING_BOTTOM =
+ new IntProperty<View>("paddingBottom") {
+ @Override
+ public void setValue(View view, int paddingBottom) {
+ view.setPadding(view.getPaddingLeft(), view.getPaddingTop(),
+ view.getPaddingRight(), paddingBottom);
+ }
+
+ @Override
+ public Integer get(View view) {
+ return view.getPaddingBottom();
+ }
+ };
+
private static final int DEFAULT_CLOSE_DURATION = 200;
private ItemInfo mOriginalItemInfo;
private Rect mInsets;
@@ -158,8 +177,7 @@
int rightInset = insets.right - mInsets.right;
int bottomInset = insets.bottom - mInsets.bottom;
mInsets.set(insets);
- setPadding(getPaddingLeft() + leftInset, getPaddingTop(),
- getPaddingRight() + rightInset, getPaddingBottom() + bottomInset);
+ setPadding(leftInset, getPaddingTop(), rightInset, bottomInset);
}
@Override
@@ -172,4 +190,10 @@
return Pair.create(findViewById(R.id.title), getContext().getString(
mIsOpen ? R.string.widgets_list : R.string.widgets_list_closed));
}
+
+ @Nullable
+ @Override
+ public Animator createHintCloseAnim(float distanceToMove) {
+ return ObjectAnimator.ofInt(this, PADDING_BOTTOM, (int) (distanceToMove + mInsets.bottom));
+ }
}
diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java
index ec06d1e..521f511 100644
--- a/src/com/android/launcher3/widget/WidgetsFullSheet.java
+++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java
@@ -17,6 +17,8 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.animation.AnimatorSet;
+import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.graphics.Rect;
@@ -27,6 +29,9 @@
import android.view.View;
import android.view.animation.AnimationUtils;
+import androidx.annotation.Nullable;
+import androidx.annotation.VisibleForTesting;
+
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
@@ -35,8 +40,6 @@
import com.android.launcher3.views.RecyclerViewFastScroller;
import com.android.launcher3.views.TopRoundedCornerView;
-import androidx.annotation.VisibleForTesting;
-
/**
* Popup for showing the full list of available widgets
*/
@@ -235,4 +238,13 @@
protected int getElementsRowCount() {
return mAdapter.getItemCount();
}
+
+ @Nullable
+ @Override
+ public Animator createHintCloseAnim(float distanceToMove) {
+ AnimatorSet anim = new AnimatorSet();
+ anim.play(ObjectAnimator.ofFloat(mRecyclerView, TRANSLATION_Y, -distanceToMove));
+ anim.play(ObjectAnimator.ofFloat(mRecyclerView, ALPHA, 0.5f));
+ return anim;
+ }
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 8a2e816..9e77937 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -102,10 +102,6 @@
}
if (TestHelpers.isInLauncherProcess()) Utilities.enableRunningInTestHarnessForTests();
mLauncher = new LauncherInstrumentation(instrumentation);
- try {
- mDevice.executeShellCommand("settings delete secure assistant");
- } catch (IOException e) {
- }
}
@Rule
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 7a2b7af..16ddba8 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -28,7 +28,6 @@
* Ancestor for AppIcon and AppMenuItem.
*/
class Launchable {
- private static final int DRAG_SPEED = 500;
protected final LauncherInstrumentation mLauncher;
protected final UiObject2 mObject;
@@ -77,8 +76,7 @@
Workspace.dragIconToWorkspace(
mLauncher,
this,
- new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2),
- DRAG_SPEED);
+ new Point(device.getDisplayWidth() / 2, device.getDisplayHeight() / 2));
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"dragged launchable to workspace")) {
return new Workspace(mLauncher);
diff --git a/tests/tapl/com/android/launcher3/tapl/Workspace.java b/tests/tapl/com/android/launcher3/tapl/Workspace.java
index f04afa0..943332e 100644
--- a/tests/tapl/com/android/launcher3/tapl/Workspace.java
+++ b/tests/tapl/com/android/launcher3/tapl/Workspace.java
@@ -21,7 +21,9 @@
import static junit.framework.TestCase.assertTrue;
import android.graphics.Point;
+import android.os.SystemClock;
import android.view.KeyEvent;
+import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -35,8 +37,8 @@
*/
public final class Workspace extends Home {
private static final float FLING_SPEED = 3500.0F;
+ private static final int DRAG_DURACTION = 2000;
private final UiObject2 mHotseat;
- private final int ICON_DRAG_SPEED = LauncherInstrumentation.needSlowGestures() ? 100 : 570;
Workspace(LauncherInstrumentation launcher) {
super(launcher);
@@ -116,8 +118,7 @@
mLauncher,
getHotseatAppIcon("Chrome"),
new Point(mLauncher.getDevice().getDisplayWidth(),
- workspace.getVisibleBounds().centerY()),
- (int) (ICON_DRAG_SPEED * mLauncher.getDisplayDensity()));
+ workspace.getVisibleBounds().centerY()));
verifyActiveContainer();
}
assertTrue("Home screen workspace didn't become scrollable",
@@ -134,10 +135,16 @@
mHotseat, AppIcon.getAppIconSelector(appName, mLauncher)));
}
- static void dragIconToWorkspace(LauncherInstrumentation launcher, Launchable launchable,
- Point dest, int icon_drag_speed) {
+ static void dragIconToWorkspace(
+ LauncherInstrumentation launcher, Launchable launchable, Point dest) {
LauncherInstrumentation.log("dragIconToWorkspace: begin");
- launchable.getObject().drag(dest, icon_drag_speed);
+ final Point launchableCenter = launchable.getObject().getVisibleCenter();
+ final long downTime = SystemClock.uptimeMillis();
+ launcher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, launchableCenter);
+ launcher.waitForLauncherObject("deep_shortcuts_container");
+ launcher.movePointer(downTime, DRAG_DURACTION, launchableCenter, dest);
+ launcher.sendPointer(
+ downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest);
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
}