Introduce xmls for primary/secondary text colors
I7c08d8f533f0dd5318c614e3df14bb39207485e9 introduced
primary/secondary text color with activated state for each
ContactListItemView, which made it impossible to set
those colors differently between People and Phone UIs.
This change instead uses those xml for app-wide use, with
which we can avoid the issue above. Also the other screens
with activated state possibly obtain the benefit.
TESTED:
- People/Phone on phone
- People on tablet (activated state should be kept, as
I7c08d8f533f0dd5318c614e3df14bb39207485e9 did)
- Picker screens show correct colors
Bug: 5249631
Change-Id: I621b2f0fb1e67c31c289c35ee756940725272885
diff --git a/res/color/list_secondary_text_color.xml b/res/color/list_secondary_text_color.xml
deleted file mode 100644
index edf8678..0000000
--- a/res/color/list_secondary_text_color.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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:state_activated="true" android:color="@color/secondary_text_color_activated" />
- <item android:color="@color/secondary_text_color" /> <!-- not selected -->
-
-</selector>
diff --git a/res/color/list_primary_text_color.xml b/res/color/primary_text_color.xml
similarity index 81%
copy from res/color/list_primary_text_color.xml
copy to res/color/primary_text_color.xml
index 7c185fc..acc2fb7 100644
--- a/res/color/list_primary_text_color.xml
+++ b/res/color/primary_text_color.xml
@@ -16,7 +16,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_activated="true" android:color="@color/primary_text_color_activated"/>
- <item android:color="@color/primary_text_color" /> <!-- not selected -->
+ <item android:state_activated="true" android:color="#FFFFFF" />
+ <item android:color="#333333" /> <!-- not selected -->
</selector>
diff --git a/res/color/list_primary_text_color.xml b/res/color/secondary_text_color.xml
similarity index 81%
rename from res/color/list_primary_text_color.xml
rename to res/color/secondary_text_color.xml
index 7c185fc..1c62458 100644
--- a/res/color/list_primary_text_color.xml
+++ b/res/color/secondary_text_color.xml
@@ -16,7 +16,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_activated="true" android:color="@color/primary_text_color_activated"/>
- <item android:color="@color/primary_text_color" /> <!-- not selected -->
+ <item android:state_activated="true" android:color="#FFFFFF" />
+ <item android:color="#777777" /> <!-- not selected -->
</selector>
diff --git a/res/layout/group_browse_list_item.xml b/res/layout/group_browse_list_item.xml
index b213754..45f444f 100644
--- a/res/layout/group_browse_list_item.xml
+++ b/res/layout/group_browse_list_item.xml
@@ -71,7 +71,6 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
- android:textColor="@color/list_primary_text_color"
android:ellipsize="end"
android:singleLine="true" />
@@ -80,7 +79,7 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/list_secondary_text_color"
+ android:textColor="?android:attr/textColorSecondary"
android:ellipsize="end"
android:singleLine="true" />
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 5e8bd70..1a8ee23 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -80,19 +80,9 @@
<!-- Color of the theme of the People app -->
<color name="people_app_theme_color">#33B5E5</color>
- <!-- Primary text color in the People app -->
- <color name="primary_text_color">#333333</color>
-
- <!-- Activated primary text color in the People app -->
- <color name="primary_text_color_activated">#FFFFFF</color>
-
- <!-- Secondary text color in the People app -->
- <color name="secondary_text_color">#777777</color>
+ <!-- Secondary text color in the Phone app -->
<color name="dialtacts_secondary_text_color">#888888</color>
- <!-- Activated secondary text color in the People app -->
- <color name="secondary_text_color_activated">#FFFFFF</color>
-
<!-- Colors in the contact browser list -->
<color name="contact_count_text_color">#AAAAAA</color>
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 4b86295..7e0940f 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -121,7 +121,6 @@
private TextView mCountView;
private ImageView mPresenceIcon;
- private ColorStateList mPrimaryTextColor;
private ColorStateList mSecondaryTextColor;
private char[] mHighlightedPrefix;
@@ -252,8 +251,9 @@
Color.GREEN));
a.recycle();
- mPrimaryTextColor = getResources().getColorStateList(R.color.list_primary_text_color);
- mSecondaryTextColor = getResources().getColorStateList(R.color.list_secondary_text_color);
+ a = getContext().obtainStyledAttributes(android.R.styleable.Theme);
+ mSecondaryTextColor = a.getColorStateList(android.R.styleable.Theme_textColorSecondary);
+ a.recycle();
mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
@@ -766,7 +766,6 @@
mNameTextView.setSingleLine(true);
mNameTextView.setEllipsize(getTextEllipsis());
mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Medium);
- mNameTextView.setTextColor(mPrimaryTextColor);
// Manually call setActivated() since this view may be added after the first
// setActivated() call toward this whole item view.
mNameTextView.setActivated(isActivated());
@@ -826,7 +825,6 @@
mPhoneticNameTextView.setEllipsize(getTextEllipsis());
mPhoneticNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mPhoneticNameTextView.setTypeface(mPhoneticNameTextView.getTypeface(), Typeface.BOLD);
- mPhoneticNameTextView.setTextColor(mPrimaryTextColor);
mPhoneticNameTextView.setActivated(isActivated());
addView(mPhoneticNameTextView);
}
@@ -873,7 +871,6 @@
mLabelView.setEllipsize(getTextEllipsis());
mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
- mLabelView.setTextColor(mPrimaryTextColor);
mLabelView.setActivated(isActivated());
addView(mLabelView);
}
@@ -905,7 +902,6 @@
mDataView.setSingleLine(true);
mDataView.setEllipsize(getTextEllipsis());
mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
- mDataView.setTextColor(mPrimaryTextColor);
mDataView.setActivated(isActivated());
addView(mDataView);
}
@@ -936,7 +932,6 @@
mSnippetView.setEllipsize(getTextEllipsis());
mSnippetView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
mSnippetView.setTypeface(mSnippetView.getTypeface(), Typeface.BOLD);
- mSnippetView.setTextColor(mPrimaryTextColor);
mSnippetView.setActivated(isActivated());
addView(mSnippetView);
}