show proper strings at yearly repetition

This commit is contained in:
tibbi 2018-05-10 13:59:16 +02:00
parent e33054be98
commit 6c2cbb6414
3 changed files with 10 additions and 4 deletions

View File

@ -46,7 +46,7 @@ ext {
}
dependencies {
implementation 'com.simplemobiletools:commons:4.0.1'
implementation 'com.simplemobiletools:commons:4.0.2'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.android.support:multidex:1.0.3'

View File

@ -307,7 +307,8 @@ class EventActivity : SimpleActivity() {
}
private fun getAvailableYearlyRepetitionRules(): ArrayList<RadioItem> {
val items = arrayListOf(RadioItem(REPEAT_SAME_DAY, getString(R.string.repeat_on_the_same_day_monthly)))
val items = arrayListOf(RadioItem(REPEAT_SAME_DAY, getString(R.string.repeat_on_the_same_day_yearly)))
items.add(RadioItem(REPEAT_ORDER_WEEKDAY, getRepeatXthDayInMonthString(true, REPEAT_ORDER_WEEKDAY)))
return items
}
@ -367,6 +368,12 @@ class EventActivity : SimpleActivity() {
})
}
private fun getRepeatXthDayInMonthString(includeBase: Boolean, repeatRule: Int): String {
val weekDayString = getRepeatXthDayString(includeBase, repeatRule)
val monthString = resources.getStringArray(R.array.in_months)[mEventStartDateTime.monthOfYear - 1]
return "$weekDayString $monthString"
}
private fun setRepeatRule(rule: Int) {
mRepeatRule = rule
checkRepetitionRuleText()
@ -405,6 +412,7 @@ class EventActivity : SimpleActivity() {
private fun getYearlyRepetitionRuleText() = when (mRepeatRule) {
REPEAT_SAME_DAY -> getString(R.string.the_same_day)
REPEAT_ORDER_WEEKDAY -> getRepeatXthDayInMonthString(false, mRepeatRule)
else -> ""
}

View File

@ -304,9 +304,7 @@
android:layout_toEndOf="@+id/event_repetition_rule_label"
android:layout_toRightOf="@+id/event_repetition_rule_label"
android:clickable="false"
android:ellipsize="end"
android:gravity="end"
android:lines="1"
android:padding="@dimen/activity_margin"
android:text="@string/every_day"
android:textSize="@dimen/day_text_size"/>