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 f28c2860a..071907635 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -183,10 +183,15 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { private fun checkRepetitionLimitText() { event_repetition_limit.text = if (mRepeatLimit == 0) { + event_repetition_limit_label.text = getString(R.string.repeat) resources.getString(R.string.forever) - } else { + } else if (mRepeatLimit > 0) { + event_repetition_limit_label.text = getString(R.string.repeat_till) val repeatLimitDateTime = Formatter.getDateTimeFromTS(mRepeatLimit) Formatter.getFullDate(applicationContext, repeatLimitDateTime) + } else { + event_repetition_limit_label.text = getString(R.string.repeat) + "${-mRepeatLimit} ${getString(R.string.times)}" } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatTypePickerDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatTypePickerDialog.kt index fe077eb8e..124ab27ac 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatTypePickerDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/RepeatTypePickerDialog.kt @@ -27,10 +27,11 @@ class RepeatTypePickerDialog(val activity: Activity, var repeatLimit: Int, val s repeat_type_date.setOnClickListener { showRepetitionLimitDialog() } repeat_type_forever.setOnClickListener { callback(0); dialog.dismiss() } repeat_type_count.setOnClickListener { dialog_radio_view.check(R.id.repeat_type_x_times) } - dialog_radio_view.check(getCheckedItem()) } - if (repeatLimit < startTS) + view.dialog_radio_view.check(getCheckedItem()) + + if (repeatLimit in 1..startTS) repeatLimit = startTS updateRepeatLimitText() @@ -47,14 +48,15 @@ class RepeatTypePickerDialog(val activity: Activity, var repeatLimit: Int, val s private fun getCheckedItem(): Int { return if (repeatLimit > 0) R.id.repeat_type_till_date - else if (repeatLimit < 0) - R.id.repeat_type_count - else + else if (repeatLimit < 0) { + view.repeat_type_count.setText((-repeatLimit).toString()) + R.id.repeat_type_x_times + } else R.id.repeat_type_forever } private fun updateRepeatLimitText() { - if (repeatLimit == 0) + if (repeatLimit <= 0) repeatLimit = (System.currentTimeMillis() / 1000).toInt() val repeatLimitDateTime = Formatter.getDateTimeFromTS(repeatLimit)