/** * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined * automatically. */ public static Intent getCallIntent(String number) { return getCallIntent(getCallUri(number)); }
/** * Determines if one of the call capable phone accounts defined supports video calling. * * @param context The context. * @return {@code true} if one of the call capable phone accounts supports video calling, * {@code false} otherwise. */ public static boolean isVideoEnabled(Context context) { return (getVideoCallingAvailability(context) & VIDEO_CALLING_ENABLED) != 0; }
public boolean isVideoEnabled() { if (!mHasCheckedForVideoEnabled) { mIsVideoEnabled = CallUtil.isVideoEnabled(mContext); mHasCheckedForVideoEnabled = true; } return mIsVideoEnabled; }
public CallIntentBuilder(String number) { this(CallUtil.getCallUri(number)); }
@Override public Intent getIntent(Context context) { return new CallIntentBuilder(CallUtil.getVoicemailUri()) .setCallInitiationType(LogState.INITIATION_CALL_LOG) .build(); } };
@Override public void onClick(View v) { String subject = mCallSubjectView.getText().toString(); Intent intent = CallUtil.getCallWithSubjectIntent(mNumber, mPhoneAccountHandle, subject); TelecomManagerCompat.placeCall( CallSubjectDialog.this, (TelecomManager) getSystemService(Context.TELECOM_SERVICE), intent); mSubjectHistory.add(subject); saveSubjectHistory(mSubjectHistory); finish(); } };
@Override public void show() { final Menu menu = getMenu(); boolean enable = !isDigitsEmpty(); for (int i = 0; i < menu.size(); i++) { MenuItem item = menu.getItem(i); item.setEnabled(enable); if (item.getItemId() == R.id.menu_call_with_note) { item.setVisible(CallUtil.isCallWithSubjectSupported(getContext())); } } super.show(); } };
/** * A variant of {@link #getCallIntent} for starting a video call. */ public static Intent getVideoCallIntent(String number, String callOrigin) { final Intent intent = new Intent(Intent.ACTION_CALL, getCallUri(number)); intent.putExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, VideoProfile.STATE_BIDIRECTIONAL); if (!TextUtils.isEmpty(callOrigin)) { intent.putExtra(PhoneConstants.EXTRA_CALL_ORIGIN, callOrigin); } return intent; }
public void callVoicemail() { DialerUtils.startActivityWithErrorToast(getActivity(), new CallIntentBuilder(CallUtil.getVoicemailUri()) .setCallInitiationType(LogState.INITIATION_DIALPAD) .build()); hideAndClearDialpad(false); }
/** * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined * automatically. */ public static Intent getCallWithSubjectIntent(String number, PhoneAccountHandle phoneAccountHandle, String callSubject) { final Intent intent = getCallIntent(getCallUri(number)); intent.putExtra(TelecomManager.EXTRA_CALL_SUBJECT, callSubject); if (phoneAccountHandle != null) { intent.putExtra(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle); } return intent; }
@Override public boolean onMenuItemClick(MenuItem item) { int resId = item.getItemId(); if (resId == R.id.context_menu_block_number) { FilteredNumberCompat .showBlockNumberDialogFlow(mContext.getContentResolver(), blockId, number, countryIso, displayNumber, R.id.floating_action_button_container, ((Activity) mContext).getFragmentManager(), mFilteredNumberDialogCallback); return true; } else if (resId == R.id.context_menu_copy_to_clipboard) { ClipboardUtils.copyText(mContext, null, number, true); return true; } else if (resId == R.id.context_menu_copy_transcript_to_clipboard) { ClipboardUtils.copyText(mContext, null, phoneCallDetailsViews.voicemailTranscriptionView.getText(), true); return true; } else if (resId == R.id.context_menu_edit_before_call) { final Intent intent = new Intent( Intent.ACTION_DIAL, CallUtil.getCallUri(number)); intent.setClass(mContext, DialtactsActivity.class); DialerUtils.startActivityWithErrorToast(mContext, intent); return true; } return false; }
public DialerPhoneNumberListAdapter(Context context) { super(context); mCountryIso = GeoUtil.getCurrentCountryIso(context); mVideoCallingEnabled = CallUtil.isVideoEnabled(context); }
public PhoneNumberListAdapter(Context context) { super(context); setDefaultFilterHeaderText(R.string.list_filter_phones); mUnknownNameText = context.getText(android.R.string.unknownName); mCountryIso = GeoUtil.getCurrentCountryIso(context); final ExtendedPhoneDirectoriesManager manager = ExtensionsFactory.getExtendedPhoneDirectoriesManager(); if (manager != null) { mExtendedDirectories = manager.getExtendedDirectories(mContext); } else { // Empty list to avoid sticky NPE's mExtendedDirectories = new ArrayList<DirectoryPartition>(); } int videoCapabilities = CallUtil.getVideoCallingAvailability(context); mIsVideoEnabled = (videoCapabilities & CallUtil.VIDEO_CALLING_ENABLED) != 0; mIsPresenceEnabled = (videoCapabilities & CallUtil.VIDEO_CALLING_PRESENCE) != 0; }
@Override public void onClick(View view) { int resId = view.getId(); if (resId == R.id.call_detail_action_block) { FilteredNumberCompat .showBlockNumberDialogFlow(mContext.getContentResolver(), mBlockedNumberId, mNumber, mDetails.countryIso, mDisplayNumber, R.id.call_detail, getFragmentManager(), this); } else if (resId == R.id.call_detail_action_copy) { ClipboardUtils.copyText(mContext, null, mNumber, true); } else if (resId == R.id.call_detail_action_edit_before_call) { Intent dialIntent = new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(getDialableNumber())); DialerUtils.startActivityWithErrorToast(mContext, dialIntent); } else { Log.wtf(TAG, "Unexpected onClick event from " + view); } }
&& CallUtil.isVideoEnabled(mContext);
protected boolean isChanged(boolean showNumberShortcuts) { boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_DIRECT_CALL, showNumberShortcuts || mIsQuerySipAddress); changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); return changed; }
@Override public void setQueryString(String queryString) { final boolean showNumberShortcuts = !TextUtils.isEmpty(getFormattedQueryString()); boolean changed = false; changed |= setShortcutEnabled(SHORTCUT_CREATE_NEW_CONTACT, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_ADD_TO_EXISTING_CONTACT, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_SEND_SMS_MESSAGE, showNumberShortcuts); changed |= setShortcutEnabled(SHORTCUT_MAKE_VIDEO_CALL, showNumberShortcuts && CallUtil.isVideoEnabled(getContext())); if (changed) { notifyDataSetChanged(); } super.setQueryString(queryString); } }