Updated bottom nav to match redlines.

Bug: 72525324
Test: manual
PiperOrigin-RevId: 184615350
Change-Id: Ic5701d67111e38f73dfa4be31dd89115ad7f5bb8
diff --git a/assets/quantum/res/drawable/quantum_ic_access_time_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_access_time_vd_theme_24.xml
new file mode 100644
index 0000000..b490b3c
--- /dev/null
+++ b/assets/quantum/res/drawable/quantum_ic_access_time_vd_theme_24.xml
@@ -0,0 +1,25 @@
+<!--
+  ~ Copyright (C) 2017 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24.0"
+    android:viewportHeight="24.0"
+    android:tint="?attr/colorControlNormal">
+  <path
+      android:fillColor="@android:color/white"
+      android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7L11,7v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
+</vector>
\ No newline at end of file
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java
index 24c3df5..85f9c9f 100644
--- a/java/com/android/dialer/main/impl/MainActivity.java
+++ b/java/com/android/dialer/main/impl/MainActivity.java
@@ -26,7 +26,7 @@
 import com.android.dialer.interactions.PhoneNumberInteraction.InteractionErrorCode;
 import com.android.dialer.interactions.PhoneNumberInteraction.InteractionErrorListener;
 import com.android.dialer.main.MainActivityPeer;
-import com.android.dialer.main.impl.BottomNavBar.TabIndex;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex;
 import com.android.dialer.util.TransactionSafeActivity;
 
 /** This is the main activity for dialer. It hosts favorites, call log, search, dialpad, etc... */
diff --git a/java/com/android/dialer/main/impl/MainSearchController.java b/java/com/android/dialer/main/impl/MainSearchController.java
index 62ecc53..0296ec9 100644
--- a/java/com/android/dialer/main/impl/MainSearchController.java
+++ b/java/com/android/dialer/main/impl/MainSearchController.java
@@ -36,6 +36,7 @@
 import com.android.dialer.dialpadview.DialpadFragment;
 import com.android.dialer.dialpadview.DialpadFragment.DialpadListener;
 import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar;
 import com.android.dialer.main.impl.toolbar.MainToolbar;
 import com.android.dialer.main.impl.toolbar.SearchBarListener;
 import com.android.dialer.searchfragment.list.NewSearchFragment;
diff --git a/java/com/android/dialer/main/impl/NewMainActivityPeer.java b/java/com/android/dialer/main/impl/NewMainActivityPeer.java
index cc4c3e7..7896489 100644
--- a/java/com/android/dialer/main/impl/NewMainActivityPeer.java
+++ b/java/com/android/dialer/main/impl/NewMainActivityPeer.java
@@ -22,8 +22,9 @@
 import android.support.v4.app.FragmentTransaction;
 import com.android.dialer.calllog.ui.NewCallLogFragment;
 import com.android.dialer.main.MainActivityPeer;
-import com.android.dialer.main.impl.BottomNavBar.OnBottomNavTabSelectedListener;
-import com.android.dialer.main.impl.BottomNavBar.TabIndex;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex;
 import com.android.dialer.voicemail.listui.NewVoicemailFragment;
 
 /** MainActivityPeer that implements the new fragments. */
diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
index dd766d0..a27bdd2 100644
--- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java
+++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java
@@ -67,8 +67,9 @@
 import com.android.dialer.dialpadview.DialpadFragment.OnDialpadQueryChangedListener;
 import com.android.dialer.interactions.PhoneNumberInteraction;
 import com.android.dialer.main.MainActivityPeer;
-import com.android.dialer.main.impl.BottomNavBar.OnBottomNavTabSelectedListener;
-import com.android.dialer.main.impl.BottomNavBar.TabIndex;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar.OnBottomNavTabSelectedListener;
+import com.android.dialer.main.impl.bottomnav.BottomNavBar.TabIndex;
 import com.android.dialer.main.impl.toolbar.MainToolbar;
 import com.android.dialer.postcall.PostCall;
 import com.android.dialer.precall.PreCall;
diff --git a/java/com/android/dialer/main/impl/bottomnav/AndroidManifest.xml b/java/com/android/dialer/main/impl/bottomnav/AndroidManifest.xml
new file mode 100644
index 0000000..9b970f2
--- /dev/null
+++ b/java/com/android/dialer/main/impl/bottomnav/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<!--
+ ~ Copyright (C) 2018 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~      http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<manifest package="com.android.dialer.main.impl.bottomnav"/>
diff --git a/java/com/android/dialer/main/impl/BottomNavBar.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
similarity index 94%
rename from java/com/android/dialer/main/impl/BottomNavBar.java
rename to java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
index 97f5262..a580aee 100644
--- a/java/com/android/dialer/main/impl/BottomNavBar.java
+++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java
@@ -14,7 +14,7 @@
  * limitations under the License
  */
 
-package com.android.dialer.main.impl;
+package com.android.dialer.main.impl.bottomnav;
 
 import android.content.Context;
 import android.support.annotation.IntDef;
@@ -67,7 +67,7 @@
     voicemail = findViewById(R.id.voicemail_tab);
 
     speedDial.setup(R.string.tab_title_speed_dial, R.drawable.quantum_ic_star_vd_theme_24);
-    callLog.setup(R.string.tab_title_call_history, R.drawable.quantum_ic_history_vd_theme_24);
+    callLog.setup(R.string.tab_title_call_history, R.drawable.quantum_ic_access_time_vd_theme_24);
     contacts.setup(R.string.tab_title_contacts, R.drawable.quantum_ic_people_vd_theme_24);
     voicemail.setup(R.string.tab_title_voicemail, R.drawable.quantum_ic_voicemail_vd_theme_24);
 
@@ -109,7 +109,7 @@
    *
    * @param tab {@link TabIndex}
    */
-  void selectTab(@TabIndex int tab) {
+  public void selectTab(@TabIndex int tab) {
     if (tab == TabIndex.SPEED_DIAL) {
       speedDial.performClick();
     } else if (tab == TabIndex.CALL_LOG) {
@@ -123,7 +123,7 @@
     }
   }
 
-  void setNotificationCount(@TabIndex int tab, int count) {
+  public void setNotificationCount(@TabIndex int tab, int count) {
     if (tab == TabIndex.SPEED_DIAL) {
       speedDial.setNotificationCount(count);
     } else if (tab == TabIndex.CALL_LOG) {
@@ -137,7 +137,7 @@
     }
   }
 
-  void addOnTabSelectedListener(OnBottomNavTabSelectedListener listener) {
+  public void addOnTabSelectedListener(OnBottomNavTabSelectedListener listener) {
     listeners.add(listener);
   }
 
diff --git a/java/com/android/dialer/main/impl/BottomNavItem.java b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
similarity index 70%
rename from java/com/android/dialer/main/impl/BottomNavItem.java
rename to java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
index af7399b..2c1b4f5 100644
--- a/java/com/android/dialer/main/impl/BottomNavItem.java
+++ b/java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java
@@ -14,15 +14,17 @@
  * limitations under the License
  */
 
-package com.android.dialer.main.impl;
+package com.android.dialer.main.impl.bottomnav;
 
 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.TextView;
@@ -64,10 +66,25 @@
   void setNotificationCount(int count) {
     Assert.checkArgument(count >= 0, "Invalid count: " + count);
     if (count == 0) {
-      notificationBadge.setVisibility(View.GONE);
+      notificationBadge.setVisibility(View.INVISIBLE);
     } else {
+      String countString = count > 99 ? "99+" : String.format(Integer.toString(count));
       notificationBadge.setVisibility(View.VISIBLE);
-      notificationBadge.setText(String.format(Integer.toString(count)));
+      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/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml
similarity index 79%
rename from java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
rename to java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml
index 2d0dafe..67e3f37 100644
--- a/java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml
@@ -16,7 +16,8 @@
   -->
 <shape
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="oval">
-  <solid android:color="@color/dialer_secondary_color"/>
-  <size android:height="14dp" android:width="14dp"/>
+    android:shape="rectangle">
+  <solid android:color="@color/dialer_theme_color"/>
+  <corners android:radius="18dp"/>
+  <stroke android:color="@color/background_dialer_white" android:width="2dp"/>
 </shape>
\ No newline at end of file
diff --git a/java/com/android/dialer/main/impl/res/layout/bottom_nav_bar_layout.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
similarity index 90%
rename from java/com/android/dialer/main/impl/res/layout/bottom_nav_bar_layout.xml
rename to java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
index 67c1a20..02ba3ab 100644
--- a/java/com/android/dialer/main/impl/res/layout/bottom_nav_bar_layout.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml
@@ -14,12 +14,12 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<com.android.dialer.main.impl.BottomNavBar
+<com.android.dialer.main.impl.bottomnav.BottomNavBar
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@color/dialer_theme_color"
+    android:background="@color/background_dialer_white"
     android:elevation="8dp">
 
   <include
@@ -49,4 +49,4 @@
       android:layout_height="wrap_content"
       android:layout_weight="1"
       layout="@layout/bottom_nav_item"/>
-</com.android.dialer.main.impl.BottomNavBar>
\ No newline at end of file
+</com.android.dialer.main.impl.bottomnav.BottomNavBar>
\ No newline at end of file
diff --git a/java/com/android/dialer/main/impl/res/layout/bottom_nav_item.xml b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml
similarity index 76%
rename from java/com/android/dialer/main/impl/res/layout/bottom_nav_item.xml
rename to java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml
index 2d9998a..5dddd3d 100644
--- a/java/com/android/dialer/main/impl/res/layout/bottom_nav_item.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml
@@ -14,47 +14,49 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<com.android.dialer.main.impl.BottomNavItem
+<com.android.dialer.main.impl.bottomnav.BottomNavItem
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:minWidth="80dp"
-    android:paddingTop="8dp"
-    android:paddingBottom="10dp"
-    android:paddingStart="12dp"
-    android:paddingEnd="12dp"
+    android:minHeight="56dp"
     android:gravity="center"
-    android:theme="@style/Theme.AppCompat"
     android:background="?android:selectableItemBackgroundBorderless">
 
   <FrameLayout
       android:layout_width="wrap_content"
-      android:layout_height="wrap_content"
-      android:layout_marginBottom="2dp">
+      android:layout_height="wrap_content">
 
     <ImageView
         android:id="@+id/bottom_nav_item_image"
         android:layout_width="24dp"
         android:layout_height="24dp"
-        android:layout_margin="4dp"/>
+        android:layout_marginTop="7dp"/>
 
     <TextView
         android:id="@+id/notification_badge"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="top|end"
+        android:paddingStart="6dp"
+        android:paddingEnd="6dp"
+        android:minHeight="20dp"
+        android:minWidth="18dp"
         android:gravity="center"
         android:textSize="12sp"
         android:textColor="@color/dialer_primary_text_color_white"
         android:background="@drawable/notification_badge"
-        android:visibility="gone"/>
+        android:fontFamily="sans-serif-medium"
+        android:visibility="invisible"/>
   </FrameLayout>
 
   <TextView
       android:id="@+id/bottom_nav_item_text"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
+      android:layout_marginBottom="8dp"
       android:textSize="12sp"
+      android:textColor="@color/dialer_theme_color"
       android:gravity="center_horizontal"/>
-</com.android.dialer.main.impl.BottomNavItem>
\ No newline at end of file
+</com.android.dialer.main.impl.bottomnav.BottomNavItem>
\ No newline at end of file
diff --git a/java/com/android/dialer/main/impl/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml
similarity index 75%
copy from java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
copy to java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml
index 2d0dafe..b858b4f 100644
--- a/java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml
@@ -14,9 +14,7 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<shape
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="oval">
-  <solid android:color="@color/dialer_secondary_color"/>
-  <size android:height="14dp" android:width="14dp"/>
-</shape>
\ No newline at end of file
+<resources>
+  <color name="bottom_nav_icon_selected">@color/dialer_theme_color</color>
+  <color name="bottom_nav_icon_deselected">@color/dialer_secondary_text_color</color>
+</resources>
diff --git a/java/com/android/dialer/main/impl/res/drawable/notification_badge.xml b/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml
similarity index 75%
copy from java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
copy to java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml
index 2d0dafe..8fd376b 100644
--- a/java/com/android/dialer/main/impl/res/drawable/notification_badge.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml
@@ -14,9 +14,8 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License
   -->
-<shape
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:shape="oval">
-  <solid android:color="@color/dialer_secondary_color"/>
-  <size android:height="14dp" android:width="14dp"/>
-</shape>
\ No newline at end of file
+<resources>
+  <dimen name="badge_margin_length_1">10dp</dimen>
+  <dimen name="badge_margin_length_2">14dp</dimen>
+  <dimen name="badge_margin_length_3">22dp</dimen>
+</resources>
\ No newline at end of file
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
new file mode 100644
index 0000000..ca5db1f
--- /dev/null
+++ b/java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2018 The Android Open Source Project
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License
+  -->
+<resources>
+  <!-- Tab text to show users their call log/call history [CHAR LIMIT=10] -->
+  <string name="tab_title_call_history">Recents</string>
+  <!-- Tab text to show users their favorite contacts that they can call in 1 click [CHAR LIMIT=10] -->
+  <string name="tab_title_speed_dial">Favorites</string>
+  <!-- Tab text to show users their voicemails  [CHAR LIMIT=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>
+</resources>
\ No newline at end of file
diff --git a/java/com/android/dialer/main/impl/res/values/colors.xml b/java/com/android/dialer/main/impl/res/values/colors.xml
deleted file mode 100644
index 3d34865..0000000
--- a/java/com/android/dialer/main/impl/res/values/colors.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2017 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License
-  -->
-<resources>
-  <color name="bottom_nav_icon_selected">#FFFFFF</color>
-  <color name="bottom_nav_icon_deselected">#B2FFFFFF</color>
-</resources>
diff --git a/java/com/android/dialer/main/impl/res/values/strings.xml b/java/com/android/dialer/main/impl/res/values/strings.xml
index 0fc1246..c842bee 100644
--- a/java/com/android/dialer/main/impl/res/values/strings.xml
+++ b/java/com/android/dialer/main/impl/res/values/strings.xml
@@ -38,15 +38,6 @@
   <!-- A11y announcement to let users know a button will let them view their contacts [CHAR LIMIT=NONE] -->
   <string name="description_contacts">View Contacts</string>
 
-  <!-- Tab text to show users their call log/call history [CHAR LIMIT=10] -->
-  <string name="tab_title_call_history">Call History</string>
-  <!-- Tab text to show users their favorite contacts that they can call in 1 click [CHAR LIMIT=10] -->
-  <string name="tab_title_speed_dial">Speed Dial</string>
-  <!-- Tab text to show users their voicemails  [CHAR LIMIT=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>
-
   <!-- Message displayed when there is no application available to handle voice search. [CHAR LIMIT=NONE] -->
   <string name="voice_search_not_available">Voice search not available</string>
 </resources>
diff --git a/packages.mk b/packages.mk
index 7070722..3a47e26 100644
--- a/packages.mk
+++ b/packages.mk
@@ -38,6 +38,7 @@
 	com.android.dialer.location \
 	com.android.dialer.main.impl \
 	com.android.dialer.main.impl.toolbar \
+	com.android.dialer.main.impl.bottomnav \
 	com.android.dialer.notification \
 	com.android.dialer.oem \
 	com.android.dialer.phonelookup.database \