summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-02-05 17:45:51 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-05 19:25:06 -0800
commit1407d25aa8f79e6ff5badc2ed8c234827c762a84 (patch)
tree91804da70150b462b251f62b910d5608835d66f0 /java
parente3fda9ecc6ec80c55bcb9b6110c4031023c6aa3b (diff)
Updated bottom nav to match redlines.
Bug: 72525324 Test: manual PiperOrigin-RevId: 184615350 Change-Id: Ic5701d67111e38f73dfa4be31dd89115ad7f5bb8
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/main/impl/MainActivity.java2
-rw-r--r--java/com/android/dialer/main/impl/MainSearchController.java1
-rw-r--r--java/com/android/dialer/main/impl/NewMainActivityPeer.java5
-rw-r--r--java/com/android/dialer/main/impl/OldMainActivityPeer.java5
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/AndroidManifest.xml16
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/BottomNavBar.java (renamed from java/com/android/dialer/main/impl/BottomNavBar.java)10
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/BottomNavItem.java (renamed from java/com/android/dialer/main/impl/BottomNavItem.java)23
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/drawable/notification_badge.xml (renamed from java/com/android/dialer/main/impl/res/drawable/notification_badge.xml)7
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_bar_layout.xml (renamed from java/com/android/dialer/main/impl/res/layout/bottom_nav_bar_layout.xml)6
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/layout/bottom_nav_item.xml (renamed from java/com/android/dialer/main/impl/res/layout/bottom_nav_item.xml)24
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml (renamed from java/com/android/dialer/main/impl/res/values/colors.xml)6
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/values/dimens.xml21
-rw-r--r--java/com/android/dialer/main/impl/bottomnav/res/values/strings.xml26
-rw-r--r--java/com/android/dialer/main/impl/res/values/strings.xml9
14 files changed, 119 insertions, 42 deletions
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java
index 24c3df575..85f9c9f4b 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.DisambigDialogDism
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 62ecc5389..0296ec911 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.constants.ActivityRequestCodes;
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 cc4c3e7fd..789648928 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.FragmentManager;
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 dd766d087..a27bdd23a 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.LastOutgoingCallCallback;
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 000000000..9b970f203
--- /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
index 97f526251..a580aee68 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 @@ public final class BottomNavBar extends LinearLayout {
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 @@ public final class BottomNavBar extends LinearLayout {
*
* @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 @@ public final class BottomNavBar extends LinearLayout {
}
}
- 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 @@ public final class BottomNavBar extends LinearLayout {
}
}
- 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
index af7399b6c..2c1b4f5d7 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 @@ final class BottomNavItem extends LinearLayout {
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
index 2d0dafe93..67e3f375d 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
index 67c1a20df..02ba3abd5 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
index 2d9998af2..5dddd3de5 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/values/colors.xml b/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml
index 3d348653c..b858b4f8c 100644
--- a/java/com/android/dialer/main/impl/res/values/colors.xml
+++ b/java/com/android/dialer/main/impl/bottomnav/res/values/colors.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
- ~ Copyright (C) 2017 The Android Open Source Project
+ ~ 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.
@@ -15,6 +15,6 @@
~ limitations under the License
-->
<resources>
- <color name="bottom_nav_icon_selected">#FFFFFF</color>
- <color name="bottom_nav_icon_deselected">#B2FFFFFF</color>
+ <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/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 @@
+<?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>
+ <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 000000000..ca5db1f49
--- /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/strings.xml b/java/com/android/dialer/main/impl/res/values/strings.xml
index 0fc1246d6..c842beeff 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>