]> iEval git - unical.git/commitdiff
Edit event. work in progress
authorPetru <l3asketballplayer@yahoo.com>
Tue, 13 Aug 2013 08:38:27 +0000 (11:38 +0300)
committerPetru <l3asketballplayer@yahoo.com>
Tue, 13 Aug 2013 08:38:27 +0000 (11:38 +0300)
res/menu/event.xml
res/values/strings.xml
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/DisplayEventActivity.java
src/ro/ieval/unical/Event.java

index 1dde0581021c42568197e1a8b9b8026850e176ab..6a854130d565bbc9996b78be2f5edcb8054a8607 100644 (file)
@@ -1,11 +1,24 @@
 <?xml version="1.0" encoding="utf-8"?>
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
-    <item android:id="@+id/deleteevent" android:icon="@android:drawable/ic_menu_delete" android:title="Delete Event" android:visible="true" android:titleCondensed="DELETE" android:showAsAction="always"></item>
+    <item android:id="@+id/deleteevent"
+          android:icon="@android:drawable/ic_menu_delete"
+          android:title="Delete Event"
+          android:visible="true"
+          android:titleCondensed="DELETE"
+          android:showAsAction="always">
+
+    </item>
     <item android:id="@+id/NewEvent" android:title="New event"
         android:visible="true" android:showAsAction="ifRoom"
         android:icon="@android:drawable/ic_menu_add"
     android:titleCondensed="NEW">
 
+    </item>
+    <item android:id="@+id/edit_event"
+            android:title="@string/edit_event"
+            android:visible="true"
+            android:showAsAction="never">
+
     </item>
     <item android:id="@+id/eventlist"
         android:title="@string/eventlist"
index 229caf7b30a8e6d8bdcfdbc78b3d524fe14a9aa7..9e87e97084dfbb04682b0e9c940119eaf8f6c077 100644 (file)
@@ -47,6 +47,7 @@
     <string name="years">years</string>
     <string name="refresh">Refresh</string>
     <string name="stop_alarm">Stop Alarm</string>
+    <string name="edit_event">Edit Event</string>
 
     <string-array name="repeat_array_s">
         <item>Day</item>
index c3d362064163b7a99cea5545133f83bd067bfea9..89fe73efc5276b25e699bc317a6aedfdac6d85a5 100644 (file)
@@ -7,6 +7,8 @@ import android.app.Activity;
 import android.app.DatePickerDialog.OnDateSetListener;
 import android.app.Fragment;
 import android.app.TimePickerDialog.OnTimeSetListener;
+import android.content.Context;
+import android.content.Intent;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -17,6 +19,14 @@ import android.widget.*;
 public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
        private TextView dateTimeTextView;
     private Event tempEvent=new Event();
+    public static final String EXTRA_EVENT = "event";
+
+    public static void editEvent(final Context c, final Event e) {
+        Intent i = new Intent(c,AddEventActivity.class);
+        i.putExtra(AddEventActivity.EXTRA_EVENT,e);
+        c.startActivity(i);
+    }
+
 
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
index bb819b9eb51558facca7f6844b3da8c5fd48b4fe..275b2dcaf93c01f64deeb98235a5b3eeaafb1b28 100644 (file)
@@ -45,7 +45,7 @@ public class DisplayEventActivity extends Activity {
                final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
 
                startDay.setText(dayOfWeekFormat.format(start));
-               if(dateFormat.format(start)!=dateFormat.format(end)) {
+               if(!dateFormat.format(start).equals(dateFormat.format(end))) {
                        endDay.setText(dayOfWeekFormat.format(end));
                        endDate.setText(dateFormat.format(end));
                }
@@ -78,6 +78,9 @@ public class DisplayEventActivity extends Activity {
                                final Intent it=new Intent(this,EventListActivity.class);
                                startActivity(it);
                                return true;
+            case R.id.edit_event:
+                AddEventActivity.editEvent(DisplayEventActivity.this,event);
+                return true;
                        default:
                                return true;
                }
index 88398389c9eef3ad626446fba8d51cf7763b7547..9e4fef80594ab5b7dd5101fa3a99a18b2cbdfd32 100644 (file)
@@ -96,6 +96,12 @@ final class Event implements Parcelable{
                return  r.toArray(new Event[r.size()]);
        }
 
+    public void insert(final Context context) {
+        final ContentResolver cr=context.getContentResolver();
+        //cr.insert(Uri.withAppendedPath(Events.CONTENT_URI));
+        //cr.notifyChange();
+    }
+
        public void delete(final Context context){
                final ContentResolver cr=context.getContentResolver();
                cr.delete(Uri.withAppendedPath(Events.CONTENT_URI, Long.toString(_id)), null, null);
This page took 0.025043 seconds and 4 git commands to generate.