add a helper function for checking if its an X monthly repetition
This commit is contained in:
parent
4264156d3f
commit
5c01bee1ae
|
@ -206,12 +206,10 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
|
|
||||||
private fun showRepetitionRuleDialog() {
|
private fun showRepetitionRuleDialog() {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
if (isXWeeklyRepetition()) {
|
|
||||||
RepeatRuleDailyDialog(this, mRepeatRule) {
|
RepeatRuleDailyDialog(this, mRepeatRule) {
|
||||||
setRepeatRule(it)
|
setRepeatRule(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun setRepeatRule(rule: Int) {
|
private fun setRepeatRule(rule: Int) {
|
||||||
mRepeatRule = rule
|
mRepeatRule = rule
|
||||||
|
@ -316,6 +314,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
|
|
||||||
private fun isXWeeklyRepetition() = mRepeatInterval != 0 && mRepeatInterval % WEEK == 0
|
private fun isXWeeklyRepetition() = mRepeatInterval != 0 && mRepeatInterval % WEEK == 0
|
||||||
|
|
||||||
|
private fun isXMonthlyRepetition() = mRepeatInterval != 0 && !isXWeeklyRepetition() && mRepeatInterval % MONTH == 0
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
menuInflater.inflate(R.menu.menu_event, menu)
|
menuInflater.inflate(R.menu.menu_event, menu)
|
||||||
menu.findItem(R.id.delete).isVisible = mEvent.id != 0
|
menu.findItem(R.id.delete).isVisible = mEvent.id != 0
|
||||||
|
|
Loading…
Reference in New Issue