update the weekly repetition day if its a single day and start date changes

This commit is contained in:
tibbi 2017-05-05 22:29:21 +02:00
parent 9e4ab1e667
commit a956a18e6e
1 changed files with 10 additions and 0 deletions

View File

@ -469,6 +469,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
updateEndDateText() updateEndDateText()
updateEndTimeText() updateEndTimeText()
} }
checkWeeklyRepeatRule()
} else { } else {
mEventEndDateTime = mEventEndDateTime.withDate(year, month + 1, day) mEventEndDateTime = mEventEndDateTime.withDate(year, month + 1, day)
updateEndDateText() updateEndDateText()
@ -491,6 +492,15 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
} }
} }
private fun checkWeeklyRepeatRule() {
if (isXWeeklyRepetition()) {
val day = mRepeatRule
if (day == MONDAY || day == TUESDAY || day == WEDNESDAY || day == THURSDAY || day == FRIDAY || day == SATURDAY || day == SUNDAY) {
setRepeatRule(Math.pow(2.0, (mEventStartDateTime.dayOfWeek - 1).toDouble()).toInt())
}
}
}
private fun updateIconColors() { private fun updateIconColors() {
event_time_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) event_time_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_repetition_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN) event_repetition_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)