summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorChris Poultney <poultney@google.com>2022-11-11 16:09:57 +0000
committerChris Poultney <poultney@google.com>2022-11-11 16:29:12 +0000
commite04905c6160645eeafb26420cf64e72bac38ca8d (patch)
tree806d8dc4e00f3ea36338bea5347a4d595145cc48 /src/com/android
parentf2ca29fa0018584f33f68af60d10838bcbb348aa (diff)
downloadThemePicker-e04905c6160645eeafb26420cf64e72bac38ca8d.tar.gz
Fix overlap between app grid options in wallpaper settings.
Large form factor: http://screen/9BVmRyiEcmFAWwE Small form factor: http://screen/VVj2pVVocFmyHta Fixes: 244257522 Test: TreeHugger Change-Id: Ia358167e800b26f17629777395a210e527e7f091
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/customization/widget/OptionSelectorController.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/com/android/customization/widget/OptionSelectorController.java b/src/com/android/customization/widget/OptionSelectorController.java
index ffd70e0a..95924fa6 100644
--- a/src/com/android/customization/widget/OptionSelectorController.java
+++ b/src/com/android/customization/widget/OptionSelectorController.java
@@ -291,13 +291,13 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
final DisplayMetrics metrics = new DisplayMetrics();
mContainer.getContext().getSystemService(WindowManager.class)
.getDefaultDisplay().getMetrics(metrics);
- // This is based on the assumption that the parent view is the same width as the screen.
- final int availableDynamicWidth = metrics.widthPixels - 2 * res.getDimensionPixelSize(
- R.dimen.section_horizontal_padding);
- final int availableWidth = (fixWidth != 0) ? fixWidth : availableDynamicWidth;
final boolean hasDecoration = mContainer.getItemDecorationCount() != 0;
if (mUseGrid) {
+ // This is based on the assumption that the parent view is the same width as the screen.
+ final int availableDynamicWidth = metrics.widthPixels - 2 * res.getDimensionPixelSize(
+ R.dimen.section_horizontal_padding);
+ final int availableWidth = (fixWidth != 0) ? fixWidth : availableDynamicWidth;
int numColumns = res.getInteger(R.integer.options_grid_num_columns);
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContainer.getContext(),
numColumns);
@@ -320,6 +320,8 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
hasDecoration ? 0 : 2 * padding);
mContainer.setLayoutManager(new LinearLayoutManager(mContainer.getContext(),
LinearLayoutManager.HORIZONTAL, false));
+ mContainer.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
+ int availableWidth = metrics.widthPixels;
int extraSpace = availableWidth - mContainer.getMeasuredWidth();
if (extraSpace >= 0) {
mContainer.setOverScrollMode(View.OVER_SCROLL_NEVER);
@@ -331,10 +333,8 @@ public class OptionSelectorController<T extends CustomizationOption<T>> {
- mContainer.getPaddingLeft();
int itemEndMargin =
spaceBetweenItems / (int) mLinearLayoutHorizontalDisplayOptionsMax;
- if (itemEndMargin <= 0) {
- itemEndMargin = res.getDimensionPixelOffset(
- R.dimen.option_tile_margin_horizontal);
- }
+ itemEndMargin = Math.max(itemEndMargin, res.getDimensionPixelOffset(
+ R.dimen.option_tile_margin_horizontal));
mContainer.addItemDecoration(new ItemEndHorizontalSpaceItemDecoration(
mContainer.getContext(), itemEndMargin));
return;