summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-04-18 00:47:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-18 00:47:45 +0000
commitb70f8a8f6e0016bbb1876a5127f635acd4568a05 (patch)
tree6885b9fa07a5c0b6d968baf3cfce6a02f31655dd /src
parentd45aaa40aa6b929f7bc644d649b3474fcf82cfa2 (diff)
parent931075eab957d7ecd7a9e880c0650012e29f05c2 (diff)
Merge "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.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.
+ }
}