Example usage for android.content Intent EXTRA_EMAIL

List of usage examples for android.content Intent EXTRA_EMAIL

Introduction

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

Prototype

String EXTRA_EMAIL

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

Click Source Link

Document

A String[] holding e-mail addresses that should be delivered to.

Usage

From source file:com.polyvi.xface.extension.messaging.XMessagingExt.java

/**
 * ??Email/*from   w w  w  .j av a 2s  . c o  m*/
 *
 * @param addr
 *            ?
 * @param body
 *            ?
 * @param subject
 *            ?
 * @return ?
 */
private void sendEmail(String addr, String body, String subject) {
    String aEmailList[] = { addr };
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.setType("text/plain");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
    mContext.startActivity(emailIntent);
    mCallbackContext.success();
}

From source file:com.denel.facepatrol.MainActivity.java

public void ContactEmail(View view) {
    Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
    emailIntent.setData(Uri.parse("mailto:"));
    emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { contact_email });
    //emailIntent.setType("message/rfc822");
    emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    startActivity(Intent.createChooser(emailIntent, "Send Email..."));
    //finish();//from   w w w . j ava  2  s .c o m
}

From source file:com.klinker.android.theme_spotlight.activity.SpotlightActivity.java

public void onFeedbackClicked(View v) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_EMAIL, "support@klinkerapps.com");
    intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name));

    // create a chooser to handle the intent and attach a author
    startActivity(Intent.createChooser(intent, getString(R.string.send_feedback)));
}

From source file:com.polyvi.xface.extension.XMessagingExt.java

/**
 * ??Email/*from w  ww.  ja  va  2s  . c  om*/
 * @param addr        ?
 * @param body        ?
 * @param subject     ?
 * @return     ?
 */
private XExtensionResult sendEmail(String addr, String body, String subject) {
    String aEmailList[] = { addr };
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.setType("text/plain");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
    getContext().startActivity(emailIntent);
    return new XExtensionResult(XExtensionResult.Status.OK, "");
}

From source file:org.thomasamsler.android.flashcards.activity.MainActivity.java

private void sendFeedback() {

    String toList[] = { FEEDBACK_EMAIL_ADDRESS };

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, toList);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
            getResources().getString(R.string.email_feedback_subject));

    startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.email_feedback_chooser)));
}

From source file:com.cypress.cysmart.DataLoggerFragments.DataLoggerFragment.java

/**
 * Sharing the data logger txt file//from   w  w w.j  ava2  s  . c  om
 */
private void shareDataLoggerFile() {
    HomePageActivity.containerView.invalidate();
    Intent emailIntent = new Intent(Intent.ACTION_SEND);
    // set the type to 'email'
    emailIntent.setType("vnd.android.cursor.dir/email");
    emailIntent.putExtra(Intent.EXTRA_EMAIL, "");
    // the attachment
    emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(mFilepath)));
    // the mail subject
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Data Logger File");
    startActivity(Intent.createChooser(emailIntent, "Send email..."));

}

From source file:com.mstoyanov.music_lessons.ScheduleFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (parent.getId()) {
    case R.id.lessons_list:
        Cursor cursor = (Cursor) parent.getItemAtPosition(position);
        int studentId = cursor.getInt(cursor.getColumnIndex("studentID"));
        lessonId = cursor.getInt(cursor.getColumnIndex("_id"));
        String firstName = cursor.getString(cursor.getColumnIndex("firstName"));
        String lastName = cursor.getString(cursor.getColumnIndex("lastName"));
        if (dualPane) {
            selectionArgs_delete[0] = String.valueOf(lessonId);

            lessonsList.setItemChecked(position, true);
            selectedLesson = position;//ww w  . j a v  a  2  s  . c o m

            selectionArgs_actions[0] = String.valueOf(studentId);

            firstNameLabel.setText("First Name");
            firstNameTextView.setText(firstName);
            lastNameLabel.setText("Last Name");
            lastNameTextView.setText(lastName);

            getLoaderManager().restartLoader(ACTIONS_LOADER, null, this);
        } else {
            Intent intent = new Intent(getActivity(), LessonDetailsActivity.class);
            intent.putExtra("LESSON_ID", lessonId);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        }
        break;
    case R.id.actions_list:
        Actions action = actions.get(position);
        switch (action.getType()) {
        case Actions.ACTION_CALL:
            Uri callUri = Uri.parse("tel:" + action.getData());
            Intent intent = new Intent(Intent.ACTION_CALL, callUri);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        case Actions.ACTION_EMAIL:
            intent = new Intent(Intent.ACTION_SEND);
            intent.setType("plain/text");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { action.getData() });
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        case Actions.ACTION_SMS:
            Uri smsUri = Uri.parse("sms:" + action.getData());
            intent = new Intent(Intent.ACTION_VIEW, smsUri);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            break;
        default:
            throw new IllegalArgumentException("Invalid action type: " + action.getType());
        }
        break;
    default:
        throw new IllegalArgumentException("Invalid parentId: " + parent.getId());
    }
}

From source file:com.kasungunathilaka.sarigama.ui.HomeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        onBackPressed();//from ww  w.  ja v  a 2  s .co m
        break;
    case R.id.action_search:
        setFragment(new SearchFragment());
        break;
    case R.id.action_about_developer:
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(HomeActivity.this);
        View dialogView = getLayoutInflater().inflate(R.layout.dialog_view_about_developer, null);
        alertDialogBuilder.setView(dialogView);
        ImageView ivClose = (ImageView) dialogView.findViewById(R.id.ivClose);
        TextView tvEmail = (TextView) dialogView.findViewById(R.id.tvEmail);
        final AlertDialog alertDialog = alertDialogBuilder.create();
        tvEmail.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    Intent emailIntent = new Intent(Intent.ACTION_SEND);
                    emailIntent.setType("plain/text");
                    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                            new String[] { "developer.kasun.gunathilaka@gmail.com" });
                    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sarigama");
                    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "");
                    startActivity(emailIntent);
                    alertDialog.dismiss();
                }
                return false;
            }
        });
        ivClose.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    alertDialog.dismiss();
                }
                return false;
            }
        });
        alertDialog.show();
        break;
    case R.id.action_exit:
        finish();
        NotificationManager notificationManager = (NotificationManager) getSystemService(
                Context.NOTIFICATION_SERVICE);
        notificationManager.cancel(9999);
        System.exit(0);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.alexcruz.papuhwalls.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.Preferences = new Preferences(getApplicationContext());

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_activity);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    context = this;
    CustomActivityOnCrash.install(this);

    prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (prefs.getBoolean(Preferences.IS_FIRST__RUN, true)) {
        startActivity(new Intent(this, Slides.class));
        finish();/*from  ww w  .  jav  a2s.  co m*/
    }

    if (Build.VERSION.SDK_INT >= 23 && PermissionChecker.checkSelfPermission(this,
            Manifest.permission.READ_EXTERNAL_STORAGE) != PermissionChecker.PERMISSION_GRANTED) {
        requestPermissions(new String[] { Manifest.permission.READ_EXTERNAL_STORAGE },
                REQUEST_READ_STORAGE_PERMISSION);
    } else {
        // Do absolutely NOTHING
    }

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    com.alexcruz.papuhwalls.Preferences.themeMe(this, toolbar);

    Home = getResources().getString(R.string.app_name);
    final String Home = getResources().getString(R.string.section_home);
    AllWalls = getResources().getString(R.string.section_all_walls);
    AndroidWalls = getResources().getString(R.string.section_android_walls);
    BwWalls = getResources().getString(R.string.section_bw_walls);
    BlurWalls = getResources().getString(R.string.section_blur_walls);
    CloudsWalls = getResources().getString(R.string.section_clouds_walls);
    MiscWalls = getResources().getString(R.string.section_misc_walls);
    MustachesWalls = getResources().getString(R.string.section_mustaches_walls);
    NexusWalls = getResources().getString(R.string.section_nexus_walls);
    OriginalWalls = getResources().getString(R.string.section_original_walls);
    PapuhWalls = getResources().getString(R.string.section_papuh_walls);
    SolidsWalls = getResources().getString(R.string.section_solids_walls);
    StarsWalls = getResources().getString(R.string.section_stars_walls);
    RomCategory = getResources().getString(R.string.section_rom_category);
    AicpWalls = getResources().getString(R.string.section_aicp_walls);
    BrokenOsWalls = getResources().getString(R.string.section_brokenos_walls);
    CandyWalls = getResources().getString(R.string.section_candy_walls);
    DuWalls = getResources().getString(R.string.section_du_walls);
    EosWalls = getResources().getString(R.string.section_eos_walls);
    LiquidsmoothWalls = getResources().getString(R.string.section_liquidsmooth_walls);
    OmniWalls = getResources().getString(R.string.section_omni_walls);
    OrionWalls = getResources().getString(R.string.section_orion_walls);
    PaWalls = getResources().getString(R.string.section_pa_walls);
    PacromWalls = getResources().getString(R.string.section_pacrom_walls);
    RrWalls = getResources().getString(R.string.section_rr_walls);
    SlimWalls = getResources().getString(R.string.section_slim_walls);
    TeslaWalls = getResources().getString(R.string.section_tesla_walls);
    TwistedAOSPWalls = getResources().getString(R.string.section_twistedaosp_walls);
    ValidusWalls = getResources().getString(R.string.section_validus_walls);
    Settings = getResources().getString(R.string.settings);
    LiveWallpaper = getResources().getString(R.string.live_wallpaper_description);
    MuzeiSettings = getResources().getString(R.string.muzei_settings);
    AboutApp = getResources().getString(R.string.section_aboutapp);

    currentItem = 1;

    final IProfile profile = new ProfileDrawerItem().withName("Alex Cruz aka Mazda")
            .withIcon(getResources().getDrawable(R.drawable.alexcruz)).withIdentifier(1);

    int header = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.time_context_headers),
            false)) {
        if (header < TIME_SUNRISE || header >= TIME_NIGHT) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_night;
            } else {
                header = R.drawable.night;
            }
        } else if (header >= TIME_SUNRISE && header < TIME_MORNING) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_sunrise;
            } else {
                header = R.drawable.sunrise;
            }
        } else if (header >= TIME_MORNING && header < TIME_NOON) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_morning;
            } else {
                header = R.drawable.morning;
            }
        } else if (header >= TIME_NOON && header < TIME_AFTERNOON) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_noon;
            } else {
                header = R.drawable.noon;
            }
        } else if (header >= TIME_AFTERNOON && header < TIME_SUNSET) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_afternoon;
            } else {
                header = R.drawable.afternoon;
            }
        } else if (header >= TIME_SUNSET && header < TIME_NIGHT) {
            if (PreferenceManager.getDefaultSharedPreferences(this)
                    .getBoolean(getString(R.string.poly_time_context_headers), false)) {
                header = R.drawable.poly_sunset;
            } else {
                header = R.drawable.sunset;
            }
        }
    } else {
        header = R.drawable.header;
    }

    String versionName;

    try {
        versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(header)
            .withSelectionFirstLine(getResources().getString(R.string.app_long_name))
            .withSelectionSecondLine("v" + versionName).withSelectionListEnabledForSingleProfile(false)
            .addProfiles(profile).withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                @Override
                public boolean onProfileChanged(View view, IProfile profile, boolean current) {
                    if (profile instanceof IDrawerItem
                            && ((IDrawerItem) profile).getIdentifier() == PROFILE_SETTING) {
                        int count = 100 + headerResult.getProfiles().size() + 1;
                        if (headerResult.getProfiles() != null) {
                            Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,
                                    new String[] { getResources().getString(R.string.email_address) });
                            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
                                    getResources().getText(R.string.artsource_name));
                            emailIntent.setType("plain/text");
                            startActivity(Intent.createChooser(emailIntent, "Contact Alex"));
                        } else {
                            headerResult.addProfiles(profile);
                        }
                    }
                    return false;
                }
            }).withSavedInstance(savedInstanceState).build();

    result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withAccountHeader(headerResult)
            .withHeader(R.layout.header).withSavedInstance(savedInstanceState).withScrollToTopAfterClick(true)
            .withFooterDivider(true).withSliderBackgroundColor(Preferences.Drawer())
            .withStatusBarColor(
                    Preferences.StatusBarTint() ? tint(Preferences.Theme(), 0.8) : Preferences.Theme())
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(Home).withIcon(R.drawable.ic_home)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(1),
                    new PrimaryDrawerItem().withName(AllWalls).withIcon(R.drawable.ic_allwalls)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(2).withBadge("1630+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(AndroidWalls).withIcon(R.drawable.ic_android)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(3).withBadge("17+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(BwWalls).withIcon(R.drawable.ic_bw)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(4).withBadge("56+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(BlurWalls).withIcon(R.drawable.ic_blur)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(5).withBadge("10+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(CloudsWalls).withIcon(R.drawable.ic_clouds)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(6).withBadge("60+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(MiscWalls).withIcon(R.drawable.ic_misc)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(7).withBadge("41+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(MustachesWalls).withIcon(R.drawable.ic_mustaches)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(8).withBadge("10+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(NexusWalls).withIcon(R.drawable.ic_nexus)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(9).withBadge("98+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(OriginalWalls).withIcon(R.drawable.ic_original)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(10).withBadge("343+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(PapuhWalls).withIcon(R.drawable.ic_papuh)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(11).withBadge("24+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(SolidsWalls).withIcon(R.drawable.ic_solids)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(12).withBadge("72+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(StarsWalls).withIcon(R.drawable.ic_stars)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(13).withBadge("11+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new SectionDrawerItem().withName(RomCategory).withTypeface(Typeface.DEFAULT_BOLD)
                            .withTextColor(Preferences.DrawerText()),
                    new PrimaryDrawerItem().withName(AicpWalls).withIcon(R.drawable.ic_aicp)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(15).withBadge("84+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(BrokenOsWalls).withIcon(R.drawable.ic_brokenos)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(16).withBadge("53+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(CandyWalls).withIcon(R.drawable.ic_candy)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(17).withBadge("80+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(DuWalls).withIcon(R.drawable.ic_dirtyunicorns)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(18).withBadge("139+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(EosWalls).withIcon(R.drawable.ic_eos)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(19).withBadge("48+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(LiquidsmoothWalls).withIcon(R.drawable.ic_liquidsmooth)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(20).withBadge("65+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(OmniWalls).withIcon(R.drawable.ic_omni)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(21).withBadge("29+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(OrionWalls).withIcon(R.drawable.ic_orion)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(22).withBadge("10+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(PaWalls).withIcon(R.drawable.ic_pa)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(23).withBadge("10+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(PacromWalls).withIcon(R.drawable.ic_pacrom)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(24).withBadge("21+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(RrWalls).withIcon(R.drawable.ic_rr)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(25).withBadge("54+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(SlimWalls).withIcon(R.drawable.ic_slim)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(26).withBadge("8+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(TeslaWalls).withIcon(R.drawable.ic_tesla)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(27).withBadge("43+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(TwistedAOSPWalls).withIcon(R.drawable.ic_twistedaosp)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(28).withBadge("43+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new PrimaryDrawerItem().withName(ValidusWalls).withIcon(R.drawable.ic_validus)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(29).withBadge("258+")
                            .withBadgeStyle(new BadgeStyle().withTextColor(Preferences.BadgeText())
                                    .withColor(Preferences.BadgeBackground())),
                    new DividerDrawerItem(),
                    new SecondaryDrawerItem().withName(Settings).withIcon(R.drawable.ic_settings)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(30),
                    new SecondaryDrawerItem().withName(LiveWallpaper)
                            .withIcon(R.drawable.ic_device_now_wallpaper).withIconTintingEnabled(true)
                            .withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(33),
                    new SecondaryDrawerItem().withName(MuzeiSettings).withIcon(R.drawable.ic_muzei)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(31),
                    new SecondaryDrawerItem().withName(AboutApp).withIcon(R.drawable.ic_about)
                            .withIconTintingEnabled(true).withSelectedIconColor(Preferences.SelectedIcon())
                            .withIconColor(Preferences.NormalIcon())
                            .withSelectedTextColor(tint(Preferences.SelectedDrawerText(), 1.0))
                            .withSelectedColor(tint(Preferences.DrawerSelector(), 1.0))
                            .withTextColor(Preferences.DrawerText()).withIdentifier(32))
            .withOnDrawerListener(new Drawer.OnDrawerListener() {
                @Override
                public void onDrawerOpened(View drawerView) {
                }

                @Override
                public void onDrawerClosed(View drawerView) {
                }

                @Override
                public void onDrawerSlide(View drawerView, float slideOffset) {

                }
            }).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {

                    boolean isMuzeiInstalled = Preferences.isAppInstalled(context, "net.nurik.roman.muzei");
                    boolean isConnected = isConnected(MainActivity.this);

                    if (drawerItem != null) {
                        switch (drawerItem.getIdentifier()) {
                        case 1:
                            switchFragment(1, Home, "BaseActivity");
                            break;
                        case 2:
                            if (isConnected) {
                                switchWalls(2, AllWalls, "AllWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 3:
                            if (isConnected) {
                                switchWalls(3, AndroidWalls, "AndroidWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 4:
                            if (isConnected) {
                                switchWalls(4, BwWalls, "BwWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 5:
                            if (isConnected) {
                                switchWalls(5, BlurWalls, "BlurWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 6:
                            if (isConnected) {
                                switchWalls(6, BwWalls, "CloudsWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 7:
                            if (isConnected) {
                                switchWalls(7, MiscWalls, "MiscWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 8:
                            if (isConnected) {
                                switchWalls(8, MustachesWalls, "MustachesWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 9:
                            if (isConnected) {
                                switchWalls(9, NexusWalls, "NexusWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 10:
                            if (isConnected) {
                                switchWalls(10, OriginalWalls, "OriginalWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 11:
                            if (isConnected) {
                                switchWalls(11, PapuhWalls, "PapuhWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 12:
                            if (isConnected) {
                                switchWalls(12, SolidsWalls, "SolidsWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 13:
                            if (isConnected) {
                                switchWalls(13, StarsWalls, "StarsWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 14:
                            setTitle(R.string.section_rom_category);
                            ;
                            break;
                        case 15:
                            if (isConnected) {
                                switchWalls(15, AicpWalls, "AicpWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 16:
                            if (isConnected) {
                                switchWalls(16, BrokenOsWalls, "BrokenOsWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 17:
                            if (isConnected) {
                                switchWalls(17, CandyWalls, "CandyWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 18:
                            if (isConnected) {
                                switchWalls(18, DuWalls, "DuWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 19:
                            if (isConnected) {
                                switchWalls(19, EosWalls, "EosWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 20:
                            if (isConnected) {
                                switchWalls(20, LiquidsmoothWalls, "LiquidsmoothWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 21:
                            if (isConnected) {
                                switchWalls(21, OmniWalls, "OmniWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 22:
                            if (isConnected) {
                                switchWalls(22, OrionWalls, "OrionWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 23:
                            if (isConnected) {
                                switchWalls(23, PaWalls, "PaWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 24:
                            if (isConnected) {
                                switchWalls(24, PacromWalls, "PacromWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 25:
                            if (isConnected) {
                                switchWalls(25, RrWalls, "RrWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 26:
                            if (isConnected) {
                                switchWalls(26, SlimWalls, "SlimWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 27:
                            if (isConnected) {
                                switchWalls(27, TeslaWalls, "TeslaWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 28:
                            if (isConnected) {
                                switchWalls(28, TwistedAOSPWalls, "TwistedAOSPWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 29:
                            if (isConnected) {
                                switchWalls(29, ValidusWalls, "ValidusWalls");
                            } else {
                                showNotConnectedDialog();
                            }
                            break;
                        case 30:
                            Intent SettingsIntent = new Intent(MainActivity.this, SettingsActivity.class);
                            startActivityForResult(SettingsIntent, 0);
                            break;
                        case 31:
                            if (isMuzeiInstalled) {
                                Intent launchMuzeiIntent = new Intent(MainActivity.this, Settings.class);
                                startActivityForResult(launchMuzeiIntent, 0);
                            } else {
                                // Do absolutely NOTHING
                            }
                            break;
                        case 32:
                            switchFragment(32, AboutApp, "Credits");
                            break;
                        case 33:
                            Intent LWIntent = new Intent(MainActivity.this,
                                    com.alexcruz.papuhwalls.Live.Settings.class);
                            startActivityForResult(LWIntent, 0);
                            break;
                        }
                    }

                    return false;
                }
            }).withOnDrawerItemLongClickListener(new Drawer.OnDrawerItemLongClickListener() {
                @Override
                public boolean onItemLongClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem instanceof SecondaryDrawerItem) {
                    }
                    return false;
                }
            }).build();
    result.setSelection(1, true);
    boolean isMuzeiInstalled = Preferences.isAppInstalled(context, "net.nurik.roman.muzei");
    if (!isMuzeiInstalled) {
        result.removeItem(31);
    } else {
        // Do absolutely NOTHING
    }

    if (Preferences.getLiveWalls().size() == 0 & isConnected(this))
        new SetupLW(this).execute();
}

From source file:com.untappedkegg.rally.home.ActivityMain.java

private void sendFeedback() {
    List<Intent> targetedShareIntents = new ArrayList<Intent>();

    final String emailMsg = String.format(
            "App Version: %s\nAndroid: %s : %s\nDevice: %s \nPlease leave the above lines for debugging purposes. Thank you!\n\n",
            BuildConfig.VERSION_NAME, Build.VERSION.SDK_INT, Build.VERSION.RELEASE,
            /*Build.FINGERPRINT,*/ Build.MODEL);

    // Google+//from w  ww .  j a v a  2s .  com
    ArrayList<Person> recipients = new ArrayList<Person>();
    recipients.add(PlusShare.createPerson("109961307643513437237", BuildConfig.DEV_NAME));
    targetedShareIntents
            .add(new PlusShare.Builder(this).setType("text/plain").setRecipients(recipients).getIntent());

    // Email
    try {
        targetedShareIntents.add(
                CommonIntents.getShareIntent("email", "Feedback: " + getString(R.string.app_name), emailMsg)
                        .putExtra(Intent.EXTRA_EMAIL, "UntappedKegg@gmail.com"));
    } catch (Exception e) {
    }

    try {
        targetedShareIntents.add(
                CommonIntents.getShareIntent("gmail", "Feedback: " + getString(R.string.app_name), emailMsg)
                        .putExtra(Intent.EXTRA_EMAIL, "UntappedKegg@gmail.com"));
    } catch (Exception e) {
    }

    // Twitter
    Intent twitterIntent = CommonIntents.getShareIntent("twitter", "Untapped Rally", "@UntappedKegg ");
    if (twitterIntent != null)
        targetedShareIntents.add(twitterIntent);

    // Market
    try {
        final String mPackageName = getPackageName();
        final String installer = getPackageManager().getInstallerPackageName(mPackageName);
        Intent marketIntent = null;

        if (AppState.MARKET_GOOGLE.equalsIgnoreCase(installer)) {
            marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppState.APP_LINK_GOOGLE + mPackageName));
            marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
                    | Intent.FLAG_ACTIVITY_NEW_TASK);

        } else if (AppState.MARKET_AMAZON.equalsIgnoreCase(installer)) {
            marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppState.APP_LINK_AMAZON + mPackageName));
            marketIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        }
        if (marketIntent != null)
            targetedShareIntents.add(marketIntent);

    } catch (Exception e) {
    }

    Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Send Feedback via:");
    chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[] {}));
    startActivity(chooserIntent);

}