diff options
author | Andrew Lee <anwlee@google.com> | 2014-04-18 00:53:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-18 00:53:51 +0000 |
commit | 0421cea465c8d05c620a44e2d18e2d651817bf7a (patch) | |
tree | f6ec57467ed40bf4dd428a66baac3a7d44d9a53f /src | |
parent | d4194af1f6aa12c069431fe779f899f0fe7bfa55 (diff) | |
parent | b70f8a8f6e0016bbb1876a5127f635acd4568a05 (diff) |
am b70f8a8f: Merge "On click, open quick contacts for list items in Dialer\'s Contacts."
* commit 'b70f8a8f6e0016bbb1876a5127f635acd4568a05':
On click, open quick contacts for list items in Dialer's Contacts.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/list/AllContactsActivity.java | 9 | ||||
-rw-r--r-- | src/com/android/dialer/list/AllContactsFragment.java | 55 |
2 files changed, 33 insertions, 31 deletions
diff --git a/src/com/android/dialer/list/AllContactsActivity.java b/src/com/android/dialer/list/AllContactsActivity.java index f5d739de3..b518ee936 100644 --- a/src/com/android/dialer/list/AllContactsActivity.java +++ b/src/com/android/dialer/list/AllContactsActivity.java @@ -83,13 +83,4 @@ public class AllContactsActivity extends TransactionSafeActivity { setContentView(R.layout.all_contacts_activity); } - - @Override - public void onAttachFragment(Fragment fragment) { - if (fragment instanceof AllContactsFragment) { - mAllContactsFragment = (AllContactsFragment) fragment; - mAllContactsFragment.setOnPhoneNumberPickerActionListener( - mPhoneNumberPickerActionListener); - } - } } diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java index 47476e686..2d671bf45 100644 --- a/src/com/android/dialer/list/AllContactsFragment.java +++ b/src/com/android/dialer/list/AllContactsFragment.java @@ -1,5 +1,4 @@ /* - * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,44 +16,56 @@ package com.android.dialer.list; -import android.app.Activity; -import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.QuickContactBadge; +import com.android.contacts.common.list.ContactEntryListAdapter; +import com.android.contacts.common.list.ContactEntryListFragment; +import com.android.contacts.common.list.ContactListFilter; import com.android.contacts.common.list.ContactListItemView; -import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; -import com.android.contacts.common.list.PhoneNumberPickerFragment; +import com.android.contacts.common.list.DefaultContactListAdapter; import com.android.dialer.R; /** * Fragments to show all contacts with phone numbers. */ -public class AllContactsFragment extends PhoneNumberPickerFragment{ - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); +public class AllContactsFragment extends ContactEntryListFragment<ContactEntryListAdapter> { - // Customizes the listview according to the dialer specifics. + public AllContactsFragment() { setQuickContactEnabled(true); + setPhotoLoaderEnabled(true); + setSectionHeaderDisplayEnabled(true); setDarkTheme(false); - setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(true /* opposite */)); - setUseCallableUri(true); - - try { - OnPhoneNumberPickerActionListener mNumberPickerListener = - (OnPhoneNumberPickerActionListener) activity; - setOnPhoneNumberPickerActionListener(mNumberPickerListener); - } catch (ClassCastException e) { - throw new ClassCastException(activity.toString() - + " must implement OnPhoneNumberPickerActionListener"); - } + } + + @Override + protected ContactEntryListAdapter createListAdapter() { + DefaultContactListAdapter adapter = new DefaultContactListAdapter(getActivity()); + adapter.setDisplayPhotos(true); + adapter.setFilter(ContactListFilter.createFilterWithType( + ContactListFilter.FILTER_TYPE_WITH_PHONE_NUMBERS_ONLY)); + adapter.setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(true /* opposite */)); + adapter.setSectionHeaderDisplayEnabled(isSectionHeaderDisplayEnabled()); + return adapter; } @Override protected View inflateView(LayoutInflater inflater, ViewGroup container) { return inflater.inflate(R.layout.show_all_contacts_fragment, null); } + + @Override + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + ContactListItemView contactListItemView = (ContactListItemView) view; + QuickContactBadge quickContact = contactListItemView.getQuickContact(); + quickContact.onClick(quickContact); + } + + @Override + protected void onItemClick(int position, long id) { + // Do nothing. Implemented to satisfy ContactEntryListFragment. + } } |