1 package ro
.ieval
.unical
;
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
;
18 public final class TrivialFragment
extends Fragment
{
19 public static final String ARGUMENT_LAYOUT
="layout";
22 public View
onCreateView(final LayoutInflater inflater
, final ViewGroup container
, final Bundle savedInstanceState
) {
24 final View view
=inflater
.inflate(getArguments().getInt(ARGUMENT_LAYOUT
), container
, false);
25 final LinearLayout ll
= (LinearLayout
) view
.findViewById(R
.id
.repeat_layout
);
28 final Switch repeatSwitch
= (Switch
) view
.findViewById(R
.id
.repeat_switch
);
29 Utils
.setEnabledRecursively(ll
, false);
31 repeatSwitch
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
33 public void onCheckedChanged(final CompoundButton buttonView
, final boolean 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
);
39 repeatType
.setOnItemSelectedListener(new OnItemSelectedListener() {
42 public void onItemSelected(AdapterView
<?
> arg0
,
43 View arg1
, int arg2
, long arg3
) {
45 //TODO adauga un date picker
46 //TODO sterge repeatCount
47 repeatCount
.setVisibility(EditText
.GONE
);
49 repeatCount
.setVisibility(EditText
.VISIBLE
);
51 //TODO sterge repeatCount
52 repeatCount
.setVisibility(EditText
.GONE
);
58 public void onNothingSelected(AdapterView
<?
> arg0
) {
63 Utils
.setEnabledRecursively(ll
, false);