mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-01-30 18:34:52 +01:00
add proper logic at yearly repetition rules
This commit is contained in:
parent
8218bfb190
commit
5fabba4032
@ -424,8 +424,7 @@ class EventActivity : SimpleActivity() {
|
||||
|
||||
private fun getYearlyRepetitionRuleText() = when (mRepeatRule) {
|
||||
REPEAT_SAME_DAY -> getString(R.string.the_same_day)
|
||||
REPEAT_ORDER_WEEKDAY -> getRepeatXthDayInMonthString(false, mRepeatRule)
|
||||
else -> ""
|
||||
else -> getRepeatXthDayInMonthString(false, mRepeatRule)
|
||||
}
|
||||
|
||||
private fun showEventTypeDialog() {
|
||||
|
@ -29,11 +29,15 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
|
||||
else -> {
|
||||
val currStart = Formatter.getDateTimeFromTS(startTS)
|
||||
val newStart = when {
|
||||
repeatInterval % YEAR == 0 -> currStart.plusYears(repeatInterval / YEAR)
|
||||
repeatInterval % YEAR == 0 -> when (repeatRule) {
|
||||
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false)
|
||||
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true)
|
||||
else -> currStart.plusYears(repeatInterval / YEAR)
|
||||
}
|
||||
repeatInterval % MONTH == 0 -> when (repeatRule) {
|
||||
REPEAT_SAME_DAY -> addMonthsWithSameDay(currStart, original)
|
||||
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true)
|
||||
REPEAT_ORDER_WEEKDAY -> addXthDayInterval(currStart, original, false)
|
||||
REPEAT_ORDER_WEEKDAY_USE_LAST -> addXthDayInterval(currStart, original, true)
|
||||
else -> currStart.plusMonths(repeatInterval / MONTH).dayOfMonth().withMaximumValue()
|
||||
}
|
||||
repeatInterval % WEEK == 0 -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user