set the default daily rule to EVERY_DAY when daily repetition is selected
This commit is contained in:
parent
c166ce8f1c
commit
cfd40fd486
|
@ -151,6 +151,10 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
mRepeatInterval = interval
|
mRepeatInterval = interval
|
||||||
updateRepetitionText()
|
updateRepetitionText()
|
||||||
checkRepeatTexts(interval)
|
checkRepeatTexts(interval)
|
||||||
|
|
||||||
|
if (mRepeatInterval == DAY) {
|
||||||
|
setRepeatRule(EVERY_DAY)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkRepeatTexts(limit: Int) {
|
private fun checkRepeatTexts(limit: Int) {
|
||||||
|
@ -190,18 +194,22 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
private fun showRepetitionRuleDialog() {
|
private fun showRepetitionRuleDialog() {
|
||||||
if (mRepeatInterval == DAY) {
|
if (mRepeatInterval == DAY) {
|
||||||
RepeatRuleDailyDialog(this, mRepeatRule) {
|
RepeatRuleDailyDialog(this, mRepeatRule) {
|
||||||
mRepeatRule = it
|
setRepeatRule(it)
|
||||||
checkRepetitionRuleText()
|
|
||||||
if (it == 0) {
|
|
||||||
setRepeatInterval(0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setRepeatRule(rule: Int) {
|
||||||
|
mRepeatRule = rule
|
||||||
|
checkRepetitionRuleText()
|
||||||
|
if (rule == 0) {
|
||||||
|
setRepeatInterval(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkRepetitionRuleText() {
|
private fun checkRepetitionRuleText() {
|
||||||
if (mRepeatInterval == DAY) {
|
if (mRepeatInterval == DAY) {
|
||||||
event_repetition_rule.text = getString(if (mRepeatRule == 127) R.string.every_day else R.string.selected_days)
|
event_repetition_rule.text = getString(if (mRepeatRule == EVERY_DAY) R.string.every_day else R.string.selected_days)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ val THURSDAY = 8
|
||||||
val FRIDAY = 16
|
val FRIDAY = 16
|
||||||
val SATURDAY = 32
|
val SATURDAY = 32
|
||||||
val SUNDAY = 64
|
val SUNDAY = 64
|
||||||
val ALL_DAYS = 127
|
val EVERY_DAY = 127
|
||||||
|
|
||||||
// repeat_rule for monthly repetition
|
// repeat_rule for monthly repetition
|
||||||
val REPEAT_MONTH_SAME_DAY = 1
|
val REPEAT_MONTH_SAME_DAY = 1
|
||||||
|
|
|
@ -593,7 +593,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
||||||
do {
|
do {
|
||||||
val eventId = cursor.getIntValue(COL_EVENT_ID)
|
val eventId = cursor.getIntValue(COL_EVENT_ID)
|
||||||
val interval = cursor.getIntValue(COL_REPEAT_INTERVAL)
|
val interval = cursor.getIntValue(COL_REPEAT_INTERVAL)
|
||||||
var rule = ALL_DAYS
|
var rule = EVERY_DAY
|
||||||
if (interval == MONTH) {
|
if (interval == MONTH) {
|
||||||
rule = REPEAT_MONTH_SAME_DAY
|
rule = REPEAT_MONTH_SAME_DAY
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue