summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-11-13 18:48:25 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-11-13 18:48:25 -0800
commit0d1804386f73f542bd6fcebe064288610d02354a (patch)
tree3260c2abbf905afdf60bc7db6413e9ca9073879f
parent246e7578a0e7c1e2e3d8aa0ad0b3557e4e339137 (diff)
parentb48e45496dd75bb7de73327a5a238dc8e19dc91d (diff)
am b48e4549: am 550e61cf: am 59a39432: Merge "Change all contacts button to look like list item" into klp-dev
* commit 'b48e45496dd75bb7de73327a5a238dc8e19dc91d': Change all contacts button to look like list item
-rw-r--r--res/drawable-hdpi/list_item_avatar_bg.pngbin614 -> 1128 bytes
-rw-r--r--res/drawable-mdpi/list_item_avatar_bg.pngbin498 -> 1065 bytes
-rw-r--r--res/drawable-xhdpi/list_item_avatar_bg.pngbin705 -> 1225 bytes
-rw-r--r--res/drawable-xxhdpi/list_item_avatar_bg.pngbin1465 -> 1382 bytes
-rw-r--r--res/layout/show_all_contact_button.xml23
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java46
6 files changed, 36 insertions, 33 deletions
diff --git a/res/drawable-hdpi/list_item_avatar_bg.png b/res/drawable-hdpi/list_item_avatar_bg.png
index e6eb68e27..66e5f3efe 100644
--- a/res/drawable-hdpi/list_item_avatar_bg.png
+++ b/res/drawable-hdpi/list_item_avatar_bg.png
Binary files differ
diff --git a/res/drawable-mdpi/list_item_avatar_bg.png b/res/drawable-mdpi/list_item_avatar_bg.png
index 1306cfc03..640eb3e07 100644
--- a/res/drawable-mdpi/list_item_avatar_bg.png
+++ b/res/drawable-mdpi/list_item_avatar_bg.png
Binary files differ
diff --git a/res/drawable-xhdpi/list_item_avatar_bg.png b/res/drawable-xhdpi/list_item_avatar_bg.png
index 3f271a0f6..cac7fbd34 100644
--- a/res/drawable-xhdpi/list_item_avatar_bg.png
+++ b/res/drawable-xhdpi/list_item_avatar_bg.png
Binary files differ
diff --git a/res/drawable-xxhdpi/list_item_avatar_bg.png b/res/drawable-xxhdpi/list_item_avatar_bg.png
index 8b03a6561..fcfe2daaa 100644
--- a/res/drawable-xxhdpi/list_item_avatar_bg.png
+++ b/res/drawable-xxhdpi/list_item_avatar_bg.png
Binary files differ
diff --git a/res/layout/show_all_contact_button.xml b/res/layout/show_all_contact_button.xml
index 824d10cdb..30060d77b 100644
--- a/res/layout/show_all_contact_button.xml
+++ b/res/layout/show_all_contact_button.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<LinearLayout
+<com.android.contacts.common.list.ContactListItemView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/show_all_contact_button"
android:orientation="horizontal"
@@ -23,23 +23,4 @@
android:layout_height="match_parent"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center"
- android:background="?android:attr/selectableItemBackground"
- android:focusable="true">
-
- <ImageView
- android:layout_height="match_parent"
- android:layout_width="wrap_content"
- android:layout_gravity="center"
- android:src="@drawable/ic_menu_all_contacts_dk"
- android:layout_marginEnd="10dp"/>
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:textSize="14sp"
- android:ellipsize="marquee"
- android:singleLine="true"
- android:text="@string/show_all_contacts_button_text"
- android:textAlignment="center"
- android:gravity="center"/>
-</LinearLayout> \ No newline at end of file
+ android:focusable="true" /> \ No newline at end of file
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java
index 73703a02c..34666ee99 100644
--- a/src/com/android/dialer/list/PhoneFavoriteFragment.java
+++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java
@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.CursorLoader;
import android.content.Loader;
import android.content.SharedPreferences;
+import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Rect;
import android.net.Uri;
@@ -50,6 +51,7 @@ import com.android.contacts.common.ContactPhotoManager;
import com.android.contacts.common.ContactTileLoaderFactory;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.list.ContactEntry;
+import com.android.contacts.common.list.ContactListItemView;
import com.android.contacts.common.list.ContactTileView;
import com.android.dialer.DialtactsActivity;
import com.android.dialer.R;
@@ -290,21 +292,12 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
mShowAllContactsInEmptyViewButton = mParentView.findViewById(
R.id.show_all_contact_button_in_nofav);
- mShowAllContactsInEmptyViewButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- showAllContacts();
- }
- });
+ prepareAllContactsButton(mShowAllContactsInEmptyViewButton);
mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView,
false);
- mShowAllContactsButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- showAllContacts();
- }
- });
+
+ prepareAllContactsButton(mShowAllContactsButton);
mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);
@@ -638,4 +631,33 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen
.apply();
fetchCalls();
}
+
+ /**
+ * Returns a view that is laid out and styled to look like a regular contact, with the correct
+ * click behavior (to launch the all contacts activity when it is clicked).
+ */
+ private View prepareAllContactsButton(View v) {
+ final ContactListItemView view = (ContactListItemView) v;
+ view.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ showAllContacts();
+ }
+ });
+
+ view.setPhotoPosition(ContactListItemView.PhotoPosition.LEFT);
+ final Resources resources = getResources();
+ view.setBackgroundResource(R.drawable.contact_list_item_background);
+
+ view.setPaddingRelative(
+ resources.getDimensionPixelSize(R.dimen.favorites_row_start_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_end_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_top_padding),
+ resources.getDimensionPixelSize(R.dimen.favorites_row_bottom_padding));
+
+ view.setDisplayName(resources.getString(R.string.show_all_contacts_button_text));
+ view.setDrawableResource(R.drawable.list_item_avatar_bg,
+ R.drawable.ic_menu_all_contacts_dk);
+ return view;
+ }
}