List of usage examples for android.content Intent ACTION_DIAL
String ACTION_DIAL
To view the source code for android.content Intent ACTION_DIAL.
Click Source Link
From source file:org.apache.cordova.plugins.InAppBrowser.java
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. *///from w w w .java2s .c o m public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { try { if (action.equals("open")) { this.callbackContext = callbackContext; String url = args.getString(0); /*cemerson: arrowbuttons=[false]*/ String featuresList = args.optString(2); int arrowButtonsDisabledIndex = featuresList.indexOf("arrowbuttonsenabled=no"); arrowButtonsAllowed = true; if (arrowButtonsDisabledIndex > -1) arrowButtonsAllowed = false; String target = args.optString(1); if (target == null || target.equals("") || target.equals(NULL)) { target = SELF; } HashMap<String, Boolean> features = parseFeature(args.optString(2)); Log.d(LOG_TAG, "target = " + target); url = updateUrl(url); String result = ""; // SELF if (SELF.equals(target)) { Log.d(LOG_TAG, "in self"); // load in webview if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) { this.webView.loadUrl(url); } //Load the dialer else if (url.startsWith(WebView.SCHEME_TEL)) { try { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse(url)); this.cordova.getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException e) { LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); } } // load in InAppBrowser else { result = this.showWebPage(url, features); } } // SYSTEM else if (SYSTEM.equals(target)) { Log.d(LOG_TAG, "in system"); result = this.openExternal(url); } // BLANK - or anything else else { Log.d(LOG_TAG, "in blank"); result = this.showWebPage(url, features); } PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); } else if (action.equals("close")) { closeDialog(); this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; if (args.getBoolean(1)) { jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectScriptFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleCode")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("show")) { Runnable runnable = new Runnable() { @Override public void run() { dialog.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); } else { return false; } } catch (JSONException e) { this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); } return true; }
From source file:com.oonhee.oojs.inappbrowser.InAppBrowser.java
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. *///from w w w . ja va2s .c o m public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { if (action.equals("open")) { this.callbackContext = callbackContext; final String url = args.getString(0); String t = args.optString(1); if (t == null || t.equals("") || t.equals(NULL)) { t = SELF; } final String target = t; final HashMap<String, Boolean> features = parseFeature(args.optString(2)); Log.d(LOG_TAG, "target = " + target); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { String result = ""; // SELF if (SELF.equals(target)) { Log.d(LOG_TAG, "in self"); // load in webview if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) { webView.loadUrl(url); } //Load the dialer else if (url.startsWith(AmazonWebView.SCHEME_TEL)) { try { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse(url)); cordova.getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException e) { LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); } } // load in InAppBrowser else { result = showWebPage(url, features); } } // SYSTEM else if (SYSTEM.equals(target)) { Log.d(LOG_TAG, "in system"); result = openExternal(url); } // BLANK - or anything else else { Log.d(LOG_TAG, "in blank"); result = showWebPage(url, features); } PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); } }); } else if (action.equals("close")) { closeDialog(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; if (args.getBoolean(1)) { jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectScriptFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleCode")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("show")) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { dialog.show(); } }); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); } else { return false; } return true; }
From source file:com.g11x.checklistapp.ChecklistItemActivity.java
private void createUI() { TextView name = (TextView) findViewById(R.id.name); name.setText(checklistItem.getName(language)); TextView description = (TextView) findViewById(R.id.description); description.setText(checklistItem.getDescription(language)); Button getDirections = (Button) findViewById(R.id.directions); getDirections.setOnClickListener(new View.OnClickListener() { @Override/*from w ww . j a va2 s .c o m*/ public void onClick(View view) { ChecklistItemActivity.this.onClickGetDirections(); } }); Button doneness = (Button) findViewById(R.id.doneness); if (checklistItem.isDone()) { doneness.setTextColor(ContextCompat.getColor(ChecklistItemActivity.this, R.color.primary)); doneness.setPaintFlags(doneness.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); doneness.setText(getResources().getString(R.string.complete)); doneness.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_check_box_accent_24dp, 0, 0, 0); } else { doneness.setTextColor(Color.BLACK); doneness.setPaintFlags(doneness.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); doneness.setText(getResources().getString(R.string.mark_as_done)); doneness.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_check_box_outline_blank_black_24dp, 0, 0, 0); } doneness.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ChecklistItemActivity.this.onClickIsDone(); } }); Button sendEmail = (Button) findViewById(R.id.send_email); if (checklistItem.getEmail() != null && !checklistItem.getEmail().equals("")) { sendEmail.setVisibility(View.VISIBLE); sendEmail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_EMAIL, checklistItem.getEmail()); intent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.sent_from_rst_checklist_app)); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(Intent.createChooser(intent, "Send e-mail")); } } }); } else { sendEmail.setVisibility(View.GONE); } Button call = (Button) findViewById(R.id.call); if (checklistItem.getPhone() != null && !checklistItem.getPhone().equals("")) { call.setVisibility(View.VISIBLE); call.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + checklistItem.getPhone())); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } }); } else { call.setVisibility(View.GONE); } }
From source file:org.pixmob.droidlink.ui.EventDetailsFragment.java
private void onCallNumber() { if (number != null) { final Intent i = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)); startActivity(i);//from w w w . j av a 2s.co m } }
From source file:com.neka.cordova.inappbrowser.InAppBrowser.java
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArry of arguments for the plugin. * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. *///from w ww . j a v a 2 s . c o m public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { if (action.equals("open")) { this.callbackContext = callbackContext; final String url = args.getString(0); String t = args.optString(1); if (t == null || t.equals("") || t.equals(NULL)) { t = SELF; } final String target = t; final HashMap<String, Boolean> features = parseFeature(args.optString(2)); Log.d(LOG_TAG, "target = " + target); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { String result = ""; // SELF if (SELF.equals(target)) { Log.d(LOG_TAG, "in self"); // load in webview if (url.startsWith("file://") || url.startsWith("javascript:") || Config.isUrlWhiteListed(url)) { Log.d(LOG_TAG, "loading in webview"); webView.loadUrl(url); } //Load the dialer else if (url.startsWith(WebView.SCHEME_TEL)) { try { Log.d(LOG_TAG, "loading in dialer"); Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse(url)); cordova.getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException e) { LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); } } // load in InAppBrowser else { Log.d(LOG_TAG, "loading in InAppBrowser"); result = showWebPage(url, features); } } // SYSTEM else if (SYSTEM.equals(target)) { Log.d(LOG_TAG, "in system"); result = openExternal(url); } // BLANK - or anything else else { Log.d(LOG_TAG, "in blank"); result = showWebPage(url, features); } PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); } }); } else if (action.equals("close")) { closeDialog(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; if (args.getBoolean(1)) { jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectScriptFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleCode")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("injectStyleFile")) { String jsWrapper; if (args.getBoolean(1)) { jsWrapper = String.format( "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); } else { jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; } injectDeferredObject(args.getString(0), jsWrapper); } else if (action.equals("show")) { this.cordova.getActivity().runOnUiThread(new Runnable() { @Override public void run() { dialog.show(); } }); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); pluginResult.setKeepCallback(true); this.callbackContext.sendPluginResult(pluginResult); } else { return false; } return true; }
From source file:com.example.meetingapp.ShowDetailsFragment.java
/** * Allows the user to call a provided number. *//*from w w w.j av a2 s. co m*/ private void callNumber() { /* If there's no phone number, don't try to call. */ if (mResult.international_phone_number == null) { return; } Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + mResult.formatted_phone_number)); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivity(intent); } }
From source file:at.wada811.utils.IntentUtils.java
/** * ??Intent??/* w w w .ja v a 2 s . c om*/ * * @param context * @param tel */ public static Intent createDailIntent(String tel) { return new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + tel)); }
From source file:br.liveo.ndrawer.ui.fragment.FragmentContactus.java
@Override public void onClick(View view) { Log.i("Main Fragment fragment", "on click"); String tflag = null;//from w w w . ja v a 2 s. co m switch (view.getId()) { case R.id.ivemail_dtu: Intent i = new Intent(Intent.ACTION_SENDTO); i.setData(Uri.parse("mailto:renaissance@dce.edu")); i.putExtra(Intent.EXTRA_SUBJECT, "Queries Regarding IET DTU Student Chapter"); startActivity(i); break; case R.id.ivemail_mukcha: Intent i2 = new Intent(Intent.ACTION_SENDTO); i2.setData(Uri.parse("mailto:mukul0505@gmail.com")); i2.putExtra(Intent.EXTRA_SUBJECT, "Queries Regarding IET DTU Student Chapter"); startActivity(i2); break; case R.id.ivemail_mukkum: Intent i3 = new Intent(Intent.ACTION_SENDTO); i3.setData(Uri.parse("mailto:mukulcj@gmail.com")); i3.putExtra(Intent.EXTRA_SUBJECT, "Queries Regarding IET DTU Student Chapter"); startActivity(i3); break; case R.id.ivcall_mukcha: Intent i4 = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:9873113748")); startActivity(i4); break; case R.id.ivcall_mukkum: Intent i5 = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:9013616477")); startActivity(i5); break; } }
From source file:com.guanyin.userface.ViewPagerActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.iv_oil: catchStation();/* w w w . ja v a 2 s. c om*/ break; case R.id.tv_logout: LayoutInflater inflater = LayoutInflater.from(this); final View loginView = inflater.inflate(R.layout.logout_dialog, null); AlertDialog.Builder loginBuilder = new AlertDialog.Builder(this); loginBuilder.setView(loginView); loginBuilder.setPositiveButton("", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Editor editor = app.sp.edit(); editor.putString("token", ""); editor.apply(); intent = new Intent(context, LoginActivity.class); startActivity(intent); finish(); } }); loginBuilder.setNegativeButton("?", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ViewPagerActivity.this.dialog.dismiss(); } }); dialog = loginBuilder.create(); dialog.show(); break; case R.id.rb_main: viewPager.setCurrentItem(0, true); break; case R.id.rb_carb: viewPager.setCurrentItem(1, true); break; case R.id.rb_photo: intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(intent); break; case R.id.rb_iphone: intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + "18829282408")); startActivity(intent); break; default: break; } }
From source file:com.secbro.qark.tapjacking.TapJackingExploitFragment.java
private void launchDialer() { Thread t = new Thread() { public void run() { /*/*from w w w . ja v a 2 s. co m*/ * We sleep first in order for the toasts to consume the screen * before the dialer activity launches */ try { sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Intent intent = new Intent(Intent.ACTION_DIAL); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // showing Google some love intent.setData(Uri.parse("tel:650-253-0000")); startActivity(intent); } }; t.start(); }