]> iEval git - unical.git/commitdiff
Finish second-to-last commit
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 12 Jun 2013 16:39:56 +0000 (19:39 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 12 Jun 2013 16:39:56 +0000 (19:39 +0300)
src/ro/ieval/unical/AddEventActivity.java
src/ro/ieval/unical/TrivialFragment.java

index 606685fbd2eae228b715e1b3ac54b6ca8c113a9d..59ddd5bf311a9247cb2c00cfa201f33a5edca19e 100644 (file)
@@ -6,18 +6,13 @@ import android.app.ActionBar;
 import android.app.Activity;
 import android.app.DatePickerDialog.OnDateSetListener;
 import android.app.Fragment;
-import android.app.FragmentManager;
 import android.app.TimePickerDialog.OnTimeSetListener;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
-import android.widget.CompoundButton;
-import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.DatePicker;
-import android.widget.Spinner;
-import android.widget.Switch;
 import android.widget.TextView;
 import android.widget.TimePicker;
 
@@ -57,25 +52,6 @@ public final class AddEventActivity extends Activity implements OnDateSetListene
                actionBar.addTab(t1);
                actionBar.addTab(t2);
                actionBar.addTab(t3);
-
-               handleViews(f1,f2,f3);
-
-       }
-
-       private void handleViews(Fragment f1,Fragment f2,Fragment f3) {
-               Switch repeatSwitch = (Switch) this.getFragmentManager().findFragmentById(f1.getId()).getView().findViewById(R.id.repeat_switch);
-               final Spinner repeatSpinner = (Spinner) this.getFragmentManager().findFragmentById(f1.getId()).getView().findViewById(R.id.repeat_spinner);
-               repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-
-                       @Override
-                       public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                               if(isChecked) {
-                                       repeatSpinner.setEnabled(true);
-                               }else {
-                                       repeatSpinner.setEnabled(false);
-                               }
-                       }
-               });
        }
 
        @Override
index 4c474e61730982882e42a28da73917d9877958e5..0932a4a727843e26076b2e45f5bf62a6d1467cb2 100644 (file)
@@ -5,12 +5,31 @@ import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.CompoundButton;
+import android.widget.Spinner;
+import android.widget.Switch;
+import android.widget.CompoundButton.OnCheckedChangeListener;
 
 public final class TrivialFragment extends Fragment {
        public static final String ARGUMENT_LAYOUT="layout";
 
        @Override
     public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
-        return inflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT), container, false);
-    }
+               final View view=inflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT), container, false);
+               final Switch repeatSwitch = (Switch) view.findViewById(R.id.repeat_switch);
+               if(repeatSwitch != null){
+                       final Spinner repeatSpinner = (Spinner) view.findViewById(R.id.repeat_spinner);
+                       repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+                               @Override
+                               public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
+                                       if(isChecked) {
+                                               repeatSpinner.setEnabled(true);
+                                       }else {
+                                               repeatSpinner.setEnabled(false);
+                                       }
+                               }
+                       });
+               }
+               return view;
+       }
 }
This page took 0.01904 seconds and 4 git commands to generate.