X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=src%2Fro%2Fieval%2Funical%2FAddEventTabListener.java;h=aa9c763a1ec370dd30a942255572fbef2de705c0;hb=2a92dcf2c86b48dead81da28ca9a1aaa77e09190;hp=b38779cfd138babeff7db32598e0f491ab913bb0;hpb=c32befcc9dc90ca41784cd234ae3b9ba695cb640;p=unical.git diff --git a/src/ro/ieval/unical/AddEventTabListener.java b/src/ro/ieval/unical/AddEventTabListener.java index b38779c..aa9c763 100644 --- a/src/ro/ieval/unical/AddEventTabListener.java +++ b/src/ro/ieval/unical/AddEventTabListener.java @@ -4,6 +4,12 @@ import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.Fragment; import android.app.FragmentTransaction; +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; @@ -19,6 +25,13 @@ public class AddEventTabListener implements ActionBar.TabListener { @Override public void onTabSelected(final Tab tab, final FragmentTransaction ft) { ft.replace(R.id.fragment_container, fragment); + switch (tabId) { + case 0: + if(fragment.getView()==null) System.err.println("MuieLaComisie"); + //EditText title =(EditText) fragment.getView().findViewById(R.id.eventtitle); + // title.setText(ev.title, TextView.BufferType.EDITABLE); + break; + } } @Override @@ -26,6 +39,19 @@ public class AddEventTabListener implements ActionBar.TabListener { 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(); + 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. + } + break; case 1: ev.description=fragment.getView().findViewById(R.id.description).toString();