On switch change the views in the repeat layout change
[unical.git] / src / ro / ieval / unical / TrivialFragment.java
1 package ro.ieval.unical;
2
3 import android.app.Fragment;
4 import android.os.Bundle;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.ViewGroup;
8 import android.widget.CompoundButton;
9 import android.widget.LinearLayout;
10 import android.widget.Spinner;
11 import android.widget.Switch;
12 import android.widget.CompoundButton.OnCheckedChangeListener;
13
14 public final class TrivialFragment extends Fragment {
15 public static final String ARGUMENT_LAYOUT="layout";
16
17 @Override
18 public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
19
20 final View view=inflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT), container, false);
21 final LinearLayout ll = (LinearLayout) view.findViewById(R.id.repeat_layout);
22
23 if(ll != null){
24 final Switch repeatSwitch = (Switch) view.findViewById(R.id.repeat_switch);
25 Utils.setEnabledRecursively(ll, false);
26
27 repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
28 @Override
29 public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
30 if(isChecked) {
31 Utils.setEnabledRecursively(ll, true);
32 }else {
33 Utils.setEnabledRecursively(ll, false);
34 }
35 }
36 });
37 }
38 return view;
39 }
40 }
This page took 0.021109 seconds and 4 git commands to generate.