From e799474e00134188acf2a4577815f057fd785f9c Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 21 Mar 2019 09:13:38 -0700 Subject: [PATCH] always respect user's local player name --- .../main/java/org/eehouse/android/xw4/jni/CommonPrefs.java | 3 +++ .../main/java/org/eehouse/android/xw4/jni/LocalPlayer.java | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) 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 6890c1eb2..ec56b5658 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 @@ -27,11 +27,14 @@ import android.os.Build; import android.preference.PreferenceManager; import org.eehouse.android.xw4.DictUtils; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.XWPrefs; import org.eehouse.android.xw4.loc.LocUtils; public class CommonPrefs extends XWPrefs { + private static final String TAG = CommonPrefs.class.getSimpleName(); + public static final int COLOR_TILE_BACK = 0; public static final int COLOR_NOTILE = 1; public static final int COLOR_FOCUS = 2; diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java index df88fd073..44cb22b1e 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/LocalPlayer.java @@ -22,15 +22,16 @@ package org.eehouse.android.xw4.jni; import android.content.Context; import android.text.TextUtils; - import java.io.Serializable; import org.eehouse.android.xw4.Assert; import org.eehouse.android.xw4.BuildConfig; +import org.eehouse.android.xw4.Log; import org.eehouse.android.xw4.R; import org.eehouse.android.xw4.Utils; public class LocalPlayer implements Serializable { + private static final String TAG = LocalPlayer.class.getSimpleName(); public String name; public String password; public String dictName; @@ -42,8 +43,8 @@ public class LocalPlayer implements Serializable { { isLocal = true; robotIQ = 0; // human - String fmt = context.getString( R.string.player_fmt); - name = String.format( fmt, num + 1 ); + name = CommonPrefs.getDefaultPlayerName( context, num, true ); + Log.d( TAG, "__init(%d) => %s", num, name ); password = ""; // Utils.testSerialization( this );