Align layout to dp grid for landscape
Set a fixed width for the recyclerview and center it for landscape mode. In addition, put a margin below the clear all button as we no longer have the nav bar padding the area below. Bug: 131610834 Test: Manual; See recents UI in landscape mode Change-Id: I8c74d2d7cc363a76c4c978befdc975693d700f86
This commit is contained in:
@@ -21,8 +21,9 @@
|
||||
android:orientation="vertical">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recent_task_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="@dimen/recents_list_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:scrollbars="none"/>
|
||||
<TextView
|
||||
android:id="@+id/recent_task_empty_view"
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<dimen name="recents_list_width">320dp</dimen>
|
||||
|
||||
<dimen name="task_item_height">60dp</dimen>
|
||||
<dimen name="task_item_top_margin">16dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_horiz_margin">16dp</dimen>
|
||||
@@ -23,5 +25,6 @@
|
||||
|
||||
<dimen name="clear_all_item_view_height">36dp</dimen>
|
||||
<dimen name="clear_all_item_view_top_margin">20dp</dimen>
|
||||
<dimen name="clear_all_item_view_landscape_bottom_margin">20dp</dimen>
|
||||
<dimen name="clear_all_button_width">106dp</dimen>
|
||||
</resources>
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.quickstep.views;
|
||||
|
||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||
|
||||
import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL;
|
||||
|
||||
@@ -31,6 +32,8 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.PropertyValuesHolder;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.util.ArraySet;
|
||||
import android.util.AttributeSet;
|
||||
@@ -185,16 +188,18 @@ public final class IconRecentsView extends FrameLayout {
|
||||
// TODO: Determine if current margins cause off screen item to be fully off
|
||||
// screen and if so, modify them so that it is partially off screen.
|
||||
int itemType = parent.getChildViewHolder(view).getItemViewType();
|
||||
Resources res = getResources();
|
||||
switch (itemType) {
|
||||
case ITEM_TYPE_CLEAR_ALL:
|
||||
outRect.top = (int) getResources().getDimension(
|
||||
outRect.top = (int) res.getDimension(
|
||||
R.dimen.clear_all_item_view_top_margin);
|
||||
// TODO: In landscape, add bottom margin as well since we won't have
|
||||
// nav bar to buffer things nicely.
|
||||
if (res.getConfiguration().orientation == ORIENTATION_LANDSCAPE) {
|
||||
outRect.bottom = (int) res.getDimension(
|
||||
R.dimen.clear_all_item_view_landscape_bottom_margin);
|
||||
}
|
||||
break;
|
||||
case ITEM_TYPE_TASK:
|
||||
outRect.top = (int) getResources().getDimension(
|
||||
R.dimen.task_item_top_margin);
|
||||
outRect.top = (int) res.getDimension(R.dimen.task_item_top_margin);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -227,6 +232,11 @@ public final class IconRecentsView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConfigurationChanged(Configuration newConfig) {
|
||||
mTaskRecyclerView.invalidateItemDecorations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set activity helper for the view to callback to.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user