diff options
author | Yorke Lee <yorkelee@google.com> | 2014-04-23 18:17:27 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-04-23 18:20:33 -0700 |
commit | 6144d027255568a76adf8c36b96af8e283460622 (patch) | |
tree | d9bf14011a23a9892b4490ca096a91480df4da37 | |
parent | d999b71452baebec789f6f58f1955d30e834826d (diff) |
Disable quickcontactbadge in AllContactsFragment
Disable the quick contacts badge in AllContactsFragment and just
use the regular photo ImageView so that contact photos can be made
round and have the overlay removed without affecting other apps
that use the QuickContactsBadge (e.g. Gmail).
Also tag the view with the contactUri so that it can be used to
bring up the QuickContactActivity when clicked.
Bug: 13747208
Change-Id: I02288fd64d133d75c7b5e635d9b450f0b2cf7673
-rw-r--r-- | src/com/android/dialer/list/AllContactsFragment.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java index ba482030a..50f23aa0a 100644 --- a/src/com/android/dialer/list/AllContactsFragment.java +++ b/src/com/android/dialer/list/AllContactsFragment.java @@ -16,6 +16,9 @@ package com.android.dialer.list; +import android.database.Cursor; +import android.net.Uri; +import android.provider.ContactsContract.QuickContact; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -35,7 +38,7 @@ import com.android.dialer.R; public class AllContactsFragment extends ContactEntryListFragment<ContactEntryListAdapter> { public AllContactsFragment() { - setQuickContactEnabled(true); + setQuickContactEnabled(false); setPhotoLoaderEnabled(true); setSectionHeaderDisplayEnabled(true); setDarkTheme(false); @@ -44,7 +47,13 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi @Override protected ContactEntryListAdapter createListAdapter() { - DefaultContactListAdapter adapter = new DefaultContactListAdapter(getActivity()); + final DefaultContactListAdapter adapter = new DefaultContactListAdapter(getActivity()) { + @Override + protected void bindView(View itemView, int partition, Cursor cursor, int position) { + super.bindView(itemView, partition, cursor, position); + itemView.setTag(this.getContactUri(partition, cursor)); + } + }; adapter.setDisplayPhotos(true); adapter.setFilter(ContactListFilter.createFilterWithType( ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY)); @@ -60,9 +69,10 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - ContactListItemView contactListItemView = (ContactListItemView) view; - QuickContactBadge quickContact = contactListItemView.getQuickContact(); - quickContact.onClick(quickContact); + final Uri uri = (Uri) view.getTag(); + if (uri != null) { + QuickContact.showQuickContact(getActivity(), view, uri, QuickContact.MODE_LARGE, null); + } } @Override |