Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34659d21 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fade task items when swiping out" into ub-launcher3-qt-dev

parents 6380f519 8f6d41ee
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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"
+14 −0
Original line number Diff line number Diff line
@@ -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;
@@ -49,6 +51,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) {