Merge "Align outer edge of profile tabs and icons" into tm-dev am: 4a191d7fad
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18566767 Change-Id: Ie03da3c82960034d1777511e58b1dc04a4ee6e70 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1002,6 +1002,7 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row);
|
mMaxTargetsPerRow = getResources().getInteger(R.integer.config_chooser_max_targets_per_row);
|
||||||
adjustPreviewWidth(newConfig.orientation, null);
|
adjustPreviewWidth(newConfig.orientation, null);
|
||||||
updateStickyContentPreview();
|
updateStickyContentPreview();
|
||||||
|
updateTabPadding();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldDisplayLandscape(int orientation) {
|
private boolean shouldDisplayLandscape(int orientation) {
|
||||||
@@ -1024,6 +1025,20 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
updateLayoutWidth(R.id.content_preview_file_layout, width, parent);
|
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) {
|
private void updateLayoutWidth(int layoutResourceId, int width, View parent) {
|
||||||
View view = parent.findViewById(layoutResourceId);
|
View view = parent.findViewById(layoutResourceId);
|
||||||
if (view != null && view.getLayoutParams() != null) {
|
if (view != null && view.getLayoutParams() != null) {
|
||||||
@@ -2480,6 +2495,8 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
recyclerView.setAdapter(gridAdapter);
|
recyclerView.setAdapter(gridAdapter);
|
||||||
((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount(
|
((GridLayoutManager) recyclerView.getLayoutManager()).setSpanCount(
|
||||||
mMaxTargetsPerRow);
|
mMaxTargetsPerRow);
|
||||||
|
|
||||||
|
updateTabPadding();
|
||||||
}
|
}
|
||||||
|
|
||||||
UserHandle currentUserHandle = mChooserMultiProfilePagerAdapter.getCurrentUserHandle();
|
UserHandle currentUserHandle = mChooserMultiProfilePagerAdapter.getCurrentUserHandle();
|
||||||
|
|||||||
@@ -90,11 +90,13 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
<!-- horizontal padding = 8dp content padding - 4dp margin that tab buttons have. -->
|
||||||
<TabWidget
|
<TabWidget
|
||||||
android:id="@android:id/tabs"
|
android:id="@android:id/tabs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:tabStripEnabled="false"
|
android:tabStripEnabled="false"
|
||||||
|
android:paddingHorizontal="4dp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@android:id/tabcontent"
|
android:id="@android:id/tabcontent"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_marginVertical="6dp"
|
android:layout_marginVertical="6dp"
|
||||||
android:layout_marginHorizontal="4dp"
|
android:layout_marginHorizontal="@dimen/resolver_profile_tab_margin"
|
||||||
android:background="@drawable/resolver_profile_tab_bg"
|
android:background="@drawable/resolver_profile_tab_bg"
|
||||||
android:textColor="@color/resolver_profile_tab_text"
|
android:textColor="@color/resolver_profile_tab_text"
|
||||||
android:textSize="@dimen/resolver_tab_text_size"
|
android:textSize="@dimen/resolver_tab_text_size"
|
||||||
|
|||||||
@@ -962,6 +962,7 @@
|
|||||||
<dimen name="resolver_title_padding_bottom">0dp</dimen>
|
<dimen name="resolver_title_padding_bottom">0dp</dimen>
|
||||||
<dimen name="resolver_empty_state_container_padding_top">48dp</dimen>
|
<dimen name="resolver_empty_state_container_padding_top">48dp</dimen>
|
||||||
<dimen name="resolver_empty_state_container_padding_bottom">8dp</dimen>
|
<dimen name="resolver_empty_state_container_padding_bottom">8dp</dimen>
|
||||||
|
<dimen name="resolver_profile_tab_margin">4dp</dimen>
|
||||||
|
|
||||||
<dimen name="chooser_action_button_icon_size">18dp</dimen>
|
<dimen name="chooser_action_button_icon_size">18dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -4321,6 +4321,7 @@
|
|||||||
<java-symbol type="dimen" name="resolver_title_padding_bottom" />
|
<java-symbol type="dimen" name="resolver_title_padding_bottom" />
|
||||||
<java-symbol type="dimen" name="resolver_empty_state_container_padding_top" />
|
<java-symbol type="dimen" name="resolver_empty_state_container_padding_top" />
|
||||||
<java-symbol type="dimen" name="resolver_empty_state_container_padding_bottom" />
|
<java-symbol type="dimen" name="resolver_empty_state_container_padding_bottom" />
|
||||||
|
<java-symbol type="dimen" name="resolver_profile_tab_margin" />
|
||||||
|
|
||||||
<java-symbol type="string" name="config_deviceSpecificDisplayAreaPolicyProvider" />
|
<java-symbol type="string" name="config_deviceSpecificDisplayAreaPolicyProvider" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user