Example usage for android.content Intent ACTION_SENDTO

List of usage examples for android.content Intent ACTION_SENDTO

Introduction

In this page you can find the example usage for android.content Intent ACTION_SENDTO.

Prototype

String ACTION_SENDTO

To view the source code for android.content Intent ACTION_SENDTO.

Click Source Link

Document

Activity Action: Send a message to someone specified by the data.

Usage

From source file:de.ub0r.android.smsdroid.ConversationListActivity.java

/**
 * Get a {@link Intent} for sending a new message.
 * //from   w  ww .j  a v a  2 s  .co m
 * @param context
 *            {@link Context}
 * @param address
 *            address
 * @return {@link Intent}
 */
static Intent getComposeIntent(final Context context, final String address) {
    final Intent i = new Intent(Intent.ACTION_SENDTO);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (address == null) {
        i.setData(Uri.parse("sms:"));
    } else {
        i.setData(Uri.parse("smsto:" + PreferencesActivity.fixNumber(context, address)));
    }
    return i;
}

From source file:com.samsung.richnotification.RichNotificationHelper.java

public static List<SrnAction> createActions(Context mContext, CallbackContext callbackContext,
        RichNotificationOptions options) throws JSONException {
    ArrayList<SrnAction> actionsList = new ArrayList<SrnAction>();
    JSONArray actions = options.actions;
    if (actions == null)
        return null;

    SrnAction action = null;//  ww w.ja v  a  2s .c o m
    for (int i = 0; i < actions.length(); i++) {
        JSONObject act = actions.optJSONObject(i);
        if (act == null)
            continue;

        String actionLabel = act.optString("actionLabel", EMPTY_STRING);
        if (actionLabel.isEmpty())
            continue;

        Bitmap actionIcon = getIconBitmap(mContext, "file://" + act.optString("actionIcon"));
        SrnImageAsset actionImg = new SrnImageAsset(mContext, actionLabel, actionIcon);

        int actionType = act.optInt("type");
        switch (actionType) {

        case ACTION_TYPE_CALL:
            SrnRemoteBuiltInAction call = new SrnRemoteBuiltInAction(actionLabel, OperationType.CALL);
            call.setData(Uri.parse(act.optString("dest")));
            action = call;
            break;
        case ACTION_TYPE_SMS:
            SrnRemoteBuiltInAction sms = new SrnRemoteBuiltInAction(actionLabel, OperationType.SMS);
            sms.setData(Uri.fromParts("sms", act.optString("dest"), null));
            action = sms;
            break;
        case ACTION_TYPE_EMAIL:
            Log.d(TAG, "Email to: '" + act.optString("dest") + "'");
            Log.d(TAG, "Subject: '" + act.optString("subject") + "'");
            Log.d(TAG, "Body: '" + act.optString("body") + "'");

            SrnHostAction email = new SrnHostAction(actionLabel);
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
            String uriText = "mailto:" + act.optString("dest") + "?subject="
                    + Uri.encode(act.optString("subject")) + "&body=" + Uri.encode(act.optString("body"));
            Uri uri = Uri.parse(uriText);
            emailIntent.setData(uri);
            email.setCallbackIntent(CallbackIntent.getActivityCallback(emailIntent));
            email.setToast(act.optString("toast"));
            email.setIcon(actionImg);
            action = email;
            break;
        case ACTION_TYPE_VIEW:
            SrnHostAction view = new SrnHostAction(actionLabel);
            Intent viewIntent = new Intent(Intent.ACTION_VIEW);
            String urlText = act.optString("dest");
            Uri url = Uri.parse(urlText);
            viewIntent.setData(url);
            view.setCallbackIntent(CallbackIntent.getActivityCallback(viewIntent));
            view.setToast(act.optString("toast"));
            view.setIcon(actionImg);
            action = view;
            break;
        case ACTION_TYPE_INPUT_KEYBOARD:
        case ACTION_TYPE_INPUT_SINGLE_SELECT:
        case ACTION_TYPE_INPUT_MULTI_SELECT:
            SrnRemoteInputAction input = getRemoteInputAction(mContext, act);
            if (input == null) {
                continue;
            }

            Intent inputIntent = new Intent("com.samsung.cordova.richnotification.remote_input_receiver");
            inputIntent.putExtra("callbackID", callbackContext.getCallbackId());
            String actionID = act.optString("actionID", EMPTY_STRING);
            if (actionID.isEmpty()) {
                continue;
            } else {
                inputIntent.putExtra("actionID", actionID);
            }
            input.setCallbackIntent(CallbackIntent.getBroadcastCallback(inputIntent));
            input.setIcon(actionImg);
            action = input;
            break;
        default:
            Log.e(TAG, "Invalid action type: " + actionType);
            continue;
        }

        Log.d(TAG, "Action type created: " + actionType);
        actionsList.add(action);
    }

    return actionsList;
}

From source file:com.silentcircle.contacts.activities.ScContactSelectionActivity.java

/**
 * Creates the fragment based on the current request.
 *///w  w w .  j  av a 2s. c  o  m
public void configureListFragment() {
    switch (mActionCode) {
    case ContactsRequest.ACTION_INSERT_OR_EDIT_CONTACT: {
        ContactPickerFragment fragment = new ContactPickerFragment();
        fragment.setEditMode(true);
        fragment.setDirectorySearchMode(DirectoryListLoader.SEARCH_MODE_NONE);
        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_PICK_CONTACT: {
        ContactPickerFragment fragment = new ContactPickerFragment();
        fragment.setIncludeProfile(mRequest.shouldIncludeProfile());
        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_PICK_OR_CREATE_CONTACT: {
        ContactPickerFragment fragment = new ContactPickerFragment();
        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_CREATE_SHORTCUT_CONTACT: {
        ContactPickerFragment fragment = new ContactPickerFragment();
        fragment.setShortcutRequested(true);
        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_PICK_PHONE: {
        PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
        fragment.setUseCallableUri(true);
        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_PICK_EMAIL: {
        mListFragment = new EmailAddressPickerFragment();
        break;
    }

    case ContactsRequest.ACTION_CREATE_SHORTCUT_CALL: {
        PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
        fragment.setShortcutAction(Intent.ACTION_CALL);

        mListFragment = fragment;
        break;
    }

    case ContactsRequest.ACTION_CREATE_SHORTCUT_SMS: {
        PhoneNumberPickerFragment fragment = new PhoneNumberPickerFragment();
        fragment.setShortcutAction(Intent.ACTION_SENDTO);
        mListFragment = fragment;
        break;
    }

    //            case ContactsRequest.ACTION_PICK_POSTAL: {
    //                PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
    //                mListFragment = fragment;
    //                break;
    //            }

    default:
        throw new IllegalStateException("Invalid action code: " + mActionCode);
    }

    mListFragment.setLegacyCompatibilityMode(mRequest.isLegacyCompatibilityMode());
    mListFragment.setDirectoryResultLimit(DEFAULT_DIRECTORY_RESULT_LIMIT);

    getSupportFragmentManager().beginTransaction().replace(R.id.list_container, mListFragment)
            .commitAllowingStateLoss();
}

From source file:com.amaze.filemanager.fragments.preference_fragments.Preffrag.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceUtils.reset();/* w  w w  .j  ava2  s.  c o  m*/
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);

    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    final int th1 = Integer.parseInt(sharedPref.getString("theme", "0"));
    theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1;
    findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).donate();
            return false;
        }
    });
    findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            final String[] sort = getResources().getStringArray(R.array.columns);
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.gridcolumnno);
            int current = Integer.parseInt(sharedPref.getString("columns", "-1"));
            current = current == -1 ? 0 : current;
            if (current != 0)
                current = current - 1;
            a.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;
                }
            });
            a.build().show();
            return true;
        }
    });

    findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.theme);
            int current = Integer.parseInt(sharedPref.getString("theme", "0"));
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("theme", "" + which).commit();
                    dialog.dismiss();
                    restartPC(getActivity());
                    return true;
                }
            });
            a.title(R.string.theme);
            a.build().show();
            return true;
        }
    });
    findPreference("colors").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).selectItem(1);
            return true;
        }
    });

    final CheckBx rootmode = (CheckBx) findPreference("rootmode");
    rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            boolean b = sharedPref.getBoolean("rootmode", false);
            if (b) {
                if (RootTools.isAccessGiven()) {
                    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;
        }
    });

    // Authors
    Preference preference4 = (Preference) findPreference("authors");
    preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            skin = PreferenceUtils.getPrimaryColorString(sharedPref);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            if (theme == 1)
                a.theme(Theme.DARK);

            a.positiveText(R.string.close);
            a.positiveColor(fab_skin);
            LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = layoutInflater.inflate(R.layout.authors, null);
            a.customView(view, true);
            a.title(R.string.authors);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                }
            });
            /*a.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.cancel();
            }
            });*/
            a.build().show();

            final Intent intent = new Intent(Intent.ACTION_VIEW);

            TextView googlePlus1 = (TextView) view.findViewById(R.id.googlePlus1);
            googlePlus1.setTextColor(Color.parseColor(skin));
            TextView googlePlus2 = (TextView) view.findViewById(R.id.googlePlus2);
            googlePlus2.setTextColor(Color.parseColor(skin));
            TextView git1 = (TextView) view.findViewById(R.id.git1);
            git1.setTextColor(Color.parseColor(skin));
            TextView git2 = (TextView) view.findViewById(R.id.git2);
            git2.setTextColor(Color.parseColor(skin));

            googlePlus1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/u/0/110424067388738907251/"));
                    startActivity(intent);
                }
            });
            googlePlus2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/+VishalNehra/"));
                    startActivity(intent);
                }
            });
            git1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/arpitkh96"));
                    startActivity(intent);
                }
            });
            git2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/vishal0071"));
                    startActivity(intent);
                }
            });

            // icon credits
            TextView textView = (TextView) view.findViewById(R.id.icon_credits);
            textView.setMovementMethod(LinkMovementMethod.getInstance());
            textView.setLinksClickable(true);
            textView.setText(Html.fromHtml(getActivity().getString(R.string.icon_credits)));

            return false;
        }
    });

    // Changelog
    Preference preference1 = (Preference) findPreference("changelog");
    preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.changelog);
            a.content(Html.fromHtml(getActivity().getString(R.string.changelog_version_9)
                    + getActivity().getString(R.string.changelog_change_9)
                    + getActivity().getString(R.string.changelog_version_8)
                    + getActivity().getString(R.string.changelog_change_8)
                    + getActivity().getString(R.string.changelog_version_7)
                    + getActivity().getString(R.string.changelog_change_7)
                    + getActivity().getString(R.string.changelog_version_6)
                    + getActivity().getString(R.string.changelog_change_6)
                    + getActivity().getString(R.string.changelog_version_5)
                    + getActivity().getString(R.string.changelog_change_5)
                    + getActivity().getString(R.string.changelog_version_4)
                    + getActivity().getString(R.string.changelog_change_4)
                    + getActivity().getString(R.string.changelog_version_3)
                    + getActivity().getString(R.string.changelog_change_3)
                    + getActivity().getString(R.string.changelog_version_2)
                    + getActivity().getString(R.string.changelog_change_2)
                    + getActivity().getString(R.string.changelog_version_1)
                    + getActivity().getString(R.string.changelog_change_1)));
            a.negativeText(R.string.close);
            a.positiveText(R.string.fullChangelog);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            a.positiveColor(fab_skin);
            a.negativeColor(fab_skin);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    Intent intent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://github.com/arpitkh96/AmazeFileManager/commits/master"));
                    startActivity(intent);
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }
            }).build().show();
            return false;
        }
    });

    // Open Source Licenses
    Preference preference2 = (Preference) findPreference("os");
    //Defining dialog layout
    final Dialog dialog = new Dialog(getActivity(),
            android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar);
    //dialog.setTitle("Open-Source Licenses");
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    final View dialog_view = inflater.inflate(R.layout.open_source_licenses, null);
    dialog.setContentView(dialog_view);

    preference2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference arg0) {

            WebView wv = (WebView) dialog_view.findViewById(R.id.webView1);
            PreferenceUtils preferenceUtils = new PreferenceUtils();
            wv.loadData(PreferenceUtils.LICENCE_TERMS, "text/html", null);
            dialog.show();
            return false;
        }
    });

    // Feedback
    Preference preference3 = (Preference) findPreference("feedback");
    preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "arpitkh96@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager");
            Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show();
            File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt");
            if (f.exists()) {
                emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
            }
            startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback)));
            return false;
        }
    });

    // rate
    Preference preference5 = (Preference) findPreference("rate");
    preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent1 = new Intent(Intent.ACTION_VIEW);
            intent1.setData(Uri.parse("market://details?id=com.amaze.filemanager"));
            startActivity(intent1);
            return false;
        }
    });

    // studio
    Preference studio = findPreference("studio");
    studio.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            COUNT++;
            if (COUNT >= 5) {
                if (toast != null)
                    toast.cancel();
                toast = Toast.makeText(getActivity(), "Studio Mode : " + COUNT, Toast.LENGTH_SHORT);
                toast.show();

                sharedPref.edit().putInt("studio", Integer.parseInt(Integer.toString(COUNT) + "000")).apply();
            } else {
                sharedPref.edit().putInt("studio", 0).apply();
            }
            return false;
        }
    });

    // G+
    gplus = (CheckBx) findPreference("plus_pic");
    gplus.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (gplus.isChecked()) {
                boolean b = checkGplusPermission();
                if (!b)
                    requestGplusPermission();
            }
            return false;
        }
    });
    if (BuildConfig.IS_VERSION_FDROID)
        gplus.setEnabled(false);

    // Colored navigation bar
}

From source file:de.tap.easy_xkcd.Activities.MainActivity.java

public void selectDrawerItem(final MenuItem menuItem, final boolean showOverview) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (menuItem.getItemId() == R.id.nav_whatif)
            toolbar.setElevation(0);//from  ww  w.  j  a v a 2s .c om
        else {
            Resources r = getResources();
            float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, r.getDisplayMetrics());
            toolbar.setElevation(px);
        }
    }
    switch (menuItem.getItemId()) {
    case R.id.nav_browser:
        if (!prefHelper.isOnline(this) && !fullOffline) {
            showDrawerErrorToast(R.string.no_connection);
            return;
        }
        //showComicBrowserFragment
        animateToolbar(-300);
        showFragment("pref_random_comics", menuItem.getItemId(), "Comics", BROWSER_TAG, FAV_TAG, WHATIF_TAG,
                showOverview);
        break;
    case R.id.nav_favorites:
        //Check if there are any Favorites
        if (Favorites.getFavoriteList(this).length == 0) {
            showDrawerErrorToast(R.string.no_favorites);
            return;
        }
        //showFavoritesFragment
        animateToolbar(300);
        showFragment("pref_random_favorites", menuItem.getItemId(),
                getResources().getString(R.string.nv_favorites), FAV_TAG, BROWSER_TAG, WHATIF_TAG,
                showOverview);
        break;
    case R.id.nav_whatif:
        if (!prefHelper.isOnline(this) && !fullOfflineWhatIf) {
            showDrawerErrorToast(R.string.no_connection);
            return;
        }
        animateToolbar(300);
        if (getSupportFragmentManager().findFragmentByTag(WHATIF_TAG) == null) {
            mDrawer.closeDrawers();
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    showFragment("", menuItem.getItemId(), "What if?", WHATIF_TAG, FAV_TAG, BROWSER_TAG,
                            showOverview);
                }
            }, 150);
        } else {
            showFragment("", menuItem.getItemId(), "What if?", WHATIF_TAG, FAV_TAG, BROWSER_TAG, showOverview);
        }
        break;

    case R.id.nav_settings:
        mDrawer.closeDrawers();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivity(i);
            }
        }, 200);
        return;

    case R.id.nav_feedback:
        mDrawer.closeDrawers();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent i = new Intent(Intent.ACTION_SENDTO,
                        Uri.fromParts("mailto", "easyxkcd@gmail.com", null));
                startActivity(Intent.createChooser(i, getResources().getString(R.string.nav_feedback_send)));
            }
        }, 200);
        return;

    case R.id.nav_about:
        mDrawer.closeDrawers();
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent i = new Intent(MainActivity.this, AboutActivity.class);
                startActivity(i);
            }
        }, 250);
        return;
    }
    menuItem.setChecked(true);
    mDrawer.closeDrawers();
    mCurrentFragment = menuItem.getItemId();
    invalidateOptionsMenu();
}

From source file:com.kyakujin.android.tagnotepad.ui.NoteListFragment.java

/**
 * About/*  w ww .j  a va 2s .  c  om*/
 */
private void showAboutDialog() {
    PackageManager pm = getActivity().getPackageManager();
    String packageName = getActivity().getPackageName();
    String versionName;
    try {
        PackageInfo info = pm.getPackageInfo(packageName, 0);
        versionName = info.versionName;
    } catch (PackageManager.NameNotFoundException e) {
        versionName = "N/A";
    }

    SpannableStringBuilder aboutBody = new SpannableStringBuilder();

    SpannableString mailAddress = new SpannableString(getString(R.string.mailto));
    mailAddress.setSpan(new ClickableSpan() {
        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SENDTO);
            intent.setData(Uri.parse(getString(R.string.description_mailto)));
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.description_mail_subject));
            startActivity(intent);
        }
    }, 0, mailAddress.length(), 0);

    aboutBody.append(Html.fromHtml(getString(R.string.about_body, versionName)));
    aboutBody.append("\n");
    aboutBody.append(mailAddress);

    LayoutInflater layoutInflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView aboutBodyView = (TextView) layoutInflater.inflate(R.layout.fragment_about_dialog, null);
    aboutBodyView.setText(aboutBody);
    aboutBodyView.setMovementMethod(LinkMovementMethod.getInstance());

    AlertDialog dlg = new AlertDialog.Builder(getActivity()).setTitle(R.string.alert_title_about)
            .setView(aboutBodyView).setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
    dlg.show();
}

From source file:com.albedinsky.android.support.intent.EmailIntent.java

/**
 *//*from w w w.j  a  v a 2  s.c o  m*/
@NonNull
@Override
protected Intent onBuild() {
    final Intent intent = new Intent(Intent.ACTION_SENDTO, createUri(mAddresses));
    intent.putExtra(Intent.EXTRA_SUBJECT, mSubject);
    intent.putExtra(Intent.EXTRA_TEXT, mMessage);
    if (mCcAddresses != null) {
        intent.putExtra(Intent.EXTRA_CC, addressesToArray(mCcAddresses));
    }
    if (mBccAddresses != null) {
        intent.putExtra(Intent.EXTRA_BCC, addressesToArray(mBccAddresses));
    }
    return intent;
}

From source file:org.glucosio.android.activity.MainActivity.java

public void openSupportDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getResources().getString(R.string.menu_support_title));
    builder.setItems(getResources().getStringArray(R.array.menu_support_options),
            new DialogInterface.OnClickListener() {
                @Override/*from  www. j  a  v  a2  s  .  c  o  m*/
                public void onClick(DialogInterface dialog, int which) {
                    if (which == 0) {
                        // Email
                        Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                                Uri.parse("mailto:hello@glucosio.org"));
                        boolean activityExists = emailIntent.resolveActivityInfo(getPackageManager(),
                                0) != null;

                        if (activityExists) {
                            startActivity(emailIntent);
                        } else {
                            showSnackBar(getResources().getString(R.string.menu_support_error1),
                                    Snackbar.LENGTH_LONG);
                        }
                    } else {
                        // Forum
                        String url = "http://community.glucosio.org/";
                        Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        i.setPackage("com.android.chrome");
                        try {
                            startActivity(i);
                        } catch (ActivityNotFoundException e) {
                            // Chrome is probably not installed
                            // Try with the default browser
                            i.setPackage(null);
                            startActivity(i);
                        }
                    }
                }
            });
    builder.show();
}

From source file:com.necisstudio.highlightgoal.MainActivity.java

void drawermenu(int id) {
    if (id == R.id.rate) {
        Uri uri = Uri.parse("market://details?id=com.necisstudio.highlightgoal");
        Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
        goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
                | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        try {//from  ww  w  . j av  a  2s . c o m
            startActivity(goToMarket);
        } catch (ActivityNotFoundException e) {
            startActivity(new Intent(Intent.ACTION_VIEW,
                    Uri.parse("http://play.google.com/store/apps/details?id=com.necisstudio.highlightgoal")));
        }

    } else if (id == R.id.feedback) {
        Intent send = new Intent(Intent.ACTION_SENDTO);
        String uriText = "mailto:" + Uri.encode("report@necistudio.com") + "?subject="
                + Uri.encode("Feedback for Highlight Goal") + "&body=" + Uri.encode("");
        Uri uri = Uri.parse(uriText);
        send.setData(uri);
        startActivity(Intent.createChooser(send, "Send mail..."));
    } else if (id == R.id.latest) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(0);
        txtTitle.setText("Latest");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightLatestFragment.newInstance(""),
                KlasementLigaFragment.newInstance("inggris"), ScheduleLigaLatestFragment.newInstance(""));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);
        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Schedule");
    } else if (id == R.id.inggris) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.premier);
        txtTitle.setText("Premier League");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("inggris"),
                KlasementLigaFragment.newInstance("inggris"), ScheduleLigaFragment.newInstance("inggris"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");

    } else if (id == R.id.europa) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.europa);
        txtTitle.setText("Europa League");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("europa"),
                new TeamEuropaFragment(), ScheduleLigaFragment.newInstance("europa"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.champion) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.champion);
        txtTitle.setText("Champions League");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("champions"),
                new TeamChampionsFragment(), ScheduleLigaFragment.newInstance("champions"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.seria) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.seria);
        txtTitle.setText("Seri A");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("italia"),
                KlasementLigaFragment.newInstance("italia"), ScheduleLigaFragment.newInstance("italia"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.jerman) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.bundes);
        txtTitle.setText("Bundesliga");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("jerman"),
                KlasementLigaFragment.newInstance("jerman"), ScheduleLigaFragment.newInstance("jerman"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.spain) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.bbva);
        txtTitle.setText("BBVA League");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("spain"),
                KlasementLigaFragment.newInstance("spain"), ScheduleLigaFragment.newInstance("spain"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.france) {
        ApplicationConfig.status = id;
        iddrawer = id;
        imgLogo.setImageResource(R.mipmap.ligue);
        txtTitle.setText("League 1");
        fList = new ArrayList<Fragment>();
        List<Fragment> fragments = getFragments(HighlightFragment.newInstance("france"),
                KlasementLigaFragment.newInstance("france"), ScheduleLigaFragment.newInstance("france"));
        adapter_viewPager = new Adapter_ViewPager(getSupportFragmentManager(), fragments);
        final ViewPager pager = (ViewPager) findViewById(R.id.viewpager);
        tabHost = (TabLayout) findViewById(R.id.materialTabHost);
        pager.setAdapter(adapter_viewPager);
        pager.setOffscreenPageLimit(3);

        tabHost.setupWithViewPager(pager);
        tabHost.getTabAt(0).setText("Highlight");
        tabHost.getTabAt(1).setText("Standings");
        tabHost.getTabAt(2).setText("Schedule");
    } else if (id == R.id.about) {
        Intent intent = new Intent(MainActivity.this, ActivityAbout.class);
        startActivity(intent);
    } else if (id == R.id.license) {
        Intent intent = new Intent(MainActivity.this, ActivityLicense.class);
        startActivity(intent);
    }
}

From source file:com.google.zxing.client.android.result.ResultHandler.java

final void sendSMSFromUri(String uri, String body) {
    Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(uri));
    putExtra(intent, "sms_body", body);
    // Exit the app once the SMS is sent
    intent.putExtra("compose_mode", true);
    launchIntent(intent);/*from w ww .j  a  va 2 s. co m*/
}