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" >
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left" >
<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:id="@+id/repeat_time"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:ems="10"
+ android:ems="4"
+ android:text="1"
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" />
+ <Spinner
+ android:id="@+id/repeat_spinner"
+ android:entries="@array/repeat_array_p"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
</LinearLayout>
<LinearLayout
- android:layout_width="match_parent"
+ android:id="@+id/repeat_count_layout"
+ android:layout_gravity="left"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Spinner
<string name="end_label">End: </string>
<string name="repeat">Repeat</string>
<string name="repeat_every">Repeat every</string>
+ <string name="day">day</string>
+ <string name="days">days</string>
+ <string name="week">week</string>
+ <string name="weeks">weeks</string>
+ <string name="month">month</string>
+ <string name="months">months</string>
+ <string name="year">year</string>
+ <string name="years">years</string>
- <string-array name="repeat_array">
- <item>Daily</item>
- <item>Weekly</item>
- <item>Monthly</item>
- <item>Yearly</item>
+ <string-array name="repeat_array_s">
+ <item>Day</item>
+ <item>Week</item>
+ <item>Month</item>
+ <item>Year</item>
+ </string-array>
+ <string-array name="repeat_array_p">
+ <item>Days</item>
+ <item>Weeks</item>
+ <item>Months</item>
+ <item>Years</item>
</string-array>
<string-array name="repeat_type_array">
<item>Forever</item>
import android.app.Fragment;
import android.os.Bundle;
+import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.CompoundButton;
+import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.Switch;
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if(isChecked) {
Utils.setEnabledRecursively(ll, true);
+ Spinner repeatType = (Spinner) view.findViewById(R.id.repeat_type);
+ final EditText repeatCount = new EditText(getActivity());
+ repeatCount.setInputType(InputType.TYPE_CLASS_NUMBER);
+ final LinearLayout repeatLayout = (LinearLayout) view.findViewById(R.id.repeat_count_layout);
+
+ repeatType.setOnItemSelectedListener(new OnItemSelectedListener() {
+
+ @Override
+ public void onItemSelected(AdapterView<?> arg0,
+ View arg1, int arg2, long arg3) {
+ if(arg2==1) {
+ //TODO adauga un date picker
+ //TODO sterge repeatCount
+ }else if(arg2==2) {
+ repeatLayout.addView(repeatCount);
+ }else {
+ //TODO sterge repeatCount
+ }
+
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> arg0) {
+
+ }
+ });
}else {
Utils.setEnabledRecursively(ll, false);
}