Skip to content

Commit 4ee8529

Browse files
committed
Handle unsupported widget theme
1 parent da0454b commit 4ee8529

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

app/src/main/java/com/orgzly/android/prefs/AppPreferences.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,9 +773,19 @@ public static boolean keepScreenOnMenuItem(Context context) {
773773
*/
774774

775775
public static String widgetColorScheme(Context context) {
776-
return getDefaultSharedPreferences(context).getString(
776+
String scheme = getDefaultSharedPreferences(context).getString(
777777
context.getResources().getString(R.string.pref_key_widget_color_scheme),
778778
context.getResources().getString(R.string.pref_default_widget_color_scheme));
779+
780+
// FIXME: Return scheme found in preferences if it's supported, or the first one if not.
781+
String[] schemes = context.getResources().getStringArray(R.array.widget_color_scheme_values);
782+
for (String s : schemes) {
783+
if (s.equals(scheme)) {
784+
return scheme;
785+
}
786+
}
787+
788+
return schemes[0];
779789
}
780790

781791
public static int widgetOpacity(Context context) {

0 commit comments

Comments
 (0)