summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-04-17 14:19:45 -0700
committerAndrew Lee <anwlee@google.com>2014-04-17 16:23:08 -0700
commit931075eab957d7ecd7a9e880c0650012e29f05c2 (patch)
tree26732d7254eaab0a334943c318a98425ed7ffff9 /src
parent33932ff9433bcd172749d416c23655c8d8bdafc2 (diff)
On click, open quick contacts for list items in Dialer's Contacts.
- Change AllContactsFragment to extend ContactEntryListFragment. - Replace PhoneNumberListAdapter with DefaultcontactListAdapter, and filter only for contacts with phone numbers. - Handle item clicks to open the ContactListItemView's QuickContact. Bug: 13956531 Change-Id: If3ceb5c3a988b0c701387eca22a3ae5de055c66a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/AllContactsActivity.java9
-rw-r--r--src/com/android/dialer/list/AllContactsFragment.java55
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.
+ }
}