Merge "Applying the alpha to individual tasks instead of the view" into ub-launcher3-master
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index 4f379e6..d868d12 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -140,7 +140,7 @@
int duration = Math.abs(pageToGoTo - mRecentsView.getNextPage())
* QUICKSCRUB_SNAP_DURATION_PER_PAGE;
mRecentsView.snapToPage(pageToGoTo, duration);
- mRecentsView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP,
+ mRecentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
}
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/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index af40352..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;
@@ -43,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;
@@ -81,6 +83,7 @@
};
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();
@@ -639,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) {
@@ -652,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);
diff --git a/res/layout/hotseat.xml b/res/layout/hotseat.xml
index 73c0e52..01cd92a 100644
--- a/res/layout/hotseat.xml
+++ b/res/layout/hotseat.xml
@@ -17,6 +17,16 @@
android:theme="@style/HomeScreenElementTheme"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto">
+
+ <ImageView
+ android:id="@+id/drag_indicator"
+ android:layout_width="@dimen/hotseat_drag_indicator_height"
+ android:layout_height="@dimen/hotseat_drag_indicator_height"
+ android:src="@drawable/ic_drag_indicator"
+ android:tint="?attr/workspaceTextColor"
+ android:scaleType="centerInside"
+ android:layout_gravity="top|center_horizontal"/>
+
<com.android.launcher3.CellLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index b7e7ca1..3a06cdd 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -37,6 +37,7 @@
<dimen name="dynamic_grid_hotseat_bottom_padding">2dp</dimen>
<dimen name="dynamic_grid_hotseat_size">80dp</dimen>
<dimen name="dynamic_grid_hotseat_side_padding">0dp</dimen>
+ <dimen name="hotseat_drag_indicator_height">24dp</dimen>
<!-- Hotseat/all-apps scrim -->
<dimen name="all_apps_scrim_radius">8dp</dimen>
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 94abcce..2f1de7b 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -22,6 +22,7 @@
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
+import com.android.launcher3.R;
import com.android.launcher3.util.TouchController;
public class UiFactory {
@@ -49,6 +50,8 @@
public static void onTrimMemory(Launcher launcher, int level) { }
public static View[] getHotseatExtraContent(Hotseat hotseat) {
- return new View[0];
+ return new View[] {
+ hotseat.findViewById(R.id.drag_indicator),
+ };
}
}