diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java index 8e1d7ae2e..ba89a4ddc 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java @@ -39,6 +39,7 @@ import org.eehouse.android.xw4.jni.DrawScoreInfo; import org.eehouse.android.xw4.jni.JNIThread; import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.jni.XwJNI.DictWrapper; +import org.eehouse.android.xw4.loc.LocUtils; import junit.framework.Assert; @@ -526,7 +527,7 @@ public class BoardCanvas extends Canvas implements DrawCtx { drawCentered( text, rect, null ); rect.offset( 0, rect.height() ); - drawCentered( m_context.getResources().getString( R.string.pts ), + drawCentered( LocUtils.getString( m_context, R.string.pts ), rect, null ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index d46146fc8..dd952f7c3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -52,7 +52,7 @@ import junit.framework.Assert; import org.eehouse.android.xw4.jni.*; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.DictUtils.DictLoc; - +import org.eehouse.android.xw4.loc.LocUtils; public class DBUtils { public static final int ROWID_NOTFOUND = -1; @@ -947,7 +947,8 @@ public class DBUtils { { HistoryPair[] result = null; if ( BuildConstants.CHAT_SUPPORTED ) { - final String localPrefix = context.getString( R.string.chat_local_id ); + final String localPrefix = + LocUtils.getString( context, R.string.chat_local_id ); String history = getChatHistoryStr( context, rowid ); if ( null != history ) { String[] msgs = history.split( "\n" ); @@ -1351,7 +1352,7 @@ public class DBUtils { if ( BuildConstants.CHAT_SUPPORTED ) { Assert.assertNotNull( msg ); int id = local ? R.string.chat_local_id : R.string.chat_other_id; - msg = context.getString( id ) + msg; + msg = LocUtils.getString( context, id ) + msg; String cur = getChatHistoryStr( context, rowid ); if ( null != cur ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java index 6ea233550..4fd01b2dd 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java @@ -40,6 +40,8 @@ import java.util.Iterator; import java.util.Set; import junit.framework.Assert; +import org.eehouse.android.xw4.loc.LocUtils; + public class DbgUtils { private static final String TAG = "XW4"; private static boolean s_doLog = BuildConfig.DEBUG; @@ -85,7 +87,7 @@ public class DbgUtils { public static void showf( Context context, int formatid, Object... args ) { - showf( context, context.getString( formatid ), args ); + showf( context, LocUtils.getString( context, formatid ), args ); } // showf public static void loge( Exception exception ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java index 55f062fe8..a069d8cc3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java @@ -60,6 +60,7 @@ import org.eehouse.android.xw4.jni.XwJNI; import org.eehouse.android.xw4.jni.JNIUtilsImpl; import org.eehouse.android.xw4.jni.GameSummary; import org.eehouse.android.xw4.DictUtils.DictLoc; +import org.eehouse.android.xw4.loc.LocUtils; public class DictsActivity extends ExpandableListActivity { @@ -165,9 +166,10 @@ public class DictsActivity extends ExpandableListActivity { .setOnMenuItemClickListener( listener ); // Add at top but save until have dal info - MenuItem curItem = - menu.add( context.getString( R.string.cur_menu_marker_fmt, - curDict ) ); + MenuItem curItem = + menu.add( LocUtils.getString( context, + R.string.cur_menu_marker_fmt, + curDict ) ); DictAndLoc[] dals = DictUtils.dictList( context ); for ( DictAndLoc dal : dals ) { diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameNamer.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameNamer.java index 303e14949..6b49fe763 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameNamer.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameNamer.java @@ -29,6 +29,8 @@ import android.widget.TextView; import junit.framework.Assert; +import org.eehouse.android.xw4.loc.LocUtils; + public class GameNamer extends LinearLayout { private Context m_context; @@ -52,7 +54,7 @@ public class GameNamer extends LinearLayout { public void setLabel( int id ) { - setLabel( m_context.getString( id ) ); + setLabel( LocUtils.getString( getContext(), id ) ); } public void setName( String text ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index b43b81964..a4c7c011f 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -588,7 +588,7 @@ public class GameUtils { int fmtId = choseEmail? R.string.invite_htm_fmt : R.string.invite_txt_fmt; int choiceID; - String message = activity.getString( fmtId, msgString ); + String message = LocUtils.getString( activity, fmtId, msgString ); Intent intent = new Intent(); if ( choseEmail ) { @@ -610,7 +610,7 @@ public class GameUtils { if ( null == attach ) { // no attachment intent.setType( "message/rfc822"); } else { - String mime = activity.getString( R.string.invite_mime ); + String mime = LocUtils.getString( activity, R.string.invite_mime ); intent.setType( mime ); Uri uri = Uri.fromFile( attach ); intent.putExtra( Intent.EXTRA_STREAM, uri ); @@ -624,7 +624,7 @@ public class GameUtils { choiceID = R.string.invite_chooser_sms; } - String choiceType = activity.getString( choiceID ); + String choiceType = LocUtils.getString( activity, choiceID ); String chooserMsg = LocUtils.getString( activity, R.string.invite_chooser_fmt, choiceType ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java index 2d15e4796..e1707c6e0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java @@ -139,7 +139,7 @@ public class MultiService { String inviter = intent.getStringExtra( INVITER ); int msgID = (null == inviter) ? R.string.invite_dict_missing_body_noname_fmt : R.string.invite_dict_missing_body_fmt; - String msg = context.getString( msgID, inviter, dict, langStr ); + String msg = LocUtils.getString( context, msgID, inviter, dict, langStr ); return LocUtils.makeAlertBuilder( context ) .setTitle( R.string.invite_dict_missing_title ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java index a4a0d98b5..aaa412b49 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java @@ -145,7 +145,7 @@ public class NFCUtils { private static NdefMessage makeMessage( Activity activity, String data ) { - String mimeType = activity.getString( R.string.xwords_nfc_mime ); + String mimeType = LocUtils.getString( activity, R.string.xwords_nfc_mime ); NdefMessage msg = new NdefMessage( new NdefRecord[] { new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeType.getBytes(), new byte[0], diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java index 1b4d1934e..30c1792aa 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java @@ -30,6 +30,7 @@ import java.io.InputStream; import org.json.JSONObject; import junit.framework.Assert; +import org.eehouse.android.xw4.loc.LocUtils; public class NetLaunchInfo { public String room; @@ -137,8 +138,8 @@ public class NetLaunchInfo { Uri.Builder ub = new Uri.Builder() .scheme( "http" ) .path( String.format( "//%s%s", - context.getString(R.string.invite_host), - context.getString(R.string.invite_prefix) ) ) + LocUtils.getString(context, R.string.invite_host), + LocUtils.getString(context, R.string.invite_prefix) ) ) .appendQueryParameter( "lang", String.format("%d", lang ) ) .appendQueryParameter( "np", String.format( "%d", nPlayersT ) ) .appendQueryParameter( "room", room ) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java index fe98d8157..a37d61529 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java @@ -31,6 +31,8 @@ import java.io.DataOutputStream; import java.util.ArrayList; import java.net.Socket; +import org.eehouse.android.xw4.loc.LocUtils; + public class RefreshNamesTask extends AsyncTask { public interface NoNameFound { @@ -55,8 +57,8 @@ public class RefreshNamesTask extends AsyncTask { m_lang = lang; m_nInGame = nInGame; - String msg = context.getString( R.string.public_names_progress_fmt, - nInGame, + String msg = LocUtils.getString( context, R.string.public_names_progress_fmt, + nInGame, DictLangCache.getLangName(context,lang) ); m_progress = ProgressDialog.show( context, msg, null, true, true ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java index c5664ce92..0fb6f3ac9 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java @@ -203,7 +203,7 @@ public class SMSService extends XWService { if ( null == s_showToasts ) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences( context ); - String key = context.getString( R.string.key_show_sms ); + String key = LocUtils.getString( context, R.string.key_show_sms ); s_showToasts = sp.getBoolean( key, false ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java index beff4c2be..14b471f1c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java @@ -335,7 +335,8 @@ public class UpdateCheckReceiver extends BroadcastReceiver { LocUtils.getString( m_context, R.string.new_app_avail_fmt, label ); String body = - m_context.getString( R.string.new_app_avail ); + LocUtils.getString( m_context, + R.string.new_app_avail ); Utils.postNotification( m_context, intent, title, body, url.hashCode() ); gotOne = true; diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWThumbListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWThumbListPreference.java index 404911de8..2fdf74c5c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWThumbListPreference.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWThumbListPreference.java @@ -23,6 +23,8 @@ package org.eehouse.android.xw4; import android.content.Context; import android.util.AttributeSet; +import org.eehouse.android.xw4.loc.LocUtils; + public class XWThumbListPreference extends XWListPreference { private Context m_context; @@ -39,8 +41,8 @@ public class XWThumbListPreference extends XWListPreference { CharSequence[] newEntries = new CharSequence[7]; int indx = 0; - newEntries[indx++] = m_context.getString( R.string.thumb_off ); - String suffix = m_context.getString( R.string.pct_suffix ); + newEntries[indx++] = LocUtils.getString( m_context, R.string.thumb_off ); + String suffix = LocUtils.getString( m_context, R.string.pct_suffix ); for ( int pct = 20; pct <= 45; pct += 5 ) { newEntries[indx++] = String.format( "%d%s", pct, suffix ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java index d1bdf364b..3cc05d760 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java @@ -120,13 +120,13 @@ public class CommonPrefs extends XWPrefs { private boolean getBoolean( Context context, SharedPreferences sp, int id, boolean dflt ) { - String key = context.getString( id ); + String key = LocUtils.getString( context, id ); return sp.getBoolean( key, dflt ); } private int prefToColor( Context context, SharedPreferences sp, int id ) { - String key = context.getString( id ); + String key = LocUtils.getString( context, id ); return 0xFF000000 | sp.getInt( key, 0 ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java index 6702ca968..922b8dcdf 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java @@ -250,7 +250,8 @@ public class CurGameInfo { public String[] visibleNames( boolean withDicts ) { - String nameFmt = withDicts? m_context.getString( R.string.name_dict_fmt ) + String nameFmt = withDicts? + LocUtils.getString( m_context, R.string.name_dict_fmt ) : "%s"; String[] names = new String[nPlayers]; for ( int ii = 0; ii < nPlayers; ++ii ) {