diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index 468293862cd3d..61c844ac81706 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -1002,6 +1002,7 @@ public class ChooserActivity extends ResolverActivity implements mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row); adjustPreviewWidth(newConfig.orientation, null); updateStickyContentPreview(); + updateTabPadding(); } private boolean shouldDisplayLandscape(int orientation) { @@ -1024,6 +1025,20 @@ public class ChooserActivity extends ResolverActivity implements updateLayoutWidth(R.id.content_preview_file_layout, width, parent); } + private void updateTabPadding() { + if (shouldShowTabs()) { + View tabs = findViewById(R.id.tabs); + float iconSize = getResources().getDimension(R.dimen.chooser_icon_size); + // The entire width consists of icons or padding. Divide the item padding in half to get + // paddingHorizontal. + float padding = (tabs.getWidth() - mMaxTargetsPerRow * iconSize) + / mMaxTargetsPerRow / 2; + // Subtract the margin the buttons already have. + padding -= getResources().getDimension(R.dimen.resolver_profile_tab_margin); + tabs.setPadding((int) padding, 0, (int) padding, 0); + } + } + private void updateLayoutWidth(int layoutResourceId, int width, View parent) { View view = parent.findViewById(layoutResourceId); if (view != null && view.getLayoutParams() != null) { @@ -2480,6 +2495,8 @@ public class ChooserActivity extends ResolverActivity implements recyclerView.setAdapter(gridAdapter); ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount( mMaxTargetsPerRow); + + updateTabPadding(); } UserHandle currentUserHandle = mChooserMultiProfilePagerAdapter.getCurrentUserHandle(); diff --git a/core/res/res/layout/resolver_list.xml b/core/res/res/layout/resolver_list.xml index 8480ec37a79e6..6a200d05c2d78 100644 --- a/core/res/res/layout/resolver_list.xml +++ b/core/res/res/layout/resolver_list.xml @@ -90,11 +90,13 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> + 0dp 48dp 8dp + 4dp 18dp diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index ce0c725934ab6..36ac2595907b1 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -4321,6 +4321,7 @@ +