diff options
author | James Kung <kingkung@google.com> | 2013-05-10 18:04:53 -0700 |
---|---|---|
committer | James Kung <kingkung@google.com> | 2013-05-10 18:57:15 -0700 |
commit | d1db03631de67104f7d3b3da73eaeec28a80aef2 (patch) | |
tree | 41e1581102eb9c98e6c04dce06be1417d6e7b484 | |
parent | a191a694a075e1f2ee8b2755e9fe379194529f9c (diff) | |
download | Calendar-d1db03631de67104f7d3b3da73eaeec28a80aef2.tar.gz |
Solution for recurrence spinner issues
Bug: 8895602
Change-Id: I22b71def459fe8fc9ccf6b60144a5341d4db4655
-rw-r--r-- | res/layout/recurrencepicker.xml | 3 | ||||
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java | 39 |
3 files changed, 16 insertions, 32 deletions
diff --git a/res/layout/recurrencepicker.xml b/res/layout/recurrencepicker.xml index cfe4b6a2..9ad5a0d3 100644 --- a/res/layout/recurrencepicker.xml +++ b/res/layout/recurrencepicker.xml @@ -223,6 +223,7 @@ android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="bottom" + android:singleLine="true" android:layout_marginBottom="-3dp" android:visibility="gone" /> @@ -234,6 +235,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" + android:singleLine="true" + android:minWidth="80dp" android:contentDescription="@string/acessibility_recurrence_choose_end_date_description" android:gravity="center_horizontal|bottom" android:layout_marginTop="3dp" diff --git a/res/values/strings.xml b/res/values/strings.xml index 5a71aae7..49bcf874 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -718,16 +718,16 @@ <!-- Repeat an monthly event on the same day of every month [CHAR LIMIT=20] --> <string name="recurrence_month_pattern_by_day">on the same day each month</string> - <!-- Specifies that a repeating event to repeat forever (based on the defined frequency) instead of ending at a future date[CHAR LIMIT=25] --> + <!-- Specifies that a repeating event to repeat forever (based on the defined frequency) instead of ending at a future date[CHAR LIMIT=20] --> <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">Until a date</string> - <!-- Specifies that a repeating event to repeat until a certain date[CHAR LIMIT=25] --> + <!-- Specifies that a repeating event to repeat until a certain date[CHAR LIMIT=20] --> <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">For a number of events</string> - <!-- Specifies that a repeating event should repeat for a certain number of iterations. --> + <!-- Specifies that a repeating event should repeat for a certain number of iterations. [CHAR LIMIT=20]--> <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> diff --git a/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java b/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java index 580d2111..a11591f6 100644 --- a/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java +++ b/src/com/android/calendar/recurrencepicker/RecurrencePickerDialog.java @@ -34,8 +34,8 @@ 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.ViewGroup.LayoutParams; import android.view.Window; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; @@ -56,7 +56,6 @@ 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; @@ -1012,17 +1011,9 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mIntervalPreText.setText(""); } else { int postTextStart = markerStart + INTERVAL_COUNT_MARKER.length(); - if (postTextStart < intervalString.length() && - intervalString.charAt(postTextStart) == ' ') { - postTextStart++; - } - mIntervalPostText.setText(intervalString.subSequence(postTextStart, - intervalString.length())); - - if (intervalString.charAt(markerStart - 1) == ' ') { - markerStart--; - } - mIntervalPreText.setText(intervalString.subSequence(0, markerStart)); + mIntervalPostText.setText(intervalString.substring(postTextStart, + intervalString.length()).trim()); + mIntervalPreText.setText(intervalString.substring(0, markerStart).trim()); } } } @@ -1042,12 +1033,8 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele 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())); + mPostEndCount.setText(endString.substring(postTextStart, + endString.length()).trim()); } } } @@ -1256,10 +1243,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele // 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)); + item.setText(mEndDateString.substring(0, markerStart).trim()); } } break; @@ -1279,11 +1263,8 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele mHidePostEndCount = true; } else { int postTextStart = markerStart + END_COUNT_MARKER.length(); - if (endString.charAt(postTextStart) == ' ') { - postTextStart++; - } - mPostEndCount.setText(endString.subSequence(postTextStart, - endString.length())); + mPostEndCount.setText(endString.substring(postTextStart, + endString.length()).trim()); // In case it's a recycled view that wasn't visible. if (mModel.end == RecurrenceModel.END_BY_COUNT) { mPostEndCount.setVisibility(View.VISIBLE); @@ -1291,7 +1272,7 @@ public class RecurrencePickerDialog extends DialogFragment implements OnItemSele if (endString.charAt(markerStart - 1) == ' ') { markerStart--; } - item.setText(endString.subSequence(0, markerStart)); + item.setText(endString.substring(0, markerStart).trim()); } } break; |