mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +01:00
convert most of GamesList to be localizable
This commit is contained in:
parent
9531c6939e
commit
2c9dc526c2
4 changed files with 28 additions and 25 deletions
|
@ -4,6 +4,7 @@
|
|||
<!-- top-level layout is hozontal, with an image and another layout -->
|
||||
<org.eehouse.android.xw4.GameListItem
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res/org.eehouse.android.xw4"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -13,15 +14,16 @@
|
|||
android:background="@android:drawable/list_selector_background"
|
||||
>
|
||||
|
||||
<TextView android:id="@+id/view_unloaded"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/game_list_tmp"
|
||||
/>
|
||||
<org.eehouse.android.xw4.loc.LocTextView
|
||||
android:id="@+id/view_unloaded"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:gravity="center"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
custom:strid="@string/game_list_tmp"
|
||||
/>
|
||||
|
||||
<LinearLayout android:id="@+id/view_loaded"
|
||||
android:orientation="horizontal"
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.eehouse.android.xw4.jni.*;
|
|||
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class GameListAdapter extends XWListAdapter
|
||||
implements GameListGroup.GroupStateListener {
|
||||
|
@ -212,9 +213,9 @@ public class GameListAdapter extends XWListAdapter
|
|||
ggi.m_lastMoveTime );
|
||||
}
|
||||
|
||||
String name = m_context.getString( R.string.group_namef,
|
||||
groupNames()[groupPosition],
|
||||
nKids );
|
||||
String name = LocUtils.getString( m_context, R.string.group_namef,
|
||||
groupNames()[groupPosition],
|
||||
nKids );
|
||||
group.setText( name );
|
||||
group.setSelected( m_cb.getSelected( group ) );
|
||||
result = group;
|
||||
|
@ -558,7 +559,7 @@ public class GameListAdapter extends XWListAdapter
|
|||
};
|
||||
int result = -1;
|
||||
for ( int id : ids ) {
|
||||
if ( m_context.getString( id ).equals( fieldName ) ) {
|
||||
if ( LocUtils.getString( m_context, id ).equals( fieldName ) ) {
|
||||
result = id;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import junit.framework.Assert;
|
|||
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.GameSummary;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
public class GameListItem extends LinearLayout
|
||||
implements View.OnClickListener, SelectableItem.LongClickHandler {
|
||||
|
@ -240,8 +241,8 @@ public class GameListItem extends LinearLayout
|
|||
|
||||
String name = GameUtils.getName( m_context, m_rowid );
|
||||
if ( null != value ) {
|
||||
value = m_context.getString( R.string.str_game_namef,
|
||||
name, value );
|
||||
value = LocUtils.getString( m_context, R.string.str_game_namef,
|
||||
name, value );
|
||||
} else {
|
||||
value = name;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eehouse.android.xw4.R;
|
|||
import org.eehouse.android.xw4.Utils;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
|
||||
/** Info we want to access when the game's closed that's not available
|
||||
* in CurGameInfo
|
||||
|
@ -139,7 +140,7 @@ public class GameSummary {
|
|||
if ( playersStr.contains("\n") ) {
|
||||
sep = "\n";
|
||||
} else {
|
||||
sep = m_context.getString( R.string.vs_join );
|
||||
sep = LocUtils.getString( m_context, R.string.vs_join );
|
||||
}
|
||||
|
||||
int ii, nxt;
|
||||
|
@ -167,10 +168,9 @@ public class GameSummary {
|
|||
{
|
||||
String result = null;
|
||||
if ( gameOver ) {
|
||||
result = m_context.getString( R.string.gameOver );
|
||||
result = LocUtils.getString( m_context, R.string.gameOver );
|
||||
} else {
|
||||
result = String.format( m_context.getString(R.string.movesf),
|
||||
nMoves );
|
||||
result = LocUtils.getString( m_context, R.string.movesf, nMoves );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class GameSummary {
|
|||
} else {
|
||||
fmtID = R.string.summary_relay_connf;
|
||||
}
|
||||
result = String.format( m_context.getString(fmtID), roomName );
|
||||
result = LocUtils.getString( m_context, fmtID, roomName );
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
case COMMS_CONN_SMS:
|
||||
|
@ -212,7 +212,7 @@ public class GameSummary {
|
|||
fmtID = R.string.summary_conn;
|
||||
}
|
||||
if ( null == result ) {
|
||||
result = m_context.getString( fmtID );
|
||||
result = LocUtils.getString( m_context, fmtID );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ public class GameSummary {
|
|||
if ( !isLocal(indx) ) {
|
||||
boolean isMissing = 0 != ((1 << indx) & missingPlayers);
|
||||
if ( isMissing ) {
|
||||
player = m_context.getString( R.string.missing_player );
|
||||
player = LocUtils.getString( m_context, R.string.missing_player );
|
||||
} else {
|
||||
formatID = R.string.str_nonlocal_namef;
|
||||
}
|
||||
|
@ -289,8 +289,7 @@ public class GameSummary {
|
|||
}
|
||||
|
||||
if ( 0 != formatID ) {
|
||||
String format = m_context.getString( formatID );
|
||||
player = String.format( format, player );
|
||||
player = LocUtils.getString( m_context, formatID, player );
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
@ -306,7 +305,7 @@ public class GameSummary {
|
|||
|
||||
String result = null;
|
||||
if ( null != names && 0 < names.length ) {
|
||||
String joiner = m_context.getString( R.string.vs_join );
|
||||
String joiner = LocUtils.getString( m_context, R.string.vs_join );
|
||||
result = TextUtils.join( joiner, names );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue