Avoid unnecessary complication and user locale's first day of week
This commit is contained in:
parent
bd9fd4879a
commit
b94c69160f
1 changed files with 1 additions and 7 deletions
|
@ -31,13 +31,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
|
||||
var firstDayOfWeek: Int
|
||||
get() {
|
||||
val calendar = Calendar.getInstance(Locale.getDefault())
|
||||
val firstDayOfWeek = calendar.firstDayOfWeek
|
||||
val defaultFirstDayOfWeek = if (isSundayFirst && firstDayOfWeek == Calendar.SUNDAY) {
|
||||
calendar.firstDayOfWeek
|
||||
} else {
|
||||
Calendar.MONDAY
|
||||
}
|
||||
val defaultFirstDayOfWeek = Calendar.getInstance(Locale.getDefault()).firstDayOfWeek
|
||||
return prefs.getInt(FIRST_DAY_OF_WEEK, getJodaDayOfWeekFromJava(defaultFirstDayOfWeek))
|
||||
}
|
||||
set(firstDayOfWeek) = prefs.edit().putInt(FIRST_DAY_OF_WEEK, firstDayOfWeek).apply()
|
||||
|
|
Loading…
Reference in a new issue