summaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent246e7578a0e7c1e2e3d8aa0ad0b3557e4e339137 (diff)
parentb48e45496dd75bb7de73327a5a238dc8e19dc91d (diff)
downloadpackages_apps_Dialer-0d1804386f73f542bd6fcebe064288610d02354a.tar.gz
packages_apps_Dialer-0d1804386f73f542bd6fcebe064288610d02354a.tar.bz2
packages_apps_Dialer-0d1804386f73f542bd6fcebe064288610d02354a.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteFragment.java46
1 files changed, 34 insertions, 12 deletions
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;
+ }
}