always properly update repetition limit text
This commit is contained in:
parent
a0c73b7504
commit
86c88cd106
1 changed files with 14 additions and 5 deletions
|
@ -89,7 +89,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
mReminderMinutes = mEvent.reminderMinutes
|
mReminderMinutes = mEvent.reminderMinutes
|
||||||
mRepeatInterval = mEvent.repeatInterval
|
mRepeatInterval = mEvent.repeatInterval
|
||||||
mRepeatLimit = mEvent.repeatLimit
|
mRepeatLimit = mEvent.repeatLimit
|
||||||
checkRepeatLimitVisibility(mRepeatInterval)
|
checkRepeatLimit(mRepeatInterval)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupNewEvent(dateTime: DateTime) {
|
private fun setupNewEvent(dateTime: DateTime) {
|
||||||
|
@ -110,13 +110,14 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
EventRepeatIntervalDialog(this, mRepeatInterval) {
|
EventRepeatIntervalDialog(this, mRepeatInterval) {
|
||||||
mRepeatInterval = it
|
mRepeatInterval = it
|
||||||
updateRepetitionText()
|
updateRepetitionText()
|
||||||
checkRepeatLimitVisibility(it)
|
checkRepeatLimit(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkRepeatLimitVisibility(limit: Int) {
|
private fun checkRepeatLimit(limit: Int) {
|
||||||
event_repetition_limit.beGoneIf(limit == 0)
|
event_repetition_limit.beGoneIf(limit == 0)
|
||||||
event_repetition_limit_label.beGoneIf(limit == 0)
|
event_repetition_limit_label.beGoneIf(limit == 0)
|
||||||
|
checkRepetitionLimitText()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showRepetitionLimitDialog() {
|
private fun showRepetitionLimitDialog() {
|
||||||
|
@ -129,12 +130,20 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
private val repetitionLimitDateSetListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
|
private val repetitionLimitDateSetListener = DatePickerDialog.OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
|
||||||
val repeatLimitDateTime = DateTime().withDate(year, monthOfYear + 1, dayOfMonth).withTime(0, 0, 0, 0)
|
val repeatLimitDateTime = DateTime().withDate(year, monthOfYear + 1, dayOfMonth).withTime(0, 0, 0, 0)
|
||||||
if (repeatLimitDateTime.seconds() < mEvent.endTS) {
|
if (repeatLimitDateTime.seconds() < mEvent.endTS) {
|
||||||
event_repetition_limit.text = resources.getString(R.string.forever)
|
|
||||||
mRepeatLimit = 0
|
mRepeatLimit = 0
|
||||||
} else {
|
} else {
|
||||||
event_repetition_limit.text = Formatter.getDate(applicationContext, repeatLimitDateTime, false)
|
|
||||||
mRepeatLimit = repeatLimitDateTime.seconds()
|
mRepeatLimit = repeatLimitDateTime.seconds()
|
||||||
}
|
}
|
||||||
|
checkRepetitionLimitText()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkRepetitionLimitText() {
|
||||||
|
event_repetition_limit.text = if (mRepeatLimit == 0) {
|
||||||
|
resources.getString(R.string.forever)
|
||||||
|
} else {
|
||||||
|
val repeatLimitDateTime = Formatter.getDateTimeFromTS(mRepeatLimit)
|
||||||
|
Formatter.getDate(applicationContext, repeatLimitDateTime, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateReminderText() {
|
private fun updateReminderText() {
|
||||||
|
|
Loading…
Reference in a new issue