use of com.android.dialer.callintent.CallSpecificAppData in project android_packages_apps_Dialer by LineageOS.
the class CallContactActivity method makeCall.
/**
* Attempt to make a call, finishing the activity if the required permissions are already granted.
* If the required permissions are not already granted, the activity is not finished so that the
* user can choose to grant or deny them.
*/
private void makeCall() {
CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder().setCallInitiationType(CallInitiationType.Type.LAUNCHER_SHORTCUT).build();
PhoneNumberInteraction.startInteractionForPhoneCall(this, contactUri, false, /* isVideoCall */
callSpecificAppData);
}
use of com.android.dialer.callintent.CallSpecificAppData in project android_packages_apps_Dialer by LineageOS.
the class ContactTileView method createClickListener.
protected OnClickListener createClickListener() {
return new OnClickListener() {
@Override
public void onClick(View v) {
if (mListener == null) {
return;
}
CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder().setCallInitiationType(CallInitiationType.Type.SPEED_DIAL).build();
mListener.onContactSelected(getLookupUri(), MoreContactUtils.getTargetRectFromView(ContactTileView.this), callSpecificAppData);
}
};
}
use of com.android.dialer.callintent.CallSpecificAppData in project android_packages_apps_Dialer by LineageOS.
the class PhoneNumberPickerFragment method callNumber.
/**
* Initiates a call to the number at the specified position.
*
* @param position The position.
* @param isVideoCall {@code true} if the call should be initiated as a video call, {@code false}
* otherwise.
*/
private void callNumber(int position, boolean isVideoCall) {
final String number = getPhoneNumber(position);
if (!TextUtils.isEmpty(number)) {
cacheContactInfo(position);
CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder().setCallInitiationType(getCallInitiationType(true)).setPositionOfSelectedSearchResult(position).setCharactersInSearchString(getQueryString() == null ? 0 : getQueryString().length()).build();
mListener.onPickPhoneNumber(number, isVideoCall, callSpecificAppData);
} else {
LogUtil.i("PhoneNumberPickerFragment.callNumber", "item at %d was clicked before adapter is ready, ignoring", position);
}
// Get the lookup key and track any analytics
final String lookupKey = getLookupKey(position);
if (!TextUtils.isEmpty(lookupKey)) {
maybeTrackAnalytics(lookupKey);
}
}
use of com.android.dialer.callintent.CallSpecificAppData 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;
}
}
Aggregations