Android Open Source - RateMyApp Sent Email Dialog Listener

From Project

Back to project page RateMyApp.


The source code is released under:

MIT License

If you think the Android project RateMyApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.mariosangiorgio.ratemyapp.listeners;
//w  w  w. j av  a2 s . co  m
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;

import com.mariosangiorgio.ratemyapp.PreferencesManager;
import com.mariosangiorgio.ratemyapp.R;

public class SentEmailDialogListener implements DialogClickListener{
    private final PreferencesManager preferencesManager;
    private final String emailAddress;
    private final String emailMessage;

    public SentEmailDialogListener(PreferencesManager preferencesManager, String emailAddress, String emailMessage) {
        if (preferencesManager == null) {
            throw new IllegalArgumentException("preferencesManager should not be null");
        this.preferencesManager = preferencesManager;
        if (emailAddress == null) {
            throw new IllegalArgumentException("emailAddress should not be null");
        this.emailAddress = emailAddress;
        this.emailMessage = emailMessage != null ? emailMessage : "";

    public void onClick(DialogInterface dialogInterface, int buttonPressed, Context context, FragmentManager fragmentManager) {
            case DialogInterface.BUTTON_POSITIVE:
                Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", emailAddress, null));
                emailIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.email_subject));
                emailIntent.putExtra(Intent.EXTRA_TEXT, emailMessage);
                context.startActivity(Intent.createChooser(emailIntent, context.getString(R.string.send_email)));
            case DialogInterface.BUTTON_NEGATIVE:

Java Source Code List