Loading go/quickstep/res/layout/icon_recents_root_view.xml +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ android:id="@+id/recent_task_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:scrollbars="none"/> <Button android:id="@+id/clear_all_button" Loading go/quickstep/res/layout/task_item_view.xml +9 −11 Original line number Diff line number Diff line Loading @@ -17,25 +17,23 @@ <com.android.quickstep.views.TaskItemView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:orientation="horizontal"> <FrameLayout <com.android.quickstep.views.TaskThumbnailIconView android:id="@+id/task_icon_and_thumbnail" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_marginHorizontal="8dp"> android:layout_marginHorizontal="8dp" android:layout_marginTop="16dp"> <ImageView android:id="@+id/task_thumbnail" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="top|start"/> android:layout_width="match_parent" android:layout_height="match_parent"/> <ImageView android:id="@+id/task_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end"/> </FrameLayout> android:layout_width="match_parent" android:layout_height="match_parent"/> </com.android.quickstep.views.TaskThumbnailIconView> <TextView android:id="@+id/task_label" android:layout_width="wrap_content" Loading go/quickstep/src/com/android/quickstep/TaskAdapter.java +1 −13 Original line number Diff line number Diff line Loading @@ -15,11 +15,6 @@ */ package com.android.quickstep; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static com.android.quickstep.views.TaskLayoutUtils.getTaskHeight; import static com.android.quickstep.views.TaskLayoutUtils.getTaskTopMargin; import android.view.LayoutInflater; import android.view.ViewGroup; Loading @@ -45,13 +40,11 @@ public final class TaskAdapter extends Adapter<TaskHolder> { private static final String TAG = "TaskAdapter"; private final TaskListLoader mLoader; private final DeviceProfile mDeviceProfile; private TaskActionController mTaskActionController; private boolean mIsShowingLoadingUi; public TaskAdapter(@NonNull TaskListLoader loader, DeviceProfile dp) { public TaskAdapter(@NonNull TaskListLoader loader) { mLoader = loader; mDeviceProfile = dp; } public void setActionController(TaskActionController taskActionController) { Loading @@ -74,11 +67,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> { public TaskHolder onCreateViewHolder(ViewGroup parent, int viewType) { TaskItemView itemView = (TaskItemView) LayoutInflater.from(parent.getContext()) .inflate(R.layout.task_item_view, parent, false); ViewGroup.MarginLayoutParams itemViewParams = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams(); itemViewParams.width = MATCH_PARENT; itemViewParams.height = getTaskHeight(mDeviceProfile); itemViewParams.topMargin = getTaskTopMargin(mDeviceProfile); TaskHolder holder = new TaskHolder(itemView); itemView.setOnClickListener(view -> mTaskActionController.launchTask(holder)); return holder; Loading go/quickstep/src/com/android/quickstep/TaskLayoutManager.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; /** * Layout manager for task list that restricts child height based off the max number of tasks the * recycler view should hold and the height of the recycler view. */ public final class TaskLayoutManager extends LinearLayoutManager { public TaskLayoutManager(Context context, int vertical, boolean b) { super(context, vertical, b); } @Override public void measureChildWithMargins(@NonNull View child, int widthUsed, int heightUsed) { // Request child view takes up 1 / MAX_TASKS of the total view height. int heightUsedByView = (int) (getHeight() * (TaskAdapter.MAX_TASKS_TO_DISPLAY - 1.0f) / TaskAdapter.MAX_TASKS_TO_DISPLAY); super.measureChildWithMargins(child, widthUsed, heightUsedByView); } } go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +5 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener; Loading @@ -56,6 +55,7 @@ import com.android.quickstep.RecentsToActivityHelper; import com.android.quickstep.TaskActionController; import com.android.quickstep.TaskAdapter; import com.android.quickstep.TaskHolder; import com.android.quickstep.TaskLayoutManager; import com.android.quickstep.TaskListLoader; import com.android.quickstep.TaskSwipeCallback; Loading Loading @@ -121,7 +121,7 @@ public final class IconRecentsView extends FrameLayout { mContext = context; mDeviceProfile = activity.getDeviceProfile(); mTaskLoader = new TaskListLoader(mContext); mTaskAdapter = new TaskAdapter(mTaskLoader, mDeviceProfile); mTaskAdapter = new TaskAdapter(mTaskLoader); mTaskActionController = new TaskActionController(mTaskLoader, mTaskAdapter); mTaskAdapter.setActionController(mTaskActionController); } Loading @@ -135,7 +135,7 @@ public final class IconRecentsView extends FrameLayout { recyclerViewParams.height = getTaskListHeight(mDeviceProfile); mTaskRecyclerView.setAdapter(mTaskAdapter); mTaskRecyclerView.setLayoutManager( new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); new TaskLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); ItemTouchHelper helper = new ItemTouchHelper( new TaskSwipeCallback(mTaskActionController)); helper.attachToRecyclerView(mTaskRecyclerView); Loading Loading @@ -170,6 +170,8 @@ public final class IconRecentsView extends FrameLayout { updateContentViewVisibility(); } }); // TODO: Move clear all button to recycler view so that it can scroll off screen. // TODO: Move layout param logic into onMeasure mClearAllView = findViewById(R.id.clear_all_button); MarginLayoutParams clearAllParams = (MarginLayoutParams) mClearAllView.getLayoutParams(); Loading Loading
go/quickstep/res/layout/icon_recents_root_view.xml +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ android:id="@+id/recent_task_recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:scrollbars="none"/> <Button android:id="@+id/clear_all_button" Loading
go/quickstep/res/layout/task_item_view.xml +9 −11 Original line number Diff line number Diff line Loading @@ -17,25 +17,23 @@ <com.android.quickstep.views.TaskItemView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_height="match_parent" android:orientation="horizontal"> <FrameLayout <com.android.quickstep.views.TaskThumbnailIconView android:id="@+id/task_icon_and_thumbnail" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:layout_marginHorizontal="8dp"> android:layout_marginHorizontal="8dp" android:layout_marginTop="16dp"> <ImageView android:id="@+id/task_thumbnail" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="top|start"/> android:layout_width="match_parent" android:layout_height="match_parent"/> <ImageView android:id="@+id/task_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end"/> </FrameLayout> android:layout_width="match_parent" android:layout_height="match_parent"/> </com.android.quickstep.views.TaskThumbnailIconView> <TextView android:id="@+id/task_label" android:layout_width="wrap_content" Loading
go/quickstep/src/com/android/quickstep/TaskAdapter.java +1 −13 Original line number Diff line number Diff line Loading @@ -15,11 +15,6 @@ */ package com.android.quickstep; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static com.android.quickstep.views.TaskLayoutUtils.getTaskHeight; import static com.android.quickstep.views.TaskLayoutUtils.getTaskTopMargin; import android.view.LayoutInflater; import android.view.ViewGroup; Loading @@ -45,13 +40,11 @@ public final class TaskAdapter extends Adapter<TaskHolder> { private static final String TAG = "TaskAdapter"; private final TaskListLoader mLoader; private final DeviceProfile mDeviceProfile; private TaskActionController mTaskActionController; private boolean mIsShowingLoadingUi; public TaskAdapter(@NonNull TaskListLoader loader, DeviceProfile dp) { public TaskAdapter(@NonNull TaskListLoader loader) { mLoader = loader; mDeviceProfile = dp; } public void setActionController(TaskActionController taskActionController) { Loading @@ -74,11 +67,6 @@ public final class TaskAdapter extends Adapter<TaskHolder> { public TaskHolder onCreateViewHolder(ViewGroup parent, int viewType) { TaskItemView itemView = (TaskItemView) LayoutInflater.from(parent.getContext()) .inflate(R.layout.task_item_view, parent, false); ViewGroup.MarginLayoutParams itemViewParams = (ViewGroup.MarginLayoutParams) itemView.getLayoutParams(); itemViewParams.width = MATCH_PARENT; itemViewParams.height = getTaskHeight(mDeviceProfile); itemViewParams.topMargin = getTaskTopMargin(mDeviceProfile); TaskHolder holder = new TaskHolder(itemView); itemView.setOnClickListener(view -> mTaskActionController.launchTask(holder)); return holder; Loading
go/quickstep/src/com/android/quickstep/TaskLayoutManager.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; /** * Layout manager for task list that restricts child height based off the max number of tasks the * recycler view should hold and the height of the recycler view. */ public final class TaskLayoutManager extends LinearLayoutManager { public TaskLayoutManager(Context context, int vertical, boolean b) { super(context, vertical, b); } @Override public void measureChildWithMargins(@NonNull View child, int widthUsed, int heightUsed) { // Request child view takes up 1 / MAX_TASKS of the total view height. int heightUsedByView = (int) (getHeight() * (TaskAdapter.MAX_TASKS_TO_DISPLAY - 1.0f) / TaskAdapter.MAX_TASKS_TO_DISPLAY); super.measureChildWithMargins(child, widthUsed, heightUsedByView); } }
go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +5 −3 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener; Loading @@ -56,6 +55,7 @@ import com.android.quickstep.RecentsToActivityHelper; import com.android.quickstep.TaskActionController; import com.android.quickstep.TaskAdapter; import com.android.quickstep.TaskHolder; import com.android.quickstep.TaskLayoutManager; import com.android.quickstep.TaskListLoader; import com.android.quickstep.TaskSwipeCallback; Loading Loading @@ -121,7 +121,7 @@ public final class IconRecentsView extends FrameLayout { mContext = context; mDeviceProfile = activity.getDeviceProfile(); mTaskLoader = new TaskListLoader(mContext); mTaskAdapter = new TaskAdapter(mTaskLoader, mDeviceProfile); mTaskAdapter = new TaskAdapter(mTaskLoader); mTaskActionController = new TaskActionController(mTaskLoader, mTaskAdapter); mTaskAdapter.setActionController(mTaskActionController); } Loading @@ -135,7 +135,7 @@ public final class IconRecentsView extends FrameLayout { recyclerViewParams.height = getTaskListHeight(mDeviceProfile); mTaskRecyclerView.setAdapter(mTaskAdapter); mTaskRecyclerView.setLayoutManager( new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); new TaskLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); ItemTouchHelper helper = new ItemTouchHelper( new TaskSwipeCallback(mTaskActionController)); helper.attachToRecyclerView(mTaskRecyclerView); Loading Loading @@ -170,6 +170,8 @@ public final class IconRecentsView extends FrameLayout { updateContentViewVisibility(); } }); // TODO: Move clear all button to recycler view so that it can scroll off screen. // TODO: Move layout param logic into onMeasure mClearAllView = findViewById(R.id.clear_all_button); MarginLayoutParams clearAllParams = (MarginLayoutParams) mClearAllView.getLayoutParams(); Loading