]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.unical; | |
2 | ||
3 | import android.app.Fragment; | |
4 | import android.os.Bundle; | |
5 | import android.text.InputType; | |
6 | import android.view.LayoutInflater; | |
7 | import android.view.View; | |
8 | import android.view.ViewGroup; | |
9 | import android.widget.AdapterView; | |
10 | import android.widget.AdapterView.OnItemSelectedListener; | |
11 | import android.widget.CompoundButton; | |
12 | import android.widget.EditText; | |
13 | import android.widget.LinearLayout; | |
14 | import android.widget.Spinner; | |
15 | import android.widget.Switch; | |
16 | import android.widget.CompoundButton.OnCheckedChangeListener; | |
17 | ||
18 | public final class TrivialFragment extends Fragment { | |
19 | public static final String ARGUMENT_LAYOUT="layout"; | |
20 | ||
21 | @Override | |
22 | public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { | |
23 | ||
24 | final View view=inflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT), container, false); | |
25 | final LinearLayout ll = (LinearLayout) view.findViewById(R.id.repeat_layout); | |
26 | ||
27 | if(ll != null){ | |
28 | final Switch repeatSwitch = (Switch) view.findViewById(R.id.repeat_switch); | |
29 | Utils.setEnabledRecursively(ll, false); | |
30 | ||
31 | repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { | |
32 | @Override | |
33 | public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { | |
34 | if(isChecked) { | |
35 | Utils.setEnabledRecursively(ll, true); | |
36 | Spinner repeatType = (Spinner) view.findViewById(R.id.repeat_type); | |
37 | final EditText repeatCount = (EditText) view.findViewById(R.id.repeat_count); | |
38 | ||
39 | repeatType.setOnItemSelectedListener(new OnItemSelectedListener() { | |
40 | ||
41 | @Override | |
42 | public void onItemSelected(AdapterView<?> arg0, | |
43 | View arg1, int arg2, long arg3) { | |
44 | if(arg2==1) { | |
45 | //TODO adauga un date picker | |
46 | //TODO sterge repeatCount | |
47 | repeatCount.setVisibility(EditText.GONE); | |
48 | }else if(arg2==2) { | |
49 | repeatCount.setVisibility(EditText.VISIBLE); | |
50 | }else { | |
51 | //TODO sterge repeatCount | |
52 | repeatCount.setVisibility(EditText.GONE); | |
53 | } | |
54 | ||
55 | } | |
56 | ||
57 | @Override | |
58 | public void onNothingSelected(AdapterView<?> arg0) { | |
59 | ||
60 | } | |
61 | }); | |
62 | }else { | |
63 | Utils.setEnabledRecursively(ll, false); | |
64 | } | |
65 | } | |
66 | }); | |
67 | } | |
68 | return view; | |
69 | } | |
70 | } |