]> iEval git - unical.git/commitdiff
Edit event. Fragment no longer takes arguments in constructor
authorPetru <l3asketballplayer@yahoo.com>
Tue, 13 Aug 2013 12:16:35 +0000 (15:16 +0300)
committerPetru <l3asketballplayer@yahoo.com>
Tue, 13 Aug 2013 12:16:35 +0000 (15:16 +0300)
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/TrivialFragment.java

index 0bc8691e8e33a1f08ac1f8fb5643bcaf60f2ac9d..beeab941c28ba20124827876ae0df1a37d7974d8 100644 (file)
@@ -16,6 +16,8 @@ import android.view.MenuItem;
 import android.view.View;
 import android.widget.*;
 
+//TODO if i want to add a new event after i edit one the fields are being filled with the last event data
+
 public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
        private TextView dateTimeTextView;
     private static Event tempEvent=new Event();
@@ -40,19 +42,22 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2));
                final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3));
 
-               f1 = new TrivialFragment(tempEvent);
+               f1 = new TrivialFragment();
                final Bundle b1=new Bundle();
                b1.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_basic_tab);
+        b1.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
                f1.setArguments(b1);
 
-               f2 = new TrivialFragment(tempEvent);
+               f2 = new TrivialFragment();
                final Bundle b2=new Bundle();
                b2.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_details_tab);
+        b2.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
                f2.setArguments(b2);
 
-               f3 = new TrivialFragment(tempEvent);
+               f3 = new TrivialFragment();
                final Bundle b3=new Bundle();
                b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab);
+        b3.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
                f3.setArguments(b3);
 
                t1.setTabListener(new AddEventTabListener(f1,tempEvent,0));
index 54c9731d675ae6de5d3cc3b4de845829b7c5523e..30b13b64df7d46306f2b2a9e822d3bf21fb79acc 100644 (file)
@@ -14,13 +14,12 @@ import java.util.Date;
 
 public final class TrivialFragment extends Fragment {
     Event ev;
-    public TrivialFragment(Event e) {
-        ev=e;
-    }
+    public static final String ARGUMENT_EVENT= "Event";
 
     @Override
     public void onActivityCreated (Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        ev=getArguments().getParcelable(ARGUMENT_EVENT);
         switch (getArguments().getInt(ARGUMENT_LAYOUT)) {
             case R.layout.add_event_basic_tab:
                 EditText title = (EditText) getView().findViewById(R.id.eventtitle);
This page took 0.029532 seconds and 4 git commands to generate.