diff options
47 files changed, 605 insertions, 10 deletions
diff --git a/res/color/secondary_text_color.xml b/res/color/secondary_text_color.xml new file mode 100644 index 00000000..1c624587 --- /dev/null +++ b/res/color/secondary_text_color.xml @@ -0,0 +1,22 @@ +<?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="#FFFFFF" /> + <item android:color="#777777" /> <!-- not selected --> + +</selector> diff --git a/res/drawable-hdpi/ic_add_contact_holo_dark.png b/res/drawable-hdpi/ic_add_contact_holo_dark.png Binary files differnew file mode 100644 index 00000000..88ff33b3 --- /dev/null +++ b/res/drawable-hdpi/ic_add_contact_holo_dark.png diff --git a/res/drawable-hdpi/ic_text_holo_dark.png b/res/drawable-hdpi/ic_text_holo_dark.png Binary files differnew file mode 100644 index 00000000..6d21e42c --- /dev/null +++ b/res/drawable-hdpi/ic_text_holo_dark.png diff --git a/res/drawable-hdpi/list_activated_holo.9.png b/res/drawable-hdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..4ea7afa0 --- /dev/null +++ b/res/drawable-hdpi/list_activated_holo.9.png diff --git a/res/drawable-hdpi/list_background_holo.9.png b/res/drawable-hdpi/list_background_holo.9.png Binary files differnew file mode 100644 index 00000000..cddf9be7 --- /dev/null +++ b/res/drawable-hdpi/list_background_holo.9.png diff --git a/res/drawable-hdpi/list_focused_holo.9.png b/res/drawable-hdpi/list_focused_holo.9.png Binary files differnew file mode 100644 index 00000000..86578be4 --- /dev/null +++ b/res/drawable-hdpi/list_focused_holo.9.png diff --git a/res/drawable-hdpi/list_title_holo.9.png b/res/drawable-hdpi/list_title_holo.9.png Binary files differnew file mode 100644 index 00000000..ae937176 --- /dev/null +++ b/res/drawable-hdpi/list_title_holo.9.png diff --git a/res/drawable-mdpi/ic_add_contact_holo_dark.png b/res/drawable-mdpi/ic_add_contact_holo_dark.png Binary files differnew file mode 100644 index 00000000..867f494b --- /dev/null +++ b/res/drawable-mdpi/ic_add_contact_holo_dark.png diff --git a/res/drawable-mdpi/ic_text_holo_dark.png b/res/drawable-mdpi/ic_text_holo_dark.png Binary files differnew file mode 100644 index 00000000..80b95eec --- /dev/null +++ b/res/drawable-mdpi/ic_text_holo_dark.png diff --git a/res/drawable-mdpi/list_activated_holo.9.png b/res/drawable-mdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..3bf8e036 --- /dev/null +++ b/res/drawable-mdpi/list_activated_holo.9.png diff --git a/res/drawable-mdpi/list_background_holo.9.png b/res/drawable-mdpi/list_background_holo.9.png Binary files differnew file mode 100644 index 00000000..7d5d66de --- /dev/null +++ b/res/drawable-mdpi/list_background_holo.9.png diff --git a/res/drawable-mdpi/list_focused_holo.9.png b/res/drawable-mdpi/list_focused_holo.9.png Binary files differnew file mode 100644 index 00000000..86578be4 --- /dev/null +++ b/res/drawable-mdpi/list_focused_holo.9.png diff --git a/res/drawable-mdpi/list_title_holo.9.png b/res/drawable-mdpi/list_title_holo.9.png Binary files differnew file mode 100644 index 00000000..64bd6912 --- /dev/null +++ b/res/drawable-mdpi/list_title_holo.9.png diff --git a/res/drawable-sw580dp-hdpi/list_activated_holo.9.png b/res/drawable-sw580dp-hdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..046b24a9 --- /dev/null +++ b/res/drawable-sw580dp-hdpi/list_activated_holo.9.png diff --git a/res/drawable-sw580dp-mdpi/list_activated_holo.9.png b/res/drawable-sw580dp-mdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..1ff33737 --- /dev/null +++ b/res/drawable-sw580dp-mdpi/list_activated_holo.9.png diff --git a/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png b/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..2eb7c7eb --- /dev/null +++ b/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png diff --git a/res/drawable-xhdpi/ic_add_contact_holo_dark.png b/res/drawable-xhdpi/ic_add_contact_holo_dark.png Binary files differnew file mode 100644 index 00000000..72988823 --- /dev/null +++ b/res/drawable-xhdpi/ic_add_contact_holo_dark.png diff --git a/res/drawable-xhdpi/ic_text_holo_dark.png b/res/drawable-xhdpi/ic_text_holo_dark.png Binary files differnew file mode 100644 index 00000000..e80a0423 --- /dev/null +++ b/res/drawable-xhdpi/ic_text_holo_dark.png diff --git a/res/drawable-xhdpi/list_activated_holo.9.png b/res/drawable-xhdpi/list_activated_holo.9.png Binary files differnew file mode 100644 index 00000000..eda10e61 --- /dev/null +++ b/res/drawable-xhdpi/list_activated_holo.9.png diff --git a/res/drawable-xhdpi/list_background_holo.9.png b/res/drawable-xhdpi/list_background_holo.9.png Binary files differnew file mode 100644 index 00000000..b6527254 --- /dev/null +++ b/res/drawable-xhdpi/list_background_holo.9.png diff --git a/res/drawable-xhdpi/list_focused_holo.9.png b/res/drawable-xhdpi/list_focused_holo.9.png Binary files differnew file mode 100644 index 00000000..86578be4 --- /dev/null +++ b/res/drawable-xhdpi/list_focused_holo.9.png diff --git a/res/drawable-xhdpi/list_title_holo.9.png b/res/drawable-xhdpi/list_title_holo.9.png Binary files differnew file mode 100644 index 00000000..f4f00ca0 --- /dev/null +++ b/res/drawable-xhdpi/list_title_holo.9.png diff --git a/res/drawable/ic_tab_all.xml b/res/drawable/ic_tab_all.xml new file mode 100644 index 00000000..97c4443e --- /dev/null +++ b/res/drawable/ic_tab_all.xml @@ -0,0 +1,20 @@ +<?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:drawable="@drawable/ic_contacts_holo_dark" /> +</selector> + diff --git a/res/drawable/list_item_activated_background.xml b/res/drawable/list_item_activated_background.xml new file mode 100644 index 00000000..a58577eb --- /dev/null +++ b/res/drawable/list_item_activated_background.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 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:drawable="@drawable/list_activated_holo" /> + <item android:drawable="@drawable/list_background_holo" /> +</selector> diff --git a/res/layout/contact_tile_frequent.xml b/res/layout/contact_tile_frequent.xml index 9219f56a..494fd3d8 100644 --- a/res/layout/contact_tile_frequent.xml +++ b/res/layout/contact_tile_frequent.xml @@ -15,7 +15,7 @@ --> <view xmlns:android="http://schemas.android.com/apk/res/android" - class="com.android.contacts.list.ContactTileFrequentView" + class="com.android.contacts.common.list.ContactTileFrequentView" android:focusable="true" android:background="?android:attr/selectableItemBackground" android:nextFocusRight="@+id/contact_tile_quick"> @@ -24,7 +24,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.contacts.widget.LayoutSuppressingQuickContactBadge + <com.android.contacts.common.widget.LayoutSuppressingQuickContactBadge android:id="@+id/contact_tile_quick" android:layout_width="64dip" android:layout_height="64dip" diff --git a/res/layout/contact_tile_frequent_phone.xml b/res/layout/contact_tile_frequent_phone.xml index cae5ec28..3a84b5a7 100644 --- a/res/layout/contact_tile_frequent_phone.xml +++ b/res/layout/contact_tile_frequent_phone.xml @@ -18,7 +18,7 @@ <view xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/contact_tile_frequent_phone" - class="com.android.contacts.list.ContactTilePhoneFrequentView" + class="com.android.contacts.common.list.ContactTilePhoneFrequentView" android:focusable="true" android:background="?android:attr/selectableItemBackground" android:nextFocusLeft="@+id/contact_tile_quick"> @@ -27,7 +27,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.contacts.widget.LayoutSuppressingQuickContactBadge + <com.android.contacts.common.widget.LayoutSuppressingQuickContactBadge android:id="@id/contact_tile_quick" android:layout_width="64dip" android:layout_height="64dip" diff --git a/res/layout/contact_tile_phone_starred.xml b/res/layout/contact_tile_phone_starred.xml index 053ffa6b..9959c82c 100644 --- a/res/layout/contact_tile_phone_starred.xml +++ b/res/layout/contact_tile_phone_starred.xml @@ -18,13 +18,13 @@ android:background="@null" android:paddingBottom="1dip" android:paddingRight="1dip" - class="com.android.contacts.list.ContactTilePhoneStarredView" > + class="com.android.contacts.common.list.ContactTilePhoneStarredView" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.contacts.widget.LayoutSuppressingImageView + <com.android.contacts.common.widget.LayoutSuppressingImageView android:id="@+id/contact_tile_image" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/res/layout/contact_tile_starred.xml b/res/layout/contact_tile_starred.xml index cfc74d80..06852a6e 100644 --- a/res/layout/contact_tile_starred.xml +++ b/res/layout/contact_tile_starred.xml @@ -18,14 +18,14 @@ android:background="@null" android:paddingBottom="1dip" android:paddingRight="1dip" - class="com.android.contacts.list.ContactTileStarredView" > + class="com.android.contacts.common.list.ContactTileStarredView" > <RelativeLayout android:id="@+id/contact_tile_layout" android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.contacts.widget.LayoutSuppressingImageView + <com.android.contacts.common.widget.LayoutSuppressingImageView android:id="@+id/contact_tile_image" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/res/layout/contact_tile_starred_quick_contact.xml b/res/layout/contact_tile_starred_quick_contact.xml index a396c41b..87a6e654 100644 --- a/res/layout/contact_tile_starred_quick_contact.xml +++ b/res/layout/contact_tile_starred_quick_contact.xml @@ -18,13 +18,13 @@ android:paddingBottom="1dip" android:paddingRight="1dip" android:background="@null" - class="com.android.contacts.list.ContactTileStarredView" > + class="com.android.contacts.common.list.ContactTileStarredView" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > - <com.android.contacts.widget.LayoutSuppressingImageView + <com.android.contacts.common.widget.LayoutSuppressingImageView android:id="@+id/contact_tile_image" android:layout_width="match_parent" android:layout_height="match_parent" diff --git a/res/values-land/integers.xml b/res/values-land/integers.xml new file mode 100644 index 00000000..44d1d5a8 --- /dev/null +++ b/res/values-land/integers.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + <integer name="contact_tile_column_count_in_favorites">4</integer> +</resources> diff --git a/res/values-sw580dp-land/integers.xml b/res/values-sw580dp-land/integers.xml new file mode 100644 index 00000000..03f5ed75 --- /dev/null +++ b/res/values-sw580dp-land/integers.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + <integer name="contact_tile_column_count_in_favorites">3</integer> +</resources> diff --git a/res/values-sw580dp/dimens.xml b/res/values-sw580dp/dimens.xml index 277c0297..0a149e75 100644 --- a/res/values-sw580dp/dimens.xml +++ b/res/values-sw580dp/dimens.xml @@ -24,4 +24,5 @@ <dimen name="contact_browser_list_header_left_margin">@dimen/list_visible_scrollbar_padding</dimen> <dimen name="contact_browser_list_header_right_margin">24dip</dimen> + <dimen name="contact_browser_list_top_margin">16dip</dimen> </resources> diff --git a/res/values-sw580dp/integers.xml b/res/values-sw580dp/integers.xml new file mode 100644 index 00000000..03f5ed75 --- /dev/null +++ b/res/values-sw580dp/integers.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + <integer name="contact_tile_column_count_in_favorites">3</integer> +</resources> diff --git a/res/values-sw680dp-land/integers.xml b/res/values-sw680dp-land/integers.xml new file mode 100644 index 00000000..44d1d5a8 --- /dev/null +++ b/res/values-sw680dp-land/integers.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + <integer name="contact_tile_column_count_in_favorites">4</integer> +</resources> diff --git a/res/values-sw680dp/integers.xml b/res/values-sw680dp/integers.xml new file mode 100644 index 00000000..3e47757a --- /dev/null +++ b/res/values-sw680dp/integers.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + <integer name="contact_tile_column_count_in_favorites">2</integer> +</resources> diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 745ceb19..9e8c08d8 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -51,4 +51,13 @@ <attr name="contact_browser_list_padding_right" format="dimension"/> <attr name="contact_browser_background" format="reference"/> </declare-styleable> + + <declare-styleable name="ProportionalLayout"> + <attr name="direction" format="string"/> + <attr name="ratio" format="float"/> + </declare-styleable> + + <declare-styleable name="Favorites"> + <attr name="favorites_padding_bottom" format="dimension"/> + </declare-styleable> </resources> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 5fd33903..2c49c2ed 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -86,4 +86,11 @@ <!-- Width of height of an icon from a third-party app in the networks section of the contact card. --> <dimen name="detail_network_icon_size">32dip</dimen> + + <!-- Empty message margins --> + <dimen name="empty_message_top_margin">48dip</dimen> + + <!-- contact browser list margins --> + <dimen name="contact_browser_list_item_photo_size">64dip</dimen> + <dimen name="contact_browser_list_top_margin">8dip</dimen> </resources> diff --git a/res/values/integers.xml b/res/values/integers.xml new file mode 100644 index 00000000..73e9aee9 --- /dev/null +++ b/res/values/integers.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 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> + + <!-- Determines the number of columns in a ContactTileRow in the favorites tab --> + <integer name="contact_tile_column_count_in_favorites">2</integer> +</resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index befa813c..cc2aad68 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -661,4 +661,48 @@ a ren't members of any other group. [CHAR LIMIT=25] --> <!-- Toast indicating that sharing a contact has failed. [CHAR LIMIT=NONE] --> <string name="share_error">This contact can\'t be shared.</string> + <!-- Menu item to search contacts --> + <string name="menu_search">Search</string> + + <!-- The menu item to filter the list of contacts displayed --> + <string name="menu_contacts_filter">Contacts to display</string> + + <!-- Title of the activity that allows the uesr to filter the list of contacts displayed according to account [CHAR LIMIT=25] --> + <string name="activity_title_contacts_filter">Contacts to display</string> + + <!-- Title of the activity that allows the user to customize filtering of contact list [CHAR LIMIT=128] --> + <string name="custom_list_filter">Define custom view</string> + + <!-- Query hint displayed inside the search field [CHAR LIMIT=64] --> + <string name="hint_findContacts">Find contacts</string> + + <!-- The description text for the favorites tab. + + Note: AccessibilityServices use this attribute to announce what the view represents. + This is especially valuable for views without textual representation like ImageView. + + [CHAR LIMIT=NONE] --> + <string name="contactsFavoritesLabel">Favorites</string> + + <!-- Displayed at the top of the contacts showing the zero total number of contacts visible when "All contacts" is selected [CHAR LIMIT=64]--> + <string name="listTotalAllContactsZero">No contacts.</string> + + <!-- Displayed at the top of the contacts showing the zero total number of contacts visible when "Custom" is selected [CHAR LIMIT=64]--> + <string name="listTotalAllContactsZeroCustom">No visible contacts.</string> + + <!-- Displayed at the top of the contacts showing the zero total number of contacts visible when starred contact list is selected [CHAR LIMIT=64]--> + <string name="listTotalAllContactsZeroStarred">No favorites.</string> + + <!-- Displayed at the top of the contacts showing the zero total number of contacts visible when a group or account is selected [CHAR LIMIT=64]--> + <string name="listTotalAllContactsZeroGroup">No contacts in <xliff:g id="name" example="Friends">%s</xliff:g></string> + + <!-- The menu item to clear frequents [CHAR LIMIT=30] --> + <string name="menu_clear_frequents">Clear frequents</string> + + <!-- The menu item to open the list of accounts --> + <string name="menu_accounts">Accounts</string> + + <!-- The menu item to bulk import or bulk export contacts from SIM card or SD card. [CHAR LIMIT=30]--> + <string name="menu_import_export">Import/export</string> + </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 7a43243b..77831b24 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -54,4 +54,13 @@ background and text color. See also android:style/Widget.Holo.TextView.ListSepar <item name="android:layout_width">match_parent</item> <item name="android:layout_height">match_parent</item> </style> + + <style name="BackgroundOnlyTheme" parent="@android:style/Theme.Holo.Light"> + <item name="android:windowBackground">@null</item> + <item name="android:windowContentOverlay">@null</item> + <item name="android:windowAnimationStyle">@null</item> + <item name="android:windowNoTitle">true</item> + <item name="android:windowNoDisplay">true</item> + <item name="android:windowIsFloating">true</item> + </style> </resources> diff --git a/src/com/android/contacts/common/list/ContactTileFrequentView.java b/src/com/android/contacts/common/list/ContactTileFrequentView.java new file mode 100644 index 00000000..a1ee1815 --- /dev/null +++ b/src/com/android/contacts/common/list/ContactTileFrequentView.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2012 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. + */ +package com.android.contacts.common.list; + +import android.content.Context; +import android.util.AttributeSet; + +import com.android.contacts.common.util.ViewUtil; + +/** + * A {@link com.android.contacts.common.list.ContactTileView} that is used for most frequently contacted in the People app + */ +public class ContactTileFrequentView extends ContactTileView { + public ContactTileFrequentView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected boolean isDarkTheme() { + return false; + } + + @Override + protected int getApproximateImageSize() { + return ViewUtil.getConstantPreLayoutWidth(getQuickContact()); + } +} diff --git a/src/com/android/contacts/common/list/ContactTilePhoneFrequentView.java b/src/com/android/contacts/common/list/ContactTilePhoneFrequentView.java new file mode 100644 index 00000000..2e5f04cb --- /dev/null +++ b/src/com/android/contacts/common/list/ContactTilePhoneFrequentView.java @@ -0,0 +1,81 @@ +/* + * 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. + */ +package com.android.contacts.common.list; + +import android.content.Context; +import android.text.TextUtils; +import android.util.AttributeSet; +import android.view.View; + +import com.android.contacts.common.MoreContactUtils; +import com.android.contacts.common.list.ContactTileAdapter.ContactEntry; +import com.android.contacts.common.util.ViewUtil; + +/** + * A dark version of the {@link com.android.contacts.common.list.ContactTileView} that is used in Dialtacts + * for frequently called contacts. Slightly different behavior from superclass... + * when you tap it, you want to call the frequently-called number for the + * contact, even if that is not the default number for that contact. + */ +public class ContactTilePhoneFrequentView extends ContactTileView { + private String mPhoneNumberString; + + public ContactTilePhoneFrequentView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected boolean isDarkTheme() { + return true; + } + + @Override + protected int getApproximateImageSize() { + return ViewUtil.getConstantPreLayoutWidth(getQuickContact()); + } + + @Override + public void loadFromContact(ContactEntry entry) { + super.loadFromContact(entry); + mPhoneNumberString = null; // ... in case we're reusing the view + if (entry != null) { + // Grab the phone-number to call directly... see {@link onClick()} + mPhoneNumberString = entry.phoneNumber; + } + } + + @Override + protected OnClickListener createClickListener() { + return new OnClickListener() { + @Override + public void onClick(View v) { + if (mListener == null) return; + if (TextUtils.isEmpty(mPhoneNumberString)) { + // Copy "superclass" implementation + mListener.onContactSelected(getLookupUri(), MoreContactUtils + .getTargetRectFromView( + mContext, ContactTilePhoneFrequentView.this)); + } else { + // When you tap a frequently-called contact, you want to + // call them at the number that you usually talk to them + // at (i.e. the one displayed in the UI), regardless of + // whether that's their default number. + mListener.onCallNumberDirectly(mPhoneNumberString); + } + } + }; + } +} diff --git a/src/com/android/contacts/common/list/ContactTilePhoneStarredView.java b/src/com/android/contacts/common/list/ContactTilePhoneStarredView.java new file mode 100644 index 00000000..c3020ebe --- /dev/null +++ b/src/com/android/contacts/common/list/ContactTilePhoneStarredView.java @@ -0,0 +1,64 @@ +/* + * 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. + */ +package com.android.contacts.common.list; + +import android.content.Context; +import android.content.Intent; +import android.util.AttributeSet; +import android.view.View; +import android.widget.ImageButton; + +import com.android.contacts.common.R; + +/** + * Displays the contact's picture overlayed with their name + * in a perfect square. It also has an additional touch target for a secondary action. + */ +public class ContactTilePhoneStarredView extends ContactTileView { + private ImageButton mSecondaryButton; + + public ContactTilePhoneStarredView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mSecondaryButton = (ImageButton) findViewById(R.id.contact_tile_secondary_button); + mSecondaryButton.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_VIEW, getLookupUri()); + // Secondary target will be visible only from phone's favorite screen, then + // we want to launch it as a separate People task. + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + getContext().startActivity(intent); + } + }); + } + + @Override + protected boolean isDarkTheme() { + return true; + } + + @Override + protected int getApproximateImageSize() { + // The picture is the full size of the tile (minus some padding, but we can be generous) + return mListener.getApproximateTileWidth(); + } +} diff --git a/src/com/android/contacts/common/list/ContactTileStarredView.java b/src/com/android/contacts/common/list/ContactTileStarredView.java new file mode 100644 index 00000000..67c7a8da --- /dev/null +++ b/src/com/android/contacts/common/list/ContactTileStarredView.java @@ -0,0 +1,41 @@ +/* + * 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. + */ +package com.android.contacts.common.list; + +import android.content.Context; +import android.util.AttributeSet; + +/** + * A {@link ContactTileStarredView} displays the contact's picture overlayed with their name + * in a square. The actual dimensions are set by + * {@link com.android.contacts.common.list.ContactTileAdapter.ContactTileRow}. + */ +public class ContactTileStarredView extends ContactTileView { + public ContactTileStarredView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + protected boolean isDarkTheme() { + return false; + } + + @Override + protected int getApproximateImageSize() { + // The picture is the full size of the tile (minus some padding, but we can be generous) + return mListener.getApproximateTileWidth(); + } +} diff --git a/src/com/android/contacts/common/util/ViewUtil.java b/src/com/android/contacts/common/util/ViewUtil.java new file mode 100644 index 00000000..190075a2 --- /dev/null +++ b/src/com/android/contacts/common/util/ViewUtil.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2012 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. + */ + +package com.android.contacts.common.util; + +import android.view.View; +import android.view.ViewGroup; + +/** + * Provides static functions to work with views + */ +public class ViewUtil { + private ViewUtil() {} + + /** + * Returns the width as specified in the LayoutParams + * @throws IllegalStateException Thrown if the view's width is unknown before a layout pass + * s + */ + public static int getConstantPreLayoutWidth(View view) { + // We haven't been layed out yet, so get the size from the LayoutParams + final ViewGroup.LayoutParams p = view.getLayoutParams(); + if (p.width < 0) { + throw new IllegalStateException("Expecting view's width to be a constant rather " + + "than a result of the layout pass"); + } + return p.width; + } +} diff --git a/src/com/android/contacts/common/widget/LayoutSuppressingImageView.java b/src/com/android/contacts/common/widget/LayoutSuppressingImageView.java new file mode 100644 index 00000000..abcf7860 --- /dev/null +++ b/src/com/android/contacts/common/widget/LayoutSuppressingImageView.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 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. + */ + +package com.android.contacts.common.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.ImageView; + +/** + * Custom {@link ImageView} that improves layouting performance. + * + * This improves the performance by not passing requestLayout() to its parent, taking advantage + * of knowing that image size won't change once set. + */ +public class LayoutSuppressingImageView extends ImageView { + + public LayoutSuppressingImageView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public void requestLayout() { + forceLayout(); + } +} diff --git a/src/com/android/contacts/common/widget/LayoutSuppressingQuickContactBadge.java b/src/com/android/contacts/common/widget/LayoutSuppressingQuickContactBadge.java new file mode 100644 index 00000000..1f48f5d2 --- /dev/null +++ b/src/com/android/contacts/common/widget/LayoutSuppressingQuickContactBadge.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 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. + */ + +package com.android.contacts.common.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.QuickContactBadge; + +/** + * Custom {@link QuickContactBadge} that improves layouting performance. + * + * This improves the performance by not passing requestLayout() to its parent, taking advantage + * of knowing that image size won't change once set. + */ +public class LayoutSuppressingQuickContactBadge extends QuickContactBadge { + + public LayoutSuppressingQuickContactBadge(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @Override + public void requestLayout() { + forceLayout(); + } +} |