diff options
90 files changed, 671 insertions, 371 deletions
@@ -1,3 +1,5 @@ bin/ gen/ .project +res/.DS_Store +res/drawable-hdpi/.DS_Store diff --git a/res/color/recurrence_bubble_text_color.xml b/res/color/recurrence_bubble_text_color.xml new file mode 100644 index 00000000..8e2e29b1 --- /dev/null +++ b/res/color/recurrence_bubble_text_color.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="true" + android:color="@android:color/white" /> + <item android:state_enabled="false" + android:color="@color/done_text_color_disabled"/> + <item + android:color="@color/recurrence_bubble_text_normal"/> +</selector> diff --git a/res/color/recurrence_spinner_text_color.xml b/res/color/recurrence_spinner_text_color.xml new file mode 100644 index 00000000..e2324e43 --- /dev/null +++ b/res/color/recurrence_spinner_text_color.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_enabled="false" + android:color="@color/done_text_color_disabled"/> + <item + android:color="@android:color/black"/> +</selector> diff --git a/res/drawable-hdpi/ic_menu_today_no_date_holo_light.png b/res/drawable-hdpi/ic_menu_today_no_date_holo_light.png Binary files differindex a8cefee1..a22339a2 100644 --- a/res/drawable-hdpi/ic_menu_today_no_date_holo_light.png +++ b/res/drawable-hdpi/ic_menu_today_no_date_holo_light.png diff --git a/res/drawable-hdpi/ic_menu_today_no_date_holo_light_disabled.png b/res/drawable-hdpi/ic_menu_today_no_date_holo_light_disabled.png Binary files differnew file mode 100644 index 00000000..da1f684a --- /dev/null +++ b/res/drawable-hdpi/ic_menu_today_no_date_holo_light_disabled.png diff --git a/res/drawable-hdpi/ic_recurrence_bubble_disabled.png b/res/drawable-hdpi/ic_recurrence_bubble_disabled.png Binary files differnew file mode 100644 index 00000000..f2ebf799 --- /dev/null +++ b/res/drawable-hdpi/ic_recurrence_bubble_disabled.png diff --git a/res/drawable-hdpi/ic_recurrence_bubble_outline.png b/res/drawable-hdpi/ic_recurrence_bubble_outline.png Binary files differindex 1e6888f8..ea7f06e6 100644 --- a/res/drawable-hdpi/ic_recurrence_bubble_outline.png +++ b/res/drawable-hdpi/ic_recurrence_bubble_outline.png diff --git a/res/drawable-hdpi/ic_recurrence_bubble_outline_disabled.png b/res/drawable-hdpi/ic_recurrence_bubble_outline_disabled.png Binary files differnew file mode 100644 index 00000000..bf8ccf87 --- /dev/null +++ b/res/drawable-hdpi/ic_recurrence_bubble_outline_disabled.png diff --git a/res/drawable-hdpi/switch_thumb_activated_holo_light.9.png b/res/drawable-hdpi/switch_thumb_activated_holo_light.9.png Binary files differnew file mode 100644 index 00000000..9c5147ef --- /dev/null +++ b/res/drawable-hdpi/switch_thumb_activated_holo_light.9.png diff --git a/res/drawable-hdpi/switch_thumb_disabled_holo_light.9.png b/res/drawable-hdpi/switch_thumb_disabled_holo_light.9.png Binary files differnew file mode 100644 index 00000000..a257e26d --- /dev/null +++ b/res/drawable-hdpi/switch_thumb_disabled_holo_light.9.png diff --git a/res/drawable-hdpi/switch_thumb_holo_light_v2.9.png b/res/drawable-hdpi/switch_thumb_holo_light_v2.9.png Binary files differnew file mode 100644 index 00000000..9b16618c --- /dev/null +++ b/res/drawable-hdpi/switch_thumb_holo_light_v2.9.png diff --git a/res/drawable-hdpi/switch_thumb_pressed_holo_light.9.png b/res/drawable-hdpi/switch_thumb_pressed_holo_light.9.png Binary files differnew file mode 100644 index 00000000..ea54380f --- /dev/null +++ b/res/drawable-hdpi/switch_thumb_pressed_holo_light.9.png diff --git a/res/drawable-mdpi/ic_menu_today_no_date_holo_light.png b/res/drawable-mdpi/ic_menu_today_no_date_holo_light.png Binary files differindex af04eb88..ff6cd8a8 100644 --- a/res/drawable-mdpi/ic_menu_today_no_date_holo_light.png +++ b/res/drawable-mdpi/ic_menu_today_no_date_holo_light.png diff --git a/res/drawable-mdpi/ic_menu_today_no_date_holo_light_disabled.png b/res/drawable-mdpi/ic_menu_today_no_date_holo_light_disabled.png Binary files differnew file mode 100644 index 00000000..bd5e272c --- /dev/null +++ b/res/drawable-mdpi/ic_menu_today_no_date_holo_light_disabled.png diff --git a/res/drawable-mdpi/ic_recurrence_bubble_disabled.png b/res/drawable-mdpi/ic_recurrence_bubble_disabled.png Binary files differnew file mode 100644 index 00000000..ed942da9 --- /dev/null +++ b/res/drawable-mdpi/ic_recurrence_bubble_disabled.png diff --git a/res/drawable-mdpi/ic_recurrence_bubble_outline.png b/res/drawable-mdpi/ic_recurrence_bubble_outline.png Binary files differindex ad59b79e..8fe185d3 100644 --- a/res/drawable-mdpi/ic_recurrence_bubble_outline.png +++ b/res/drawable-mdpi/ic_recurrence_bubble_outline.png diff --git a/res/drawable-mdpi/ic_recurrence_bubble_outline_disabled.png b/res/drawable-mdpi/ic_recurrence_bubble_outline_disabled.png Binary files differnew file mode 100644 index 00000000..a4b8cf98 --- /dev/null +++ b/res/drawable-mdpi/ic_recurrence_bubble_outline_disabled.png diff --git a/res/drawable-mdpi/switch_thumb_activated_holo_light.9.png b/res/drawable-mdpi/switch_thumb_activated_holo_light.9.png Binary files differnew file mode 100644 index 00000000..3d7c236a --- /dev/null +++ b/res/drawable-mdpi/switch_thumb_activated_holo_light.9.png diff --git a/res/drawable-mdpi/switch_thumb_disabled_holo_light.9.png b/res/drawable-mdpi/switch_thumb_disabled_holo_light.9.png Binary files differnew file mode 100644 index 00000000..82f05d62 --- /dev/null +++ b/res/drawable-mdpi/switch_thumb_disabled_holo_light.9.png diff --git a/res/drawable-mdpi/switch_thumb_holo_light_v2.9.png b/res/drawable-mdpi/switch_thumb_holo_light_v2.9.png Binary files differnew file mode 100644 index 00000000..b3cee3f7 --- /dev/null +++ b/res/drawable-mdpi/switch_thumb_holo_light_v2.9.png diff --git a/res/drawable-mdpi/switch_thumb_pressed_holo_light.9.png b/res/drawable-mdpi/switch_thumb_pressed_holo_light.9.png Binary files differnew file mode 100644 index 00000000..670dc2e9 --- /dev/null +++ b/res/drawable-mdpi/switch_thumb_pressed_holo_light.9.png diff --git a/res/drawable-xhdpi/ic_menu_today_no_date_holo_light.png b/res/drawable-xhdpi/ic_menu_today_no_date_holo_light.png Binary files differindex aeaec2fc..0c99b7b1 100644 --- a/res/drawable-xhdpi/ic_menu_today_no_date_holo_light.png +++ b/res/drawable-xhdpi/ic_menu_today_no_date_holo_light.png diff --git a/res/drawable-xhdpi/ic_menu_today_no_date_holo_light_disabled.png b/res/drawable-xhdpi/ic_menu_today_no_date_holo_light_disabled.png Binary files differnew file mode 100644 index 00000000..9776e106 --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_today_no_date_holo_light_disabled.png diff --git a/res/drawable-xhdpi/ic_recurrence_bubble_disabled.png b/res/drawable-xhdpi/ic_recurrence_bubble_disabled.png Binary files differnew file mode 100644 index 00000000..98f27557 --- /dev/null +++ b/res/drawable-xhdpi/ic_recurrence_bubble_disabled.png diff --git a/res/drawable-xhdpi/ic_recurrence_bubble_outline.png b/res/drawable-xhdpi/ic_recurrence_bubble_outline.png Binary files differindex 50bae6b7..1a45cd4d 100644 --- a/res/drawable-xhdpi/ic_recurrence_bubble_outline.png +++ b/res/drawable-xhdpi/ic_recurrence_bubble_outline.png diff --git a/res/drawable-xhdpi/ic_recurrence_bubble_outline_disabled.png b/res/drawable-xhdpi/ic_recurrence_bubble_outline_disabled.png Binary files differnew file mode 100644 index 00000000..e3a927ea --- /dev/null +++ b/res/drawable-xhdpi/ic_recurrence_bubble_outline_disabled.png diff --git a/res/drawable-xhdpi/switch_thumb_activated_holo_light.9.png b/res/drawable-xhdpi/switch_thumb_activated_holo_light.9.png Binary files differnew file mode 100644 index 00000000..ca48bd86 --- /dev/null +++ b/res/drawable-xhdpi/switch_thumb_activated_holo_light.9.png diff --git a/res/drawable-xhdpi/switch_thumb_disabled_holo_light.9.png b/res/drawable-xhdpi/switch_thumb_disabled_holo_light.9.png Binary files differnew file mode 100644 index 00000000..c3d80f0e --- /dev/null +++ b/res/drawable-xhdpi/switch_thumb_disabled_holo_light.9.png diff --git a/res/drawable-xhdpi/switch_thumb_holo_light_v2.9.png b/res/drawable-xhdpi/switch_thumb_holo_light_v2.9.png Binary files differnew file mode 100644 index 00000000..39592ac8 --- /dev/null +++ b/res/drawable-xhdpi/switch_thumb_holo_light_v2.9.png diff --git a/res/drawable-xhdpi/switch_thumb_pressed_holo_light.9.png b/res/drawable-xhdpi/switch_thumb_pressed_holo_light.9.png Binary files differnew file mode 100644 index 00000000..4acb32b1 --- /dev/null +++ b/res/drawable-xhdpi/switch_thumb_pressed_holo_light.9.png diff --git a/res/drawable/ic_launch_date_picker.xml b/res/drawable/ic_launch_date_picker.xml new file mode 100644 index 00000000..4c819ac4 --- /dev/null +++ b/res/drawable/ic_launch_date_picker.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_enabled="false" + android:drawable="@drawable/ic_menu_today_no_date_holo_light_disabled" /> + <item + android:drawable="@drawable/ic_menu_today_no_date_holo_light"/> +</selector> diff --git a/res/drawable/recurrence_bubble_fill.xml b/res/drawable/recurrence_bubble_fill.xml index 8b3be335..a3ab8862 100644 --- a/res/drawable/recurrence_bubble_fill.xml +++ b/res/drawable/recurrence_bubble_fill.xml @@ -17,6 +17,10 @@ --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_enabled="false" android:state_checked="false" + android:drawable="@drawable/ic_recurrence_bubble_outline_disabled" /> + <item android:state_enabled="false" android:state_checked="true" + android:drawable="@drawable/ic_recurrence_bubble_disabled" /> <item android:state_pressed="true" android:state_window_focused="true" android:drawable="@drawable/ic_recurrence_bubble_fill"/> <item android:state_checked="true" diff --git a/res/drawable/switch_thumb.xml b/res/drawable/switch_thumb.xml new file mode 100644 index 00000000..5c425e53 --- /dev/null +++ b/res/drawable/switch_thumb.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:drawable="@drawable/switch_thumb_disabled_holo_light" android:state_enabled="false"/> + <item android:drawable="@drawable/switch_thumb_pressed_holo_light" android:state_pressed="true"/> + <item android:drawable="@drawable/switch_thumb_activated_holo_light" android:state_checked="true"/> + <item android:drawable="@drawable/switch_thumb_holo_light_v2"/> + +</selector>
\ No newline at end of file diff --git a/res/layout/recurrencepicker.xml b/res/layout/recurrencepicker.xml index 63889963..ee022eb9 100644 --- a/res/layout/recurrencepicker.xml +++ b/res/layout/recurrencepicker.xml @@ -14,26 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. --> - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="0dp" > - - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="60dp" - android:background="#ffffff" - android:gravity="center_vertical" - android:padding="12dp" - android:textColor="#33b5e5" - android:textSize="24sp" /> - - <!-- Grabbing focus to prevent interval from gaining focus at launch --> + android:layout_width="wrap_content" + android:layout_height="wrap_content" > + <!-- This outer linear layout protects the fixed dimensions of the dialog. + The dimensions are not respected if this outer layout is not present. --> <LinearLayout android:layout_width="@dimen/recurrence_picker_width" android:layout_height="@dimen/recurrence_picker_height" @@ -49,34 +36,47 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="12dp" android:descendantFocusability="beforeDescendants" android:focusable="true" android:focusableInTouchMode="true" android:orientation="vertical" > - <Spinner - android:id="@+id/freqSpinner" - style="@style/TextAppearance.RecurrencePickerStyle" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginBottom="4dp" - android:layout_marginLeft="-4dp" - android:layout_marginRight="-4dp" - android:layout_marginTop="-4dp" - android:entries="@array/recurrence_freq" - android:gravity="left" - android:padding="0dp" /> + android:background="@color/white" + android:paddingLeft="12dip" + android:paddingTop="12dip" + android:paddingRight="12dip" + android:paddingBottom="4dip"> + + <Spinner + android:id="@+id/freqSpinner" + style="@style/TextAppearance.RecurrencePickerStyle" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:entries="@array/recurrence_freq" + android:gravity="left" + android:padding="0dp" /> + + <Switch + android:id="@+id/repeat_switch" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:thumb="@drawable/switch_thumb" + android:layout_marginLeft="4dp" /> + </LinearLayout> <LinearLayout android:id="@+id/options" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/white" android:measureAllChildren="true" android:orientation="vertical" - android:paddingBottom="12dp" + android:paddingBottom="4dp" android:paddingLeft="12dp" android:paddingRight="12dp" android:paddingTop="4dp" > @@ -85,7 +85,8 @@ android:id="@+id/intervalGroup" android:layout_width="match_parent" android:layout_height="wrap_content" - android:gravity="start" > + android:gravity="start" + android:paddingLeft="4dp" > <TextView android:id="@+id/intervalPreText" @@ -101,7 +102,10 @@ android:gravity="center_horizontal" android:inputType="number" android:maxLength="2" + android:paddingLeft="4dp" + android:paddingRight="4dp" android:selectAllOnFocus="true" + android:textSize="15sp" android:singleLine="true" > </EditText> @@ -122,26 +126,19 @@ android:gravity="center_horizontal" android:orientation="horizontal" > - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> </com.android.calendar.recurrencepicker.LinearLayoutWithMaxWidth> <com.android.calendar.recurrencepicker.LinearLayoutWithMaxWidth @@ -154,14 +151,11 @@ android:orientation="horizontal" android:visibility="gone" > - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> - <com.android.calendar.recurrencepicker.WeekButton - style="@style/RecurrenceDayOfWeekStyle" /> + <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" /> <com.android.calendar.recurrencepicker.WeekButton style="@style/RecurrenceDayOfWeekStyle" @@ -200,40 +194,55 @@ <Spinner android:id="@+id/endSpinner" style="@style/TextAppearance.RecurrencePickerStyle" - android:layout_width="0dp" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="-4dp" - android:layout_weight="1" + android:layout_marginRight="8dp" android:entries="@array/recurrence_freq" - android:gravity="left" + android:gravity="left|center_vertical" android:padding="0dp" /> <EditText android:id="@+id/endCount" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="-2dp" android:layout_gravity="center_vertical" + android:layout_marginBottom="-3dp" android:ems="3" - android:layout_marginLeft="8dp" android:gravity="center_horizontal" android:inputType="number" android:maxLength="3" android:selectAllOnFocus="true" + android:textSize="15sp" android:singleLine="true" /> - <ImageButton - android:id="@+id/endDate" + <TextView + android:id="@+id/postEndCount" + style="@style/TextAppearance.RecurrencePickerStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginLeft="8dp" - android:background="?android:attr/selectableItemBackground" - android:contentDescription= - "@string/acessibility_recurrence_choose_end_date_description" - android:padding="4dp" - android:src="@drawable/ic_menu_today_no_date_holo_light" + android:gravity="bottom" + android:layout_marginBottom="-3dp" + android:visibility="gone" /> + + <TextView + android:id="@+id/endDate" + style="@style/TextAppearance.EditEvent_SpinnerButton" + android:textSize="15sp" + android:textColor="@color/recurrence_spinner_text_color" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:contentDescription="@string/acessibility_recurrence_choose_end_date_description" + android:gravity="center_horizontal|bottom" + android:layout_marginTop="3dp" + android:layout_marginLeft="0dp" + android:layout_marginRight="0dp" + android:paddingLeft="12dp" + android:paddingRight="16dp" + android:paddingBottom="8dp" android:visibility="gone" /> </LinearLayout> </LinearLayout> @@ -258,7 +267,8 @@ style="?android:attr/buttonBarButtonStyle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/save_label" /> + android:text="@string/save_label" + android:textColor="@color/done_text_color" /> </LinearLayout> </LinearLayout> -</LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/res/layout/recurrencepicker_end_text.xml b/res/layout/recurrencepicker_end_text.xml new file mode 100644 index 00000000..09bb22a7 --- /dev/null +++ b/res/layout/recurrencepicker_end_text.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2013 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/spinner_item" + style="@style/TextAppearance.RecurrencePickerStyle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:paddingLeft="12dp" + android:paddingRight="12dp" + android:paddingTop="12dp" + android:paddingBottom="8dip" + android:singleLine="true" + android:ellipsize="end" /> diff --git a/res/layout/recurrencepicker_freq_item.xml b/res/layout/recurrencepicker_freq_item.xml index 1ef563c0..e7a23536 100644 --- a/res/layout/recurrencepicker_freq_item.xml +++ b/res/layout/recurrencepicker_freq_item.xml @@ -15,7 +15,10 @@ ~ limitations under the License --> <TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/spinner_item" style="@style/TextAppearance.RecurrencePickerStyle" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:padding="12dp" /> + android:padding="12dp" + android:ellipsize="end" + android:singleLine="true" /> diff --git a/res/values-af/arrays.xml b/res/values-af/arrays.xml index eef4e21f..f37d2dbd 100644 --- a/res/values-af/arrays.xml +++ b/res/values-af/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"As afgewys of nie gereageer nie"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EENMALIGE GELEENTHEID"</item> + <item msgid="5093122819962980394">"DAAGLIKS"</item> <item msgid="3061751350069329559">"WEEKLIKS"</item> <item msgid="7221838315296593556">"MAANDELIKS"</item> diff --git a/res/values-am/arrays.xml b/res/values-am/arrays.xml index e75d947b..5414e127 100644 --- a/res/values-am/arrays.xml +++ b/res/values-am/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"ተቀባይነት ካላገኘ ወይም ምላሽ ካልተሰጠበት"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"የአንድ ጊዜ ክስተት"</item> + <item msgid="5093122819962980394">"ዕለታዊ"</item> <item msgid="3061751350069329559">"ሳምንታዊ"</item> <item msgid="7221838315296593556">"ወርሃዊ"</item> diff --git a/res/values-ar/arrays.xml b/res/values-ar/arrays.xml index 49dcd709..a79574e7 100644 --- a/res/values-ar/arrays.xml +++ b/res/values-ar/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"في حالة الرفض أو عدم الرد"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"حدث لمرة واحدة"</item> + <item msgid="5093122819962980394">"يوميًا"</item> <item msgid="3061751350069329559">"أسبوعيًا"</item> <item msgid="7221838315296593556">"شهريًا"</item> diff --git a/res/values-be/arrays.xml b/res/values-be/arrays.xml index b102d437..92ebd5bc 100644 --- a/res/values-be/arrays.xml +++ b/res/values-be/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Калі адмоўлена або адказу няма"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"АДНАРАЗОВАЕ МЕРАПРЫЕМСТВА"</item> + <item msgid="5093122819962980394">"ШТОДЗЁННА"</item> <item msgid="3061751350069329559">"ШТОТЫДНЁВА"</item> <item msgid="7221838315296593556">"ШТОМЕСЯЧНА"</item> diff --git a/res/values-bg/arrays.xml b/res/values-bg/arrays.xml index 9f2bf84a..54e92dee 100644 --- a/res/values-bg/arrays.xml +++ b/res/values-bg/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"При отхвърляне или липса на отговор"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ЕДНОКРАТНО СЪБИТИЕ"</item> + <item msgid="5093122819962980394">"ЕЖЕДНЕВНО"</item> <item msgid="3061751350069329559">"ЕЖЕСЕДМИЧНО"</item> <item msgid="7221838315296593556">"ЕЖЕМЕСЕЧНО"</item> diff --git a/res/values-ca/arrays.xml b/res/values-ca/arrays.xml index 072f7f86..87ea97bf 100644 --- a/res/values-ca/arrays.xml +++ b/res/values-ca/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Si es rebutja o no es contesta"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ESDEVENIMENT ÚNIC"</item> + <item msgid="5093122819962980394">"DIÀRIAMENT"</item> <item msgid="3061751350069329559">"SETMANALMENT"</item> <item msgid="7221838315296593556">"MENSUALMENT"</item> diff --git a/res/values-cs/arrays.xml b/res/values-cs/arrays.xml index 8263d7c8..caa16240 100644 --- a/res/values-cs/arrays.xml +++ b/res/values-cs/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Při odmítnutí nebo bez odpovědi"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"JEDNORÁZOVÁ UDÁLOST"</item> + <item msgid="5093122819962980394">"DENNÍ"</item> <item msgid="3061751350069329559">"TÝDENNÍ"</item> <item msgid="7221838315296593556">"MĚSÍČNÍ"</item> diff --git a/res/values-da/arrays.xml b/res/values-da/arrays.xml index b68d3d0e..c9db3338 100644 --- a/res/values-da/arrays.xml +++ b/res/values-da/arrays.xml @@ -112,7 +112,6 @@ <item msgid="6367412240524984286">"Hvis afvist eller der ikke reageres"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"Engangsbegivenhed"</item> <item msgid="5093122819962980394">"DAGLIGT"</item> <item msgid="3061751350069329559">"UGENTLIGT"</item> <item msgid="7221838315296593556">"MÅNEDLIGT"</item> diff --git a/res/values-de/arrays.xml b/res/values-de/arrays.xml index 3ae7e2df..14910a6a 100644 --- a/res/values-de/arrays.xml +++ b/res/values-de/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Bei Ablehnung oder keine Antwort"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"Einmaliger Termin"</item> + <item msgid="5093122819962980394">"Täglich"</item> <item msgid="3061751350069329559">"Wöchentlich"</item> <item msgid="7221838315296593556">"Monatlich"</item> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 097b8af7..acde65e2 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -272,4 +272,9 @@ <string name="recurrence_end_date" msgid="3693751578164711701">"Bis <xliff:g id="DATE">%s</xliff:g>"</string> <string name="recurrence_end_count_label" msgid="1820779096399658437">"Anzahl der Wiederholungen"</string> <string name="acessibility_recurrence_choose_end_date_description" msgid="5899029840837836711">"Enddatum ändern"</string> + + <plurals name="recurrence_end_count"> + <item quantity="one"><xliff:g id="event_count">%d</xliff:g> Veranstaltungen</item> + <item quantity="other"><xliff:g id="event_count">%d</xliff:g> Veranstaltungen</item> + </plurals> </resources> diff --git a/res/values-el/arrays.xml b/res/values-el/arrays.xml index b1a2d469..9a63c103 100644 --- a/res/values-el/arrays.xml +++ b/res/values-el/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Μετά από απόρριψη ή μη απόκριση"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ΜΗ ΕΠΑΝΑΛΑΜΒ.ΣΥΜΒΑΝ"</item> + <item msgid="5093122819962980394">"ΚΑΘΗΜΕΡΙΝΑ"</item> <item msgid="3061751350069329559">"ΕΒΔΟΜΑΔΙΑΙΑ"</item> <item msgid="7221838315296593556">"ΜΗΝΙΑΙΑ"</item> diff --git a/res/values-en-rGB/arrays.xml b/res/values-en-rGB/arrays.xml index efdb9937..a801f040 100644 --- a/res/values-en-rGB/arrays.xml +++ b/res/values-en-rGB/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"If declined or not responded"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ONE-TIME EVENT"</item> + <item msgid="5093122819962980394">"DAILY"</item> <item msgid="3061751350069329559">"WEEKLY"</item> <item msgid="7221838315296593556">"MONTHLY"</item> diff --git a/res/values-es-rUS/arrays.xml b/res/values-es-rUS/arrays.xml index cad970e7..240a1eed 100644 --- a/res/values-es-rUS/arrays.xml +++ b/res/values-es-rUS/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Si se rechaza o no tiene respuesta"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EVENTO ÚNICO"</item> + <item msgid="5093122819962980394">"DIARIAMENTE"</item> <item msgid="3061751350069329559">"SEMANALMENTE"</item> <item msgid="7221838315296593556">"MENSUALMENTE"</item> diff --git a/res/values-es/arrays.xml b/res/values-es/arrays.xml index 4df48a56..2773abcd 100644 --- a/res/values-es/arrays.xml +++ b/res/values-es/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Si se rechaza o no responde"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EVENTO ÚNICO"</item> + <item msgid="5093122819962980394">"DIARIAMENTE"</item> <item msgid="3061751350069329559">"SEMANALMENTE"</item> <item msgid="7221838315296593556">"MENSUALMENTE"</item> diff --git a/res/values-et/arrays.xml b/res/values-et/arrays.xml index 9b37c921..28dfa81e 100644 --- a/res/values-et/arrays.xml +++ b/res/values-et/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Keeldumisel või vastamata jätmisel"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ÜHEKORDNE SÜNDMUS"</item> + <item msgid="5093122819962980394">"IGA PÄEV"</item> <item msgid="3061751350069329559">"IGA NÄDAL"</item> <item msgid="7221838315296593556">"IGA KUU"</item> diff --git a/res/values-fa/arrays.xml b/res/values-fa/arrays.xml index d1817ad0..b8cd8ff9 100644 --- a/res/values-fa/arrays.xml +++ b/res/values-fa/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"درصورت ردکردن یا پاسخ ندادن"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"رویداد تکی"</item> + <item msgid="5093122819962980394">"روزانه"</item> <item msgid="3061751350069329559">"هفتگی"</item> <item msgid="7221838315296593556">"ماهانه"</item> diff --git a/res/values-fi/arrays.xml b/res/values-fi/arrays.xml index 1734f33e..a6e0d49f 100644 --- a/res/values-fi/arrays.xml +++ b/res/values-fi/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Jos kieltäydyn tai en vastaa"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"YKSITTÄIN. TAPAHTUMA"</item> + <item msgid="5093122819962980394">"PÄIVITTÄIN"</item> <item msgid="3061751350069329559">"VIIKOITTAIN"</item> <item msgid="7221838315296593556">"KUUKAUSITTAIN"</item> diff --git a/res/values-fr/arrays.xml b/res/values-fr/arrays.xml index c7dfbbd2..f97c8901 100644 --- a/res/values-fr/arrays.xml +++ b/res/values-fr/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Si refus ou pas de réponse"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ÉVÉNEMENT PONCTUEL"</item> + <item msgid="5093122819962980394">"QUOTIDIEN"</item> <item msgid="3061751350069329559">"HEBDOMADAIRE"</item> <item msgid="7221838315296593556">"MENSUEL"</item> diff --git a/res/values-hi/arrays.xml b/res/values-hi/arrays.xml index 85337d60..72f5a29b 100644 --- a/res/values-hi/arrays.xml +++ b/res/values-hi/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"यदि अस्वीकार हुआ हो या जवाब न मिला हो"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"एक-बार का ईवेंट"</item> + <item msgid="5093122819962980394">"प्रतिदिन"</item> <item msgid="3061751350069329559">"प्रति सप्ताह"</item> <item msgid="7221838315296593556">"प्रति माह"</item> diff --git a/res/values-hr/arrays.xml b/res/values-hr/arrays.xml index 2b8162ab..50284186 100644 --- a/res/values-hr/arrays.xml +++ b/res/values-hr/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Ako je odbijeno ili nema odgovora"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"JEDNOKRATNI DOGAĐAJ"</item> + <item msgid="5093122819962980394">"JEDANPUT DNEVNO"</item> <item msgid="3061751350069329559">"JEDANPUT TJEDNO"</item> <item msgid="7221838315296593556">"JEDANPUT MJESEČNO"</item> diff --git a/res/values-hu/arrays.xml b/res/values-hu/arrays.xml index 25f244c0..37ac3df1 100644 --- a/res/values-hu/arrays.xml +++ b/res/values-hu/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Elutasítás/nem válaszolás esetén"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EGYSZERI ESEMÉNY"</item> + <item msgid="5093122819962980394">"NAPONTA"</item> <item msgid="3061751350069329559">"HETENTE"</item> <item msgid="7221838315296593556">"HAVONTA"</item> diff --git a/res/values-in/arrays.xml b/res/values-in/arrays.xml index f8900d37..89bc5e94 100644 --- a/res/values-in/arrays.xml +++ b/res/values-in/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Jika ditolak atau tidak ditanggapi"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ACARA SATU KALI"</item> + <item msgid="5093122819962980394">"HARIAN"</item> <item msgid="3061751350069329559">"MINGGUAN"</item> <item msgid="7221838315296593556">"BULANAN"</item> diff --git a/res/values-iw/arrays.xml b/res/values-iw/arrays.xml index 75f0a029..27c104bd 100644 --- a/res/values-iw/arrays.xml +++ b/res/values-iw/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"לאחר הבעת סירוב או אם אין תגובה"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"אירוע חד-פעמי"</item> + <item msgid="5093122819962980394">"פעם ביום"</item> <item msgid="3061751350069329559">"פעם בשבוע"</item> <item msgid="7221838315296593556">"פעם בחודש"</item> diff --git a/res/values-ja/arrays.xml b/res/values-ja/arrays.xml index b01ac0d7..fea82fd8 100644 --- a/res/values-ja/arrays.xml +++ b/res/values-ja/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"辞退したか応答がなかった場合"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"一度だけの予定"</item> + <item msgid="5093122819962980394">"毎日"</item> <item msgid="3061751350069329559">"毎週"</item> <item msgid="7221838315296593556">"毎月"</item> diff --git a/res/values-ko/arrays.xml b/res/values-ko/arrays.xml index d69ee1a1..d3abf858 100644 --- a/res/values-ko/arrays.xml +++ b/res/values-ko/arrays.xml @@ -112,7 +112,6 @@ <item msgid="6367412240524984286">"거부했거나 응답이 없는 경우만 해당"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"없음"</item> <item msgid="5093122819962980394">"매일"</item> <item msgid="3061751350069329559">"매주"</item> <item msgid="7221838315296593556">"매월"</item> diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml index e2ac402c..efabbf1c 100644 --- a/res/values-land/dimens.xml +++ b/res/values-land/dimens.xml @@ -17,5 +17,5 @@ <dimen name="action_bar_date_text_size">18sp</dimen> <dimen name="recurrence_picker_width">500dp</dimen> - <dimen name="recurrence_picker_height">270dp</dimen> + <dimen name="recurrence_picker_height">281dp</dimen> </resources> diff --git a/res/values-lt/arrays.xml b/res/values-lt/arrays.xml index aa1b2ebf..63b964f6 100644 --- a/res/values-lt/arrays.xml +++ b/res/values-lt/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Jei atmesta ar neatsakyta"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"VIENKARTINIS ĮVYKIS"</item> + <item msgid="5093122819962980394">"KASDIEN"</item> <item msgid="3061751350069329559">"KAS SAVAITĘ"</item> <item msgid="7221838315296593556">"KAS MĖNESĮ"</item> diff --git a/res/values-lv/arrays.xml b/res/values-lv/arrays.xml index c38d6e42..75569fc9 100644 --- a/res/values-lv/arrays.xml +++ b/res/values-lv/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Ja tiek noraidīti vai ignorēti"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"VIENREIZĒJS NOTIKUMS"</item> + <item msgid="5093122819962980394">"KATRU DIENU"</item> <item msgid="3061751350069329559">"KATRU NEDĒĻU"</item> <item msgid="7221838315296593556">"KATRU MĒNESI"</item> diff --git a/res/values-ms/arrays.xml b/res/values-ms/arrays.xml index bd7fe05d..1e36b28b 100644 --- a/res/values-ms/arrays.xml +++ b/res/values-ms/arrays.xml @@ -112,7 +112,6 @@ <item msgid="6367412240524984286">"Jika ditolak atau tidak dijawab"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ACARA SATU KALI"</item> <item msgid="5093122819962980394">"HARIAN"</item> <item msgid="3061751350069329559">"MINGGUAN"</item> <item msgid="7221838315296593556">"BULANAN"</item> diff --git a/res/values-nb/arrays.xml b/res/values-nb/arrays.xml index 025d681b..70b7d354 100644 --- a/res/values-nb/arrays.xml +++ b/res/values-nb/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Hvis avvist eller ikke svart på"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ENGANGSAKTIVITET"</item> + <item msgid="5093122819962980394">"DAGLIG"</item> <item msgid="3061751350069329559">"UKENTLIG"</item> <item msgid="7221838315296593556">"MÅNEDLIG"</item> diff --git a/res/values-nl/arrays.xml b/res/values-nl/arrays.xml index 1b22120b..681a853a 100644 --- a/res/values-nl/arrays.xml +++ b/res/values-nl/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Indien geweigerd of niet gereageerd"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EENMALIG EVENEMENT"</item> + <item msgid="5093122819962980394">"DAGELIJKS"</item> <item msgid="3061751350069329559">"WEKELIJKS"</item> <item msgid="7221838315296593556">"MAANDELIJKS"</item> diff --git a/res/values-pl/arrays.xml b/res/values-pl/arrays.xml index 915fca38..c526fb9f 100644 --- a/res/values-pl/arrays.xml +++ b/res/values-pl/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Po odrzuceniu lub gdy bez odpowiedzi"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"WYDARZENIE JEDNORAZOWE"</item> + <item msgid="5093122819962980394">"CODZIENNIE"</item> <item msgid="3061751350069329559">"CO TYDZIEŃ"</item> <item msgid="7221838315296593556">"CO MIESIĄC"</item> diff --git a/res/values-pt-rPT/arrays.xml b/res/values-pt-rPT/arrays.xml index 89d69416..19c25e29 100644 --- a/res/values-pt-rPT/arrays.xml +++ b/res/values-pt-rPT/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Se recusado ou sem resposta"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EVENTO ÚNICO"</item> + <item msgid="5093122819962980394">"DIARIAMENTE"</item> <item msgid="3061751350069329559">"SEMANALMENTE"</item> <item msgid="7221838315296593556">"MENSALMENTE"</item> diff --git a/res/values-pt/arrays.xml b/res/values-pt/arrays.xml index b56055e1..91c8fb3e 100644 --- a/res/values-pt/arrays.xml +++ b/res/values-pt/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Somente se recusou ou não respondeu"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EVENTO ÚNICO"</item> + <item msgid="5093122819962980394">"DIÁRIO"</item> <item msgid="3061751350069329559">"SEMANAL"</item> <item msgid="7221838315296593556">"MENSAL"</item> diff --git a/res/values-ro/arrays.xml b/res/values-ro/arrays.xml index 2c770378..a4ea4c4c 100644 --- a/res/values-ro/arrays.xml +++ b/res/values-ro/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Dacă sunt respinse sau fără răspuns"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"EVENIMENT UNIC"</item> + <item msgid="5093122819962980394">"ZILNIC"</item> <item msgid="3061751350069329559">"SĂPTĂMÂNAL"</item> <item msgid="7221838315296593556">"LUNAR"</item> diff --git a/res/values-ru/arrays.xml b/res/values-ru/arrays.xml index d823d0e3..e4d841c7 100644 --- a/res/values-ru/arrays.xml +++ b/res/values-ru/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Если отклонено или нет ответа"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"НИКОГДА"</item> + <item msgid="5093122819962980394">"ЕЖЕДНЕВНО"</item> <item msgid="3061751350069329559">"ЕЖЕНЕДЕЛЬНО"</item> <item msgid="7221838315296593556">"ЕЖЕМЕСЯЧНО"</item> diff --git a/res/values-sk/arrays.xml b/res/values-sk/arrays.xml index def82528..a27b7d0d 100644 --- a/res/values-sk/arrays.xml +++ b/res/values-sk/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Ak sú odmietnuté alebo bez odpovede"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"JEDNORAZOVÁ UDALOSŤ"</item> + <item msgid="5093122819962980394">"DENNE"</item> <item msgid="3061751350069329559">"TÝŽDENNE"</item> <item msgid="7221838315296593556">"MESAČNE"</item> diff --git a/res/values-sl/arrays.xml b/res/values-sl/arrays.xml index 95d85966..d7244a97 100644 --- a/res/values-sl/arrays.xml +++ b/res/values-sl/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Ob zavrnitvi ali neodzivanju"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ENKRATEN DOGODEK"</item> + <item msgid="5093122819962980394">"DNEVNO"</item> <item msgid="3061751350069329559">"TEDENSKO"</item> <item msgid="7221838315296593556">"MESEČNO"</item> diff --git a/res/values-sr/arrays.xml b/res/values-sr/arrays.xml index b51e6a45..2302d7f2 100644 --- a/res/values-sr/arrays.xml +++ b/res/values-sr/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"За одбијања или догађаје без одговора"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ЈЕДНОКРАТНИ ДОГАЂАЈ"</item> + <item msgid="5093122819962980394">"ДНЕВНО"</item> <item msgid="3061751350069329559">"НЕДЕЉНО"</item> <item msgid="7221838315296593556">"МЕСЕЧНО"</item> diff --git a/res/values-sv/arrays.xml b/res/values-sv/arrays.xml index f559e863..066d04f3 100644 --- a/res/values-sv/arrays.xml +++ b/res/values-sv/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Om minskat eller inte svarat"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ENGÅNGSHÄNDELSE"</item> + <item msgid="5093122819962980394">"VARJE DAG"</item> <item msgid="3061751350069329559">"VARJE VECKA"</item> <item msgid="7221838315296593556">"VARJE MÅNAD"</item> diff --git a/res/values-sw/arrays.xml b/res/values-sw/arrays.xml index 11c7225b..6a91dc7f 100644 --- a/res/values-sw/arrays.xml +++ b/res/values-sw/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Ikikataliwa au Isipojibiwa"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"TUKIO LA WAKATI MOJA"</item> + <item msgid="5093122819962980394">"KILA SIKU"</item> <item msgid="3061751350069329559">"KILA WIKI"</item> <item msgid="7221838315296593556">"KILA MWEZI"</item> diff --git a/res/values-th/arrays.xml b/res/values-th/arrays.xml index 432421bc..531d1a56 100644 --- a/res/values-th/arrays.xml +++ b/res/values-th/arrays.xml @@ -112,7 +112,6 @@ <item msgid="6367412240524984286">"หากถูกปฏิเสธหรือไม่ตอบกลับ"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"เกิดขึ้นครั้งเดียว"</item> <item msgid="5093122819962980394">"รายวัน"</item> <item msgid="3061751350069329559">"รายสัปดาห์"</item> <item msgid="7221838315296593556">"รายเดือน"</item> diff --git a/res/values-tl/arrays.xml b/res/values-tl/arrays.xml index 084811f9..62565db9 100644 --- a/res/values-tl/arrays.xml +++ b/res/values-tl/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Kung tinanggihan o hindi tinugunan"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"1 BESES NA KAGANAPAN"</item> + <item msgid="5093122819962980394">"ARAW-ARAW"</item> <item msgid="3061751350069329559">"LINGGU-LINGGO"</item> <item msgid="7221838315296593556">"BUWAN-BUWAN"</item> diff --git a/res/values-tr/arrays.xml b/res/values-tr/arrays.xml index 5d682351..8c455054 100644 --- a/res/values-tr/arrays.xml +++ b/res/values-tr/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Reddedildiyse veya yanıt verilmediyse"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"BİR KERELİK ETKİNLİK"</item> + <item msgid="5093122819962980394">"GÜNLÜK"</item> <item msgid="3061751350069329559">"HAFTALIK"</item> <item msgid="7221838315296593556">"AYLIK"</item> diff --git a/res/values-uk/arrays.xml b/res/values-uk/arrays.xml index 7c888491..4328b79f 100644 --- a/res/values-uk/arrays.xml +++ b/res/values-uk/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Якщо відхилено або без відповіді"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"ОДНОРАЗОВА ПОДІЯ"</item> + <item msgid="5093122819962980394">"ЩОДНЯ"</item> <item msgid="3061751350069329559">"ЩОТИЖНЯ"</item> <item msgid="7221838315296593556">"ЩОМІСЯЦЯ"</item> diff --git a/res/values-vi/arrays.xml b/res/values-vi/arrays.xml index 438bb0b1..f8f16fc0 100644 --- a/res/values-vi/arrays.xml +++ b/res/values-vi/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Nếu bị từ chối hoặc không phản hổi"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"SỰ KIỆN DIỄN RA MỘT LẦN"</item> + <item msgid="5093122819962980394">"HÀNG NGÀY"</item> <item msgid="3061751350069329559">"HÀNG TUẦN"</item> <item msgid="7221838315296593556">"HÀNG THÁNG"</item> diff --git a/res/values-zh-rCN/arrays.xml b/res/values-zh-rCN/arrays.xml index 60e3d583..c623aa48 100644 --- a/res/values-zh-rCN/arrays.xml +++ b/res/values-zh-rCN/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"在您不参加或未回复的情况下"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"一次性活动"</item> + <item msgid="5093122819962980394">"每天"</item> <item msgid="3061751350069329559">"每周"</item> <item msgid="7221838315296593556">"每月"</item> diff --git a/res/values-zh-rTW/arrays.xml b/res/values-zh-rTW/arrays.xml index 2e013487..4141d351 100644 --- a/res/values-zh-rTW/arrays.xml +++ b/res/values-zh-rTW/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"拒絕或未回應時"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"單次活動"</item> + <item msgid="5093122819962980394">"每天"</item> <item msgid="3061751350069329559">"每週"</item> <item msgid="7221838315296593556">"每月"</item> diff --git a/res/values-zu/arrays.xml b/res/values-zu/arrays.xml index 1cbcaed0..cc65ecb9 100644 --- a/res/values-zu/arrays.xml +++ b/res/values-zu/arrays.xml @@ -112,7 +112,7 @@ <item msgid="6367412240524984286">"Uma ngabe kunqatshelwe noma kungaphendulwanga"</item> </string-array> <string-array name="recurrence_freq"> - <item msgid="5937533480933137696">"UMCIMBI WESIKHATHI ESISODWA"</item> + <item msgid="5093122819962980394">"NSUKU ZONKE"</item> <item msgid="3061751350069329559">"MAVIKI WONKE"</item> <item msgid="7221838315296593556">"NYANGA ZONKE"</item> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 34ac0b12..f4a78a58 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -239,10 +239,9 @@ <!-- Recurrence picker: How events are to be repeated. [CHAR LIMIT = 20] --> <string-array name="recurrence_freq"> - <item >ONE-TIME EVENT</item> - <item >DAILY</item> - <item >WEEKLY</item> - <item >MONTHLY</item> - <item >YEARLY</item> + <item >REPEAT DAILY</item> + <item >REPEAT WEEKLY</item> + <item >REPEAT MONTHLY</item> + <item >REPEAT YEARLY</item> </string-array> </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 0a73b92d..2ef7a4bc 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -166,4 +166,5 @@ <color name="appwidget_no_events">#ffffffff</color> <color name="recurrence_picker_background">#fff2f2f2</color> + <color name="recurrence_bubble_text_normal">#ff737373</color> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 0c1a7c7f..956cdd4a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -728,11 +728,17 @@ <!-- Specifies that a repeating event to repeat forever (based on the defined frequency) instead of ending at a future date[CHAR LIMIT=25] --> <string name="recurrence_end_continously">Forever</string> <!-- Specifies that a repeating event to repeat until a certain date[CHAR LIMIT=25] --> - <string name="recurrence_end_date_label">End date</string> + <string name="recurrence_end_date_label">Until a date</string> <!-- Specifies that a repeating event to repeat until a certain date[CHAR LIMIT=25] --> <string name="recurrence_end_date">Until <xliff:g id="date">%s</xliff:g></string> <!-- Specifies that a repeating event to repeat for a number of times. A repeating event can repeat forever, repeat in a certain frequency until a certain date, or repeat for a number of times. e.g. repeat 10 times and stop. This string is for the last case [CHAR LIMIT=25] --> - <string name="recurrence_end_count_label">Number of repetitions</string> + <string name="recurrence_end_count_label">For a number of events</string> + + <!-- Specifies that a repeating event should repeat for a certain number of iterations. --> + <plurals name="recurrence_end_count"> + <item quantity="one">For <xliff:g id="event_count">%d</xliff:g> event</item> + <item quantity="other">For <xliff:g id="event_count">%d</xliff:g> events</item> + </plurals> <!-- Description of the selected marker for accessibility support [CHAR LIMIT = NONE]--> <string name="acessibility_recurrence_choose_end_date_description">change end date</string> diff --git a/res/values/styles.xml b/res/values/styles.xml index 377c831b..b24c3c3a 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -258,6 +258,9 @@ <item name="android:textSize">15sp</item> </style> + <style name="TextAppearance.Recurrence_SpinnerButton" + parent="android:style/Widget.Holo.Light.Spinner" /> + <style name="RecurrenceDayOfWeekStyle"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> @@ -266,6 +269,7 @@ <item name="android:layout_marginLeft">8dip</item> <item name="android:layout_marginRight">8dip</item> <item name="android:layout_weight">1</item> + <item name="android:textColor">@color/recurrence_bubble_text_color</item> <item name="android:textAllCaps">true</item> <item name="android:textSize">12sp</item> <item name="android:textStyle">bold</item> diff --git a/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java b/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java index bb28877c..971260ad 100644 --- a/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java +++ b/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java @@ -18,6 +18,7 @@ package com.android.calendar.recurrencepicker; import android.app.Activity; import android.app.DialogFragment; +import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Bundle; @@ -33,6 +34,7 @@ import android.util.TimeFormatException; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; +import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup; import android.view.Window; import android.widget.AdapterView; @@ -42,17 +44,19 @@ import android.widget.Button; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; -import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Spinner; +import android.widget.Switch; +import android.widget.TableLayout; import android.widget.TextView; import android.widget.Toast; import android.widget.ToggleButton; import com.android.calendar.R; import com.android.calendar.Utils; +import com.android.calendar.CalendarController.ViewType; import com.android.calendarcommon2.EventRecurrence; import com.android.datetimepicker.date.DatePickerDialog; @@ -77,15 +81,9 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele private static final int COUNT_MAX = 730; private static final int COUNT_DEFAULT = 5; - private static final int DAY_OF_WEEK_CHECKED_TEXT_COLOR = 0xFFFFFFFF; - private static final int DAY_OF_WEEK_UNCHECKED_TEXT_COLOR = 0xFF000000; - private DatePickerDialog mDatePickerDialog; - private class Model implements Parcelable { - - // Not repeating - static final int FREQ_NONE = -1; + private class RecurrenceModel implements Parcelable { // Should match EventRecurrence.DAILY, etc static final int FREQ_DAILY = 0; @@ -100,6 +98,11 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele static final int MONTHLY_BY_DATE = 0; static final int MONTHLY_BY_NTH_DAY_OF_WEEK = 1; + static final int STATE_NO_RECURRENCE = 0; + static final int STATE_RECURRENCE = 1; + + int recurrenceState; + /** * FREQ: Repeat pattern * @@ -108,7 +111,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele * @see FREQ_MONTHLY * @see FREQ_YEARLY */ - int freq = FREQ_NONE; + int freq = FREQ_WEEKLY; /** * INTERVAL: Every n days/weeks/months/years. n >= 1 @@ -185,39 +188,9 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele return 0; } - public Model() { + public RecurrenceModel() { } - // protected Model(Parcel in) { - // freq = in.readInt(); - // interval = in.readInt(); - // end = in.readInt(); - // endDate = new Time(); // TODO timezone? - // endDate.hour = endDate.minute = endDate.second = 0; - // endDate.year = in.readInt(); - // endDate.month = in.readInt(); - // endDate.monthDay = in.readInt(); - // endCount = in.readInt(); - // in.readBooleanArray(weeklyByDayOfWeek); - // monthlyRepeat = in.readInt(); - // monthlyByMonthDay = in.readInt(); - // monthlyByDayOfWeek = in.readInt(); - // monthlyByNthDayOfWeek = in.readInt(); - // } - // - // public static final Parcelable.Creator<Model> CREATOR = new - // Parcelable.Creator<Model>() { - // @Override - // public Model createFromParcel(Parcel in) { - // return new Model(in); - // } - // - // @Override - // public Model[] newArray(int size) { - // return new Model[size]; - // } - // }; - @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(freq); @@ -232,6 +205,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele dest.writeInt(monthlyByMonthDay); dest.writeInt(monthlyByDayOfWeek); dest.writeInt(monthlyByNthDayOfWeek); + dest.writeInt(recurrenceState); } } @@ -271,6 +245,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele s.append(Integer.toString(value)); } + updateDoneButtonState(); onChange(value); } @@ -290,7 +265,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele private Resources mResources; private EventRecurrence mRecurrence = new EventRecurrence(); private Time mTime = new Time(); // TODO timezone? - private Model mModel = new Model(); + private RecurrenceModel mModel = new RecurrenceModel(); private Toast mToast; private final int[] TIME_DAY_TO_CALENDAR_DAY = new int[] { @@ -310,8 +285,6 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele private View mView; - private TextView mTitleView; - private View mOptionsFrame; private Spinner mFreqSpinner; private static final int[] mFreqModelToEventRecurrence = { EventRecurrence.DAILY, @@ -325,29 +298,29 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele public static final String BUNDLE_RRULE = "bundle_event_rrule"; private static final String BUNDLE_MODEL = "bundle_model"; - private static final String BUNDLE_END_YEAR = "bundle_end_year"; - private static final String BUNDLE_END_MONTH = "bundle_end_month"; - private static final String BUNDLE_END_DAY = "bundle_end_day"; private static final String BUNDLE_END_COUNT_HAS_FOCUS = "bundle_end_count_has_focus"; private static final String FRAG_TAG_DATE_PICKER = "tag_date_picker_frag"; - private LinearLayout mIntervalGroup; + private Switch mRepeatSwitch; + private EditText mInterval; private TextView mIntervalPreText; private TextView mIntervalPostText; private int mIntervalResId = -1; - private LinearLayout mEndGroup; private Spinner mEndSpinner; - private ImageButton mEndDateTextView; + private TextView mEndDateTextView; private EditText mEndCount; + private TextView mPostEndCount; + private boolean mHidePostEndCount; private ArrayList<CharSequence> mEndSpinnerArray = new ArrayList<CharSequence>(3); - private ArrayAdapter<CharSequence> mEndSpinnerAdapter; + private EndSpinnerAdapter mEndSpinnerAdapter; private String mEndNeverStr; private String mEndDateLabel; + private String mEndCountLabel; /** Hold toggle buttons in the order per user's first day of week preference */ private LinearLayout mWeekGroup; @@ -359,7 +332,8 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele private LinearLayout mMonthGroup; private RadioGroup mMonthRepeatByRadioGroup; - private RadioButton mMonthRepeatByNthDayOfWeek; + private RadioButton mRepeatMonthlyByNthDayOfWeek; + private RadioButton mRepeatMonthlyByNthDayOfMonth; private String mMonthRepeatByDayOfWeekStr; private Button mDone; @@ -425,62 +399,22 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele return true; } - // TODO compare - // private boolean isCustomRecurrence() { - // - // if (mEventRecurrence.until != null - // || (mEventRecurrence.interval != 0 && mEventRecurrence.interval != 1) - // || mEventRecurrence.count != 0) { - // return true; - // } - // - // if (mEventRecurrence.freq == 0) { - // return false; - // } - // - // switch (mEventRecurrence.freq) { - // case EventRecurrence.DAILY: - // return false; - // case EventRecurrence.WEEKLY: - // if (mEventRecurrence.repeatsOnEveryWeekDay() && isWeekdayEvent()) { - // return false; - // } else if (mEventRecurrence.bydayCount == 1) { - // return false; - // } - // break; - // case EventRecurrence.MONTHLY: - // if (mEventRecurrence.repeatsMonthlyOnDayCount()) { - // /* this is a "3rd Tuesday of every month" sort of rule */ - // return false; - // } else if (mEventRecurrence.bydayCount == 0 - // && mEventRecurrence.bymonthdayCount == 1 - // && mEventRecurrence.bymonthday[0] > 0) { - // /* this is a "22nd day of every month" sort of rule */ - // return false; - // } - // break; - // case EventRecurrence.YEARLY: - // return false; - // } - // - // return true; - // } - // TODO don't lose data when getting data that our UI can't handle - static private void copyEventRecurrenceToModel(final EventRecurrence er, Model model) { + static private void copyEventRecurrenceToModel(final EventRecurrence er, + RecurrenceModel model) { // Freq: switch (er.freq) { case EventRecurrence.DAILY: - model.freq = Model.FREQ_DAILY; + model.freq = RecurrenceModel.FREQ_DAILY; break; case EventRecurrence.MONTHLY: - model.freq = Model.FREQ_MONTHLY; + model.freq = RecurrenceModel.FREQ_MONTHLY; break; case EventRecurrence.YEARLY: - model.freq = Model.FREQ_YEARLY; + model.freq = RecurrenceModel.FREQ_YEARLY; break; case EventRecurrence.WEEKLY: - model.freq = Model.FREQ_WEEKLY; + model.freq = RecurrenceModel.FREQ_WEEKLY; break; default: throw new IllegalStateException("freq=" + er.freq); @@ -495,7 +429,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele // End by count: model.endCount = er.count; if (model.endCount > 0) { - model.end = Model.END_BY_COUNT; + model.end = RecurrenceModel.END_BY_COUNT; } // End by date: @@ -511,11 +445,11 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele } // LIMITATION: The UI can only handle END_BY_DATE or END_BY_COUNT - if (model.end == Model.END_BY_COUNT && model.endDate != null) { + if (model.end == RecurrenceModel.END_BY_COUNT && model.endDate != null) { throw new IllegalStateException("freq=" + er.freq); } - model.end = Model.END_BY_DATE; + model.end = RecurrenceModel.END_BY_DATE; } // Weekly: repeat by day of week or Monthly: repeat by nth day of week @@ -527,18 +461,18 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele int dayOfWeek = EventRecurrence.day2TimeDay(er.byday[i]); model.weeklyByDayOfWeek[dayOfWeek] = true; - if (model.freq == Model.FREQ_MONTHLY && er.bydayNum[i] > 0) { + if (model.freq == RecurrenceModel.FREQ_MONTHLY && er.bydayNum[i] > 0) { // LIMITATION: Can handle only (one) weekDayNum and only // when // monthly model.monthlyByDayOfWeek = dayOfWeek; model.monthlyByNthDayOfWeek = er.bydayNum[i]; - model.monthlyRepeat = Model.MONTHLY_BY_NTH_DAY_OF_WEEK; + model.monthlyRepeat = RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK; count++; } } - if (model.freq == Model.FREQ_MONTHLY) { + if (model.freq == RecurrenceModel.FREQ_MONTHLY) { if (er.bydayCount != 1) { // Can't handle 1st Monday and 2nd Wed throw new IllegalStateException("Can handle only 1 byDayOfWeek in monthly"); @@ -551,14 +485,14 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele } // Monthly by day of month - if (model.freq == Model.FREQ_MONTHLY) { + if (model.freq == RecurrenceModel.FREQ_MONTHLY) { if (er.bymonthdayCount == 1) { - if (model.monthlyRepeat == Model.MONTHLY_BY_NTH_DAY_OF_WEEK) { + if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) { throw new IllegalStateException( "Can handle only by monthday or by nth day of week, not both"); } model.monthlyByMonthDay = er.bymonthday[0]; - model.monthlyRepeat = Model.MONTHLY_BY_DATE; + model.monthlyRepeat = RecurrenceModel.MONTHLY_BY_DATE; } else if (er.bymonthCount > 1) { // LIMITATION: Can handle only one month day throw new IllegalStateException("Can handle only one bymonthday"); @@ -566,8 +500,9 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele } } - static private void copyModelToEventRecurrence(final Model model, EventRecurrence er) { - if (model.freq == Model.FREQ_NONE) { + static private void copyModelToEventRecurrence(final RecurrenceModel model, + EventRecurrence er) { + if (model.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { throw new IllegalStateException("There's no recurrence"); } @@ -583,7 +518,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele // End switch (model.end) { - case Model.END_BY_DATE: + case RecurrenceModel.END_BY_DATE: if (model.endDate != null) { model.endDate.switchTimezone(Time.TIMEZONE_UTC); model.endDate.normalize(false); @@ -593,7 +528,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele throw new IllegalStateException("end = END_BY_DATE but endDate is null"); } break; - case Model.END_BY_COUNT: + case RecurrenceModel.END_BY_COUNT: er.count = model.endCount; er.until = null; if (er.count <= 0) { @@ -611,8 +546,8 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele er.bymonthdayCount = 0; switch (model.freq) { - case Model.FREQ_MONTHLY: - if (model.monthlyRepeat == Model.MONTHLY_BY_DATE) { + case RecurrenceModel.FREQ_MONTHLY: + if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_DATE) { if (model.monthlyByMonthDay > 0) { if (er.bymonthday == null || er.bymonthdayCount < 1) { er.bymonthday = new int[1]; @@ -620,7 +555,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele er.bymonthday[0] = model.monthlyByMonthDay; er.bymonthdayCount = 1; } - } else if (model.monthlyRepeat == Model.MONTHLY_BY_NTH_DAY_OF_WEEK) { + } else if (model.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) { if (model.monthlyByNthDayOfWeek <= 0) { throw new IllegalStateException("month repeat by nth week but n is " + model.monthlyByNthDayOfWeek); @@ -635,7 +570,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele er.bydayNum[0] = model.monthlyByNthDayOfWeek; } break; - case Model.FREQ_WEEKLY: + case RecurrenceModel.FREQ_WEEKLY: int count = 0; for (int i = 0; i < 7; i++) { if (model.weeklyByDayOfWeek[i]) { @@ -673,7 +608,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele boolean endCountHasFocus = false; if (savedInstanceState != null) { - Model m = (Model) savedInstanceState.get(BUNDLE_MODEL); + RecurrenceModel m = (RecurrenceModel) savedInstanceState.get(BUNDLE_MODEL); if (m != null) { mModel = m; } @@ -691,12 +626,17 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele // Time days of week: Sun=0, Mon=1, etc mModel.weeklyByDayOfWeek[mTime.weekDay] = true; - String rrule = b.getString(BUNDLE_RRULE); if (!TextUtils.isEmpty(rrule)) { + mModel.recurrenceState = RecurrenceModel.STATE_RECURRENCE; mRecurrence.parse(rrule); copyEventRecurrenceToModel(mRecurrence, mModel); + // Leave today's day of week as checked by default in weekly view. + if (mRecurrence.bydayCount == 0) { + mModel.weeklyByDayOfWeek[mTime.weekDay] = true; + } } + } else { mTime.setToNow(); } @@ -705,14 +645,20 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mResources = getResources(); mView = inflater.inflate(R.layout.recurrencepicker, container, true); - mTitleView = (TextView) mView.findViewById(R.id.title); final Activity activity = getActivity(); final Configuration config = activity.getResources().getConfiguration(); - if (config.orientation == Configuration.ORIENTATION_LANDSCAPE && - !Utils.getConfigBool(activity, R.bool.tablet_config)) { - mTitleView.setVisibility(View.GONE); - } - mOptionsFrame = mView.findViewById(R.id.options); + + mRepeatSwitch = (Switch) mView.findViewById(R.id.repeat_switch); + mRepeatSwitch.setChecked(mModel.recurrenceState == RecurrenceModel.STATE_RECURRENCE); + mRepeatSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { + + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mModel.recurrenceState = isChecked ? RecurrenceModel.STATE_RECURRENCE + : RecurrenceModel.STATE_NO_RECURRENCE; + togglePickerOptions(); + } + }); mFreqSpinner = (Spinner) mView.findViewById(R.id.freqSpinner); mFreqSpinner.setOnItemSelectedListener(this); @@ -721,13 +667,12 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele freqAdapter.setDropDownViewResource(R.layout.recurrencepicker_freq_item); mFreqSpinner.setAdapter(freqAdapter); - mIntervalGroup = (LinearLayout) mView.findViewById(R.id.intervalGroup); mInterval = (EditText) mView.findViewById(R.id.interval); mInterval.addTextChangedListener(new minMaxTextWatcher(1, INTERVAL_DEFAULT, INTERVAL_MAX) { @Override void onChange(int v) { - mModel.interval = v; if (mIntervalResId != -1 && mInterval.getText().toString().length() > 0) { + mModel.interval = v; updateIntervalText(); mInterval.requestLayout(); } @@ -736,20 +681,17 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mIntervalPreText = (TextView) mView.findViewById(R.id.intervalPreText); mIntervalPostText = (TextView) mView.findViewById(R.id.intervalPostText); - mEndGroup = (LinearLayout) mView.findViewById(R.id.endGroup); mEndNeverStr = mResources.getString(R.string.recurrence_end_continously); mEndDateLabel = mResources.getString(R.string.recurrence_end_date_label); - // mEndByDateFormatStr = - // mResources.getString(R.string.recurrence_end_date); - // mEndByCountFormatStr = - // mResources.getString(R.string.recurrence_end_count); + mEndCountLabel = mResources.getString(R.string.recurrence_end_count_label); + mEndSpinnerArray.add(mEndNeverStr); mEndSpinnerArray.add(mEndDateLabel); - mEndSpinnerArray.add(mResources.getString(R.string.recurrence_end_count_label)); + mEndSpinnerArray.add(mEndCountLabel); mEndSpinner = (Spinner) mView.findViewById(R.id.endSpinner); mEndSpinner.setOnItemSelectedListener(this); - mEndSpinnerAdapter = new ArrayAdapter<CharSequence>(getActivity(), - R.layout.recurrencepicker_freq_item, mEndSpinnerArray); + mEndSpinnerAdapter = new EndSpinnerAdapter(getActivity(), mEndSpinnerArray, + R.layout.recurrencepicker_freq_item, R.layout.recurrencepicker_end_text); mEndSpinnerAdapter.setDropDownViewResource(R.layout.recurrencepicker_freq_item); mEndSpinner.setAdapter(mEndSpinnerAdapter); @@ -757,23 +699,28 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mEndCount.addTextChangedListener(new minMaxTextWatcher(1, COUNT_DEFAULT, COUNT_MAX) { @Override void onChange(int v) { - mModel.endCount = v; + if (mModel.endCount != v) { + mModel.endCount = v; + updateEndCountText(); + mEndCount.requestLayout(); + } } }); - mEndDateTextView = (ImageButton) mView.findViewById(R.id.endDate); + mPostEndCount = (TextView) mView.findViewById(R.id.postEndCount); + + mEndDateTextView = (TextView) mView.findViewById(R.id.endDate); mEndDateTextView.setOnClickListener(this); if (mModel.endDate == null) { mModel.endDate = new Time(mTime); switch (mModel.freq) { - case Model.FREQ_NONE: - case Model.FREQ_DAILY: - case Model.FREQ_WEEKLY: + case RecurrenceModel.FREQ_DAILY: + case RecurrenceModel.FREQ_WEEKLY: mModel.endDate.month += 1; break; - case Model.FREQ_MONTHLY: + case RecurrenceModel.FREQ_MONTHLY: mModel.endDate.month += 3; break; - case Model.FREQ_YEARLY: + case RecurrenceModel.FREQ_YEARLY: mModel.endDate.year += 3; break; } @@ -852,12 +799,15 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mMonthGroup = (LinearLayout) mView.findViewById(R.id.monthGroup); mMonthRepeatByRadioGroup = (RadioGroup) mView.findViewById(R.id.monthGroup); mMonthRepeatByRadioGroup.setOnCheckedChangeListener(this); - mMonthRepeatByNthDayOfWeek = (RadioButton) mView + mRepeatMonthlyByNthDayOfWeek = (RadioButton) mView .findViewById(R.id.repeatMonthlyByNthDayOfTheWeek); + mRepeatMonthlyByNthDayOfMonth = (RadioButton) mView + .findViewById(R.id.repeatMonthlyByNthDayOfMonth); mDone = (Button) mView.findViewById(R.id.done); mDone.setOnClickListener(this); + togglePickerOptions(); updateDialog(); if (endCountHasFocus) { mEndCount.requestFocus(); @@ -865,6 +815,73 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele return mView; } + private void togglePickerOptions() { + if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { + mFreqSpinner.setEnabled(false); + mEndSpinner.setEnabled(false); + mIntervalPreText.setEnabled(false); + mInterval.setEnabled(false); + mIntervalPostText.setEnabled(false); + mMonthRepeatByRadioGroup.setEnabled(false); + mEndCount.setEnabled(false); + mPostEndCount.setEnabled(false); + mEndDateTextView.setEnabled(false); + mRepeatMonthlyByNthDayOfWeek.setEnabled(false); + mRepeatMonthlyByNthDayOfMonth.setEnabled(false); + for (Button button : mWeekByDayButtons) { + button.setEnabled(false); + } + } else { + mView.findViewById(R.id.options).setEnabled(true); + mFreqSpinner.setEnabled(true); + mEndSpinner.setEnabled(true); + mIntervalPreText.setEnabled(true); + mInterval.setEnabled(true); + mIntervalPostText.setEnabled(true); + mMonthRepeatByRadioGroup.setEnabled(true); + mEndCount.setEnabled(true); + mPostEndCount.setEnabled(true); + mEndDateTextView.setEnabled(true); + mRepeatMonthlyByNthDayOfWeek.setEnabled(true); + mRepeatMonthlyByNthDayOfMonth.setEnabled(true); + for (Button button : mWeekByDayButtons) { + button.setEnabled(true); + } + } + updateDoneButtonState(); + } + + private void updateDoneButtonState() { + if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { + mDone.setEnabled(true); + return; + } + + if (mInterval.getText().toString().length() == 0) { + mDone.setEnabled(false); + return; + } + + if (mEndCount.getVisibility() == View.VISIBLE && + mEndCount.getText().toString().length() == 0) { + mDone.setEnabled(false); + return; + } + + if (mModel.freq == RecurrenceModel.FREQ_WEEKLY) { + for (CompoundButton b : mWeekByDayButtons) { + if (b.isChecked()) { + mDone.setEnabled(true); + return; + } + } + mDone.setEnabled(false); + return; + } + + mDone.setEnabled(true); + } + @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); @@ -883,91 +900,66 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mInterval.setText(intervalStr); } - mFreqSpinner.setSelection(mModel.freq + 1); // FREQ_* starts at -1 - mWeekGroup.setVisibility(mModel.freq == Model.FREQ_WEEKLY ? View.VISIBLE : View.GONE); - mWeekGroup2.setVisibility(mModel.freq == Model.FREQ_WEEKLY ? View.VISIBLE : View.GONE); - mMonthGroup.setVisibility(mModel.freq == Model.FREQ_MONTHLY ? View.VISIBLE : View.GONE); - - if (mModel.freq == Model.FREQ_NONE) { - mTitleView.setText(R.string.recurrence_dialog_title_never); - mOptionsFrame.setVisibility(View.INVISIBLE); - mIntervalGroup.setVisibility(View.INVISIBLE); - mEndGroup.setVisibility(View.INVISIBLE); - } else { - mTitleView.setText(R.string.recurrence_dialog_title); - mOptionsFrame.setVisibility(View.VISIBLE); - mIntervalGroup.setVisibility(View.VISIBLE); - mEndGroup.setVisibility(View.VISIBLE); - - switch (mModel.freq) { - case Model.FREQ_DAILY: - mIntervalResId = R.plurals.recurrence_interval_daily; - break; + mFreqSpinner.setSelection(mModel.freq); + mWeekGroup.setVisibility(mModel.freq == RecurrenceModel.FREQ_WEEKLY ? View.VISIBLE : View.GONE); + mWeekGroup2.setVisibility(mModel.freq == RecurrenceModel.FREQ_WEEKLY ? View.VISIBLE : View.GONE); + mMonthGroup.setVisibility(mModel.freq == RecurrenceModel.FREQ_MONTHLY ? View.VISIBLE : View.GONE); - case Model.FREQ_WEEKLY: - mIntervalResId = R.plurals.recurrence_interval_weekly; + switch (mModel.freq) { + case RecurrenceModel.FREQ_DAILY: + mIntervalResId = R.plurals.recurrence_interval_daily; + break; - int count = 0; - for (int i = 0; i < 7; i++) { - mWeekByDayButtons[i].setChecked(mModel.weeklyByDayOfWeek[i]); - if (mModel.weeklyByDayOfWeek[i]) { - count++; - mWeekByDayButtons[i].setTextColor(DAY_OF_WEEK_CHECKED_TEXT_COLOR); - } else { - mWeekByDayButtons[i].setTextColor(DAY_OF_WEEK_UNCHECKED_TEXT_COLOR); - } - } - if (count == 0) { - mModel.weeklyByDayOfWeek[mTime.weekDay] = true; - mWeekByDayButtons[mTime.weekDay].setChecked(true); - mWeekByDayButtons[mTime.weekDay] - .setTextColor(DAY_OF_WEEK_CHECKED_TEXT_COLOR); - } - break; + case RecurrenceModel.FREQ_WEEKLY: + mIntervalResId = R.plurals.recurrence_interval_weekly; + for (int i = 0; i < 7; i++) { + mWeekByDayButtons[i].setChecked(mModel.weeklyByDayOfWeek[i]); + } + break; - case Model.FREQ_MONTHLY: - mIntervalResId = R.plurals.recurrence_interval_monthly; + case RecurrenceModel.FREQ_MONTHLY: + mIntervalResId = R.plurals.recurrence_interval_monthly; - if (mModel.monthlyRepeat == Model.MONTHLY_BY_DATE) { - mMonthRepeatByRadioGroup.check(R.id.repeatMonthlyByNthDayOfMonth); - } else if (mModel.monthlyRepeat == Model.MONTHLY_BY_NTH_DAY_OF_WEEK) { - mMonthRepeatByRadioGroup.check(R.id.repeatMonthlyByNthDayOfTheWeek); - } + if (mModel.monthlyRepeat == RecurrenceModel.MONTHLY_BY_DATE) { + mMonthRepeatByRadioGroup.check(R.id.repeatMonthlyByNthDayOfMonth); + } else if (mModel.monthlyRepeat == RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK) { + mMonthRepeatByRadioGroup.check(R.id.repeatMonthlyByNthDayOfTheWeek); + } - if (mMonthRepeatByDayOfWeekStr == null) { + if (mMonthRepeatByDayOfWeekStr == null) { + if (mModel.monthlyByNthDayOfWeek == 0) { mModel.monthlyByNthDayOfWeek = (mTime.monthDay + 6) / 7; mModel.monthlyByDayOfWeek = mTime.weekDay; - - mMonthRepeatByDayOfWeekStr = mResources.getString( - R.string.recurrence_month_pattern_by_day_of_week, - mOrdinalArray[mModel.monthlyByNthDayOfWeek - 1], - mDayOfWeekString[mModel.monthlyByDayOfWeek]); - mMonthRepeatByNthDayOfWeek.setText(mMonthRepeatByDayOfWeekStr); } - break; - case Model.FREQ_YEARLY: - mIntervalResId = R.plurals.recurrence_interval_yearly; - break; - } - updateIntervalText(); - mEndSpinner.setSelection(mModel.end); - if (mModel.end == Model.END_BY_DATE) { - final String dateStr = DateUtils.formatDateTime(getActivity(), - mModel.endDate.toMillis(false), DateUtils.FORMAT_NUMERIC_DATE); - final String endDateString = mResources.getString(R.string.recurrence_end_date, - dateStr); - setEndSpinnerEndDateStr(endDateString); - } else { - setEndSpinnerEndDateStr(mEndDateLabel); - if (mModel.end == Model.END_BY_COUNT) { - // Checking before setting because this causes infinite - // recursion - // in afterTextWatcher - final String countStr = Integer.toString(mModel.endCount); - if (!countStr.equals(mEndCount.getText().toString())) { - mEndCount.setText(countStr); - } + mMonthRepeatByDayOfWeekStr = mResources.getString( + R.string.recurrence_month_pattern_by_day_of_week, + mOrdinalArray[mModel.monthlyByNthDayOfWeek - 1], + mDayOfWeekString[mModel.monthlyByDayOfWeek]); + mRepeatMonthlyByNthDayOfWeek.setText(mMonthRepeatByDayOfWeekStr); + } + break; + + case RecurrenceModel.FREQ_YEARLY: + mIntervalResId = R.plurals.recurrence_interval_yearly; + break; + } + updateIntervalText(); + updateDoneButtonState(); + + mEndSpinner.setSelection(mModel.end); + if (mModel.end == RecurrenceModel.END_BY_DATE) { + final String dateStr = DateUtils.formatDateTime(getActivity(), + mModel.endDate.toMillis(false), DateUtils.FORMAT_NUMERIC_DATE); + mEndDateTextView.setText(dateStr); + } else { + if (mModel.end == RecurrenceModel.END_BY_COUNT) { + // Checking before setting because this causes infinite + // recursion + // in afterTextWatcher + final String countStr = Integer.toString(mModel.endCount); + if (!countStr.equals(mEndCount.getText().toString())) { + mEndCount.setText(countStr); } } } @@ -984,7 +976,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele private void doToast() { Log.e(TAG, "Model = " + mModel.toString()); String rrule; - if (mModel.freq == Model.FREQ_NONE) { + if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { rrule = "Not repeating"; } else { copyModelToEventRecurrence(mModel, mRecurrence); @@ -1014,7 +1006,8 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mIntervalPreText.setText(""); } else { int postTextStart = markerStart + INTERVAL_COUNT_MARKER.length(); - if (intervalString.charAt(postTextStart) == ' ') { + if (postTextStart < intervalString.length() && + intervalString.charAt(postTextStart) == ' ') { postTextStart++; } mIntervalPostText.setText(intervalString.subSequence(postTextStart, @@ -1028,37 +1021,65 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele } } + /** + * Update the "Repeat for N events" end option with the proper string values + * based on the value that has been entered for N. + */ + private void updateEndCountText() { + final String END_COUNT_MARKER = "%d"; + String endString = mResources.getQuantityString(R.plurals.recurrence_end_count, + mModel.endCount); + int markerStart = endString.indexOf(END_COUNT_MARKER); + + if (markerStart != -1) { + if (markerStart == 0) { + Log.e(TAG, "No text to put in to recurrence's end spinner."); + } else { + int postTextStart = markerStart + END_COUNT_MARKER.length(); + if (postTextStart < endString.length() && + endString.charAt(postTextStart) == ' ') { + postTextStart++; + } + mPostEndCount.setText(endString.subSequence(postTextStart, + endString.length())); + } + } + } + // Implements OnItemSelectedListener interface // Freq spinner // End spinner @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (parent == mFreqSpinner) { - // FREQ_* starts at -1. - // Spinner starts at 0. - mModel.freq = position - 1; + mModel.freq = position; } else if (parent == mEndSpinner) { switch (position) { - case Model.END_NEVER: - mModel.end = Model.END_NEVER; + case RecurrenceModel.END_NEVER: + mModel.end = RecurrenceModel.END_NEVER; break; - case Model.END_BY_DATE: - mModel.end = Model.END_BY_DATE; + case RecurrenceModel.END_BY_DATE: + mModel.end = RecurrenceModel.END_BY_DATE; break; - case Model.END_BY_COUNT: - mModel.end = Model.END_BY_COUNT; + case RecurrenceModel.END_BY_COUNT: + mModel.end = RecurrenceModel.END_BY_COUNT; if (mModel.endCount <= 1) { mModel.endCount = 1; } else if (mModel.endCount > COUNT_MAX) { mModel.endCount = COUNT_MAX; } + updateEndCountText(); break; } - mEndCount.setVisibility(mModel.end == Model.END_BY_COUNT ? View.VISIBLE + mEndCount.setVisibility(mModel.end == RecurrenceModel.END_BY_COUNT ? View.VISIBLE : View.GONE); - mEndDateTextView.setVisibility(mModel.end == Model.END_BY_DATE ? View.VISIBLE + mEndDateTextView.setVisibility(mModel.end == RecurrenceModel.END_BY_DATE ? View.VISIBLE : View.GONE); + mPostEndCount.setVisibility( + mModel.end == RecurrenceModel.END_BY_COUNT && !mHidePostEndCount? + View.VISIBLE : View.GONE); + } updateDialog(); } @@ -1086,27 +1107,12 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int itemIdx = -1; - int checkedItems = 0; for (int i = 0; i < 7; i++) { if (itemIdx == -1 && buttonView == mWeekByDayButtons[i]) { itemIdx = i; mModel.weeklyByDayOfWeek[i] = isChecked; } - - if (mModel.weeklyByDayOfWeek[i]) { - checkedItems++; - } - } - - // Re-enable item if nothing was enabled. - if (checkedItems == 0 && itemIdx != -1) { - buttonView.setChecked(true); - mModel.weeklyByDayOfWeek[itemIdx] = true; } - - buttonView.setTextColor(isChecked ? DAY_OF_WEEK_CHECKED_TEXT_COLOR - : DAY_OF_WEEK_UNCHECKED_TEXT_COLOR); - updateDialog(); } @@ -1115,9 +1121,9 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.repeatMonthlyByNthDayOfMonth) { - mModel.monthlyRepeat = Model.MONTHLY_BY_DATE; + mModel.monthlyRepeat = RecurrenceModel.MONTHLY_BY_DATE; } else if (checkedId == R.id.repeatMonthlyByNthDayOfTheWeek) { - mModel.monthlyRepeat = Model.MONTHLY_BY_NTH_DAY_OF_WEEK; + mModel.monthlyRepeat = RecurrenceModel.MONTHLY_BY_NTH_DAY_OF_WEEK; } updateDialog(); } @@ -1138,13 +1144,12 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mDatePickerDialog.show(getFragmentManager(), FRAG_TAG_DATE_PICKER); } else if (mDone == v) { String rrule; - if (mModel.freq == Model.FREQ_NONE) { + if (mModel.recurrenceState == RecurrenceModel.STATE_NO_RECURRENCE) { rrule = null; } else { copyModelToEventRecurrence(mModel, mRecurrence); rrule = mRecurrence.toString(); } - mRecurrenceSetListener.onRecurrenceSet(rrule); dismiss(); } @@ -1167,4 +1172,143 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele public void setOnRecurrenceSetListener(OnRecurrenceSetListener l) { mRecurrenceSetListener = l; } + + private class EndSpinnerAdapter extends ArrayAdapter<CharSequence> { + final String END_DATE_MARKER = "%s"; + final String END_COUNT_MARKER = "%d"; + + private LayoutInflater mInflater; + private int mItemResourceId; + private int mTextResourceId; + private ArrayList<CharSequence> mStrings; + private String mEndDateString; + private boolean mUseFormStrings; + + /** + * @param context + * @param textViewResourceId + * @param objects + */ + public EndSpinnerAdapter(Context context, ArrayList<CharSequence> strings, + int itemResourceId, int textResourceId) { + super(context, itemResourceId, strings); + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mItemResourceId = itemResourceId; + mTextResourceId = textResourceId; + mStrings = strings; + mEndDateString = getResources().getString(R.string.recurrence_end_date); + + // If either date or count strings don't translate well, such that we aren't assured + // to have some text available to be placed in the spinner, then we'll have to use + // the more form-like versions of both strings instead. + int markerStart = mEndDateString.indexOf(END_DATE_MARKER); + if (markerStart <= 0) { + // The date string does not have any text before the "%s" so we'll have to use the + // more form-like strings instead. + mUseFormStrings = true; + } else { + String countEndStr = getResources().getQuantityString( + R.plurals.recurrence_end_count, 1); + markerStart = countEndStr.indexOf(END_COUNT_MARKER); + if (markerStart <= 0) { + // The count string does not have any text before the "%d" so we'll have to use + // the more form-like strings instead. + mUseFormStrings = true; + } + } + + if (mUseFormStrings) { + // We'll have to set the layout for the spinner to be weight=0 so it doesn't + // take up too much space. + mEndSpinner.setLayoutParams( + new TableLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f)); + } + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + View v; + // Check if we can recycle the view + if (convertView == null) { + v = mInflater.inflate(mTextResourceId, parent, false); + } else { + v = convertView; + } + + TextView item = (TextView) v.findViewById(R.id.spinner_item); + int markerStart; + switch (position) { + case RecurrenceModel.END_NEVER: + item.setText(mStrings.get(RecurrenceModel.END_NEVER)); + break; + case RecurrenceModel.END_BY_DATE: + markerStart = mEndDateString.indexOf(END_DATE_MARKER); + + if (markerStart != -1) { + if (mUseFormStrings || markerStart == 0) { + // If we get here, the translation of "Until" doesn't work correctly, + // so we'll just set the whole "Until a date" string. + item.setText(mEndDateLabel); + } else { + if (mEndDateString.charAt(markerStart - 1) == ' ') { + markerStart--; + } + item.setText(mEndDateString.subSequence(0, markerStart)); + } + } + break; + case RecurrenceModel.END_BY_COUNT: + String endString = mResources.getQuantityString(R.plurals.recurrence_end_count, + mModel.endCount); + markerStart = endString.indexOf(END_COUNT_MARKER); + + if (markerStart != -1) { + if (mUseFormStrings || markerStart == 0) { + // If we get here, the translation of "For" doesn't work correctly, + // so we'll just set the whole "For a number of events" string. + item.setText(mEndCountLabel); + // Also, we'll hide the " events" that would have been at the end. + mPostEndCount.setVisibility(View.GONE); + // Use this flag so the onItemSelected knows whether to show it later. + mHidePostEndCount = true; + } else { + int postTextStart = markerStart + END_COUNT_MARKER.length(); + if (endString.charAt(postTextStart) == ' ') { + postTextStart++; + } + mPostEndCount.setText(endString.subSequence(postTextStart, + endString.length())); + // In case it's a recycled view that wasn't visible. + mPostEndCount.setVisibility(View.VISIBLE); + if (endString.charAt(markerStart - 1) == ' ') { + markerStart--; + } + item.setText(endString.subSequence(0, markerStart)); + } + } + break; + default: + v = null; + break; + } + + return v; + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + View v; + // Check if we can recycle the view + if (convertView == null) { + v = mInflater.inflate(mItemResourceId, parent, false); + } else { + v = convertView; + } + + TextView item = (TextView) v.findViewById(R.id.spinner_item); + item.setText(mStrings.get(position)); + + return v; + } + } } |