Edit event. Time now shows propperly
[unical.git] / src / ro / ieval / unical / AddEventTabListener.java
index 364ce555738febbc01cac16e0228df7f1ba448be..9238d4c03a4679156a36162e9288d42c0f34ee0f 100644 (file)
@@ -4,15 +4,19 @@ import android.app.ActionBar;
 import android.app.ActionBar.Tab;
 import android.app.Fragment;
 import android.app.FragmentTransaction;
+import android.util.Log;
+import android.widget.EditText;
+import android.widget.TextView;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
 public class AddEventTabListener implements ActionBar.TabListener {
-       public Fragment fragment;
+       private Fragment fragment;
     private Event ev;
-    int tabId;
+       private boolean isAdded = false;
+    private int tabId;
 
        public AddEventTabListener(final Fragment fragment,Event e,int tabId) {
                this.fragment = fragment;
@@ -22,25 +26,25 @@ public class AddEventTabListener implements ActionBar.TabListener {
 
        @Override
        public void onTabSelected(final Tab tab, final FragmentTransaction ft) {
-               ft.replace(R.id.fragment_container, fragment);
+               ft.replace(android.R.id.content, fragment, null);
        }
 
        @Override
        public void onTabUnselected(final Tab tab, final FragmentTransaction ft) {
         switch (tabId) {
             case 0:
-                ev.title=fragment.getView().findViewById(R.id.eventtitle).toString();
-                String start=fragment.getView().findViewById(R.id.date_start).toString()+ " " +
-                             fragment.getView().findViewById(R.id.time_start).toString();
-                String end=fragment.getView().findViewById(R.id.date_end).toString()+ " " +
-                             fragment.getView().findViewById(R.id.time_end).toString();
+                ev.title=((TextView)fragment.getView().findViewById(R.id.eventtitle)).getText().toString();
+                String start=((TextView)fragment.getView().findViewById(R.id.date_start)).getText()+ " " +
+                                       ((TextView)fragment.getView().findViewById(R.id.time_start)).getText();
+                               String end=((TextView)fragment.getView().findViewById(R.id.date_end)).getText()+ " " +
+                                       ((TextView)fragment.getView().findViewById(R.id.time_end)).getText();
                 try {
                     Date s=new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(start);
                     Date e=new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(end);
                     ev.dtstart=s.getTime();
                     ev.dtend=s.getTime();
                 } catch (ParseException e) {
-                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+                    e.printStackTrace();
                 }
 
                 break;
@@ -50,12 +54,10 @@ public class AddEventTabListener implements ActionBar.TabListener {
             case 2:
                 break;
         }
-               ft.remove(fragment);
        }
 
        @Override
        public void onTabReselected(final Tab tab, final FragmentTransaction ft) {
-               // TODO Auto-generated method stub
-
+               // do nothing
        }
 }
This page took 0.010436 seconds and 4 git commands to generate.