mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-16 20:00:39 +01:00
Migrate user preference from previous version
This commit is contained in:
parent
2eb2ec398e
commit
7a45c38b5d
@ -31,7 +31,13 @@ class Config(context: Context) : BaseConfig(context) {
|
||||
|
||||
var firstDayOfWeek: Int
|
||||
get() {
|
||||
val defaultFirstDayOfWeek = Calendar.getInstance(Locale.getDefault()).firstDayOfWeek
|
||||
val calendar = Calendar.getInstance(Locale.getDefault())
|
||||
val firstDayOfWeek = calendar.firstDayOfWeek
|
||||
val defaultFirstDayOfWeek = if (isSundayFirst && firstDayOfWeek == Calendar.SUNDAY) {
|
||||
calendar.firstDayOfWeek
|
||||
} else {
|
||||
Calendar.MONDAY
|
||||
}
|
||||
return prefs.getInt(FIRST_DAY_OF_WEEK, getJodaDayOfWeekFromJava(defaultFirstDayOfWeek))
|
||||
}
|
||||
set(firstDayOfWeek) = prefs.edit().putInt(FIRST_DAY_OF_WEEK, firstDayOfWeek).apply()
|
||||
|
Loading…
x
Reference in New Issue
Block a user