1 package ro
.ieval
.unical
;
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
;
11 @SuppressLint("ValidFragment")
12 public final class DeleteEventDialog
extends DialogFragment
{
13 private final Event event
;
14 private final Activity activity
;
16 public DeleteEventDialog(final Event event
, final Activity activity
) {
19 this.activity
=activity
;
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() {
28 public void onClick(final DialogInterface dialog
, final int id
) {
29 event
.delete(getActivity());
33 .setNegativeButton(R
.string
.no
, new DialogInterface
.OnClickListener() {
35 public void onClick(final DialogInterface dialog
, final int id
) {
36 // User cancelled the dialog
39 return builder
.create();