use of com.android.contacts.common.list.PhoneNumberListAdapter.Listener in project android_packages_apps_Dialer by LineageOS.
the class ContactListItemView method setCallToAction.
/**
* Sets whether the call to action is shown. For the {@link CallToAction} to be shown, it must be
* supported as well.
*
* @param action {@link CallToAction} you want to display (if it's supported).
* @param listener Listener to notify when the call to action is clicked.
* @param position The position in the adapter of the call to action.
*/
public void setCallToAction(@CallToAction int action, Listener listener, int position) {
mCallToAction = action;
mPosition = position;
Drawable drawable;
int description;
OnClickListener onClickListener;
if (action == CALL_AND_SHARE) {
drawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_phone_attach);
drawable.setAutoMirrored(true);
description = R.string.description_search_call_and_share;
onClickListener = v -> listener.onCallAndShareIconClicked(position);
} else if (action == VIDEO && mSupportVideoCall) {
drawable = ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_videocam_vd_theme_24);
drawable.setAutoMirrored(true);
description = R.string.description_search_video_call;
onClickListener = v -> listener.onVideoCallIconClicked(position);
} else if (action == LIGHTBRINGER) {
CallIntentBuilder.increaseLightbringerCallButtonAppearInSearchCount();
drawable = ContextCompat.getDrawable(getContext(), R.drawable.quantum_ic_videocam_vd_theme_24);
drawable.setAutoMirrored(true);
description = R.string.description_search_video_call;
onClickListener = v -> listener.onLightbringerIconClicked(position);
} else {
mCallToActionView.setVisibility(View.GONE);
mCallToActionView.setOnClickListener(null);
return;
}
mCallToActionView.setContentDescription(getContext().getString(description));
mCallToActionView.setOnClickListener(onClickListener);
mCallToActionView.setImageDrawable(drawable);
mCallToActionView.setVisibility(View.VISIBLE);
}
use of com.android.contacts.common.list.PhoneNumberListAdapter.Listener in project android_packages_apps_Dialer by LineageOS.
the class PhoneNumberPickerFragment method onCapabilitiesUpdated.
@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());
}
}
}
Aggregations