summaryrefslogtreecommitdiffstats
path: root/go/quickstep/src/com/android/quickstep
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-03-21 11:51:06 -0700
committerKevin <kevhan@google.com>2019-03-22 12:53:02 -0700
commitc977ea9a3c492b288c34efc295a8824f3d5a3f67 (patch)
tree99d269923bc3b5a7f6b5061e52afa42b25006d47 /go/quickstep/src/com/android/quickstep
parent969e7a6c5723157298f3ff325671404ec72676cc (diff)
downloadandroid_packages_apps_Trebuchet-c977ea9a3c492b288c34efc295a8824f3d5a3f67.tar.gz
android_packages_apps_Trebuchet-c977ea9a3c492b288c34efc295a8824f3d5a3f67.tar.bz2
android_packages_apps_Trebuchet-c977ea9a3c492b288c34efc295a8824f3d5a3f67.zip
Add overview button handling to Go recents.
Add the same overview button handling as in the original launcher. Specifically, pressing overview on recents will launch the next appropriate task (e.g. the next most recent task if you came from an app). Bug: 114136250 Test: Go to recents from launcher, press overview => launch task. Test: Go to recents from app, press overview => launches next task Change-Id: I946974b4c2b65b6d0f212d8e8c0816983386d952
Diffstat (limited to 'go/quickstep/src/com/android/quickstep')
-rw-r--r--go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java5
-rw-r--r--go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java4
-rw-r--r--go/quickstep/src/com/android/quickstep/TaskHolder.java2
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java36
4 files changed, 43 insertions, 4 deletions
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index defed845d..051c80f97 100644
--- a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -34,6 +34,7 @@ import androidx.annotation.NonNull;
import com.android.launcher3.BaseDraggingActivity;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.util.RemoteAnimationProvider;
+import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.IconRecentsView;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat;
@@ -100,6 +101,10 @@ final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> imple
return anim;
}
+ RemoteAnimationTargetSet targetSet =
+ new RemoteAnimationTargetSet(targetCompats, MODE_CLOSING);
+ mRecentsView.setTransitionedFromApp(!targetSet.isAnimatingHome());
+
RemoteAnimationTargetCompat recentsTarget = null;
RemoteAnimationTargetCompat closingAppTarget = null;
diff --git a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index d9873fe5e..379cc100e 100644
--- a/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/go/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -96,7 +96,7 @@ public class OverviewCommandHelper {
if (recents == null) {
return false;
}
- //TODO: Launch last running task or go to home.
+ recents.handleOverviewCommand();
return true;
}
}
@@ -146,7 +146,7 @@ public class OverviewCommandHelper {
protected boolean handleCommand(long elapsedTime) {
IconRecentsView recents = mHelper.getVisibleRecentsView();
if (recents != null) {
- //TODO: Launch next task in icon recents.
+ recents.handleOverviewCommand();
return true;
} else if (elapsedTime < ViewConfiguration.getDoubleTapTimeout()) {
// The user tried to launch back into overview too quickly, either after
diff --git a/go/quickstep/src/com/android/quickstep/TaskHolder.java b/go/quickstep/src/com/android/quickstep/TaskHolder.java
index 8d5e4d55f..a89229f2f 100644
--- a/go/quickstep/src/com/android/quickstep/TaskHolder.java
+++ b/go/quickstep/src/com/android/quickstep/TaskHolder.java
@@ -25,7 +25,7 @@ import com.android.systemui.shared.recents.model.Task;
* A recycler view holder that holds the task view and binds {@link Task} content (app title, icon,
* etc.) to the view.
*/
-final class TaskHolder extends ViewHolder {
+public final class TaskHolder extends ViewHolder {
private final TaskItemView mTaskItemView;
private Task mTask;
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 0e5dbc479..a1d62c2bb 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -35,8 +35,9 @@ import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
import com.android.launcher3.R;
import com.android.quickstep.RecentsToActivityHelper;
-import com.android.quickstep.TaskAdapter;
import com.android.quickstep.TaskActionController;
+import com.android.quickstep.TaskAdapter;
+import com.android.quickstep.TaskHolder;
import com.android.quickstep.TaskListLoader;
import com.android.quickstep.TaskSwipeCallback;
@@ -80,6 +81,7 @@ public final class IconRecentsView extends FrameLayout {
private RecyclerView mTaskRecyclerView;
private View mEmptyView;
private View mContentView;
+ private boolean mTransitionedFromApp;
public IconRecentsView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -147,6 +149,38 @@ public final class IconRecentsView extends FrameLayout {
}
/**
+ * Set whether we transitioned to recents from the most recent app.
+ *
+ * @param transitionedFromApp true if transitioned from the most recent app, false otherwise
+ */
+ public void setTransitionedFromApp(boolean transitionedFromApp) {
+ mTransitionedFromApp = transitionedFromApp;
+ }
+
+ /**
+ * Handles input from the overview button. Launch the most recent task unless we just came from
+ * the app. In that case, we launch the next most recent.
+ */
+ public void handleOverviewCommand() {
+ int childCount = mTaskRecyclerView.getChildCount();
+ if (childCount == 0) {
+ // Do nothing
+ return;
+ }
+ TaskHolder taskToLaunch;
+ if (mTransitionedFromApp && childCount > 1) {
+ // Launch the next most recent app
+ TaskItemView itemView = (TaskItemView) mTaskRecyclerView.getChildAt(1);
+ taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
+ } else {
+ // Launch the most recent app
+ TaskItemView itemView = (TaskItemView) mTaskRecyclerView.getChildAt(0);
+ taskToLaunch = (TaskHolder) mTaskRecyclerView.getChildViewHolder(itemView);
+ }
+ mTaskActionController.launchTask(taskToLaunch);
+ }
+
+ /**
* Get the thumbnail view associated with a task for the purposes of animation.
*
* @param taskId task id of thumbnail view to get