<EditText
android:id="@+id/repeat_time"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:ems="4"
- android:text="1"
- android:inputType="number" />
+ android:inputType="number"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
<Spinner
android:id="@+id/repeat_spinner"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:visibility="gone"
- />
-
+ android:visibility="gone" />
+ <TextView
+ style="@android:style/Widget.DeviceDefault.EditText"
+ android:id="@+id/repeat_until"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:onClick="showDateTimePickerDialog"
+ android:ems="8"
+ android:visibility="gone" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
public void showDateTimePickerDialog(final View v) {
dateTimeTextView=(TextView) v;
- if(v.getId()==R.id.date_start || v.getId()==R.id.date_end)
+ if(v.getId()==R.id.date_start || v.getId()==R.id.date_end || v.getId() == R.id.repeat_until)
new DatePickerFragment().show(getFragmentManager(), "datePicker");
else
new TimePickerFragment().show(getFragmentManager(), "timePicker");
public final class TrivialFragment extends Fragment {
private static class OnItemSelectedListener implements android.widget.AdapterView.OnItemSelectedListener{
private final View repeatCount;
- public OnItemSelectedListener(final View repeatCount) {
+ private final View repeatUntil;
+
+ public OnItemSelectedListener(final View repeatCount, final View repeatUntil) {
this.repeatCount=repeatCount;
+ this.repeatUntil=repeatUntil;
}
@Override
switch(pos){
case 0:
repeatCount.setVisibility(View.GONE);
+ repeatUntil.setVisibility(View.GONE);
break;
case 1:
repeatCount.setVisibility(View.GONE);
+ repeatUntil.setVisibility(View.VISIBLE);
break;
case 2:
repeatCount.setVisibility(View.VISIBLE);
+ repeatUntil.setVisibility(View.GONE);
break;
default:
}
if(isChecked) {
Utils.setEnabledRecursively(layout, true);
final Spinner repeatType = (Spinner) root.findViewById(R.id.repeat_type);
- repeatType.setOnItemSelectedListener(new OnItemSelectedListener(root.findViewById(R.id.repeat_count)));
+ repeatType.setOnItemSelectedListener(new OnItemSelectedListener(root.findViewById(R.id.repeat_count),root.findViewById(R.id.repeat_until)));
}else {
Utils.setEnabledRecursively(layout, false);
}