]> iEval git - unical.git/commitdiff
Add event. work in progress[2]
authorPetru <l3asketballplayer@yahoo.com>
Mon, 15 Jul 2013 16:13:55 +0000 (19:13 +0300)
committerPetru <l3asketballplayer@yahoo.com>
Mon, 15 Jul 2013 16:13:55 +0000 (19:13 +0300)
res/values/strings.xml
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/AddEventTabListener.java
src/ro/ieval/unical/Event.java

index 6e334219d0e72b3159465289fe3b5a68949b760d..229caf7b30a8e6d8bdcfdbc78b3d524fe14a9aa7 100644 (file)
@@ -25,7 +25,7 @@
     <string name="friday">Friday</string>
     <string name="saturday">Saturday</string>
     <string name="save">Save</string>
-    <string name="addevtab1">Basic info</string>
+    <string name="addevtab1">Basic</string>
     <string name="addevtab2">Details</string>
     <string name="addevtab3">Other</string>
     <string name="eventname">Event Name</string>
index 6284b732076cffc93c1e6937f3fc01270c21a567..c3d362064163b7a99cea5545133f83bd067bfea9 100644 (file)
@@ -12,13 +12,11 @@ import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
-import android.widget.DatePicker;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.widget.TimePicker;
+import android.widget.*;
 
 public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
        private TextView dateTimeTextView;
+    private Event tempEvent=new Event();
 
        @Override
        protected void onCreate(final Bundle savedInstanceState) {
@@ -46,9 +44,9 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab);
                f3.setArguments(b3);
 
-               t1.setTabListener(new AddEventTabListener(f1));
-               t2.setTabListener(new AddEventTabListener(f2));
-               t3.setTabListener(new AddEventTabListener(f3));
+               t1.setTabListener(new AddEventTabListener(f1,tempEvent,0));
+               t2.setTabListener(new AddEventTabListener(f2,tempEvent,1));
+               t3.setTabListener(new AddEventTabListener(f3,tempEvent,2));
 
                actionBar.addTab(t1);
                actionBar.addTab(t2);
@@ -69,29 +67,16 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                                finish();
                                return true;
             case R.id.save:
-                Event e = getEvent(this);
+                //TODO Save event
+                Toast toast = Toast.makeText(getApplicationContext(),"Event saved!",Toast.LENGTH_LONG);
+                toast.show();
+                finish();
                 return true;
                        default:
                                return false;
                }
        }
 
-    private Event getEvent(final Activity v) {
-        //TODO get all information
-        final long _id=23;//blatul olimpic
-        final String organizer="";
-        final String title="";
-        final String eventLocation="";
-        final String description="";
-        final int eventColor=0;
-        final long dtstart=0;
-        final long dtend=0;
-        final long calendarID = 0;
-        System.out.print(title + description);
-        Event ret = new Event(_id,organizer,title,eventLocation,description,eventColor,dtstart,dtend,calendarID);
-        return ret;
-    }
-
     public void showDateTimePickerDialog(final View v) {
                dateTimeTextView=(TextView) v;
                if(v.getId()==R.id.date_start || v.getId()==R.id.date_end || v.getId() == R.id.repeat_until)
index ea67b63f4c7dbf62967a75331e0cd1fd5c873beb..b38779cfd138babeff7db32598e0f491ab913bb0 100644 (file)
@@ -7,9 +7,13 @@ import android.app.FragmentTransaction;
 
 public class AddEventTabListener implements ActionBar.TabListener {
        public Fragment fragment;
+    private Event ev;
+    int tabId;
 
-       public AddEventTabListener(final Fragment fragment) {
+       public AddEventTabListener(final Fragment fragment,Event e,int tabId) {
                this.fragment = fragment;
+        this.ev = e;
+        this.tabId=tabId;
        }
 
        @Override
@@ -19,6 +23,16 @@ public class AddEventTabListener implements ActionBar.TabListener {
 
        @Override
        public void onTabUnselected(final Tab tab, final FragmentTransaction ft) {
+        switch (tabId) {
+            case 0:
+                ev.title=fragment.getView().findViewById(R.id.eventtitle).toString();
+                break;
+            case 1:
+                ev.description=fragment.getView().findViewById(R.id.description).toString();
+                break;
+            case 2:
+                break;
+        }
                ft.remove(fragment);
        }
 
index 748d42efe2eb9bfd3345f26b22796dc893c98b0a..88398389c9eef3ad626446fba8d51cf7763b7547 100644 (file)
@@ -55,6 +55,8 @@ final class Event implements Parcelable{
        /** Calendar ID */
        public long calendarID;
 
+    public  Event() {}
+
        public Event(final long _id, final String organizer, final String title, final String eventLocation, final String description, final int eventColor, final long dtstart, final long dtend, final long calendarID) {
                this._id=_id;
                this.organizer=organizer;
This page took 0.03269 seconds and 4 git commands to generate.