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
(cherry picked from commit cacf7df2d4
)
This commit is contained in:
parent
1834728db6
commit
6af38e14aa
|
@ -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.CHANGE_EVENT_TYPE_EMPTY_TO_CONTENT;
|
||||||
import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;
|
import static com.android.quickstep.TaskAdapter.TASKS_START_POSITION;
|
||||||
import static com.android.quickstep.views.TaskLayoutUtils.getTaskListHeight;
|
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
@ -33,7 +32,6 @@ import android.util.AttributeSet;
|
||||||
import android.util.FloatProperty;
|
import android.util.FloatProperty;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewDebug;
|
import android.view.ViewDebug;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
@ -47,7 +45,6 @@ import androidx.recyclerview.widget.RecyclerView.AdapterDataObserver;
|
||||||
import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener;
|
import androidx.recyclerview.widget.RecyclerView.OnChildAttachStateChangeListener;
|
||||||
|
|
||||||
import com.android.launcher3.BaseActivity;
|
import com.android.launcher3.BaseActivity;
|
||||||
import com.android.launcher3.DeviceProfile;
|
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.quickstep.ContentFillItemAnimator;
|
import com.android.quickstep.ContentFillItemAnimator;
|
||||||
import com.android.quickstep.RecentsModel;
|
import com.android.quickstep.RecentsModel;
|
||||||
|
@ -106,7 +103,6 @@ public final class IconRecentsView extends FrameLayout {
|
||||||
private final DefaultItemAnimator mDefaultItemAnimator = new DefaultItemAnimator();
|
private final DefaultItemAnimator mDefaultItemAnimator = new DefaultItemAnimator();
|
||||||
private final ContentFillItemAnimator mLoadingContentItemAnimator =
|
private final ContentFillItemAnimator mLoadingContentItemAnimator =
|
||||||
new ContentFillItemAnimator();
|
new ContentFillItemAnimator();
|
||||||
private final DeviceProfile mDeviceProfile;
|
|
||||||
|
|
||||||
private RecentsToActivityHelper mActivityHelper;
|
private RecentsToActivityHelper mActivityHelper;
|
||||||
private RecyclerView mTaskRecyclerView;
|
private RecyclerView mTaskRecyclerView;
|
||||||
|
@ -137,7 +133,6 @@ public final class IconRecentsView extends FrameLayout {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
BaseActivity activity = BaseActivity.fromContext(context);
|
BaseActivity activity = BaseActivity.fromContext(context);
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mDeviceProfile = activity.getDeviceProfile();
|
|
||||||
mTaskLoader = new TaskListLoader(mContext);
|
mTaskLoader = new TaskListLoader(mContext);
|
||||||
mTaskAdapter = new TaskAdapter(mTaskLoader);
|
mTaskAdapter = new TaskAdapter(mTaskLoader);
|
||||||
mTaskAdapter.setOnClearAllClickListener(view -> animateClearAllTasks());
|
mTaskAdapter.setOnClearAllClickListener(view -> animateClearAllTasks());
|
||||||
|
@ -151,8 +146,6 @@ public final class IconRecentsView extends FrameLayout {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
if (mTaskRecyclerView == null) {
|
if (mTaskRecyclerView == null) {
|
||||||
mTaskRecyclerView = findViewById(R.id.recent_task_recycler_view);
|
mTaskRecyclerView = findViewById(R.id.recent_task_recycler_view);
|
||||||
ViewGroup.LayoutParams recyclerViewParams = mTaskRecyclerView.getLayoutParams();
|
|
||||||
recyclerViewParams.height = getTaskListHeight(mDeviceProfile);
|
|
||||||
mTaskRecyclerView.setAdapter(mTaskAdapter);
|
mTaskRecyclerView.setAdapter(mTaskAdapter);
|
||||||
mTaskRecyclerView.setLayoutManager(
|
mTaskRecyclerView.setLayoutManager(
|
||||||
new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */));
|
new LinearLayoutManager(mContext, VERTICAL, true /* reverseLayout */));
|
||||||
|
|
|
@ -19,7 +19,6 @@ import static com.android.quickstep.TaskAdapter.MAX_TASKS_TO_DISPLAY;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.android.launcher3.DeviceProfile;
|
|
||||||
import com.android.launcher3.InvariantDeviceProfile;
|
import com.android.launcher3.InvariantDeviceProfile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,18 +26,8 @@ import com.android.launcher3.InvariantDeviceProfile;
|
||||||
*/
|
*/
|
||||||
public final class TaskLayoutUtils {
|
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() {}
|
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
|
* 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
|
* 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);
|
return (int) (availableHeight * 1.0f / MAX_TASKS_TO_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getClearAllButtonHeight(DeviceProfile dp) {
|
public static int getClearAllButtonHeight(Context context) {
|
||||||
return (int) (BUTTON_TO_DEVICE_HEIGHT_RATIO * getDeviceLongWidth(dp));
|
// TODO: Implement this
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue