summaryrefslogtreecommitdiffstats
path: root/go
diff options
context:
space:
mode:
authorKevin <kevhan@google.com>2019-05-02 12:04:15 -0700
committerKevin <kevhan@google.com>2019-05-02 12:09:26 -0700
commit990e7d45937e15d23c796245208067e917c6302d (patch)
treeba76684775e23b91460dbe080f6ccd6c44e73568 /go
parentd16f87f52d969578613abb3f17ed960ff1fefc56 (diff)
downloadandroid_packages_apps_Trebuchet-990e7d45937e15d23c796245208067e917c6302d.tar.gz
android_packages_apps_Trebuchet-990e7d45937e15d23c796245208067e917c6302d.tar.bz2
android_packages_apps_Trebuchet-990e7d45937e15d23c796245208067e917c6302d.zip
Fix bug where we left recents right after entering
There was an issue where tapping recents while there were no tasks and we first launched would not actually go to recents. This was because we had the leave recents call tightly coupled with showing the empty view. When the user first goes to recents and no task is available, we animate to the empty view. However, this also causes us to leave the view even though nothing happened and it results in the user leaving right after enterring. Instead, we should couple the leaving logic with the actual action, removing the task. Bug: 131708240 Fix: 131708240 Test: Go to recents while empty, goes on first tap now Test: Ensured swipe to remove => leave recents logic still works Change-Id: Ifff6d051d957838c3cfae200a2a8ebb316b22965
Diffstat (limited to 'go')
-rw-r--r--go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java10
-rw-r--r--go/quickstep/src/com/android/quickstep/views/IconRecentsView.java8
2 files changed, 12 insertions, 6 deletions
diff --git a/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java b/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java
index 76865435a..57f49d653 100644
--- a/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java
+++ b/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java
@@ -26,16 +26,18 @@ import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
+import java.util.function.Consumer;
+
/**
* Callback for swipe input on {@link TaskHolder} views in the recents view.
*/
public final class TaskSwipeCallback extends ItemTouchHelper.SimpleCallback {
- private final TaskActionController mTaskActionController;
+ private final Consumer<TaskHolder> mOnTaskSwipeCallback;
- public TaskSwipeCallback(TaskActionController taskActionController) {
+ public TaskSwipeCallback(Consumer<TaskHolder> onTaskSwipeCallback) {
super(0 /* dragDirs */, RIGHT);
- mTaskActionController = taskActionController;
+ mOnTaskSwipeCallback = onTaskSwipeCallback;
}
@Override
@@ -47,7 +49,7 @@ public final class TaskSwipeCallback extends ItemTouchHelper.SimpleCallback {
@Override
public void onSwiped(ViewHolder viewHolder, int direction) {
if (direction == RIGHT) {
- mTaskActionController.removeTask((TaskHolder) viewHolder);
+ mOnTaskSwipeCallback.accept((TaskHolder) viewHolder);
}
}
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index f951304f5..21924c8ff 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -162,7 +162,12 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
mTaskRecyclerView.setAdapter(mTaskAdapter);
mTaskRecyclerView.setLayoutManager(mTaskLayoutManager);
ItemTouchHelper helper = new ItemTouchHelper(
- new TaskSwipeCallback(mTaskActionController));
+ new TaskSwipeCallback(holder -> {
+ mTaskActionController.removeTask(holder);
+ if (mTaskLoader.getCurrentTaskList().isEmpty()) {
+ mActivityHelper.leaveRecents();
+ }
+ }));
helper.attachToRecyclerView(mTaskRecyclerView);
mTaskRecyclerView.addOnChildAttachStateChangeListener(
new OnChildAttachStateChangeListener() {
@@ -438,7 +443,6 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
if (mShowingContentView != mEmptyView && taskListSize == 0) {
mShowingContentView = mEmptyView;
crossfadeViews(mEmptyView, mContentView);
- mActivityHelper.leaveRecents();
}
if (mShowingContentView != mContentView && taskListSize > 0) {
mShowingContentView = mContentView;