Avoid unnecessary complication and user locale's first day of week

This commit is contained in:
Naveen 2023-07-24 00:26:31 +05:30
parent bd9fd4879a
commit b94c69160f
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3

View file

@ -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()