Loading go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java +6 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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); } } Loading go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +6 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,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() { Loading Loading @@ -459,7 +464,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; Loading Loading
go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java +6 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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); } } Loading
go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +6 −2 Original line number Diff line number Diff line Loading @@ -168,7 +168,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() { Loading Loading @@ -459,7 +464,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; Loading