diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-05 15:29:54 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-05 15:29:54 +0000 |
commit | 43b3152d075138b11e1fe297682b3bbc775e5641 (patch) | |
tree | 3a325b0effac02fbd228b8ddf2f96589e5df72cd /java/com/android/contacts/common/list/PhoneNumberPickerFragment.java | |
parent | 2034759538273aed8a0b412d8fb90994eba1f7ea (diff) | |
parent | 300a8683b9c28424fb0f0c571a0abe128c461f69 (diff) |
Update Dialer to V10 RC16 am: 10b34a5ebf
am: 300a8683b9
Change-Id: If5695bad59f8a4dab6e6c90b54943b900bd2652a
Diffstat (limited to 'java/com/android/contacts/common/list/PhoneNumberPickerFragment.java')
-rw-r--r-- | java/com/android/contacts/common/list/PhoneNumberPickerFragment.java | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java index 99c41f92d..8f25f82a5 100644 --- a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java +++ b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java @@ -15,6 +15,8 @@ */ package com.android.contacts.common.list; +import android.content.ComponentName; +import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; @@ -28,19 +30,23 @@ import android.view.View; import android.view.ViewGroup; import com.android.contacts.common.R; import com.android.contacts.common.util.AccountFilterUtil; +import com.android.dialer.callcomposer.CallComposerContact; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallInitiationType.Type; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; +import com.android.dialer.enrichedcall.EnrichedCallComponent; +import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.logging.Logger; +import com.android.dialer.protos.ProtoParsers; import java.util.Set; import org.json.JSONException; import org.json.JSONObject; /** Fragment containing a phone number list for picking. */ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactEntryListAdapter> - implements PhoneNumberListAdapter.Listener { + implements PhoneNumberListAdapter.Listener, EnrichedCallManager.CapabilitiesListener { private static final String KEY_FILTER = "filter"; private OnPhoneNumberPickerActionListener mListener; @@ -58,8 +64,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE private ContactListItemView.PhotoPosition mPhotoPosition = ContactListItemView.getDefaultPhotoPosition(false /* normal/non opposite */); - private final Set<OnLoadFinishedListener> mLoadFinishedListeners = - new ArraySet<OnLoadFinishedListener>(); + private final Set<OnLoadFinishedListener> mLoadFinishedListeners = new ArraySet<>(); private CursorReranker mCursorReranker; @@ -83,6 +88,18 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE callNumber(position, true /* isVideoCall */); } + @Override + public void onCallAndShareIconClicked(int position) { + // Required because of cyclic dependencies of everything depending on contacts/common. + String componentName = "com.android.dialer.callcomposer.CallComposerActivity"; + Intent intent = new Intent(); + intent.setComponent(new ComponentName(getContext(), componentName)); + CallComposerContact contact = + ((PhoneNumberListAdapter) getAdapter()).getCallComposerContact(position); + ProtoParsers.put(intent, "CALL_COMPOSER_CONTACT", contact); + startActivity(intent); + } + public void setDirectorySearchEnabled(boolean flag) { setDirectorySearchMode( flag ? DirectoryListLoader.SEARCH_MODE_DEFAULT : DirectoryListLoader.SEARCH_MODE_NONE); @@ -110,6 +127,22 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE setVisibleScrollbarEnabled(getVisibleScrollbarEnabled()); } + @Override + public void onPause() { + super.onPause(); + EnrichedCallComponent.get(getContext()) + .getEnrichedCallManager() + .unregisterCapabilitiesListener(this); + } + + @Override + public void onResume() { + super.onResume(); + EnrichedCallComponent.get(getContext()) + .getEnrichedCallManager() + .registerCapabilitiesListener(this); + } + protected boolean getVisibleScrollbarEnabled() { return true; } @@ -284,6 +317,13 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE } } + @Override + public void onCapabilitiesUpdated() { + if (getAdapter() != null) { + getAdapter().notifyDataSetChanged(); + } + } + @MainThread @Override public void onDetach() { |