1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package epson.print.imgsel;
- import android.app.AlertDialog;
- import android.app.Dialog;
- import android.content.DialogInterface;
- import android.os.Bundle;
- import epson.print.R;
- public class LocalAlertDialogFragment extends DialogFragment {
- private static final String KEY_DIALOG_CODE = "dialog_code";
- private static final String KEY_MESSAGE = "message";
- private static final String KEY_NO_TITLE = "no_title";
- private static final String KEY_TITLE = "title";
- private int mDialogCode;
- public interface DialogCallback {
- void onDialogCallback(int i);
- }
- public static LocalAlertDialogFragment newInstance(String str, int i, int i2) {
- LocalAlertDialogFragment localAlertDialogFragment = new LocalAlertDialogFragment();
- Bundle bundle = new Bundle();
- bundle.putString("message", str);
- bundle.putInt(KEY_TITLE, i);
- bundle.putInt(KEY_DIALOG_CODE, i2);
- localAlertDialogFragment.setArguments(bundle);
- return localAlertDialogFragment;
- }
- public static LocalAlertDialogFragment newInstance(String str, int i) {
- LocalAlertDialogFragment localAlertDialogFragment = new LocalAlertDialogFragment();
- Bundle bundle = new Bundle();
- bundle.putString("message", str);
- bundle.putInt(KEY_DIALOG_CODE, i);
- bundle.putBoolean(KEY_NO_TITLE, true);
- localAlertDialogFragment.setArguments(bundle);
- return localAlertDialogFragment;
- }
- public Dialog onCreateDialog(Bundle bundle) {
- Bundle arguments = getArguments();
- String string = arguments.getString("message");
- if (string == null) {
- string = "";
- }
- int i = arguments.getInt(KEY_TITLE, 0);
- boolean z = arguments.getBoolean(KEY_NO_TITLE, false);
- this.mDialogCode = arguments.getInt(KEY_DIALOG_CODE);
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setMessage(string).setPositiveButton(getActivity().getString(R.string.str_ok), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- LocalAlertDialogFragment.this.execCallback();
- }
- });
- if (!z) {
- builder.setTitle(i);
- }
- AlertDialog create = builder.create();
- create.setCanceledOnTouchOutside(false);
- return create;
- }
- /* access modifiers changed from: private */
- public void execCallback() {
- try {
- DialogCallback dialogCallback = (DialogCallback) getActivity();
- if (dialogCallback != null) {
- dialogCallback.onDialogCallback(this.mDialogCode);
- }
- } catch (ClassCastException unused) {
- }
- }
- }
|