package com.epson.iprint.storage;

import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;



import android.support.p003v7.app.AlertDialog;
import epson.print.R;

public class ConfirmCancelDialog extends DialogFragment {
    private static final String PARAM_MESSAGE_RESOURCE_ID = "message_id";

    public interface DialogCancelListener {
        void cancel();
    }

    public static ConfirmCancelDialog newInstance(int i) {
        ConfirmCancelDialog confirmCancelDialog = new ConfirmCancelDialog();
        Bundle bundle = new Bundle();
        bundle.putInt(PARAM_MESSAGE_RESOURCE_ID, i);
        confirmCancelDialog.setArguments(bundle);
        return confirmCancelDialog;
    }

    @NonNull
    public Dialog onCreateDialog(Bundle bundle) {
        int i = getArguments().getInt(PARAM_MESSAGE_RESOURCE_ID);
        setCancelable(false);
        return new AlertDialog.Builder(getActivity()).setMessage(i).setPositiveButton((CharSequence) getString(R.string.str_yes), (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialogInterface, int i) {
                ConfirmCancelDialog.this.doCancel();
            }
        }).setNegativeButton((CharSequence) getString(R.string.str_no), (DialogInterface.OnClickListener) new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialogInterface, int i) {
            }
        }).create();
    }

    /* access modifiers changed from: private */
    public void doCancel() {
        FragmentActivity activity = getActivity();
        if (activity != null) {
            ((DialogCancelListener) activity).cancel();
        }
    }
}
