diff options
author | Eric Erfanian <erfanian@google.com> | 2018-07-10 14:23:00 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-07-10 14:23:00 -0700 |
commit | 51733a7747f1b15817f83ed12c37e54ffbc0b081 (patch) | |
tree | ce72b720421049c0b4094ab8c9843bc6b7ac80bc /java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java | |
parent | 56162775ef882d22b0308dcc32b2ed1dcd9d8d9f (diff) | |
parent | 9ef4e5430114fa5996d0ceaeb4dad3fb2d4ee811 (diff) |
Merge changes from topic "ui-update" am: e0dbd9f907 am: 247a5d039a
am: 9ef4e54301
Change-Id: I4513871ae9e89c314bc5f275ff0f6af3c597987b
Diffstat (limited to 'java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java')
-rw-r--r-- | java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 48cfc8160..4794b8823 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -20,18 +20,20 @@ import android.content.Context; import android.content.res.ColorStateList; import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; +import android.support.annotation.Px; import android.support.annotation.StringRes; import android.util.AttributeSet; import android.view.View; +import android.widget.FrameLayout; import android.widget.ImageView; -import android.widget.RelativeLayout; +import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.theme.base.ThemeComponent; /** Navigation item in a bottom nav. */ -final class BottomNavItem extends RelativeLayout { +final class BottomNavItem extends LinearLayout { private ImageView image; private TextView text; @@ -55,7 +57,7 @@ final class BottomNavItem extends RelativeLayout { int colorId = selected ? ThemeComponent.get(getContext()).theme().getColorPrimary() - : ThemeComponent.get(getContext()).theme().getColorIcon(); + : ThemeComponent.get(getContext()).theme().getTextColorSecondary(); image.setImageTintList(ColorStateList.valueOf(colorId)); text.setTextColor(colorId); } @@ -85,6 +87,20 @@ final class BottomNavItem extends RelativeLayout { } notificationBadge.setVisibility(View.VISIBLE); notificationBadge.setText(countString); + + @Px int margin; + if (countString.length() == 1) { + margin = getContext().getResources().getDimensionPixelSize(R.dimen.badge_margin_length_1); + } else if (countString.length() == 2) { + margin = getContext().getResources().getDimensionPixelSize(R.dimen.badge_margin_length_2); + } else { + margin = getContext().getResources().getDimensionPixelSize(R.dimen.badge_margin_length_3); + } + + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) image.getLayoutParams(); + params.setMarginStart(margin); + params.setMarginEnd(margin); + image.setLayoutParams(params); } } } |