Merge "Dismissing tasks via keyboard" into ub-launcher3-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
e006cc902b
@@ -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.DeviceProfile;
|
||||
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 @@ import java.util.function.Consumer;
|
||||
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 @@ public class TaskSystemShortcut<T extends SystemShortcut> extends SystemShortcut
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.quickstep.views;
|
||||
|
||||
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;
|
||||
@@ -42,6 +43,7 @@ import com.android.launcher3.DeviceProfile;
|
||||
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;
|
||||
@@ -65,6 +67,7 @@ public abstract class RecentsView<T extends BaseActivity>
|
||||
extends PagedView implements OnSharedPreferenceChangeListener {
|
||||
|
||||
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();
|
||||
|
||||
@@ -623,6 +626,17 @@ public abstract class RecentsView<T extends BaseActivity>
|
||||
}
|
||||
}
|
||||
|
||||
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 +650,18 @@ public abstract class RecentsView<T extends BaseActivity>
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user