diff options
Diffstat (limited to 'java/com/android/contacts/common/list/PhoneNumberPickerFragment.java')
-rw-r--r-- | java/com/android/contacts/common/list/PhoneNumberPickerFragment.java | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java index 79e670010..8f25f82a5 100644 --- a/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java +++ b/java/com/android/contacts/common/list/PhoneNumberPickerFragment.java @@ -29,18 +29,15 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.android.contacts.common.R; -import com.android.contacts.common.list.PhoneNumberListAdapter.Listener; 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.dialercontact.DialerContact; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; -import com.android.dialer.lightbringer.LightbringerComponent; -import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.protos.ProtoParsers; import java.util.Set; @@ -64,6 +61,9 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE private boolean mUseCallableUri; + private ContactListItemView.PhotoPosition mPhotoPosition = + ContactListItemView.getDefaultPhotoPosition(false /* normal/non opposite */); + private final Set<OnLoadFinishedListener> mLoadFinishedListeners = new ArraySet<>(); private CursorReranker mCursorReranker; @@ -71,7 +71,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE public PhoneNumberPickerFragment() { setQuickContactEnabled(false); setPhotoLoaderEnabled(true); - setSectionHeaderDisplayEnabled(false); + setSectionHeaderDisplayEnabled(true); setDirectorySearchMode(DirectoryListLoader.SEARCH_MODE_NONE); // Show nothing instead of letting caller Activity show something. @@ -85,32 +85,17 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE */ @Override public void onVideoCallIconClicked(int position) { - Logger.get(getContext()).logImpression(DialerImpression.Type.IMS_VIDEO_REQUESTED_FROM_SEARCH); callNumber(position, true /* isVideoCall */); } @Override - public void onLightbringerIconClicked(int position) { - String phoneNumber = getPhoneNumber(position); - Intent intent = - LightbringerComponent.get(getContext()) - .getLightbringer() - .getIntent(getContext(), phoneNumber); - // DialtactsActivity.ACTIVITY_REQUEST_CODE_LIGHTBRINGER - // Cannot reference because of cyclic dependencies - Logger.get(getContext()) - .logImpression(DialerImpression.Type.LIGHTBRINGER_VIDEO_REQUESTED_FROM_SEARCH); - int dialactsActivityRequestCode = 3; - getActivity().startActivityForResult(intent, dialactsActivityRequestCode); - } - - @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)); - DialerContact contact = ((PhoneNumberListAdapter) getAdapter()).getDialerContact(position); + CallComposerContact contact = + ((PhoneNumberListAdapter) getAdapter()).getCallComposerContact(position); ProtoParsers.put(intent, "CALL_COMPOSER_CONTACT", contact); startActivity(intent); } @@ -335,27 +320,7 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE @Override public void onCapabilitiesUpdated() { if (getAdapter() != null) { - EnrichedCallManager manager = - EnrichedCallComponent.get(getContext()).getEnrichedCallManager(); - Listener listener = ((PhoneNumberListAdapter) getAdapter()).getListener(); - - for (int i = 0; i < getListView().getChildCount(); i++) { - if (!(getListView().getChildAt(i) instanceof ContactListItemView)) { - continue; - } - - // Since call and share is the lowest priority call to action, if any others are set, - // do not reset the call to action. Also do not set the call and share call to action if - // the number doesn't support call composer. - ContactListItemView view = (ContactListItemView) getListView().getChildAt(i); - if (view.getCallToAction() != ContactListItemView.NONE - || view.getPhoneNumber() == null - || manager.getCapabilities(view.getPhoneNumber()) == null - || !manager.getCapabilities(view.getPhoneNumber()).supportsCallComposer()) { - continue; - } - view.setCallToAction(ContactListItemView.CALL_AND_SHARE, listener, view.getPosition()); - } + getAdapter().notifyDataSetChanged(); } } @@ -395,6 +360,12 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE if (!isSearchMode() && mFilter != null) { adapter.setFilter(mFilter); } + + setPhotoPosition(adapter); + } + + protected void setPhotoPosition(ContactEntryListAdapter adapter) { + ((PhoneNumberListAdapter) adapter).setPhotoPosition(mPhotoPosition); } @Override @@ -418,6 +389,15 @@ public class PhoneNumberPickerFragment extends ContactEntryListFragment<ContactE updateFilterHeaderView(); } + public void setPhotoPosition(ContactListItemView.PhotoPosition photoPosition) { + mPhotoPosition = photoPosition; + + final PhoneNumberListAdapter adapter = (PhoneNumberListAdapter) getAdapter(); + if (adapter != null) { + adapter.setPhotoPosition(photoPosition); + } + } + /** * @param isRemoteDirectory {@code true} if the call was initiated using a contact/phone number * not in the local contacts database |