mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +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,16 +177,17 @@ 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,
|
||||
tmp ) );
|
||||
sb.append( LocUtils.getString( context,
|
||||
R.string.connstat_net_fmt,
|
||||
tmp ) );
|
||||
sb.append("\n\n");
|
||||
|
||||
SuccessRecord record = recordFor( connType, false );
|
||||
tmp = context.getString( record.successNewer?
|
||||
R.string.connstat_succ :
|
||||
R.string.connstat_unsucc );
|
||||
sb.append( Utils.format( context, R.string.connstat_lastsend_fmt,
|
||||
tmp, record.newerStr( context ) ) );
|
||||
sb.append( LocUtils.getString( context, R.string.connstat_lastsend_fmt,
|
||||
tmp, record.newerStr( context ) ) );
|
||||
sb.append("\n");
|
||||
|
||||
int fmtId = 0;
|
||||
|
@ -199,16 +201,16 @@ public class ConnStatusHandler {
|
|||
}
|
||||
}
|
||||
if ( 0 != fmtId ) {
|
||||
sb.append( Utils.format( context, fmtId,
|
||||
record.olderStr( context ) ) );
|
||||
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,
|
||||
R.string.connstat_lastreceipt_fmt,
|
||||
record.newerStr( context ) ) );
|
||||
sb.append( LocUtils.getString( context,
|
||||
R.string.connstat_lastreceipt_fmt,
|
||||
record.newerStr( context ) ) );
|
||||
} else {
|
||||
sb.append( context.getString(R.string.connstat_noreceipt) );
|
||||
}
|
||||
|
|
|
@ -89,9 +89,9 @@ 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,
|
||||
m_name, m_nWords, m_browseState.m_minShown,
|
||||
m_browseState.m_maxShown ));
|
||||
setTitle( LocUtils.getString( DictBrowseActivity.this, format,
|
||||
m_name, m_nWords, m_browseState.m_minShown,
|
||||
m_browseState.m_maxShown ));
|
||||
|
||||
String desc = XwJNI.dict_iter_getDesc( m_dictClosure );
|
||||
if ( null != desc ) {
|
||||
|
@ -193,8 +193,8 @@ 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,
|
||||
name );
|
||||
String msg = LocUtils.getString( this, R.string.alert_empty_dict_fmt,
|
||||
name );
|
||||
showOKOnlyDialogThen( msg, Action.FINISH_ACTION );
|
||||
} else {
|
||||
figureMinMax( m_browseState.m_counts );
|
||||
|
|
|
@ -365,16 +365,17 @@ public class DlgDelegate {
|
|||
boolean asToast = true;
|
||||
switch( event ) {
|
||||
case BAD_PROTO:
|
||||
msg = Utils.format( m_activity, R.string.bt_bad_proto_fmt,
|
||||
(String)args[0] );
|
||||
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,
|
||||
(String)args[0] );
|
||||
msg = LocUtils.getString( m_activity, R.string.bt_fail_fmt,
|
||||
(String)args[0] );
|
||||
asToast = false;
|
||||
break;
|
||||
case RELAY_ALERT:
|
||||
|
|
|
@ -1131,8 +1131,8 @@ public class GameConfig extends XWActivity
|
|||
strID = R.string.title_game_config_fmt;
|
||||
break;
|
||||
}
|
||||
setTitle( Utils.format( this, strID,
|
||||
GameUtils.getName( this, m_rowid ) ) );
|
||||
setTitle( LocUtils.getString( this, strID,
|
||||
GameUtils.getName( this, m_rowid ) ) );
|
||||
}
|
||||
|
||||
private boolean localOnlyGame()
|
||||
|
|
|
@ -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,9 +786,9 @@ public class GamesListDelegate extends DelegateBase
|
|||
|
||||
// Game menus: one or more games selected
|
||||
case R.id.games_game_delete:
|
||||
String msg = Utils.format( m_activity,
|
||||
R.string.confirm_seldeletes_fmt,
|
||||
selRowIDs.length );
|
||||
String msg = LocUtils.getString( m_activity,
|
||||
R.string.confirm_seldeletes_fmt,
|
||||
selRowIDs.length );
|
||||
showConfirmThen( msg, R.string.button_delete,
|
||||
Action.DELETE_GAMES, selRowIDs );
|
||||
break;
|
||||
|
|
|
@ -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,8 +254,8 @@ 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,
|
||||
m_words[m_wordIndex] );
|
||||
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,
|
||||
m_words[m_wordIndex] );
|
||||
|
|
|
@ -196,8 +196,8 @@ public class NewGameActivity extends XWActivity {
|
|||
m_remoteDev = remoteDevs[0];
|
||||
|
||||
m_gameID = GameUtils.newGameID();
|
||||
m_gameName = Utils.format( this, R.string.dft_name_fmt,
|
||||
m_gameID & 0xFFFF );
|
||||
m_gameName = LocUtils.getString( this, R.string.dft_name_fmt,
|
||||
m_gameID & 0xFFFF );
|
||||
showDialog( DlgID.NAME_GAME.ordinal() );
|
||||
}
|
||||
break;
|
||||
|
@ -381,8 +381,8 @@ 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,
|
||||
gameID & 0xFFFF );
|
||||
String name = LocUtils.getString( this, R.string.dft_sms_name_fmt,
|
||||
gameID & 0xFFFF );
|
||||
DBUtils.setName( this, m_newRowID, name );
|
||||
|
||||
Intent intent = new Intent( this, GameConfig.class );
|
||||
|
|
|
@ -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,8 +380,8 @@ 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,
|
||||
GameUtils.getName( this, rowid ) );
|
||||
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,8 +262,8 @@ public class SMSInviteActivity extends InviteActivity {
|
|||
} else {
|
||||
m_immobileConfirmed = false;
|
||||
String msg =
|
||||
Utils.format( this, R.string.warn_nomobile_fmt,
|
||||
number, name );
|
||||
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,8 +553,8 @@ 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,
|
||||
owner );
|
||||
String body = LocUtils.getString( this, R.string.new_name_body_fmt,
|
||||
owner );
|
||||
postNotification( gameID, R.string.new_sms_title, body, rowid );
|
||||
|
||||
ackInvite( phone, gameID );
|
||||
|
|
|
@ -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,8 +332,8 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
|
|||
}
|
||||
|
||||
String title =
|
||||
Utils.format( m_context, R.string.new_app_avail_fmt,
|
||||
label );
|
||||
LocUtils.getString( m_context, R.string.new_app_avail_fmt,
|
||||
label );
|
||||
String body =
|
||||
m_context.getString( R.string.new_app_avail );
|
||||
Utils.postNotification( m_context, intent, title,
|
||||
|
@ -352,9 +354,9 @@ 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,
|
||||
R.string.new_dict_avail_fmt,
|
||||
dal.name );
|
||||
LocUtils.getString( m_context,
|
||||
R.string.new_dict_avail_fmt,
|
||||
dal.name );
|
||||
Utils.postNotification( m_context, intent,
|
||||
R.string.new_dict_avail,
|
||||
body, url.hashCode() );
|
||||
|
|
|
@ -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,8 +156,8 @@ 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,
|
||||
BuildConstants.GIT_REV );
|
||||
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 );
|
||||
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
|
||||
|
@ -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,8 +206,8 @@ public class GameSummary {
|
|||
} else if ( null != remoteDevs
|
||||
&& CommsConnType.COMMS_CONN_SMS == conType ) {
|
||||
result =
|
||||
Utils.format( m_context, R.string.summary_conn_sms_fmt,
|
||||
TextUtils.join(", ", m_remotePhones) );
|
||||
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