Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2975e75

Browse files
committed
Merge pull request #286 from code-troopers/fix/282
fix #282 : Recurrence NPE on selected monthly recurrency + any last w…
2 parents 5e7960f + b8b4843 commit 2975e75

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

library/src/main/java/com/codetroopers/betterpickers/recurrencepicker/EventRecurrenceFormatter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@ public static String getRepeatString(Context context, Resources r, EventRecurren
103103
String details = "";
104104
if (recurrence.byday != null) {
105105
int weekday = EventRecurrence.day2CalendarDay(recurrence.byday[0]) - 1;
106-
int dayNumber = recurrence.bydayNum[0];
107106
// Cache this stuff so we won't have to redo work again later.
108107
cacheMonthRepeatStrings(r, weekday);
109108

109+
int dayNumber = recurrence.bydayNum[0];
110+
if(dayNumber == RecurrencePickerDialogFragment.LAST_NTH_DAY_OF_WEEK){
111+
dayNumber = 5;
112+
}
110113
details = mMonthRepeatByDayOfWeekStrs[weekday][dayNumber - 1];
111114
}
112115
return r.getQuantityString(R.plurals.monthly, interval, interval, details) + endString;

library/src/main/java/com/codetroopers/betterpickers/recurrencepicker/RecurrencePickerDialogFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class RecurrencePickerDialogFragment extends DialogFragment implements On
8484

8585
// Special cases in monthlyByNthDayOfWeek
8686
private static final int FIFTH_WEEK_IN_A_MONTH = 5;
87-
private static final int LAST_NTH_DAY_OF_WEEK = -1;
87+
public static final int LAST_NTH_DAY_OF_WEEK = -1;
8888

8989
private CalendarDatePickerDialogFragment mDatePickerDialog;
9090

0 commit comments

Comments
 (0)