12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package com.epson.memcardacc;
- import android.app.AlertDialog;
- import android.app.Dialog;
- import android.content.DialogInterface;
- import android.os.Bundle;
- public class AltAlertDialogFragment extends DialogFragment {
- private static final String ARG_MESSAGE = "message";
- private static final String ARG_MESSAGE_STR = "message_string";
- private static final String ARG_TITLE = "title";
- public interface DialogCallback {
- void onPositiveCallback();
- }
- public static AltAlertDialogFragment newInstance(String str, String str2) {
- AltAlertDialogFragment altAlertDialogFragment = new AltAlertDialogFragment();
- Bundle bundle = new Bundle();
- if (str != null) {
- bundle.putString(ARG_TITLE, str);
- }
- bundle.putString(ARG_MESSAGE_STR, str2);
- altAlertDialogFragment.setArguments(bundle);
- return altAlertDialogFragment;
- }
- public Dialog onCreateDialog(Bundle bundle) {
- Bundle arguments = getArguments();
- String string = arguments.getString(ARG_TITLE);
- AlertDialog create = new AlertDialog.Builder(getActivity()).setMessage(arguments.getString(ARG_MESSAGE_STR)).setCancelable(false).setPositiveButton(R.string.str_btn_close, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- ((DialogCallback) getActivity()).onPositiveCallback();
- }
- }).create();
- if (string != null) {
- create.setTitle(string);
- }
- create.setCanceledOnTouchOutside(false);
- return create;
- }
- }
|