</LinearLayout>
- <Spinner
- android:id="@+id/repeat_spinner"
- android:entries="@array/repeat_array"
- android:layout_width="match_parent"
+ <LinearLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:id="@+id/repeat_layout"
+ android:orientation="vertical" >
+
+ <Spinner
+ android:id="@+id/repeat_spinner"
+ android:entries="@array/repeat_array"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
/>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/repeat_every"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <EditText
- android:id="@+id/editText1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:ems="10"
- android:inputType="number" />
-
- <TextView
- android:id="@+id/textView2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Medium Text"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <Spinner
- android:id="@+id/repeat_type"
- android:entries="@array/repeat_type_array"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1" />
-
- </LinearLayout>
-
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/repeat_every"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <EditText
+ android:id="@+id/editText1"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:ems="10"
+ android:inputType="number" />
+
+ <TextView
+ android:id="@+id/textView2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Medium Text"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <Spinner
+ android:id="@+id/repeat_type"
+ android:entries="@array/repeat_type_array"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+
+ </LinearLayout>
+ </LinearLayout>
</LinearLayout>
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
+import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.CompoundButton.OnCheckedChangeListener;
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
+
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);
+ final LinearLayout ll = (LinearLayout) view.findViewById(R.id.repeat_layout);
+
+ if(ll != null){
+ final Switch repeatSwitch = (Switch) view.findViewById(R.id.repeat_switch);
+ Utils.setEnabledRecursively(ll, false);
+
repeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if(isChecked) {
- repeatSpinner.setEnabled(true);
+ Utils.setEnabledRecursively(ll, true);
}else {
- repeatSpinner.setEnabled(false);
+ Utils.setEnabledRecursively(ll, false);
}
}
});