From 5c01bee1ae46ca7897ea9f4e867b89eddb6c1e40 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 7 May 2017 16:37:07 +0200 Subject: [PATCH] add a helper function for checking if its an X monthly repetition --- .../calendar/activities/EventActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index f0d0864d0..fc15f4c3e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -206,10 +206,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { private fun showRepetitionRuleDialog() { hideKeyboard() - if (isXWeeklyRepetition()) { - RepeatRuleDailyDialog(this, mRepeatRule) { - setRepeatRule(it) - } + RepeatRuleDailyDialog(this, mRepeatRule) { + setRepeatRule(it) } } @@ -316,6 +314,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { private fun isXWeeklyRepetition() = mRepeatInterval != 0 && mRepeatInterval % WEEK == 0 + private fun isXMonthlyRepetition() = mRepeatInterval != 0 && !isXWeeklyRepetition() && mRepeatInterval % MONTH == 0 + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_event, menu) menu.findItem(R.id.delete).isVisible = mEvent.id != 0