show the selected days at weekly repetition
This commit is contained in:
parent
c55762745b
commit
3c45e960ad
|
@ -211,10 +211,30 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
||||||
|
|
||||||
private fun checkRepetitionRuleText() {
|
private fun checkRepetitionRuleText() {
|
||||||
if (isXWeeklyRepetition()) {
|
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() {
|
private fun showEventTypeDialog() {
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
SelectEventTypeDialog(this, mEventTypeId) {
|
SelectEventTypeDialog(this, mEventTypeId) {
|
||||||
|
|
|
@ -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))
|
||||||
|
}
|
|
@ -251,10 +251,8 @@
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/event_repetition_rule_label"
|
android:id="@+id/event_repetition_rule_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toLeftOf="@+id/event_repetition_rule"
|
|
||||||
android:layout_toStartOf="@+id/event_repetition_rule"
|
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingBottom="@dimen/activity_margin"
|
android:paddingBottom="@dimen/activity_margin"
|
||||||
android:paddingTop="@dimen/activity_margin"
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
@ -263,11 +261,16 @@
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyTextView
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
android:id="@+id/event_repetition_rule"
|
android:id="@+id/event_repetition_rule"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_toEndOf="@+id/event_repetition_rule_label"
|
||||||
|
android:layout_toRightOf="@+id/event_repetition_rule_label"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="end"
|
||||||
|
android:lines="1"
|
||||||
android:padding="@dimen/activity_margin"
|
android:padding="@dimen/activity_margin"
|
||||||
android:text="@string/every_day"
|
android:text="@string/every_day"
|
||||||
android:textSize="@dimen/day_text_size"/>
|
android:textSize="@dimen/day_text_size"/>
|
||||||
|
|
Loading…
Reference in New Issue