diff options
author | Brian Attwell <brianattwell@google.com> | 2014-06-25 13:54:49 -0700 |
---|---|---|
committer | Brian Attwell <brianattwell@google.com> | 2014-06-25 14:54:05 -0700 |
commit | 3c4e8501b8fe4a6f508a256fd133004e1f1936a4 (patch) | |
tree | 365dcd2b6b75772e3301ebe83be120e06ab99288 | |
parent | f399277792958103cd8b93db8187d64d1e3209d2 (diff) | |
download | android_packages_apps_ContactsCommon-3c4e8501b8fe4a6f508a256fd133004e1f1936a4.tar.gz android_packages_apps_ContactsCommon-3c4e8501b8fe4a6f508a256fd133004e1f1936a4.tar.bz2 android_packages_apps_ContactsCommon-3c4e8501b8fe4a6f508a256fd133004e1f1936a4.zip |
Frequently Contacted title style in Favorites tab
Change-Id: I2effc74dfd1b570844296c003de456ec71e2940d
-rw-r--r-- | res/layout/list_separator.xml | 22 | ||||
-rw-r--r-- | res/values/colors.xml | 3 | ||||
-rw-r--r-- | res/values/dimens.xml | 6 | ||||
-rw-r--r-- | src/com/android/contacts/common/MoreContactUtils.java | 27 | ||||
-rw-r--r-- | src/com/android/contacts/common/list/ContactTileAdapter.java | 11 |
5 files changed, 48 insertions, 21 deletions
diff --git a/res/layout/list_separator.xml b/res/layout/list_separator.xml index 4553d48b..97e154bb 100644 --- a/res/layout/list_separator.xml +++ b/res/layout/list_separator.xml @@ -13,21 +13,15 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<FrameLayout +<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" + android:id="@+id/title" + android:textColor="@color/frequently_contacted_title_color" android:paddingLeft="16dip" - android:paddingRight="16dip" android:paddingStart="16dip" + android:paddingRight="16dip" android:paddingEnd="16dip" - android:focusable="false"> - <TextView - android:id="@+id/title" - style="@style/ContactListSeparatorTextViewStyle" - android:paddingLeft="8dip" - android:paddingRight="8dip" - android:paddingStart="8dip" - android:paddingEnd="8dip" /> -</FrameLayout> + android:paddingBottom="15dip" + android:paddingTop="16dip" + android:textStyle="bold" + android:textSize="20sp"/> diff --git a/res/values/colors.xml b/res/values/colors.xml index 5e3f4b88..80c444bc 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -83,6 +83,9 @@ <!-- Darker version of the actionbar color. Used for the status bar and navigation bar colors. --> <color name="actionbar_background_color_dark">#008aa1</color> + <!-- Color of the title to the Frequently Contacted section --> + <color name="frequently_contacted_title_color">#00acc1</color> + <!-- Color of action bar text. Ensure this stays in sync with packages/Telephony phone_settings_actionbar_text_color--> <color name="actionbar_text_color">#ffffff</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index cf2f944d..942b2c89 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -125,4 +125,10 @@ <dimen name="search_box_text_left_margin">27dp</dimen> <!-- Search box text size --> <dimen name="search_text_size">20sp</dimen> + + <!-- Top margin for the Frequently Contacted section title --> + <dimen name="frequently_contacted_title_top_margin_when_first_row">16dp</dimen> + <!-- Top margin for the Frequently Contacted section title, when the title is the first + item in the list --> + <dimen name="frequently_contacted_title_top_margin">57dp</dimen> </resources> diff --git a/src/com/android/contacts/common/MoreContactUtils.java b/src/com/android/contacts/common/MoreContactUtils.java index 5a834671..86cfb204 100644 --- a/src/com/android/contacts/common/MoreContactUtils.java +++ b/src/com/android/contacts/common/MoreContactUtils.java @@ -185,15 +185,32 @@ public class MoreContactUtils { * Returns a header view based on the R.layout.list_separator, where the * containing {@link android.widget.TextView} is set using the given textResourceId. */ - public static View createHeaderView(Context context, int textResourceId) { - View view = View.inflate(context, R.layout.list_separator, null); - TextView textView = (TextView) view.findViewById(R.id.title); + public static TextView createHeaderView(Context context, int textResourceId) { + final TextView textView = (TextView) View.inflate(context, R.layout.list_separator, null); textView.setText(context.getString(textResourceId)); - textView.setAllCaps(true); - return view; + return textView; } /** + * Set the top padding on the header view dynamically, based on whether the header is in + * the first row or not. + */ + public static void setHeaderViewBottomPadding(Context context, TextView textView, + boolean isFirstRow) { + final int topPadding; + if (isFirstRow) { + topPadding = (int) context.getResources().getDimension( + R.dimen.frequently_contacted_title_top_margin_when_first_row); + } else { + topPadding = (int) context.getResources().getDimension( + R.dimen.frequently_contacted_title_top_margin); + } + textView.setPaddingRelative(textView.getPaddingStart(), topPadding, + textView.getPaddingEnd(), textView.getPaddingBottom()); + } + + + /** * Returns the intent to launch for the given invitable account type and contact lookup URI. * This will return null if the account type is not invitable (i.e. there is no * {@link AccountType#getInviteContactActivityClassName()} or diff --git a/src/com/android/contacts/common/list/ContactTileAdapter.java b/src/com/android/contacts/common/list/ContactTileAdapter.java index 141f4c00..322e83e2 100644 --- a/src/com/android/contacts/common/list/ContactTileAdapter.java +++ b/src/com/android/contacts/common/list/ContactTileAdapter.java @@ -26,6 +26,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.FrameLayout; +import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPresenceIconUtil; @@ -385,7 +386,9 @@ public class ContactTileAdapter extends BaseAdapter { if (itemViewType == ViewTypes.DIVIDER) { // Checking For Divider First so not to cast convertView - return convertView == null ? getDivider() : convertView; + final TextView textView = (TextView) (convertView == null ? getDivider() : convertView); + setDividerPadding(textView, position == 0); + return textView; } ContactTileRow contactTileRowView = (ContactTileRow) convertView; @@ -404,10 +407,14 @@ public class ContactTileAdapter extends BaseAdapter { * Divider uses a list_seperator.xml along with text to denote * the most frequently contacted contacts. */ - public View getDivider() { + private TextView getDivider() { return MoreContactUtils.createHeaderView(mContext, R.string.favoritesFrequentContacted); } + private void setDividerPadding(TextView headerTextView, boolean isFirstRow) { + MoreContactUtils.setHeaderViewBottomPadding(mContext, headerTextView, isFirstRow); + } + private int getLayoutResourceId(int viewType) { switch (viewType) { case ViewTypes.STARRED: |