Skip to content
This repository was archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Turning Auto dark mode on should flip the dark mode switch too. #44
Browse files Browse the repository at this point in the history
  • Loading branch information
afollestad committed May 19, 2019
1 parent 8fa26cf commit 9d111ce
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ class SettingsUiFragment : BaseSettingsFragment(), TimeCallback {

val darkModeAutomaticEntry = findPreference(PREF_DARK_MODE_AUTOMATIC) as SwitchPreference
darkModeAutomaticEntry.setOnPreferenceChangeListener { _, newValue ->
darkModeAutoPref.set(newValue as Boolean)
if (newValue as Boolean) {
darkModeEntry.isChecked = true
}
darkModeAutoPref.set(newValue)
true
}
darkModeAutoPref.observe()
Expand All @@ -88,7 +91,7 @@ class SettingsUiFragment : BaseSettingsFragment(), TimeCallback {
.subscribe {
val formattedTime = timeFormatter().format(currentDateWithTime(it))
darkModeStartEntry.summary =
getString(R.string.setting_dark_mode_automatic_start_desc, formattedTime)
getString(R.string.setting_dark_mode_automatic_start_desc, formattedTime)
}
.attachLifecycle(this)

Expand All @@ -100,7 +103,7 @@ class SettingsUiFragment : BaseSettingsFragment(), TimeCallback {
.subscribe {
val formattedTime = timeFormatter().format(currentDateWithTime(it))
darkModeEndEntry.summary =
getString(R.string.setting_dark_mode_automatic_end_desc, formattedTime)
getString(R.string.setting_dark_mode_automatic_end_desc, formattedTime)
}
.attachLifecycle(this)
}
Expand Down

0 comments on commit 9d111ce

Please sign in to comment.