diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-02-24 21:02:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-02-24 21:02:14 +0000 |
commit | 19a126b0c12c0ea93ffe7f60f3250e81aa305785 (patch) | |
tree | 716006ff47663e8741ab609b4cfc153df8348183 /java/com/android/dialer/main/impl/bottomnav | |
parent | a39e732c6326f6265a213024bbb6899aea04f10a (diff) | |
parent | 35ecd12f1617f36d8d22fecdabf9c63cbf92599d (diff) |
Merge "Cancel Old SpeedDial contact loaders when they are reset."
Diffstat (limited to 'java/com/android/dialer/main/impl/bottomnav')
3 files changed, 19 insertions, 2 deletions
diff --git a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java index 2c1b4f5d7..2519d23cb 100644 --- a/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java +++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java @@ -29,6 +29,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.dialer.common.Assert; +import com.android.dialer.configprovider.ConfigProviderBindings; /** Navigation item in a bottom nav. */ final class BottomNavItem extends LinearLayout { @@ -68,7 +69,17 @@ final class BottomNavItem extends LinearLayout { if (count == 0) { notificationBadge.setVisibility(View.INVISIBLE); } else { - String countString = count > 99 ? "99+" : String.format(Integer.toString(count)); + String countString = String.format(Integer.toString(count)); + + boolean use99PlusCount = + ConfigProviderBindings.get(getContext()).getBoolean("use_99_plus", false); + boolean use9Plus = !use99PlusCount; + + if (use99PlusCount && count > 99) { + countString = getContext().getString(R.string.bottom_nav_count_99_plus); + } else if (use9Plus && count > 9) { + countString = getContext().getString(R.string.bottom_nav_count_9_plus); + } notificationBadge.setVisibility(View.VISIBLE); notificationBadge.setText(countString); 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 5dddd3de5..d319b2ed9 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 @@ -32,7 +32,7 @@ android:id="@+id/bottom_nav_item_image" android:layout_width="24dp" android:layout_height="24dp" - android:layout_marginTop="7dp"/> + android:layout_marginTop="4dp"/> <TextView android:id="@+id/notification_badge" diff --git a/java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml b/java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml index ca5db1f49..6d3886959 100644 --- a/java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml +++ b/java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml @@ -23,4 +23,10 @@ <string name="tab_title_voicemail">Voicemail</string> <!-- Tab text to show users their contacts [CHAR LIMIT=10] --> <string name="tab_title_contacts">Contacts</string> + + <!-- Notification badge indicating that there are more than 9 notifications for the user [CHAR LIMIT=3] --> + <string name="bottom_nav_count_9_plus">9+</string> + + <!-- Notification badge indicating that there are more than 9 notifications for the user [CHAR LIMIT=3] --> + <string name="bottom_nav_count_99_plus">99+</string> </resources>
\ No newline at end of file |