From c2df207616a882d75f48fcb4112242adb8ffe884 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Tue, 10 Jul 2018 18:41:17 +0000 Subject: Revert "UI refresh for bottom nav bar." This reverts commit 9af4b65fa7717a647e3c8996cbbbcc93637aeab4. Change-Id: I5610ae55eb9c22609e3e6a73ea0ce6a5ef3c0cda --- .../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, 80 insertions(+), 39 deletions(-) create mode 100644 java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml (limited to 'java') 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); } } } 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 e02d7c441..65bc8f9b4 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,6 +16,8 @@ --> - + android:shape="rectangle"> + + + \ 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 8c0705fe0..02874a9d8 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,41 +16,49 @@ --> + android:gravity="center" + android:background="?android:attr/selectableItemBackgroundBorderless"> - + + + + + + - + android:gravity="center_horizontal" + android:textSize="12sp" + style="@style/Dialer.TextAppearance.Secondary"/> \ 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 new file mode 100644 index 000000000..8fd376bda --- /dev/null +++ b/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml @@ -0,0 +1,21 @@ + + + + 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 0af550fce..207d29c80 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 - #EA4335 + #C53929 #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 1f2d6c728..df5dafa31 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,12 +37,6 @@ sans-serif-medium - -