diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java
index 00daa9257..340481810 100644
--- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java
+++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/PrefsDelegate.java
@@ -159,18 +159,10 @@ public class PrefsDelegate extends DelegateBase
protected void onResume()
{
super.onResume();
- SharedPreferences sp = getSharedPreferences();
- sp.registerOnSharedPreferenceChangeListener( this );
+ getSharedPreferences().registerOnSharedPreferenceChangeListener( this );
// It's too early somehow to do this in init() above
findViewById( R.id.prefs_menu ).setOnClickListener(this);
-
- String key = LocUtils.getString( mActivity, R.string.key_theme_which );
- if ( null == sp.getString( key, null ) ) {
- Resources res = mActivity.getResources();
- String[] vals = res.getStringArray( R.array.color_themes );
- sp.edit().putString( key, vals[0] ).commit();
- }
}
@Override
diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWListPreference.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWListPreference.java
index f1b86bf95..28d00ec93 100644
--- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWListPreference.java
+++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/XWListPreference.java
@@ -52,6 +52,13 @@ public class XWListPreference extends ListPreference {
@Override
public void setSummary( CharSequence summary )
{
+ CharSequence[] entries = getEntries();
+ if ( null != entries ) {
+ int indx = findIndexOfValue( summary.toString() );
+ if ( 0 <= indx && indx < entries.length ) {
+ summary = entries[indx];
+ }
+ }
String xlated = LocUtils.xlateString( getContext(), summary.toString() );
if ( null != xlated ) {
summary = xlated;
diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommonPrefs.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommonPrefs.java
index 55a2df513..6519b8606 100644
--- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommonPrefs.java
+++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/CommonPrefs.java
@@ -109,19 +109,28 @@ public class CommonPrefs extends XWPrefs {
int strsID = R.array.color_ids_light;
String which = LocUtils.getString( context, R.string.key_theme_which );
which = sp.getString( which, null );
- if ( null == which ) {
- // do nothing
- } else if ( which.equals( LocUtils.getString( context,
- R.string.color_use_theme_light ) ) ) {
- // do nothing
- } else if ( which.equals( LocUtils.getString( context,
- R.string.color_use_theme_dark ) ) ) {
- strsID = R.array.color_ids_dark;
- } else {
- int uiMode = res.getConfiguration().uiMode;
- if ( Configuration.UI_MODE_NIGHT_YES
- == (uiMode & Configuration.UI_MODE_NIGHT_MASK) ) {
- strsID = R.array.color_ids_dark;
+ if ( null != which ) {
+ try {
+ switch ( Integer.parseInt( which ) ) {
+ case 0:
+ // do nothing
+ break;
+ case 1:
+ strsID = R.array.color_ids_dark;
+ break;
+ case 2:
+ int uiMode = res.getConfiguration().uiMode;
+ if ( Configuration.UI_MODE_NIGHT_YES
+ == (uiMode & Configuration.UI_MODE_NIGHT_MASK) ) {
+ strsID = R.array.color_ids_dark;
+ }
+ break;
+ default:
+ Assert.failDbg();
+ }
+ } catch ( Exception ex ) {
+ // Will happen with old not-an-int saved value
+ Log.ex( TAG, ex );
}
}
String[] colorStrIds = res.getStringArray( strsID );
diff --git a/xwords4/android/app/src/main/res/values-v29/common_rsrc.xml b/xwords4/android/app/src/main/res/values-v29/common_rsrc.xml
index 6c29f78b4..931024028 100644
--- a/xwords4/android/app/src/main/res/values-v29/common_rsrc.xml
+++ b/xwords4/android/app/src/main/res/values-v29/common_rsrc.xml
@@ -3,9 +3,15 @@
tools:ignore="MissingTranslation"
>
- - @string/color_use_theme_os
- @string/color_use_theme_light
- @string/color_use_theme_dark
+ - @string/color_use_theme_os
+
+ - 0
+ - 1
+ - 2
+
+ 2
diff --git a/xwords4/android/app/src/main/res/values/common_rsrc.xml b/xwords4/android/app/src/main/res/values/common_rsrc.xml
index b705c7e80..307c13d9b 100644
--- a/xwords4/android/app/src/main/res/values/common_rsrc.xml
+++ b/xwords4/android/app/src/main/res/values/common_rsrc.xml
@@ -387,6 +387,11 @@
- @string/color_use_theme_light
- @string/color_use_theme_dark
+
+ - 0
+ - 1
+
+ 0
diff --git a/xwords4/android/app/src/main/res/xml/prefs_appear_themes.xml b/xwords4/android/app/src/main/res/xml/prefs_appear_themes.xml
index 43aec48bc..4b737d1a9 100644
--- a/xwords4/android/app/src/main/res/xml/prefs_appear_themes.xml
+++ b/xwords4/android/app/src/main/res/xml/prefs_appear_themes.xml
@@ -11,7 +11,8 @@
android:key="@string/key_theme_which"
android:title="@string/theme_which"
android:entries="@array/color_themes"
- android:entryValues="@array/color_themes"
+ android:entryValues="@array/color_themes_vals"
+ android:defaultValue="@string/theme_which_default"
/>