]> iEval git - unical.git/commitdiff
Delete Event now works
authorPetru Trimbitas <l3asketballplayer@yahoo.com>
Sat, 15 Jun 2013 15:04:28 +0000 (18:04 +0300)
committerPetru Trimbitas <l3asketballplayer@yahoo.com>
Sat, 15 Jun 2013 15:04:28 +0000 (18:04 +0300)
src/ro/ieval/unical/DeleteEventDialog.java
src/ro/ieval/unical/DisplayEventActivity.java

index 40fe58251af3382842b1c51c94e51020d33ced62..ba2f9c4600f07948c5ba6885b6ead96a6adbb5d5 100644 (file)
@@ -1,12 +1,17 @@
 package ro.ieval.unical;
 
+import android.annotation.SuppressLint;
+import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.content.DialogInterface;
 import android.os.Bundle;
 
+@SuppressLint("ValidFragment")
 public final class DeleteEventDialog extends DialogFragment {
+       Event e; Activity a;
+       
        @Override
        public Dialog onCreateDialog(final Bundle savedInstanceState) {
                final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@@ -15,6 +20,8 @@ public final class DeleteEventDialog extends DialogFragment {
                                   @Override
                                   public void onClick(final DialogInterface dialog, final int id) {
                                           // Nothing happens here yet
+                                          e.delete(getActivity());
+                                          a.finish();
                                   }
                           })
                           .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
@@ -25,4 +32,8 @@ public final class DeleteEventDialog extends DialogFragment {
                           });
                return builder.create();
        }
+       public DeleteEventDialog(Event e,Activity a) {
+               this.e=e;
+               this.a=a;
+       }
 }
index 967a556b5cf03c69303f343466f660086c5f5f83..f5bb14653686068d3f47ec33b3c7439c2ed60a79 100644 (file)
@@ -15,6 +15,7 @@ import android.widget.TextView;
 
 public class DisplayEventActivity extends Activity {
        public static final String EXTRA_EVENT = "event";
+       Event e;
 
        public static void displayEvent(final Context context, final Event event){
                final Intent i=new Intent(context,DisplayEventActivity.class);
@@ -25,7 +26,7 @@ public class DisplayEventActivity extends Activity {
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
-               final Event e=getIntent().getParcelableExtra(EXTRA_EVENT);
+               e=getIntent().getParcelableExtra(EXTRA_EVENT);
                setContentView(R.layout.event_view);
                setTitle(e.title);
 
@@ -70,7 +71,7 @@ public class DisplayEventActivity extends Activity {
                                startActivity(i);
                                return true;
                        case R.id.deleteevent:
-                               final DeleteEventDialog d=new DeleteEventDialog();
+                               final DeleteEventDialog d=new DeleteEventDialog(e,this);
                                d.show(getFragmentManager(), "Delete");
                                return true;
                        case R.id.eventlist:
This page took 0.019229 seconds and 4 git commands to generate.