Update the favorite number disable state.
Using a disabled color for favorite number entry so user can tell if the
phone number has been added to favorite.
Bug: 132811088
Test: manually
Change-Id: I5e24ffd33748c8e4b8d5163d60f413c83e904cb8
diff --git a/res/color/primary_icon_selector.xml b/res/color/primary_icon_selector.xml
new file mode 100644
index 0000000..21e3e45
--- /dev/null
+++ b/res/color/primary_icon_selector.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ Copyright (C) 2019 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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@color/primary_icon_color"
+ android:state_enabled="true"/>
+ <item android:color="@color/secondary_icon_color"
+ android:state_enabled="false"/>
+</selector>
diff --git a/res/color/primary_text_selector.xml b/res/color/primary_text_selector.xml
new file mode 100644
index 0000000..b6c837c
--- /dev/null
+++ b/res/color/primary_text_selector.xml
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ Copyright (C) 2019 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.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@color/primary_text_color"
+ android:state_enabled="true"/>
+ <item android:color="@color/secondary_text_color"
+ android:state_enabled="false"/>
+</selector>
diff --git a/res/layout/add_favorite_number_list_item.xml b/res/layout/add_favorite_number_list_item.xml
index 0cbdb82..ffe5445 100644
--- a/res/layout/add_favorite_number_list_item.xml
+++ b/res/layout/add_favorite_number_list_item.xml
@@ -27,7 +27,8 @@
android:id="@+id/phone_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textAppearance="@style/TextAppearance.AddFavoriteNumberTitle"
+ android:duplicateParentState="true"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/phone_number_description"
@@ -38,7 +39,8 @@
android:id="@+id/phone_number_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textAppearance="@style/TextAppearance.AddFavoriteNumberSubtitle"
+ android:duplicateParentState="true"
app:layout_constraintTop_toBottomOf="@id/phone_number"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -49,7 +51,8 @@
android:src="@drawable/ic_favorite_activatable"
android:layout_width="@dimen/primary_icon_size"
android:layout_height="@dimen/primary_icon_size"
- android:tint="@color/primary_icon_color"
+ android:tint="@color/primary_icon_selector"
+ android:duplicateParentState="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a214911..0035be2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -133,6 +133,12 @@
" - Default"
</string>
+ <!-- Description for the favorite phone number in add to favorite flow [CHAR LIMIT=30] -->
+ <string name="favorite_number_description">
+ <xliff:g id="label" example="Mobile">%1$s</xliff:g>
+ " - Favorite"
+ </string>
+
<!-- Heads Up Notification -->
<!-- Name of incoming call notification channel in app info [CHAR LIMIT=50] -->
<string name="in_call_notification_channel_name">Incoming call notification</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 40a1c1d..1baeeaa 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -132,6 +132,14 @@
<!-- Contact results -->
<style name="TextAppearance.ContactResultTitle" parent="@style/TextAppearance.Body1"/>
+ <!-- Add to favorite flow dialog -->
+ <style name="TextAppearance.AddFavoriteNumberTitle" parent="@style/TextAppearance.Body1">
+ <item name="android:textColor">@color/primary_text_selector</item>
+ </style>
+ <style name="TextAppearance.AddFavoriteNumberSubtitle" parent="@style/TextAppearance.Body3">
+ <item name="android:textColor">@color/primary_text_selector</item>
+ </style>
+
<!-- Subheader -->
<style name="SubheaderText">
<item name="android:textAppearance">@style/TextAppearance.Body3</item>
diff --git a/src/com/android/car/dialer/ui/common/FavoritePhoneNumberListAdapter.java b/src/com/android/car/dialer/ui/common/FavoritePhoneNumberListAdapter.java
index cd039cf..911e6a7 100644
--- a/src/com/android/car/dialer/ui/common/FavoritePhoneNumberListAdapter.java
+++ b/src/com/android/car/dialer/ui/common/FavoritePhoneNumberListAdapter.java
@@ -107,18 +107,15 @@
void bind(PhoneNumber phoneNumber) {
mPhoneNumberView.setText(phoneNumber.getRawNumber());
CharSequence readableLabel = phoneNumber.getReadableLabel(itemView.getResources());
- if (phoneNumber.isPrimary()) {
- mPhoneNumberDescriptionView.setText(
- itemView.getResources().getString(R.string.primary_number_description,
- readableLabel));
- } else {
- mPhoneNumberDescriptionView.setText(readableLabel);
- }
if (phoneNumber.isFavorite()) {
+ mPhoneNumberDescriptionView.setText(
+ itemView.getResources().getString(R.string.favorite_number_description,
+ readableLabel));
itemView.setActivated(true);
itemView.setEnabled(false);
} else {
+ mPhoneNumberDescriptionView.setText(readableLabel);
itemView.setActivated(false);
itemView.setEnabled(true);
itemView.setOnClickListener(