List of usage examples for android.content Intent ACTION_CALL
String ACTION_CALL
To view the source code for android.content Intent ACTION_CALL.
Click Source Link
From source file:com.findcab.activity.LocationOverlay.java
/** * MKSearchListener?,??/* w w w.j a v a 2s . c om*/ * * @author liufeng */ @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.map_calling_title_btn_fresh: // pt?? if (HttpTools.checkNetWork(context)) { if (pt != null) { // mMapView.refresh(); mMapView.getController().animateTo(pt); MyToast toast = new MyToast(context, "?"); toast.startMyToast(); getDrivers(); // mMapView.refresh(); } else { // Toast.makeText(LocationOverlay.this, "?", Toast.LENGTH_SHORT).show(); MyToast toast = new MyToast(context, "?"); toast.startMyToast(); } } break; case R.id.map_calling_title_btn_setting: Intent i1 = new Intent(context, SettingActivity.class); startActivity(i1); break; case R.id.map_calling_bottom_btn_call: Intent i = new Intent(context, CallActivity.class); startActivityForResult(i, SEND); break; // calling?? case R.id.map_waiting_bottom_btn_cancel: // ?? judgeCancle = CANCLE_CALLING; showDialog1(); if (lastConversation != null) { String id = String.valueOf(ConversationID); System.out.print("?ID----------------------->" + ConversationID); changeConversationsStatus("-1", id); } else { Log.e("??", "CANCLE_CALLING"); } break; // answer?? case R.id.map_answr_bottom_btn_cancel: isGetConversation = false;// ?????? judgeCancle = CANCLE_ANSWER; if (lastConversation != null) { String id = String.valueOf(ConversationID); System.out.print("?ID----------------------->" + ConversationID); changeConversationsStatus("-1", id); } else { Log.e("???", "CANCLE_ANSWER"); } // Intent i2 = new Intent(); // startActivityForResult(i2, CANCLE_ANSWER); showDialog1(); break; // answer?? case R.id.map_driver_call_button: Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + acceptInfo.getMobile())); startActivity(intent); break; // dialog_?? case R.id.dialog_frist_cancel: isGetConversation = false; if (lastConversation != null) { String id = String.valueOf(ConversationID); System.out.print("?ID----------------------->" + ConversationID); changeConversationsStatus("-1", id); } else { Log.e("??", "CANCLE_ANSWER"); } showNorm(); break; // dialog_? case R.id.dialog_frist_contiune: isGetConversation = false; timeOutDialog.setVisibility(View.GONE); getDrivers(); sendTrips(); break; // dialog?? case R.id.dialog_two_cancel: isGetConversation = false;// ???????? if (lastConversation != null) { String id = String.valueOf(lastConversation.getId()); changeConversationsStatus("-1", id); } showDialog2(); break; // dialog? case R.id.dialog_two_contiune: dialog1.setVisibility(View.GONE); // calling?answer? if (judgeCancle == CANCLE_CALLING) { // getDrivers(); // sendTrips(); // judgeCancle=0; } else if (judgeCancle == CANCLE_ANSWER) { getDrivers(); sendTrips(); // judgeCancle=0; } else { } break; // ???call? case R.id.dialog_three_1: showNorm(); break; case R.id.dialog_three_2: showNorm(); break; case R.id.dialog_three_3: showNorm(); break; case R.id.dialog_three_4: showNorm(); break; default: break; } }
From source file:com.roamprocess1.roaming4world.service.SipNotifications.java
public void showNotificationForVoiceMail(SipProfile acc, int numberOfMessages) { if (messageVoicemail == null) { messageVoicemail = new NotificationCompat.Builder(context); messageVoicemail.setSmallIcon(android.R.drawable.stat_notify_voicemail); messageVoicemail.setTicker(context.getString(R.string.voice_mail)); messageVoicemail.setWhen(System.currentTimeMillis()); messageVoicemail.setDefaults(Notification.DEFAULT_ALL); messageVoicemail.setAutoCancel(true); messageVoicemail.setOnlyAlertOnce(true); }/*from w w w . j a v a2 s .c om*/ PendingIntent contentIntent = null; Intent notificationIntent; if (acc != null && !TextUtils.isEmpty(acc.vm_nbr) && acc.vm_nbr != "null") { notificationIntent = new Intent(Intent.ACTION_CALL); notificationIntent.setData( SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, acc.vm_nbr + "@" + acc.getDefaultDomain())); notificationIntent.putExtra(SipProfile.FIELD_ACC_ID, acc.id); } else { notificationIntent = new Intent(SipManager.ACTION_SIP_DIALER); } notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT); String messageText = ""; if (acc != null) { messageText += acc.getProfileName() + " : "; } messageText += Integer.toString(numberOfMessages); messageVoicemail.setContentTitle(context.getString(R.string.voice_mail)); System.out.println("SipNotifications messageText " + messageText); messageVoicemail.setContentText(messageText); if (contentIntent != null) { messageVoicemail.setContentIntent(contentIntent); notificationManager.notify(VOICEMAIL_NOTIF_ID, messageVoicemail.build()); } }
From source file:com.ibuildapp.romanblack.WebPlugin.WebPlugin.java
@Override public void create() { try {//from www .ja v a 2s .c om setContentView(R.layout.romanblack_html_main); root = (FrameLayout) findViewById(R.id.romanblack_root_layout); webView = new ObservableWebView(this); webView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); root.addView(webView); webView.setHorizontalScrollBarEnabled(false); setTitle("HTML"); Intent currentIntent = getIntent(); Bundle store = currentIntent.getExtras(); widget = (Widget) store.getSerializable("Widget"); if (widget == null) { handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100); return; } appName = widget.getAppName(); if (widget.getPluginXmlData().length() == 0) { if (currentIntent.getStringExtra("WidgetFile").length() == 0) { handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100); return; } } if (widget.getTitle() != null && widget.getTitle().length() > 0) { setTopBarTitle(widget.getTitle()); } else { setTopBarTitle(getResources().getString(R.string.romanblack_html_web)); } currentUrl = (String) getSession(); if (currentUrl == null) { currentUrl = ""; } ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni != null && ni.isConnectedOrConnecting()) { isOnline = true; } // topbar initialization setTopBarLeftButtonText(getString(R.string.common_home_upper), true, new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); } }); if (isOnline) { webView.getSettings().setJavaScriptEnabled(true); } webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.getSettings().setGeolocationEnabled(true); webView.getSettings().setAllowFileAccess(true); webView.getSettings().setAppCacheEnabled(true); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setUseWideViewPort(false); webView.getSettings().setSavePassword(false); webView.clearHistory(); webView.invalidate(); if (Build.VERSION.SDK_INT >= 19) { } webView.getSettings().setUserAgentString( "Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Nexus One Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"); webView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.invalidate(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { } break; case MotionEvent.ACTION_UP: { if (!v.hasFocus()) { v.requestFocus(); } } break; case MotionEvent.ACTION_MOVE: { } break; } return false; } }); webView.setBackgroundColor(Color.WHITE); try { if (widget.getBackgroundColor() != Color.TRANSPARENT) { webView.setBackgroundColor(widget.getBackgroundColor()); } } catch (IllegalArgumentException e) { } webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); startActivity(intent); } }); webView.setWebChromeClient(new WebChromeClient() { FrameLayout.LayoutParams LayoutParameters = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); @Override public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) { AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this); builder.setTitle(R.string.location_dialog_title); builder.setMessage(R.string.location_dialog_description); builder.setCancelable(true); builder.setPositiveButton(R.string.location_dialog_allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.invoke(origin, true, false); } }); builder.setNegativeButton(R.string.location_dialog_not_allow, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.invoke(origin, false, false); } }); AlertDialog alert = builder.create(); alert.show(); } @Override public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { if (customView != null) { customViewCallback.onCustomViewHidden(); return; } view.setBackgroundColor(Color.BLACK); view.setLayoutParams(LayoutParameters); root.addView(view); customView = view; customViewCallback = callback; webView.setVisibility(View.GONE); } @Override public void onHideCustomView() { if (customView == null) { return; } else { closeFullScreenVideo(); } } public void openFileChooser(ValueCallback<Uri> uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT);//Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); isMedia = true; startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE); } //For Android 4.1 public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); isMedia = true; i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } @Override public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, FileChooserParams fileChooserParams) { isV21 = true; mUploadMessageV21 = filePathCallback; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); return true; } @Override public void onReceivedTouchIconUrl(WebView view, String url, boolean precomposed) { super.onReceivedTouchIconUrl(view, url, precomposed); } }); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); if (state == states.EMPTY) { currentUrl = url; setSession(currentUrl); state = states.LOAD_START; handler.sendEmptyMessage(SHOW_PROGRESS); } } @Override public void onLoadResource(WebView view, String url) { if (!alreadyLoaded && (url.startsWith("http://www.youtube.com/get_video_info?") || url.startsWith("https://www.youtube.com/get_video_info?")) && Build.VERSION.SDK_INT < 11) { try { String path = url.contains("https://www.youtube.com/get_video_info?") ? url.replace("https://www.youtube.com/get_video_info?", "") : url.replace("http://www.youtube.com/get_video_info?", ""); String[] parqamValuePairs = path.split("&"); String videoId = null; for (String pair : parqamValuePairs) { if (pair.startsWith("video_id")) { videoId = pair.split("=")[1]; break; } } if (videoId != null) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com")) .setData(Uri.parse("http://www.youtube.com/watch?v=" + videoId))); needRefresh = true; alreadyLoaded = !alreadyLoaded; return; } } catch (Exception ex) { } } else { super.onLoadResource(view, url); } } @Override public void onPageFinished(WebView view, String url) { if (hideProgress) { if (TextUtils.isEmpty(WebPlugin.this.url)) { state = states.LOAD_COMPLETE; handler.sendEmptyMessage(HIDE_PROGRESS); super.onPageFinished(view, url); } else { view.loadUrl("javascript:(function(){" + "l=document.getElementById('link');" + "e=document.createEvent('HTMLEvents');" + "e.initEvent('click',true,true);" + "l.dispatchEvent(e);" + "})()"); hideProgress = false; } } else { state = states.LOAD_COMPLETE; handler.sendEmptyMessage(HIDE_PROGRESS); super.onPageFinished(view, url); } } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { if (errorCode == WebViewClient.ERROR_BAD_URL) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)), DOWNLOAD_REQUEST_CODE); } } @Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final AlertDialog.Builder builder = new AlertDialog.Builder(WebPlugin.this); builder.setMessage(R.string.notification_error_ssl_cert_invalid); builder.setPositiveButton(WebPlugin.this.getResources().getString(R.string.wp_continue), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton(WebPlugin.this.getResources().getString(R.string.wp_cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.cancel(); } }); final AlertDialog dialog = builder.create(); dialog.show(); } @Override public void onFormResubmission(WebView view, Message dontResend, Message resend) { super.onFormResubmission(view, dontResend, resend); } @Override public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) { return super.shouldInterceptRequest(view, request); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { try { if (url.contains("youtube.com/watch")) { if (Build.VERSION.SDK_INT < 11) { try { startActivity( new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com")) .setData(Uri.parse(url))); return true; } catch (Exception ex) { return false; } } else { return false; } } else if (url.contains("paypal.com")) { if (url.contains("&bn=ibuildapp_SP")) { return false; } else { url = url + "&bn=ibuildapp_SP"; webView.loadUrl(url); return true; } } else if (url.contains("sms:")) { try { Intent smsIntent = new Intent(Intent.ACTION_VIEW); smsIntent.setData(Uri.parse(url)); startActivity(smsIntent); return true; } catch (Exception ex) { Log.e("", ex.getMessage()); return false; } } else if (url.contains("tel:")) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(url)); startActivity(callIntent); return true; } else if (url.contains("mailto:")) { MailTo mailTo = MailTo.parse(url); Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { mailTo.getTo() }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mailTo.getSubject()); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, mailTo.getBody()); WebPlugin.this.startActivity(Intent.createChooser(emailIntent, getString(R.string.romanblack_html_send_email))); return true; } else if (url.contains("rtsp:")) { Uri address = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, address); final PackageManager pm = getPackageManager(); final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0); if (matches.size() > 0) { startActivity(intent); } else { Toast.makeText(WebPlugin.this, getString(R.string.romanblack_html_no_video_player), Toast.LENGTH_SHORT).show(); } return true; } else if (url.startsWith("intent:") || url.startsWith("market:") || url.startsWith("col-g2m-2:")) { Intent it = new Intent(); it.setData(Uri.parse(url)); startActivity(it); return true; } else if (url.contains("//play.google.com/")) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { if (url.contains("ibuildapp.com-1915109")) { String param = Uri.parse(url).getQueryParameter("widget"); finish(); if (param != null && param.equals("1001")) com.appbuilder.sdk.android.Statics.launchMain(); else if (param != null && !"".equals(param)) { View.OnClickListener widget = Statics.linkWidgets.get(Integer.valueOf(param)); if (widget != null) widget.onClick(view); } return false; } currentUrl = url; setSession(currentUrl); if (!isOnline) { handler.sendEmptyMessage(HIDE_PROGRESS); handler.sendEmptyMessage(STOP_LOADING); } else { String pageType = "application/html"; if (!url.contains("vk.com")) { getPageType(url); } if (pageType.contains("application") && !pageType.contains("html") && !pageType.contains("xml")) { startActivityForResult(new Intent(Intent.ACTION_VIEW, Uri.parse(url)), DOWNLOAD_REQUEST_CODE); return super.shouldOverrideUrlLoading(view, url); } else { view.getSettings().setLoadWithOverviewMode(true); view.getSettings().setUseWideViewPort(true); view.setBackgroundColor(Color.WHITE); } } return false; } } catch (Exception ex) { // Error Logging return false; } } }); handler.sendEmptyMessage(SHOW_PROGRESS); new Thread() { @Override public void run() { EntityParser parser; if (widget.getPluginXmlData() != null) { if (widget.getPluginXmlData().length() > 0) { parser = new EntityParser(widget.getPluginXmlData()); } else { String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile")); parser = new EntityParser(xmlData); } } else { String xmlData = readXmlFromFile(getIntent().getStringExtra("WidgetFile")); parser = new EntityParser(xmlData); } parser.parse(); url = parser.getUrl(); html = parser.getHtml(); if (url.length() > 0 && !isOnline) { handler.sendEmptyMessage(NEED_INTERNET_CONNECTION); } else { if (isOnline) { } else { if (html.length() == 0) { } } if (html.length() > 0 || url.length() > 0) { handler.sendEmptyMessageDelayed(SHOW_HTML, 700); } else { handler.sendEmptyMessage(HIDE_PROGRESS); handler.sendEmptyMessage(INITIALIZATION_FAILED); } } } }.start(); } catch (Exception ex) { } }
From source file:com.abcvoipsip.ui.dialpad.DialerFragment.java
@Override public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;//from w w w .jav a 2 s. c o m acc = accountChooserButton.getSelectedAccount(); if (acc != null) { accountToUse = acc.id; } if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandler.getAccountIdForCallHandler(getActivity(), "com.abcvoipsip/com.abcvoipsip.plugins.telephony.CallHandler")) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { OutgoingCall.ignoreNext = vmNumber; Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.newcell.calltext.ui.dialpad.DialerFragment.java
private void placeCallWithOption(Bundle b) { if (service == null) { return;/*from www. jav a 2s . co m*/ } String toCall = ""; Long accountToUse = SipProfile.INVALID_ID; // Find account to use SipProfile acc = accountChooserButton.getSelectedAccount(); if (acc == null) { return; } accountToUse = acc.id; // Find number to dial toCall = digits.getText().toString(); if (isDigit) { toCall = PhoneNumberUtils.stripSeparators(toCall); } /* * Check for special phone numbers ie. *228 * If found, call using gsm */ if (toCall.equals("*228")) { Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + toCall)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); return; } if (accountChooserFilterItem != null && accountChooserFilterItem.isChecked()) { toCall = rewriteNumber(toCall); } if (TextUtils.isEmpty(toCall)) { return; } // Well we have now the fields, clear theses fields digits.getText().clear(); // -- MAKE THE CALL --// if (accountToUse >= 0) { // It is a SIP account, try to call service for that try { service.makeCallWithOptions(toCall, accountToUse.intValue(), b); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else if (accountToUse != SipProfile.INVALID_ID) { // It's an external account, find correct external account CallHandlerPlugin ch = new CallHandlerPlugin(getActivity()); ch.loadFrom(accountToUse, toCall, new OnLoadListener() { @Override public void onLoad(CallHandlerPlugin ch) { placePluginCall(ch); } }); } }
From source file:com.hp.map.CustomerMapActivity.java
public void callNumber(View view) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + customer_phone.getText().toString().trim())); startActivity(callIntent);/*w ww . j a v a2s.c o m*/ }
From source file:tw.net.ezcall.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;// w w w . ja va 2 s.c om acc = accountChooserButton.getSelectedAccount(); if (acc != null) { accountToUse = acc.id; } if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), tw.net.ezcall.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.ieeton.user.activity.ChatActivity.java
/** * ?// w ww. j a va 2 s . c om * * @param view */ @Override public void onClick(View view) { int id = view.getId(); if (id == R.id.btn_send) {// ??(?) String s = mEditTextContent.getText().toString(); sendText(s); } else if (id == R.id.btn_take_picture) { selectPicFromCamera();// } else if (id == R.id.btn_picture) { selectPicFromLocal(); // } else if (id == R.id.btn_location) { // ? startActivityForResult(new Intent(this, BaiduMapActivity.class), REQUEST_CODE_MAP); } else if (id == R.id.iv_emoticons_normal) { // more.setVisibility(View.VISIBLE); iv_emoticons_normal.setVisibility(View.INVISIBLE); iv_emoticons_checked.setVisibility(View.VISIBLE); btnContainer.setVisibility(View.GONE); emojiIconContainer.setVisibility(View.VISIBLE); hideKeyboard(); } else if (id == R.id.iv_emoticons_checked) { // ?? iv_emoticons_normal.setVisibility(View.VISIBLE); iv_emoticons_checked.setVisibility(View.INVISIBLE); btnContainer.setVisibility(View.VISIBLE); emojiIconContainer.setVisibility(View.GONE); more.setVisibility(View.GONE); } else if (id == R.id.btn_video) { // ? Intent intent = new Intent(ChatActivity.this, ImageGridActivity.class); startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO); } else if (id == R.id.btn_file) { // selectFileFromLocal(); } else if (id == R.id.btn_voice_call) { // ? if (!EMChatManager.getInstance().isConnected()) Toast.makeText(this, "????", 0).show(); else startActivity(new Intent(ChatActivity.this, VoiceCallActivity.class) .putExtra("username", toChatUsername).putExtra("isComingCall", false)); } else if (id == R.id.iv_call) { if (toChatUsername.equals(NetEngine.getSecretaryID())) { //??400??? String number = NetEngine.getIvrNumber(); if (number != null && !"".equals(number)) { Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + number)); startActivity(intent); } return; } if (mUser == null) { return; } if (mUser.getSwitchMobile() == 0 || TextUtils.isEmpty(mUser.getIvrMobile()) && TextUtils.isEmpty(mUser.getMobile())) { Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT); return; } String mobile = TextUtils.isEmpty(mUser.getIvrMobile()) ? mUser.getMobile() : mUser.getIvrMobile(); mCallDialog = Utils.showCallDialog(this, mobile); // String mobile = ""; // if (!TextUtils.isEmpty(mUser.getIvrMobile())){ // mobile = mUser.getIvrMobile(); // }else if (!TextUtils.isEmpty(mUser.getMobile())){ // mobile = mUser.getMobile(); // } // if (!TextUtils.isEmpty(mobile)){ // Intent intent=new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+mobile)); // startActivity(intent); // }else{ // Utils.showToast(this, R.string.call_service_is_unavlable, Toast.LENGTH_SHORT); // } } else if (view == mBackBtn) { finish(); } }
From source file:org.sipdroid.sipua.ui.Receiver.java
static Intent createMWIIntent() { Intent intent;/*from ww w . j a va2 s. c om*/ if (MWI_account != null) intent = new Intent(Intent.ACTION_CALL, Uri.parse(MWI_account.replaceFirst("sip:", "sipdroid:"))); else intent = new Intent(Intent.ACTION_DIAL); return intent; }
From source file:com.sip.pwc.sipphone.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;/*from w w w . ja va 2s .co m*/ acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), CallHandler.class).flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }