]>
Commit | Line | Data |
---|---|---|
46e6c000 PT |
1 | package ro.ieval.unical; |
2 | ||
dd76f98a PT |
3 | import android.annotation.SuppressLint; |
4 | import android.app.Activity; | |
46e6c000 PT |
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 | ||
dd76f98a | 11 | @SuppressLint("ValidFragment") |
5cf4714f | 12 | public final class DeleteEventDialog extends DialogFragment { |
f580909c MG |
13 | private final Event event; |
14 | private final Activity activity; | |
15 | ||
16 | public DeleteEventDialog(final Event event, final Activity activity) { | |
17 | super(); | |
18 | this.event=event; | |
19 | this.activity=activity; | |
20 | } | |
21 | ||
46e6c000 | 22 | @Override |
8a08d036 MG |
23 | public Dialog onCreateDialog(final Bundle savedInstanceState) { |
24 | final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | |
25 | builder.setMessage(R.string.askdeleteevent) | |
26 | .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { | |
27 | @Override | |
28 | public void onClick(final DialogInterface dialog, final int id) { | |
f580909c MG |
29 | event.delete(getActivity()); |
30 | activity.finish(); | |
8a08d036 MG |
31 | } |
32 | }) | |
33 | .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { | |
34 | @Override | |
35 | public void onClick(final DialogInterface dialog, final int id) { | |
36 | // User cancelled the dialog | |
37 | } | |
38 | }); | |
39 | return builder.create(); | |
40 | } | |
46e6c000 | 41 | } |