List of usage examples for android.content Intent ACTION_SENDTO
String ACTION_SENDTO
To view the source code for android.content Intent ACTION_SENDTO.
Click Source Link
From source file:com.owncloud.android.ui.activity.DrawerActivity.java
private void openFeedback() { String feedbackMail = (String) getText(R.string.mail_feedback); String feedback = getText(R.string.drawer_feedback) + " - android v" + BuildConfig.VERSION_NAME; Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, feedback); intent.setData(Uri.parse(feedbackMail)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);/* w w w .ja va 2 s . c o m*/ }
From source file:org.kontalk.ui.ComposeMessage.java
private Bundle processIntent(Bundle savedInstanceState) { Intent intent;//www . j av a 2 s . c o m if (savedInstanceState != null) { mLostFocus = savedInstanceState.getBoolean("lostFocus"); Uri uri = savedInstanceState.getParcelable(Uri.class.getName()); if (uri == null) { Log.d(TAG, "restoring non-loaded conversation, aborting"); finish(); return null; } intent = new Intent(ACTION_VIEW_USERID, uri); } else { intent = getIntent(); } if (intent != null) { final String action = intent.getAction(); Bundle args = null; // view intent // view conversation - just threadId provided // view conversation - just userId provided if (Intent.ACTION_VIEW.equals(action) || ACTION_VIEW_CONVERSATION.equals(action) || ACTION_VIEW_USERID.equals(action)) { Uri uri = intent.getData(); // two-panes UI: start conversation list if (Kontalk.hasTwoPanesUI(this)) { Intent startIntent = new Intent(action, uri, getApplicationContext(), ConversationsActivity.class); startActivity(startIntent); // no need to go further finish(); return null; } // single-pane UI: start normally else { args = new Bundle(); args.putString("action", action); args.putParcelable("data", uri); args.putLong(EXTRA_MESSAGE, intent.getLongExtra(EXTRA_MESSAGE, -1)); args.putString(EXTRA_HIGHLIGHT, intent.getStringExtra(EXTRA_HIGHLIGHT)); args.putBoolean(EXTRA_CREATING_GROUP, intent.getBooleanExtra(EXTRA_CREATING_GROUP, false)); } } // send external content else if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) { sendIntent = intent; String mime = intent.getType(); Log.i(TAG, "sending data to someone: " + mime); chooseContact(); // onActivityResult will handle the rest return null; } // send to someone else if (Intent.ACTION_SENDTO.equals(action)) { try { Uri uri = intent.getData(); // a phone number should come here... String number = NumberValidator.fixNumber(this, uri.getSchemeSpecificPart(), Authenticator.getDefaultAccountName(this), 0); // compute hash and open conversation String jid = XMPPUtils.createLocalJID(this, MessageUtils.sha1(number)); // two-panes UI: start conversation list if (Kontalk.hasTwoPanesUI(this)) { Intent startIntent = new Intent(getApplicationContext(), ConversationsActivity.class); startIntent.setAction(ACTION_VIEW_USERID); startIntent.setData(Threads.getUri(jid)); startActivity(startIntent); // no need to go further finish(); return null; } // single-pane UI: start normally else { args = new Bundle(); args.putString("action", ComposeMessage.ACTION_VIEW_USERID); args.putParcelable("data", Threads.getUri(jid)); args.putString("number", number); } } catch (Exception e) { Log.e(TAG, "invalid intent", e); finish(); } } return args; } return null; }
From source file:com.github.fi3te.iliasdownloader.view.IliasActivity.java
@Override public boolean onNavigationItemSelected(final MenuItem menuItem) { pendingRunnable = new Runnable() { @Override// w w w . j a va2s. c o m public void run() { switch (menuItem.getItemId()) { case R.id.ignore_list_item: if (!ilias.isRunning()) { startActivity(new Intent(IliasActivity.this, BlockedFilesActivity.class)); } else { Snackbar.make(coordinatorLayout, R.string.synchronisation_is_running, Snackbar.LENGTH_SHORT) .show(); } break; case R.id.recommendation_item: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, getResources().getString(R.string.recommendation_text)); startActivity( Intent.createChooser(sharingIntent, getResources().getString(R.string.recommend_by))); break; case R.id.rating_item: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "https://play.google.com/store/apps/details?id=com.github.fi3te.iliasdownloader"))); break; case R.id.bug_report_item: String versionName = "X.X"; try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); versionName = getResources().getString(R.string.version) + " " + packageInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "fiete.wennier@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name) + " " + versionName); startActivity(Intent.createChooser(emailIntent, "E-Mail")); break; case R.id.settings_item: startActivity(new Intent(IliasActivity.this, SettingsActivity.class)); break; case R.id.login_item: startActivity(new Intent(IliasActivity.this, LoginActivity.class)); break; case R.id.logout_item: if (ilias.logout()) { updateNavigationView(); } else { Snackbar.make(coordinatorLayout, R.string.synchronisation_is_running, Snackbar.LENGTH_SHORT) .show(); } break; } } }; drawerLayout.closeDrawers(); return true; }
From source file:net.networksaremadeofstring.rhybudd.RhybuddHome.java
private void ProcessDrawerClick(int position) { switch (position) { case SETTINGS: { Intent SettingsIntent = new Intent(RhybuddHome.this, SettingsFragment.class); this.startActivityForResult(SettingsIntent, 99); }//from w w w .jav a 2s .c om break; case CONFIGURERHYBUDDPUSH: { Intent PushSettingsIntent = new Intent(RhybuddHome.this, PushConfigActivity.class); this.startActivityForResult(PushSettingsIntent, ZenossAPI.ACTIVITYRESULT_PUSHCONFIG); } break; case HELP: { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse("http://wiki.zenoss.org/index.php?title=Rhybudd#Getting_Started")); startActivityForResult(i, 20); } break; case INFRASTRUCTURE: { Intent DeviceList = new Intent(RhybuddHome.this, ViewZenossDeviceListActivity.class); RhybuddHome.this.startActivityForResult(DeviceList, 20); } break; case GROUPS: { Intent GroupsIntent = new Intent(RhybuddHome.this, ViewZenossGroupsActivity.class); RhybuddHome.this.startActivityForResult(GroupsIntent, 20); } break; case MANAGEDATABASE: { Intent MangeDBIntent = new Intent(RhybuddHome.this, ManageDatabase.class); RhybuddHome.this.startActivityForResult(MangeDBIntent, 20); } break; case FEEDBACK: { try { Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "Gareth@DataSift.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback suggestion for Rhybudd"); startActivity(Intent.createChooser(emailIntent, "Send feedback as email")); } catch (Exception e) { Toast.makeText(RhybuddHome.this, "There was a problem launching your email client.\n\nPlease email Gareth@DataSift.com with your feedback.", Toast.LENGTH_LONG).show(); } } break; } // update selected item and title, then close the drawer //mDrawerList.setItemChecked(position, true); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.amaze.carbonfilemanager.fragments.preference_fragments.Preffrag.java
@Override public boolean onPreferenceClick(Preference preference) { final String[] sort; MaterialDialog.Builder builder;//from ww w . j a va2 s . c o m switch (preference.getKey()) { case "columns": sort = getResources().getStringArray(R.array.columns); builder = new MaterialDialog.Builder(getActivity()); builder.theme(utilsProvider.getAppTheme().getMaterialDialogTheme()); builder.title(R.string.gridcolumnno); int current = Integer.parseInt(sharedPref.getString("columns", "-1")); current = current == -1 ? 0 : current; if (current != 0) current = current - 1; builder.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit(); dialog.dismiss(); return true; } }); builder.build().show(); return true; case "theme": sort = getResources().getStringArray(R.array.theme); current = Integer.parseInt(sharedPref.getString("theme", "0")); builder = new MaterialDialog.Builder(getActivity()); //builder.theme(utilsProvider.getAppTheme().getMaterialDialogTheme()); builder.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() { @Override public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) { utilsProvider.getThemeManager().setAppTheme(AppTheme.fromIndex(which)).save(); Log.d("theme", AppTheme.fromIndex(which).name()); dialog.dismiss(); restartPC(getActivity()); return true; } }); builder.title(R.string.theme); builder.build().show(); return true; case "sidebar_folders_enable": sharedPref.edit().putBoolean(PREFERENCE_SHOW_SIDEBAR_FOLDERS, !sharedPref.getBoolean(PREFERENCE_SHOW_SIDEBAR_FOLDERS, true)).apply(); return true; case "sidebar_quickaccess_enable": sharedPref.edit().putBoolean(PREFERENCE_SHOW_SIDEBAR_QUICKACCESSES, !sharedPref.getBoolean(PREFERENCE_SHOW_SIDEBAR_QUICKACCESSES, true)).apply(); return true; case PREFERENCE_SHOW_HIDDENFILES: setEnabledShortcuts(); return false; case PREFERENCE_ROOTMODE: setEnabledShortcuts(); /* boolean b = sharedPref.getBoolean("rootmode", false); if (b) { if (MainActivity.shellInteractive.isRunning()) { rootmode.setChecked(true); } else { rootmode.setChecked(false); Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure), Toast.LENGTH_LONG).show(); } } else { rootmode.setChecked(false); } */ return false; case "feedback": Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", "vishalmeham2@gmail.com", null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager"); startActivity(Intent.createChooser(emailIntent, getResources().getString(feedback))); return false; case PREFERENCE_KEY_ABOUT: startActivity(new Intent(getActivity(), AboutActivity.class)); return false; case "plus_pic": if (gplus.isChecked()) { boolean b = MainActivityHelper.checkAccountsPermission(getActivity()); if (!b) MainActivityHelper.requestAccountsPermission(getActivity()); } return false; /*FROM HERE BE FRAGMENTS*/ case "colors": ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.COLORS_PREFERENCE); return true; case "sidebar_folders": ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.FOLDERS_PREFERENCE); return true; case "sidebar_quickaccess": ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.QUICKACCESS_PREFERENCE); return true; case "advancedsearch": ((PreferencesActivity) getActivity()).selectItem(PreferencesActivity.ADVANCEDSEARCH_PREFERENCE); return true; } return false; }
From source file:org.dmfs.webcal.MainActivity.java
@Override protected boolean selectItem(long id) { if (id == mSelectedItemId) { super.selectItem(id); return true; }//from www. j a va 2 s . c om Fragment fragment = null; if (id == R.id.side_nav_favorite_calendars) { fragment = GenericListFragment.newInstance( CalendarContentContract.ContentItem.getStarredItemsContentUri(this), getString(R.string.side_nav_favorite_calendars), R.string.error_favorite_calendars_empty, GenericListFragment.PROJECTION2, true); mSelectedItemId = id; Analytics.event("fav-calendars", "menu", null, null, null, null); } else if (id == R.id.side_nav_my_calendars) { fragment = GenericListFragment.newInstance( CalendarContentContract.SubscribedCalendars.getContentUri(this), getString(R.string.side_nav_my_calendars), R.string.error_my_calendars_empty, GenericListFragment.PROJECTION, true); mSelectedItemId = id; Analytics.event("my-calendars", "menu", null, null, null, null); } else if (id == R.id.side_nav_all_calendars) { fragment = PagerFragment.newInstance(this, 0, getItemTitleById(id), -1); mSelectedItemId = id; Analytics.event("all-calendars", "menu", null, null, null, null); } else if (id == R.id.side_nav_faq) { Intent faqIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.faq_url))); startActivity(faqIntent); Analytics.event("faq", "menu", null, null, null, null); } else if (id == R.id.side_nav_feedback) { Analytics.event("feedback", "menu", null, null, null, null); PackageManager pm = getPackageManager(); PackageInfo pi = null; try { pi = pm.getPackageInfo(getPackageName(), 0); } catch (NameNotFoundException e) { // that should not happen! } StringBuilder emailContent = new StringBuilder(256); emailContent.append("\r\n\r\n\r\n\r\n\r\n--------------\r\n"); emailContent.append("app: ").append(getPackageName()).append("\r\n"); emailContent.append("version: ").append(pi.versionName).append(" / ").append(pi.versionCode) .append("\r\n"); emailContent.append("locale: ").append(Locale.getDefault().getLanguage()).append("\r\n"); emailContent.append("location: ").append(Locale.getDefault().getCountry()).append("\r\n"); emailContent.append("timezone: ").append(TimeZone.getDefault().getID()).append("\r\n"); emailContent.append("device: ").append(android.os.Build.DEVICE).append("\r\n"); emailContent.append("model: ").append(android.os.Build.MODEL).append("\r\n"); emailContent.append("os version: ").append(android.os.Build.VERSION.RELEASE).append(" / ") .append(android.os.Build.VERSION.SDK_INT).append("\r\n"); emailContent.append("firmware: ").append(android.os.Build.ID).append("\r\n"); Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", getString(R.string.contact_address), null)); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Contact"); emailIntent.putExtra(Intent.EXTRA_TEXT, emailContent.toString()); startActivity(Intent.createChooser(emailIntent, getString(R.string.send_email))); // fragment = ContactFragment.newInstance(); } else if (id == R.id.side_nav_settings) { Intent preferencesIntent = new Intent(this, PreferencesActivity.class); startActivity(preferencesIntent); Analytics.event("settings", "menu", "settings clicked", null, null, null); } if (fragment != null) { // drop backstack mFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); FragmentTransaction fragmentTransaction = mFragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content, fragment); fragmentTransaction.commit(); } super.selectItem(id); return fragment != null; }
From source file:com.pdftron.pdf.controls.ReflowPagerAdapter.java
public void initialize() { // set loading file depending on night mode if (sIsNightMode) { mLoadingFile = NIGHT_MODE_LOADING_FILE; } else {/* w w w.jav a 2s . c o m*/ mLoadingFile = NORMAL_MODE_LOADING_FILE; } if (mWebViewRepository != null) { mWebViewRepository.reset(); } ReflowWebView[] webViews = mWebViewRepository.getWebViews(); for (final ReflowWebView webView : webViews) { webView.clearCache(true); // reset reading css file webView.getSettings().setJavaScriptEnabled(true); webView.setWillNotCacheDrawing(false); if (sIsNightMode) { webView.setBackgroundColor(Color.BLACK); } else { webView.setBackgroundColor(Color.WHITE); } webView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); webView.loadUrl("about:blank"); webView.setListener(this); webView.setWebChromeClient(new WebChromeClient()); // enable the use of methods like alert in javascript webView.setWebViewClient(new WebViewClient() { // now all links the user clicks load in your WebView @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); Log.e(TAG, description + " url: " + failingUrl); } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { super.onReceivedSslError(view, handler, error); Log.e(TAG, error.toString()); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.startsWith("file:///") && url.endsWith(".html")) { int slashPos = url.lastIndexOf('/'); try { int objNum = Integer.parseInt(url.substring(slashPos + 1, url.length() - 5)); int pageNum = 0; for (int i = 1; i <= mPageCount; i++) { try { Page page = mDoc.getPage(i); if (page.getSDFObj().getObjNum() == objNum) { pageNum = i; break; } } catch (Exception e) { } } if (pageNum != 0) { mViewPager.setCurrentItem(pageNum - 1); } } catch (NumberFormatException e) { return true; } } else { if (url.startsWith("mailto:") || android.util.Patterns.EMAIL_ADDRESS.matcher(url).matches()) { if (url.startsWith("mailto:")) { url = url.substring(7); } Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", url, null)); mContext.startActivity(Intent.createChooser(intent, mContext.getResources().getString(R.string.tools_misc_sendemail))); } else { // ACTION_VIEW needs the address to have http or https if (!url.startsWith("https://") && !url.startsWith("http://")) { url = "http://" + url; } if (DEBUG) Log.d(TAG, url); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); mContext.startActivity(Intent.createChooser(intent, mContext.getResources().getString(R.string.tools_misc_openwith))); } } return true; } }); } }
From source file:com.xabber.android.ui.ContactList.java
@Override protected void onResume() { super.onResume(); barPainter.setDefaultColor();/*from ww w. ja v a 2s . c o m*/ rebuildAccountToggle(); Application.getInstance().addUIListener(OnAccountChangedListener.class, this); if (action != null) { switch (action) { case ContactList.ACTION_ROOM_INVITE: case Intent.ACTION_SEND: case Intent.ACTION_CREATE_SHORTCUT: if (Intent.ACTION_SEND.equals(action)) { sendText = getIntent().getStringExtra(Intent.EXTRA_TEXT); } Toast.makeText(this, getString(R.string.select_contact), Toast.LENGTH_LONG).show(); break; case Intent.ACTION_VIEW: { action = null; Uri data = getIntent().getData(); if (data != null && "xmpp".equals(data.getScheme())) { XMPPUri xmppUri; try { xmppUri = XMPPUri.parse(data); } catch (IllegalArgumentException e) { xmppUri = null; } if (xmppUri != null && "message".equals(xmppUri.getQueryType())) { ArrayList<String> texts = xmppUri.getValues("body"); String text = null; if (texts != null && !texts.isEmpty()) { text = texts.get(0); } openChat(xmppUri.getPath(), text); } } break; } case Intent.ACTION_SENDTO: { action = null; Uri data = getIntent().getData(); if (data != null) { String path = data.getPath(); if (path != null && path.startsWith("/")) { openChat(path.substring(1), null); } } break; } } } if (Application.getInstance().doNotify()) { if (!SettingsManager.isTranslationSuggested()) { Locale currentLocale = getResources().getConfiguration().locale; if (!currentLocale.getLanguage().equals("en") && !getResources().getBoolean(R.bool.is_translated)) { new TranslationDialog().show(getFragmentManager(), "TRANSLATION_DIALOG"); SettingsManager.setTranslationSuggested(); } } if (SettingsManager.bootCount() > 2 && !SettingsManager.connectionStartAtBoot() && !SettingsManager.startAtBootSuggested()) { StartAtBootDialogFragment.newInstance().show(getFragmentManager(), "START_AT_BOOT"); } if (!SettingsManager.contactIntegrationSuggested() && Application.getInstance().isContactsSupported()) { if (AccountManager.getInstance().getAllAccounts().isEmpty()) { SettingsManager.setContactIntegrationSuggested(); } else { ContactIntegrationDialogFragment.newInstance().show(getFragmentManager(), "CONTACT_INTEGRATION"); } } } }
From source file:com.tfc.webviewer.ui.WebViewerActivity.java
@Override public void openEmail(String email) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", email, null)); startActivity(Intent.createChooser(intent, getString(R.string.email))); }
From source file:com.rp.podemu.SettingsActivity.java
public void sendDebug(View v) { String version;/*w w w .ja v a 2 s . co m*/ try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); version = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { version = "NA"; } String username = "dev.roman"; String domain = "gmail.com"; String uriText = "mailto:" + username + "@" + domain + "?subject=" + Uri.encode("PodEmu debug - V" + version) + "&body=" + Uri.encode("You can put additional description of the problem instead of this text."); Uri uri = Uri.parse(uriText); Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(uri); //intent.setAction(Intent.ACTION_ATTACH_DATA); Uri attachment = Uri.parse("file://" + PodEmuLog.getLogFileName()); intent.putExtra(Intent.EXTRA_STREAM, attachment); try { startActivity(Intent.createChooser(intent, "Send email")); } catch (android.content.ActivityNotFoundException e) { new AlertDialog.Builder(this).setTitle("Application not found").setMessage( "There is no application installed that can send emails. Please go to Android Market and install one.") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // continue with delete } }).setIcon(android.R.drawable.ic_dialog_alert).show(); } }