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 fa5dc1bc2..436fb8e74 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -211,10 +211,30 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { private fun checkRepetitionRuleText() { if (isXWeeklyRepetition()) { - event_repetition_rule.text = getString(if (mRepeatRule == EVERY_DAY) R.string.every_day else R.string.selected_days) + event_repetition_rule.text = if (mRepeatRule == EVERY_DAY) getString(R.string.every_day) else getSelectedDaysString() } } + private fun getSelectedDaysString(): String { + var days = "" + if (mRepeatRule and MONDAY != 0) + days += "${getString(R.string.monday).substringTo(3)}, " + if (mRepeatRule and TUESDAY != 0) + days += "${getString(R.string.tuesday).substringTo(3)}, " + if (mRepeatRule and WEDNESDAY != 0) + days += "${getString(R.string.wednesday).substringTo(3)}, " + if (mRepeatRule and THURSDAY != 0) + days += "${getString(R.string.thursday).substringTo(3)}, " + if (mRepeatRule and FRIDAY != 0) + days += "${getString(R.string.friday).substringTo(3)}, " + if (mRepeatRule and SATURDAY != 0) + days += "${getString(R.string.saturday).substringTo(3)}, " + if (mRepeatRule and SUNDAY != 0) + days += "${getString(R.string.sunday).substringTo(3)}, " + + return days.trim().trimEnd(',') + } + private fun showEventTypeDialog() { hideKeyboard() SelectEventTypeDialog(this, mEventTypeId) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/String.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/String.kt new file mode 100644 index 000000000..41e61aef3 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/String.kt @@ -0,0 +1,8 @@ +package com.simplemobiletools.calendar.extensions + +fun String.substringTo(cnt: Int): String { + return if (isEmpty()) { + "" + } else + substring(0, Math.min(length, cnt)) +} diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 915913bb3..f851419c5 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -251,10 +251,8 @@