Merge "Adding a custom view for DragHandle" into ub-launcher3-master
diff --git a/quickstep/res/drawable-hdpi/recents_horizontal_scrim_left.png b/quickstep/res/drawable-hdpi/recents_horizontal_scrim_left.png
deleted file mode 100644
index d4f995d..0000000
--- a/quickstep/res/drawable-hdpi/recents_horizontal_scrim_left.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-hdpi/recents_horizontal_scrim_right.png b/quickstep/res/drawable-hdpi/recents_horizontal_scrim_right.png
deleted file mode 100644
index 9013c1a..0000000
--- a/quickstep/res/drawable-hdpi/recents_horizontal_scrim_right.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-mdpi/recents_horizontal_scrim_left.png b/quickstep/res/drawable-mdpi/recents_horizontal_scrim_left.png
deleted file mode 100644
index 6e924ec..0000000
--- a/quickstep/res/drawable-mdpi/recents_horizontal_scrim_left.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-mdpi/recents_horizontal_scrim_right.png b/quickstep/res/drawable-mdpi/recents_horizontal_scrim_right.png
deleted file mode 100644
index 33d0edd..0000000
--- a/quickstep/res/drawable-mdpi/recents_horizontal_scrim_right.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_left.png b/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_left.png
deleted file mode 100644
index 20c85e6..0000000
--- a/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_left.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_right.png b/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_right.png
deleted file mode 100644
index 58a1ca0..0000000
--- a/quickstep/res/drawable-xhdpi/recents_horizontal_scrim_right.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_left.png b/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_left.png
deleted file mode 100644
index 9d3dc31..0000000
--- a/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_left.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_right.png b/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_right.png
deleted file mode 100644
index 7fb248b..0000000
--- a/quickstep/res/drawable-xxhdpi/recents_horizontal_scrim_right.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_left.png b/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_left.png
deleted file mode 100644
index 49ec7aa..0000000
--- a/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_left.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_right.png b/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_right.png
deleted file mode 100644
index a8922e2..0000000
--- a/quickstep/res/drawable-xxxhdpi/recents_horizontal_scrim_right.png
+++ /dev/null
Binary files differ
diff --git a/quickstep/res/layout/overview_panel.xml b/quickstep/res/layout/overview_panel.xml
index e2f9ba8..89e0571 100644
--- a/quickstep/res/layout/overview_panel.xml
+++ b/quickstep/res/layout/overview_panel.xml
@@ -21,7 +21,6 @@
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
- android:alpha="0.0"
android:visibility="invisible"
android:focusableInTouchMode="true" >
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index e61e359..b751e0d 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -22,7 +22,6 @@
<dimen name="task_corner_radius">2dp</dimen>
<dimen name="task_fade_length">20dp</dimen>
<dimen name="recents_page_spacing">10dp</dimen>
- <dimen name="recents_page_fade_length">100dp</dimen>
<!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start
loading full resolution screenshots. -->
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 52faa51..4b2763b 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -110,8 +110,7 @@
@Override
public int getVisibleElements(Launcher launcher) {
if (launcher.getDeviceProfile().isVerticalBarLayout()) {
- // TODO: Remove hotseat from overview
- return HOTSEAT_ICONS;
+ return NONE;
} else {
return HOTSEAT_SEARCH_BOX | DRAG_HANDLE_INDICATOR |
(launcher.getAppsView().getFloatingHeaderView().hasVisibleContent()
diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
index b993c3c..d8f206c 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java
@@ -22,6 +22,7 @@
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_X_FACTOR;
import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR;
+import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
@@ -49,7 +50,7 @@
@Override
public void setState(LauncherState state) {
- mRecentsView.setAlpha(state.overviewUi ? 1 : 0);
+ mRecentsView.setContentAlpha(state.overviewUi ? 1 : 0);
updateVisibility(mRecentsView, isAccessibilityEnabled(mLauncher));
float[] translationFactor = state.getOverviewTranslationFactor(mLauncher);
mRecentsView.setTranslationXFactor(translationFactor[0]);
@@ -83,7 +84,7 @@
setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR,
translationFactor[1],
builder.getInterpolator(ANIM_OVERVIEW_TRANSLATION, LINEAR));
- setter.setViewAlpha(mRecentsView, toState.overviewUi ? 1 : 0, LINEAR);
+ setter.setFloat(mRecentsView, CONTENT_ALPHA, toState.overviewUi ? 1 : 0, LINEAR);
if (toState.overviewUi) {
ValueAnimator updateAnim = ValueAnimator.ofFloat(0, 1);
diff --git a/quickstep/src/com/android/quickstep/RecentsModel.java b/quickstep/src/com/android/quickstep/RecentsModel.java
index 392b73f..1e43202 100644
--- a/quickstep/src/com/android/quickstep/RecentsModel.java
+++ b/quickstep/src/com/android/quickstep/RecentsModel.java
@@ -30,6 +30,7 @@
import android.support.annotation.WorkerThread;
import android.util.LruCache;
import android.util.SparseArray;
+import android.view.accessibility.AccessibilityManager;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
@@ -85,6 +86,7 @@
private ISystemUiProxy mSystemUiProxy;
private boolean mClearAssistCacheOnStackChange = true;
private final boolean mPreloadTasksInBackground;
+ private final AccessibilityManager mAccessibilityManager;
private RecentsModel(Context context) {
mContext = context;
@@ -111,6 +113,7 @@
mTaskChangeId = 1;
loadTasks(-1, null);
+ mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
}
public RecentsTaskLoader getRecentsTaskLoader() {
@@ -140,7 +143,7 @@
// Preload the plan
RecentsTaskLoadPlan loadPlan = new RecentsTaskLoadPlan(mContext);
PreloadOptions opts = new PreloadOptions();
- opts.loadTitles = false;
+ opts.loadTitles = mAccessibilityManager.isEnabled();
loadPlan.preloadPlan(opts, mRecentsTaskLoader, taskId, UserHandle.myUserId());
// Set the load plan on UI thread
mMainThreadExecutor.execute(() -> {
@@ -187,7 +190,7 @@
launchOpts.onlyLoadPausedActivities = true;
launchOpts.loadThumbnails = true;
PreloadOptions preloadOpts = new PreloadOptions();
- preloadOpts.loadTitles = false;
+ preloadOpts.loadTitles = mAccessibilityManager.isEnabled();
plan.preloadPlan(preloadOpts, mRecentsTaskLoader, -1, userId);
mRecentsTaskLoader.loadTasks(plan, launchOpts);
}
diff --git a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
index 08be0c8..2ebf252 100644
--- a/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
+++ b/quickstep/src/com/android/quickstep/TaskSystemShortcut.java
@@ -16,8 +16,6 @@
package com.android.quickstep;
-import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
-
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Bitmap;
@@ -37,7 +35,6 @@
import com.android.launcher3.ItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutInfo;
-import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.util.InstantAppResolver;
import com.android.quickstep.views.RecentsView;
@@ -62,7 +59,6 @@
public class TaskSystemShortcut<T extends SystemShortcut> extends SystemShortcut {
private static final String TAG = "TaskSystemShortcut";
- private static final int DISMISS_TASK_DURATION = 300;
protected T mSystemShortcut;
@@ -206,14 +202,7 @@
mRecentsView.removeIgnoreResetTask(mTaskView);
// Start animating in the side pages once launcher has been resized
- PendingAnimation pendingAnim = mRecentsView.createTaskDismissAnimation(mTaskView,
- false, false, DISMISS_TASK_DURATION);
- AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(
- pendingAnim.anim, DISMISS_TASK_DURATION);
- controller.dispatchOnStart();
- controller.setEndAction(() -> pendingAnim.finish(true));
- controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
- controller.start();
+ mRecentsView.dismissTask(mTaskView, false, false);
}
}
diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
index 130d34c..861b5fa 100644
--- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -19,18 +19,7 @@
import android.annotation.TargetApi;
import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
-import android.graphics.Shader;
-import android.graphics.Shader.TileMode;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.util.FloatProperty;
@@ -75,12 +64,6 @@
}
};
- private Bitmap mScrim;
- private Paint mFadePaint;
- private Shader mFadeShader;
- private Matrix mFadeMatrix;
- private boolean mScrimOnLeft;
-
private float mTranslationXFactor;
private float mTranslationYFactor;
private Rect mPagePadding = new Rect();
@@ -95,6 +78,7 @@
public LauncherRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
+ setContentAlpha(0);
}
@Override
@@ -109,60 +93,6 @@
setPadding(padding.left, padding.top, padding.right, 0);
mPagePadding.set(padding);
mPagePadding.top += getResources().getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
-
- if (dp.isVerticalBarLayout()) {
- boolean wasScrimOnLeft = mScrimOnLeft;
- mScrimOnLeft = dp.isSeascape();
-
- if (mScrim == null || wasScrimOnLeft != mScrimOnLeft) {
- Drawable scrim = getContext().getDrawable(mScrimOnLeft
- ? R.drawable.recents_horizontal_scrim_left
- : R.drawable.recents_horizontal_scrim_right);
- if (scrim instanceof BitmapDrawable) {
- mScrim = ((BitmapDrawable) scrim).getBitmap();
- mFadePaint = new Paint();
- mFadePaint.setXfermode(new PorterDuffXfermode(Mode.DST_IN));
- mFadeShader = new BitmapShader(mScrim, TileMode.CLAMP, TileMode.REPEAT);
- mFadeMatrix = new Matrix();
- } else {
- mScrim = null;
- }
- }
- } else {
- mScrim = null;
- mFadePaint = null;
- mFadeShader = null;
- mFadeMatrix = null;
- }
- }
-
- @Override
- public void draw(Canvas canvas) {
- if (mScrim == null) {
- super.draw(canvas);
- return;
- }
-
- final int flags = Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
-
- int length = mScrim.getWidth();
- int height = getHeight();
- int saveCount = canvas.getSaveCount();
-
- int scrimLeft;
- if (mScrimOnLeft) {
- scrimLeft = getScrollX();
- } else {
- scrimLeft = getScrollX() + getWidth() - length;
- }
- canvas.saveLayer(scrimLeft, 0, scrimLeft + length, height, null, flags);
- super.draw(canvas);
-
- mFadeMatrix.setTranslate(scrimLeft, 0);
- mFadeShader.setLocalMatrix(mFadeMatrix);
- mFadePaint.setShader(mFadeShader);
- canvas.drawRect(scrimLeft, 0, scrimLeft + length, height, mFadePaint);
- canvas.restoreToCount(saveCount);
}
@Override
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index db82286..8901e6d 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -18,6 +18,7 @@
import static com.android.launcher3.anim.Interpolators.ACCEL;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
+import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import android.animation.AnimatorSet;
@@ -32,6 +33,7 @@
import android.os.Build;
import android.util.ArraySet;
import android.util.AttributeSet;
+import android.util.FloatProperty;
import android.util.SparseBooleanArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -42,6 +44,7 @@
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
+import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.quickstep.PendingAnimation;
import com.android.quickstep.QuickScrubController;
@@ -64,7 +67,23 @@
public abstract class RecentsView<T extends BaseActivity>
extends PagedView implements OnSharedPreferenceChangeListener {
+ public static final FloatProperty<RecentsView> CONTENT_ALPHA =
+ new FloatProperty<RecentsView>("contentAlpha") {
+
+
+ @Override
+ public void setValue(RecentsView recentsView, float v) {
+ recentsView.setContentAlpha(v);
+ }
+
+ @Override
+ public Float get(RecentsView recentsView) {
+ return recentsView.mContentAlpha;
+ }
+ };
+
private static final String PREF_FLIP_RECENTS = "pref_flip_recents";
+ private static final int DISMISS_TASK_DURATION = 300;
private static final Rect sTempStableInsets = new Rect();
@@ -106,6 +125,8 @@
private PendingAnimation mPendingAnimation;
+ private float mContentAlpha = 1;
+
// Keeps track of task views whose visual state should not be reset
private ArraySet<TaskView> mIgnoreResetTaskViews = new ArraySet<>();
@@ -302,12 +323,10 @@
float overviewHeight, overviewWidth;
if (profile.isVerticalBarLayout()) {
- float scrimLength = context.getResources()
- .getDimension(R.dimen.recents_page_fade_length);
float maxPadding = Math.max(padding.left, padding.right);
// Use the same padding on both sides for symmetry.
- float availableWidth = taskWidth - 2 * Math.max(maxPadding, scrimLength);
+ float availableWidth = taskWidth - 2 * maxPadding;
float availableHeight = profile.availableHeightPx - padding.top - padding.bottom
- sTempStableInsets.top;
float scaledRatio = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
@@ -623,6 +642,17 @@
}
}
+ public void dismissTask(TaskView taskView, boolean animateTaskView, boolean removeTask) {
+ PendingAnimation pendingAnim = createTaskDismissAnimation(taskView, animateTaskView,
+ removeTask, DISMISS_TASK_DURATION);
+ AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(
+ pendingAnim.anim, DISMISS_TASK_DURATION);
+ controller.dispatchOnStart();
+ controller.setEndAction(() -> pendingAnim.finish(true));
+ controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
+ controller.start();
+ }
+
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
@@ -636,6 +666,18 @@
case KeyEvent.KEYCODE_DPAD_LEFT:
snapToPageRelative(mIsRtl ? 1 : -1);
return true;
+ case KeyEvent.KEYCODE_DEL:
+ case KeyEvent.KEYCODE_FORWARD_DEL:
+ dismissTask((TaskView) getChildAt(getNextPage()), true /*animateTaskView*/,
+ true /*removeTask*/);
+ return true;
+ case KeyEvent.KEYCODE_NUMPAD_DOT:
+ if (event.isAltPressed()) {
+ // Numpad DEL pressed while holding Alt.
+ dismissTask((TaskView) getChildAt(getNextPage()), true /*animateTaskView*/,
+ true /*removeTask*/);
+ return true;
+ }
}
}
return super.dispatchKeyEvent(event);
@@ -649,4 +691,21 @@
final TaskView nextTask = (TaskView) getChildAt(getNextPage());
nextTask.launchTask(true);
}
+
+ public void setContentAlpha(float alpha) {
+ if (mContentAlpha == alpha) {
+ return;
+ }
+ mContentAlpha = alpha;
+ for (int i = getChildCount() - 1; i >= 0; i--) {
+ getChildAt(i).setAlpha(alpha);
+ }
+ setVisibility(alpha > 0 ? VISIBLE : GONE);
+ }
+
+ @Override
+ public void onViewAdded(View child) {
+ super.onViewAdded(child);
+ child.setAlpha(mContentAlpha);
+ }
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 7de1600..9884a48 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -96,6 +96,7 @@
mTask = task;
mSnapshotView.bind();
task.addCallback(this);
+ setContentDescription(task.titleDescription);
}
public Task getTask() {
@@ -176,6 +177,12 @@
setScaleY(scale);
}
+ @Override
+ public boolean hasOverlappingRendering() {
+ // TODO: Clip-out the icon region from the thumbnail, since they are overlapping.
+ return false;
+ }
+
private static final class TaskOutlineProvider extends ViewOutlineProvider {
private final int mMarginTop;
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 9eff84b..a1ac122 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -188,6 +188,10 @@
mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * density);
mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density);
setWillNotDraw(false);
+
+ if (Utilities.ATLEAST_OREO) {
+ setDefaultFocusHighlightEnabled(false);
+ }
}
protected void setDefaultInterpolator(Interpolator interpolator) {