Skip to content

Commit

Permalink
Merge pull request orgzly#54 from Riyyi/master
Browse files Browse the repository at this point in the history
Disable widget opacity on unsupported color scheme
  • Loading branch information
amberin authored Nov 4, 2023
2 parents 63b81eb + cfbbbc7 commit f6ee716
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP

/* Update preferences which depend on multiple others. */
updateRemindersScreen()
updateWidgetScreen()
}

private fun setupVersionPreference() {
Expand Down Expand Up @@ -326,6 +327,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
}

updateRemindersScreen()
updateWidgetScreen()

/* Always notify about possibly changed data, if settings are modified.
*
Expand Down Expand Up @@ -363,6 +365,16 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
}
}

private fun updateWidgetScreen() {
val colorScheme = preference(R.string.pref_key_widget_color_scheme)

if (colorScheme != null) {
/* Widget opacity isn't supported on the dynamic color scheme. */
val opacityEnabled = (colorScheme as ListPreference).value != "dynamic"
preference(R.string.pref_key_widget_opacity)?.isEnabled = opacityEnabled
}
}

/**
* Update list of possible states that can be used as default for a new note.
*/
Expand Down

0 comments on commit f6ee716

Please sign in to comment.