Add recycler view for recents Go
Add recycler view to view hierarchy for recents Go to hold the list of
recent tasks.
Bug: 114136250
Test: Manual test, see view in place
Change-Id: I255bb4a7737726b0e211b52aec3f2fb8f4723513
diff --git a/go/quickstep/res/layout/icon_recents_root_view.xml b/go/quickstep/res/layout/icon_recents_root_view.xml
index 82d5890..6c50950 100644
--- a/go/quickstep/res/layout/icon_recents_root_view.xml
+++ b/go/quickstep/res/layout/icon_recents_root_view.xml
@@ -18,13 +18,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center">
- <!-- TODO(114136250): Remove this temporary placeholder view for Go recents -->
- <TextView
+ android:orientation="vertical">
+ <androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/recent_task_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:gravity="center"
- android:text="Stub!"
- android:textSize="40sp"/>
+ android:scrollbars="none"/>
</com.android.quickstep.views.IconRecentsView>
\ No newline at end of file
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index 00415fe..15da10c 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -15,12 +15,19 @@
*/
package com.android.quickstep.views;
+import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
+
import android.content.Context;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.ViewDebug;
import android.widget.FrameLayout;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.android.launcher3.R;
+import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskAdapter;
import com.android.systemui.shared.recents.model.Task;
@@ -72,19 +79,25 @@
// TODO: Write a recents task list observer that creates/updates tasks and signals task adapter.
private static final ArrayList<Task> DUMMY_TASK_LIST = new ArrayList<>();
+ private final Context mContext;
private float mTranslationYFactor;
private TaskAdapter mTaskAdapter;
+ private RecyclerView mTaskRecyclerView;
public IconRecentsView(Context context, AttributeSet attrs) {
super(context, attrs);
+ mContext = context;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mTaskAdapter = new TaskAdapter(DUMMY_TASK_LIST);
- // TODO: Hook task adapter up to recycler view.
+ mTaskRecyclerView = findViewById(R.id.recent_task_recycler_view);
+ mTaskRecyclerView.setAdapter(mTaskAdapter);
+ mTaskRecyclerView.setLayoutManager(
+ new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */));
}
public void setTranslationYFactor(float translationFactor) {