summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubham Basu <basushubham@google.com>2021-09-17 15:51:31 -0700
committerShubham Basu <basushubham@google.com>2021-09-27 14:02:21 -0700
commit90940fb8c10beb2b06dd927db08ba065571c1f61 (patch)
tree54b64a01481d6ea4d58ea3e178feb90934c852fa
parentfb3b16a593a92b4eed47bd0c4b8fa6cd6bca35a3 (diff)
downloadDocumentsUI-90940fb8c10beb2b06dd927db08ba065571c1f61.tar.gz
fix: adding padding top and changing default color for tab
bug: 187798688 test: manual Android S: https://screenshot.googleplex.com/7UC2b2Fa4Ti6G3W.png Android R: https://screenshot.googleplex.com/7k6FayW4Spps3KR.png Change-Id: Ib092777d9015152806dd8ba15cf99e247abac3f6
-rw-r--r--res/values-v31/colors.xml5
-rw-r--r--res/values-v31/dimens.xml4
-rw-r--r--src/com/android/documentsui/ProfileTabs.java16
3 files changed, 21 insertions, 4 deletions
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index a6820181d..72de6e574 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -33,10 +33,9 @@
<color name="profile_tab_selected_color">@*android:color/system_accent1_100
</color>
<!-- accent 100 -->
- <color name="profile_tab_default_color">@*android:color/system_neutral1_100
+ <color name="profile_tab_default_color">@*android:color/system_neutral1_10
</color>
- <!-- neutral 100 -->
-
+ <!-- neutral 10 -->
<color name="fragment_pick_inactive_button_color">
@*android:color/system_neutral1_100
</color>
diff --git a/res/values-v31/dimens.xml b/res/values-v31/dimens.xml
index 87b5f1a6e..79b300541 100644
--- a/res/values-v31/dimens.xml
+++ b/res/values-v31/dimens.xml
@@ -18,7 +18,11 @@
<dimen name="action_bar_margin">0dp</dimen>
<dimen name="button_corner_radius">20dp</dimen>
<dimen name="tab_selector_indicator_height">0dp</dimen>
+ <dimen name="tab_height">36dp</dimen>
+ <dimen name="tab_container_height">48dp</dimen>
<dimen name="profile_tab_padding">20dp</dimen>
+ <dimen name="profile_tab_margin_top">16dp</dimen>
+ <dimen name="profile_tab_margin_side">4dp</dimen>
<dimen name="cross_profile_button_corner_radius">30dp</dimen>
<dimen name="cross_profile_button_stroke_width">1dp</dimen>
<dimen name="cross_profile_button_message_margin_top">16dp</dimen>
diff --git a/src/com/android/documentsui/ProfileTabs.java b/src/com/android/documentsui/ProfileTabs.java
index cf3c7f7a8..3d59051b1 100644
--- a/src/com/android/documentsui/ProfileTabs.java
+++ b/src/com/android/documentsui/ProfileTabs.java
@@ -105,6 +105,15 @@ public class ProfileTabs implements ProfileTabsAddons {
// Material next changes apply only for version S or greater
if(VersionUtils.isAtLeastS()) {
mTabSeparator.setVisibility(View.GONE);
+ int tabContainerHeightInDp = (int)mTabsContainer.getContext().getResources().
+ getDimension(R.dimen.tab_container_height);
+ mTabsContainer.getLayoutParams().height = tabContainerHeightInDp;
+ ViewGroup.MarginLayoutParams tabContainerMarginLayoutParams =
+ (ViewGroup.MarginLayoutParams) mTabsContainer.getLayoutParams();
+ int tabContainerMarginTop = (int)mTabsContainer.getContext().getResources().
+ getDimension(R.dimen.profile_tab_margin_top);
+ tabContainerMarginLayoutParams.setMargins(0, tabContainerMarginTop, 0, 0);
+ mTabsContainer.requestLayout();
for (int i = 0; i < mTabs.getTabCount(); i++) {
// Tablayout holds a view that contains the individual tab
@@ -113,7 +122,12 @@ public class ProfileTabs implements ProfileTabsAddons {
// Get individual tab to set the style
ViewGroup.MarginLayoutParams marginLayoutParams =
(ViewGroup.MarginLayoutParams) tab.getLayoutParams();
- marginLayoutParams.setMargins(10, 20, 10, 20);
+ int tabMarginSide = (int)mTabsContainer.getContext().getResources().
+ getDimension(R.dimen.profile_tab_margin_side);
+ marginLayoutParams.setMargins(tabMarginSide, 0, tabMarginSide, 0);
+ int tabHeightInDp = (int)mTabsContainer.getContext().getResources().
+ getDimension(R.dimen.tab_height);
+ tab.getLayoutParams().height = tabHeightInDp;
tab.requestLayout();
tab.setBackgroundResource(R.drawable.tab_border_rounded);
}