| 1 | package ro.ieval.unical; |
| 2 | |
| 3 | import android.annotation.SuppressLint; |
| 4 | import android.app.Activity; |
| 5 | import android.app.AlertDialog; |
| 6 | import android.app.Dialog; |
| 7 | import android.app.DialogFragment; |
| 8 | import android.content.DialogInterface; |
| 9 | import android.os.Bundle; |
| 10 | |
| 11 | @SuppressLint("ValidFragment") |
| 12 | public final class DeleteEventDialog extends DialogFragment { |
| 13 | Event e; Activity a; |
| 14 | |
| 15 | @Override |
| 16 | public Dialog onCreateDialog(final Bundle savedInstanceState) { |
| 17 | final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |
| 18 | builder.setMessage(R.string.askdeleteevent) |
| 19 | .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { |
| 20 | @Override |
| 21 | public void onClick(final DialogInterface dialog, final int id) { |
| 22 | // Nothing happens here yet |
| 23 | e.delete(getActivity()); |
| 24 | a.finish(); |
| 25 | } |
| 26 | }) |
| 27 | .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { |
| 28 | @Override |
| 29 | public void onClick(final DialogInterface dialog, final int id) { |
| 30 | // User cancelled the dialog |
| 31 | } |
| 32 | }); |
| 33 | return builder.create(); |
| 34 | } |
| 35 | public DeleteEventDialog(Event e,Activity a) { |
| 36 | this.e=e; |
| 37 | this.a=a; |
| 38 | } |
| 39 | } |