From 9af4b65fa7717a647e3c8996cbbbcc93637aeab4 Mon Sep 17 00:00:00 2001 From: wangqi Date: Thu, 28 Jun 2018 13:39:44 -0700 Subject: UI refresh for bottom nav bar. Bug: 73963403 Test: manual PiperOrigin-RevId: 202535473 Change-Id: Iccb4e72c63cbf031399448ee2def5dcb3a152081 --- .../dialer/main/impl/bottomnav/BottomNavItem.java | 22 ++------ .../bottomnav/res/drawable/notification_badge.xml | 6 +-- .../impl/bottomnav/res/layout/bottom_nav_item.xml | 62 ++++++++++------------ .../main/impl/bottomnav/res/values/dimens.xml | 21 -------- .../dialer/theme/common/res/values/colors.xml | 2 +- .../dialer/theme/common/res/values/text_styles.xml | 6 +++ 6 files changed, 39 insertions(+), 80 deletions(-) delete mode 100644 java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml (limited to 'java/com') diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 4794b8823..48cfc8160 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -20,20 +20,18 @@ 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.LinearLayout; +import android.widget.RelativeLayout; 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 LinearLayout { +final class BottomNavItem extends RelativeLayout { private ImageView image; private TextView text; @@ -57,7 +55,7 @@ final class BottomNavItem extends LinearLayout { int colorId = selected ? ThemeComponent.get(getContext()).theme().getColorPrimary() - : ThemeComponent.get(getContext()).theme().getTextColorSecondary(); + : ThemeComponent.get(getContext()).theme().getColorIcon(); image.setImageTintList(ColorStateList.valueOf(colorId)); text.setTextColor(colorId); } @@ -87,20 +85,6 @@ final class BottomNavItem extends LinearLayout { } 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); } } } diff --git a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml index 65bc8f9b4..e02d7c441 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml @@ -16,8 +16,6 @@ --> - - - + android:shape="oval"> + \ No newline at end of file diff --git a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml index 02874a9d8..8c0705fe0 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml @@ -16,49 +16,41 @@ --> + android:minWidth="80dp"> - - - - - - + + + android:layout_below="@id/bottom_nav_item_image" + android:layout_centerHorizontal="true" + android:gravity="center_horizontal"/> \ No newline at end of file diff --git a/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml b/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml deleted file mode 100644 index 8fd376bda..000000000 --- a/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - 10dp - 14dp - 22dp - \ No newline at end of file diff --git a/java/com/android/dialer/theme/common/res/values/colors.xml b/java/com/android/dialer/theme/common/res/values/colors.xml index 207d29c80..0af550fce 100644 --- a/java/com/android/dialer/theme/common/res/values/colors.xml +++ b/java/com/android/dialer/theme/common/res/values/colors.xml @@ -27,7 +27,7 @@ #A52714 #097138 - #C53929 + #EA4335 #CFD8DC diff --git a/java/com/android/dialer/theme/common/res/values/text_styles.xml b/java/com/android/dialer/theme/common/res/values/text_styles.xml index df5dafa31..1f2d6c728 100644 --- a/java/com/android/dialer/theme/common/res/values/text_styles.xml +++ b/java/com/android/dialer/theme/common/res/values/text_styles.xml @@ -37,6 +37,12 @@ sans-serif-medium + +