mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
replace the last of the context.getString(...) calls with LocUtils.getString(context,...)
This commit is contained in:
parent
ce59793458
commit
96c7f301d0
15 changed files with 40 additions and 25 deletions
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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<Void, Void, String[]> {
|
||||
|
||||
public interface NoNameFound {
|
||||
|
@ -55,8 +57,8 @@ public class RefreshNamesTask extends AsyncTask<Void, Void, String[]> {
|
|||
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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue