use of com.android.contacts.common.list.OnPhoneNumberPickerActionListener in project android_packages_apps_Dialer by LineageOS.
the class SearchFragment method onItemClick.
@Override
protected void onItemClick(int position, long id) {
final DialerPhoneNumberListAdapter adapter = (DialerPhoneNumberListAdapter) getAdapter();
final int shortcutType = adapter.getShortcutTypeFromPosition(position);
final OnPhoneNumberPickerActionListener listener;
final Intent intent;
final String number;
LogUtil.i("SearchFragment.onItemClick", "shortcutType: " + shortcutType);
switch(shortcutType) {
case DialerPhoneNumberListAdapter.SHORTCUT_DIRECT_CALL:
number = adapter.getQueryString();
listener = getOnPhoneNumberPickerListener();
if (listener != null && !checkForProhibitedPhoneNumber(number)) {
CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder().setCallInitiationType(getCallInitiationType(false)).setPositionOfSelectedSearchResult(position).setCharactersInSearchString(getQueryString() == null ? 0 : getQueryString().length()).build();
listener.onPickPhoneNumber(number, false, /* isVideoCall */
callSpecificAppData);
}
break;
case DialerPhoneNumberListAdapter.SHORTCUT_CREATE_NEW_CONTACT:
if (this instanceof SmartDialSearchFragment) {
Logger.get(getContext()).logImpression(DialerImpression.Type.CREATE_NEW_CONTACT_FROM_DIALPAD);
}
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getFormattedQueryString() : mAddToContactNumber;
intent = IntentUtil.getNewContactIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_ADD_TO_EXISTING_CONTACT:
if (this instanceof SmartDialSearchFragment) {
Logger.get(getContext()).logImpression(DialerImpression.Type.ADD_TO_A_CONTACT_FROM_DIALPAD);
}
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getFormattedQueryString() : mAddToContactNumber;
intent = IntentUtil.getAddToExistingContactIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent, R.string.add_contact_not_available);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_SEND_SMS_MESSAGE:
number = adapter.getFormattedQueryString();
intent = IntentUtil.getSendSmsIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_MAKE_VIDEO_CALL:
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getQueryString() : mAddToContactNumber;
listener = getOnPhoneNumberPickerListener();
if (listener != null && !checkForProhibitedPhoneNumber(number)) {
CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder().setCallInitiationType(getCallInitiationType(false)).setPositionOfSelectedSearchResult(position).setCharactersInSearchString(getQueryString() == null ? 0 : getQueryString().length()).build();
listener.onPickPhoneNumber(number, true, /* isVideoCall */
callSpecificAppData);
}
break;
case DialerPhoneNumberListAdapter.SHORTCUT_INVALID:
default:
super.onItemClick(position, id);
break;
}
}
use of com.android.contacts.common.list.OnPhoneNumberPickerActionListener in project android_packages_apps_Dialer by MoKee.
the class SearchFragment method onItemClick.
@Override
protected void onItemClick(int position, long id) {
final DialerPhoneNumberListAdapter adapter = (DialerPhoneNumberListAdapter) getAdapter();
final int shortcutType = adapter.getShortcutTypeFromPosition(position);
final OnPhoneNumberPickerActionListener listener;
final Intent intent;
final String number;
Log.i(TAG, "onItemClick: shortcutType=" + shortcutType);
switch(shortcutType) {
case DialerPhoneNumberListAdapter.SHORTCUT_INVALID:
super.onItemClick(position, id);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_DIRECT_CALL:
number = adapter.getQueryString();
listener = getOnPhoneNumberPickerListener();
if (listener != null && !checkForProhibitedPhoneNumber(number)) {
listener.onPickPhoneNumber(number, false, /* isVideoCall */
getCallInitiationType(false));
}
break;
case DialerPhoneNumberListAdapter.SHORTCUT_CREATE_NEW_CONTACT:
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getFormattedQueryString() : mAddToContactNumber;
intent = IntentUtil.getNewContactIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_ADD_TO_EXISTING_CONTACT:
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getFormattedQueryString() : mAddToContactNumber;
intent = IntentUtil.getAddToExistingContactIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent, R.string.add_contact_not_available);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_SEND_SMS_MESSAGE:
number = adapter.getFormattedQueryString();
intent = IntentUtil.getSendSmsIntent(number);
DialerUtils.startActivityWithErrorToast(getActivity(), intent);
break;
case DialerPhoneNumberListAdapter.SHORTCUT_MAKE_VIDEO_CALL:
number = TextUtils.isEmpty(mAddToContactNumber) ? adapter.getQueryString() : mAddToContactNumber;
listener = getOnPhoneNumberPickerListener();
if (listener != null && !checkForProhibitedPhoneNumber(number)) {
listener.onPickPhoneNumber(number, true, /* isVideoCall */
getCallInitiationType(false));
}
break;
}
}
Aggregations