From cacf7df2d4dcd35b166a42a512bcacd74bae471d Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 19 Apr 2019 11:17:08 -0700 Subject: [PATCH] Remove old recyclerview layout logic Remove old layout logic for recycler view as there is no need for the recycler view height to change based off device profile. Instead the task items themselves will change. Bug: 114136250 Test: Builds Change-Id: Ia6dae22e3e73fafe46d4adf834bf7d24af36a607 --- .../quickstep/views/IconRecentsView.java | 7 ----- .../quickstep/views/TaskLayoutUtils.java | 28 ++----------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index 09d5ae6f01..ec02e9d705 100644 --- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java @@ -19,7 +19,6 @@ import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL; import static com.android.quickstep.TaskAdapter.CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT; import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION; -import static com.android.quickstep.views.TaskLayoutUtils.getTaskListHeight; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -33,7 +32,6 @@ import android.util.AttributeSet; import android.util.FloatProperty; import android.view.View; import android.view.ViewDebug; -import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.FrameLayout; @@ -47,7 +45,6 @@ import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver; import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener; import com.android.launcher3.BaseActivity; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.quickstep.ContentFillItemAnimator; import com.android.quickstep.RecentsModel; @@ -106,7 +103,6 @@ public final class IconRecentsView extends FrameLayout { private final DefaultItemAnimator mDefaultItemAnimator = new DefaultItemAnimator(); private final ContentFillItemAnimator mLoadingContentItemAnimator = new ContentFillItemAnimator(); - private final DeviceProfile mDeviceProfile; private RecentsToActivityHelper mActivityHelper; private RecyclerView mTaskRecyclerView; @@ -137,7 +133,6 @@ public final class IconRecentsView extends FrameLayout { super(context, attrs); BaseActivity activity = BaseActivity.fromContext(context); mContext = context; - mDeviceProfile = activity.getDeviceProfile(); mTaskLoader = new TaskListLoader(mContext); mTaskAdapter = new TaskAdapter(mTaskLoader); mTaskAdapter.setOnClearAllClickListener(view -> animateClearAllTasks()); @@ -151,8 +146,6 @@ public final class IconRecentsView extends FrameLayout { super.onFinishInflate(); if (mTaskRecyclerView == null) { mTaskRecyclerView = findViewById(R.id.recent_task_recycler_view); - ViewGroup.LayoutParams recyclerViewParams = mTaskRecyclerView.getLayoutParams(); - recyclerViewParams.height = getTaskListHeight(mDeviceProfile); mTaskRecyclerView.setAdapter(mTaskAdapter); mTaskRecyclerView.setLayoutManager( new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */)); diff --git a/go/quickstep/src/com/android/quickstep/views/TaskLayoutUtils.java b/go/quickstep/src/com/android/quickstep/views/TaskLayoutUtils.java index bda3e4dd3e..f7d6495d28 100644 --- a/go/quickstep/src/com/android/quickstep/views/TaskLayoutUtils.java +++ b/go/quickstep/src/com/android/quickstep/views/TaskLayoutUtils.java @@ -19,7 +19,6 @@ import static com.android.quickstep.TaskAdapter.MAX_TASKS_TO_DISPLAY; import android.content.Context; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.InvariantDeviceProfile; /** @@ -27,18 +26,8 @@ import com.android.launcher3.InvariantDeviceProfile; */ public final class TaskLayoutUtils { - private static final float BUTTON_TO_DEVICE_HEIGHT_RATIO = 36.0f/569; - private static final float BUTTON_WIDTH_TO_HEIGHT_RATIO = 53.0f/18; - private static final float BUTTON_MARGIN_TO_BUTTON_HEIGHT_RATIO = 5.0f/9; - private TaskLayoutUtils() {} - public static int getTaskListHeight(DeviceProfile dp) { - // TODO: Remove this as task height is determined directly from device height. - int clearAllSpace = getClearAllButtonHeight(dp) + 2 * getClearAllButtonTopBottomMargin(dp); - return getDeviceLongWidth(dp) - clearAllSpace; - } - /** * Calculate task height based off the available height in portrait mode such that when the * recents list is full, the total height fills in the available device height perfectly. In @@ -54,19 +43,8 @@ public final class TaskLayoutUtils { return (int) (availableHeight * 1.0f / MAX_TASKS_TO_DISPLAY); } - public static int getClearAllButtonHeight(DeviceProfile dp) { - return (int) (BUTTON_TO_DEVICE_HEIGHT_RATIO * getDeviceLongWidth(dp)); - } - - public static int getClearAllButtonWidth(DeviceProfile dp) { - return (int) (BUTTON_WIDTH_TO_HEIGHT_RATIO * getClearAllButtonHeight(dp)); - } - - public static int getClearAllButtonTopBottomMargin(DeviceProfile dp) { - return (int) (BUTTON_MARGIN_TO_BUTTON_HEIGHT_RATIO * getClearAllButtonHeight(dp)); - } - - private static int getDeviceLongWidth(DeviceProfile dp) { - return Math.max(dp.availableHeightPx, dp.availableWidthPx); + public static int getClearAllButtonHeight(Context context) { + // TODO: Implement this + return 0; } }