mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
remove format() in favor of LocUtils call
This commit is contained in:
parent
0b93e77018
commit
0ac951c096
16 changed files with 66 additions and 57 deletions
|
@ -46,6 +46,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.eehouse.android.xw4.MultiService.MultiEvent;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -433,8 +434,9 @@ public class BTService extends XWService {
|
|||
DBUtils.setName( context, rowid, gameName );
|
||||
}
|
||||
result = BTCmd.INVITE_ACCPT;
|
||||
String body = Utils.format( BTService.this,
|
||||
R.string.new_bt_body_fmt, sender );
|
||||
String body = LocUtils.getString( BTService.this,
|
||||
R.string.new_bt_body_fmt,
|
||||
sender );
|
||||
postNotification( gameID, R.string.new_bt_title, body, rowid );
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -41,6 +41,7 @@ import junit.framework.Assert;
|
|||
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.XwJNI;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class ConnStatusHandler {
|
||||
|
||||
|
@ -176,7 +177,8 @@ public class ConnStatusHandler {
|
|||
StringBuffer sb = new StringBuffer();
|
||||
synchronized( s_lockObj ) {
|
||||
String tmp = context.getString( connType2StrID( connType ) );
|
||||
sb.append( Utils.format( context, R.string.connstat_net_fmt,
|
||||
sb.append( LocUtils.getString( context,
|
||||
R.string.connstat_net_fmt,
|
||||
tmp ) );
|
||||
sb.append("\n\n");
|
||||
|
||||
|
@ -184,7 +186,7 @@ public class ConnStatusHandler {
|
|||
tmp = context.getString( record.successNewer?
|
||||
R.string.connstat_succ :
|
||||
R.string.connstat_unsucc );
|
||||
sb.append( Utils.format( context, R.string.connstat_lastsend_fmt,
|
||||
sb.append( LocUtils.getString( context, R.string.connstat_lastsend_fmt,
|
||||
tmp, record.newerStr( context ) ) );
|
||||
sb.append("\n");
|
||||
|
||||
|
@ -199,14 +201,14 @@ public class ConnStatusHandler {
|
|||
}
|
||||
}
|
||||
if ( 0 != fmtId ) {
|
||||
sb.append( Utils.format( context, fmtId,
|
||||
sb.append( LocUtils.getString( context, fmtId,
|
||||
record.olderStr( context ) ) );
|
||||
}
|
||||
sb.append( "\n\n" );
|
||||
|
||||
record = recordFor( connType, true );
|
||||
if ( record.haveSuccess() ) {
|
||||
sb.append( Utils.format( context,
|
||||
sb.append( LocUtils.getString( context,
|
||||
R.string.connstat_lastreceipt_fmt,
|
||||
record.newerStr( context ) ) );
|
||||
} else {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class DictBrowseActivity extends XWListActivity
|
|||
|
||||
int format = m_browseState.m_minShown == m_browseState.m_maxShown ?
|
||||
R.string.dict_browse_title1_fmt : R.string.dict_browse_title_fmt;
|
||||
setTitle( Utils.format( DictBrowseActivity.this, format,
|
||||
setTitle( LocUtils.getString( DictBrowseActivity.this, format,
|
||||
m_name, m_nWords, m_browseState.m_minShown,
|
||||
m_browseState.m_maxShown ));
|
||||
|
||||
|
@ -193,7 +193,7 @@ public class DictBrowseActivity extends XWListActivity
|
|||
// this is extended to include tile info -- it should
|
||||
// be -- then use an empty list elem and disable
|
||||
// search/minmax stuff.
|
||||
String msg = Utils.format( this, R.string.alert_empty_dict_fmt,
|
||||
String msg = LocUtils.getString( this, R.string.alert_empty_dict_fmt,
|
||||
name );
|
||||
showOKOnlyDialogThen( msg, Action.FINISH_ACTION );
|
||||
} else {
|
||||
|
|
|
@ -365,15 +365,16 @@ public class DlgDelegate {
|
|||
boolean asToast = true;
|
||||
switch( event ) {
|
||||
case BAD_PROTO:
|
||||
msg = Utils.format( m_activity, R.string.bt_bad_proto_fmt,
|
||||
msg = LocUtils.getString( m_activity, R.string.bt_bad_proto_fmt,
|
||||
(String)args[0] );
|
||||
break;
|
||||
case MESSAGE_RESEND:
|
||||
msg = Utils.format( m_activity, R.string.bt_resend_fmt,
|
||||
(String)args[0], (Long)args[1], (Integer)args[2] );
|
||||
msg = LocUtils.getString( m_activity, R.string.bt_resend_fmt,
|
||||
(String)args[0], (Long)args[1],
|
||||
(Integer)args[2] );
|
||||
break;
|
||||
case MESSAGE_FAILOUT:
|
||||
msg = Utils.format( m_activity, R.string.bt_fail_fmt,
|
||||
msg = LocUtils.getString( m_activity, R.string.bt_fail_fmt,
|
||||
(String)args[0] );
|
||||
asToast = false;
|
||||
break;
|
||||
|
|
|
@ -1131,7 +1131,7 @@ public class GameConfig extends XWActivity
|
|||
strID = R.string.title_game_config_fmt;
|
||||
break;
|
||||
}
|
||||
setTitle( Utils.format( this, strID,
|
||||
setTitle( LocUtils.getString( this, strID,
|
||||
GameUtils.getName( this, m_rowid ) ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -594,7 +594,8 @@ public class GameUtils {
|
|||
if ( choseEmail ) {
|
||||
intent.setAction( Intent.ACTION_SEND );
|
||||
String subject =
|
||||
Utils.format( activity, R.string.invite_subject_fmt, room );
|
||||
LocUtils.getString( activity, R.string.invite_subject_fmt,
|
||||
room );
|
||||
intent.putExtra( Intent.EXTRA_SUBJECT, subject );
|
||||
intent.putExtra( Intent.EXTRA_TEXT, Html.fromHtml(message) );
|
||||
|
||||
|
@ -625,7 +626,8 @@ public class GameUtils {
|
|||
|
||||
String choiceType = activity.getString( choiceID );
|
||||
String chooserMsg =
|
||||
Utils.format( activity, R.string.invite_chooser_fmt, choiceType );
|
||||
LocUtils.getString( activity, R.string.invite_chooser_fmt,
|
||||
choiceType );
|
||||
activity.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -786,7 +786,7 @@ public class GamesListDelegate extends DelegateBase
|
|||
|
||||
// Game menus: one or more games selected
|
||||
case R.id.games_game_delete:
|
||||
String msg = Utils.format( m_activity,
|
||||
String msg = LocUtils.getString( m_activity,
|
||||
R.string.confirm_seldeletes_fmt,
|
||||
selRowIDs.length );
|
||||
showConfirmThen( msg, R.string.button_delete,
|
||||
|
|
|
@ -37,6 +37,8 @@ import android.widget.LinearLayout;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
abstract class InviteActivity extends XWListActivity
|
||||
|
@ -71,7 +73,7 @@ abstract class InviteActivity extends XWListActivity
|
|||
m_clearButton.setOnClickListener( this );
|
||||
|
||||
TextView desc = (TextView)findViewById( desc_id );
|
||||
desc.setText( Utils.format( this, desc_strf, m_nMissing ) );
|
||||
desc.setText( LocUtils.getString( this, desc_strf, m_nMissing ) );
|
||||
|
||||
tryEnable();
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ public class LookupAlert extends LinearLayout
|
|||
case STATE_URLS:
|
||||
m_listView.setAdapter( s_urlsAdapter );
|
||||
setSummary( m_words[m_wordIndex] );
|
||||
String txt = Utils.format( m_context, R.string.button_done_fmt,
|
||||
String txt = LocUtils.getString( m_context, R.string.button_done_fmt,
|
||||
m_words[m_wordIndex] );
|
||||
m_doneButton.setText( txt );
|
||||
txt = m_context.getString( R.string.add_to_study_fmt,
|
||||
|
|
|
@ -196,7 +196,7 @@ public class NewGameActivity extends XWActivity {
|
|||
m_remoteDev = remoteDevs[0];
|
||||
|
||||
m_gameID = GameUtils.newGameID();
|
||||
m_gameName = Utils.format( this, R.string.dft_name_fmt,
|
||||
m_gameName = LocUtils.getString( this, R.string.dft_name_fmt,
|
||||
m_gameID & 0xFFFF );
|
||||
showDialog( DlgID.NAME_GAME.ordinal() );
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ public class NewGameActivity extends XWActivity {
|
|||
m_newRowID = GameUtils.makeNewSMSGame( NewGameActivity.this,
|
||||
m_groupID, gameID, null,
|
||||
m_lang, m_dict, 2, 1 );
|
||||
String name = Utils.format( this, R.string.dft_sms_name_fmt,
|
||||
String name = LocUtils.getString( this, R.string.dft_sms_name_fmt,
|
||||
gameID & 0xFFFF );
|
||||
DBUtils.setName( this, m_newRowID, name );
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.eehouse.android.xw4.jni.GameSummary;
|
|||
import org.eehouse.android.xw4.jni.UtilCtxt;
|
||||
import org.eehouse.android.xw4.jni.UtilCtxt.DevIDType;
|
||||
import org.eehouse.android.xw4.jni.XwJNI;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class RelayService extends XWService
|
||||
implements NetStateCache.StateChangedIf {
|
||||
|
@ -379,7 +380,7 @@ public class RelayService extends XWService
|
|||
private void setupNotification( long rowid )
|
||||
{
|
||||
Intent intent = GamesListActivity.makeRowidIntent( this, rowid );
|
||||
String msg = Utils.format( this, R.string.notify_body_fmt,
|
||||
String msg = LocUtils.getString( this, R.string.notify_body_fmt,
|
||||
GameUtils.getName( this, rowid ) );
|
||||
Utils.postNotification( this, intent, R.string.notify_title,
|
||||
msg, (int)rowid );
|
||||
|
|
|
@ -262,7 +262,7 @@ public class SMSInviteActivity extends InviteActivity {
|
|||
} else {
|
||||
m_immobileConfirmed = false;
|
||||
String msg =
|
||||
Utils.format( this, R.string.warn_nomobile_fmt,
|
||||
LocUtils.getString( this, R.string.warn_nomobile_fmt,
|
||||
number, name );
|
||||
showConfirmThen( msg, R.string.button_yes,
|
||||
Action.USE_IMMOBILE_ACTION );
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.eehouse.android.xw4.MultiService.MultiEvent;
|
|||
import org.eehouse.android.xw4.jni.CommsAddrRec;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.XwJNI;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class SMSService extends XWService {
|
||||
|
||||
|
@ -552,7 +553,7 @@ public class SMSService extends XWService {
|
|||
DBUtils.setName( this, rowid, gameName );
|
||||
}
|
||||
String owner = Utils.phoneToContact( this, phone, true );
|
||||
String body = Utils.format( this, R.string.new_name_body_fmt,
|
||||
String body = LocUtils.getString( this, R.string.new_name_body_fmt,
|
||||
owner );
|
||||
postNotification( gameID, R.string.new_sms_title, body, rowid );
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ import org.apache.http.util.EntityUtils;
|
|||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class UpdateCheckReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String NEW_DICT_URL = "NEW_DICT_URL";
|
||||
|
@ -330,7 +332,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
String title =
|
||||
Utils.format( m_context, R.string.new_app_avail_fmt,
|
||||
LocUtils.getString( m_context, R.string.new_app_avail_fmt,
|
||||
label );
|
||||
String body =
|
||||
m_context.getString( R.string.new_app_avail );
|
||||
|
@ -352,7 +354,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
|
|||
intent.putExtra( NEW_DICT_URL, url );
|
||||
intent.putExtra( NEW_DICT_LOC, dal.loc.ordinal() );
|
||||
String body =
|
||||
Utils.format( m_context,
|
||||
LocUtils.getString( m_context,
|
||||
R.string.new_dict_avail_fmt,
|
||||
dal.name );
|
||||
Utils.postNotification( m_context, intent,
|
||||
|
|
|
@ -53,6 +53,7 @@ import java.util.Random;
|
|||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.jni.*;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class Utils {
|
||||
public static final int TURN_COLOR = 0x7F00FF00;
|
||||
|
@ -126,7 +127,7 @@ public class Utils {
|
|||
|
||||
public static void showToast( Context context, int id )
|
||||
{
|
||||
String msg = context.getString( id );
|
||||
String msg = LocUtils.getString( context, id );
|
||||
showToast( context, msg );
|
||||
}
|
||||
|
||||
|
@ -155,7 +156,7 @@ public class Utils {
|
|||
context.getString( R.string.email_author_subject ) );
|
||||
String[] addrs = { context.getString( R.string.email_author_email ) };
|
||||
intent.putExtra( Intent.EXTRA_EMAIL, addrs );
|
||||
String body = format( context, R.string.email_body_rev_fmt,
|
||||
String body = LocUtils.getString( context, R.string.email_body_rev_fmt,
|
||||
BuildConstants.GIT_REV );
|
||||
intent.putExtra( Intent.EXTRA_TEXT, body );
|
||||
String chooserMsg = context.getString( R.string.email_author_chooser );
|
||||
|
@ -369,11 +370,6 @@ public class Utils {
|
|||
return s_hasSmallScreen;
|
||||
}
|
||||
|
||||
public static String format( Context context, int id, Object... args )
|
||||
{
|
||||
return context.getString( id, args );
|
||||
}
|
||||
|
||||
public static String digestToString( byte[] digest )
|
||||
{
|
||||
String result = null;
|
||||
|
|
|
@ -206,7 +206,7 @@ public class GameSummary {
|
|||
} else if ( null != remoteDevs
|
||||
&& CommsConnType.COMMS_CONN_SMS == conType ) {
|
||||
result =
|
||||
Utils.format( m_context, R.string.summary_conn_sms_fmt,
|
||||
LocUtils.getString( m_context, R.string.summary_conn_sms_fmt,
|
||||
TextUtils.join(", ", m_remotePhones) );
|
||||
} else {
|
||||
fmtID = R.string.summary_conn;
|
||||
|
|
Loading…
Add table
Reference in a new issue