diff options
author | Kevin <kevhan@google.com> | 2019-04-30 09:13:24 -0700 |
---|---|---|
committer | Kevin <kevhan@google.com> | 2019-04-30 09:13:51 -0700 |
commit | 8f6d41ee53a2b2bf9122cab52333933fdb3b5ae2 (patch) | |
tree | 40005798f844b986e55f5872d9577f7b2d165fea /go/quickstep | |
parent | ee8caf680afbf2d4b7a980fb11738f5547d23a13 (diff) | |
download | android_packages_apps_Trebuchet-8f6d41ee53a2b2bf9122cab52333933fdb3b5ae2.tar.gz android_packages_apps_Trebuchet-8f6d41ee53a2b2bf9122cab52333933fdb3b5ae2.tar.bz2 android_packages_apps_Trebuchet-8f6d41ee53a2b2bf9122cab52333933fdb3b5ae2.zip |
Fade task items when swiping out
As we have a fixed width for the task list now, we have to ensure that
we do not clip the task items when we swipe them out. In addition, we
should fade them out by the end of the swipe as the swipe end location
may still be on a visible part of the screen.
Bug: 131686863
Test: Go to landscape mode, swipe out tasks
Change-Id: If86136a9f9d47098a6dd5d355d3a99d540165c77
Diffstat (limited to 'go/quickstep')
-rw-r--r-- | go/quickstep/res/layout/icon_recents_root_view.xml | 6 | ||||
-rw-r--r-- | go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/go/quickstep/res/layout/icon_recents_root_view.xml b/go/quickstep/res/layout/icon_recents_root_view.xml index b64b7fdad..595a380bd 100644 --- a/go/quickstep/res/layout/icon_recents_root_view.xml +++ b/go/quickstep/res/layout/icon_recents_root_view.xml @@ -18,14 +18,16 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + android:clipChildren="false"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recent_task_recycler_view" android:layout_width="@dimen/recents_list_width" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:scrollbars="none" - android:clipToPadding="false"/> + android:clipToPadding="false" + android:clipChildren="false"/> <TextView android:id="@+id/recent_task_empty_view" android:layout_width="match_parent" diff --git a/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java b/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java index 19951bb37..76865435a 100644 --- a/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java +++ b/go/quickstep/src/com/android/quickstep/TaskSwipeCallback.java @@ -19,6 +19,8 @@ import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT; import static com.android.quickstep.TaskAdapter.ITEM_TYPE_CLEAR_ALL; +import android.graphics.Canvas; + import androidx.annotation.NonNull; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.RecyclerView; @@ -50,6 +52,18 @@ public final class TaskSwipeCallback extends ItemTouchHelper.SimpleCallback { } @Override + public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, + @NonNull ViewHolder viewHolder, float dX, float dY, int actionState, + boolean isCurrentlyActive) { + if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { + float alpha = 1.0f - dX / (float) viewHolder.itemView.getWidth(); + viewHolder.itemView.setAlpha(alpha); + } + super.onChildDraw(c, recyclerView, viewHolder, dX, dY, + actionState, isCurrentlyActive); + } + + @Override public int getSwipeDirs(@NonNull RecyclerView recyclerView, @NonNull ViewHolder viewHolder) { if (viewHolder.getItemViewType() == ITEM_TYPE_CLEAR_ALL) { |