mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-29 10:26:36 +01:00
move getting user strings into impl so available in background. Fixes
bug where trades were not reported when received from relay via proxy.
This commit is contained in:
parent
13b5acf8b5
commit
c30dd905a2
3 changed files with 103 additions and 91 deletions
|
@ -695,6 +695,11 @@ public class BoardActivity extends XWActivity
|
|||
|
||||
private class BoardUtilCtxt extends UtilCtxtImpl {
|
||||
|
||||
public BoardUtilCtxt()
|
||||
{
|
||||
super( BoardActivity.this );
|
||||
}
|
||||
|
||||
public void requestTime()
|
||||
{
|
||||
m_handler.post( new Runnable() {
|
||||
|
@ -831,95 +836,6 @@ public class BoardActivity extends XWActivity
|
|||
} );
|
||||
}
|
||||
|
||||
public String getUserString( int stringCode )
|
||||
{
|
||||
int id = 0;
|
||||
switch( stringCode ) {
|
||||
case UtilCtxt.STRD_ROBOT_TRADED:
|
||||
id = R.string.strd_robot_traded;
|
||||
break;
|
||||
case UtilCtxt.STR_ROBOT_MOVED:
|
||||
id = R.string.str_robot_moved;
|
||||
break;
|
||||
case UtilCtxt.STRS_VALUES_HEADER:
|
||||
id = R.string.strs_values_header;
|
||||
break;
|
||||
case UtilCtxt.STRD_REMAINING_TILES_ADD:
|
||||
id = R.string.strd_remaining_tiles_add;
|
||||
break;
|
||||
case UtilCtxt.STRD_UNUSED_TILES_SUB:
|
||||
id = R.string.strd_unused_tiles_sub;
|
||||
break;
|
||||
case UtilCtxt.STR_REMOTE_MOVED:
|
||||
id = R.string.str_remote_moved;
|
||||
break;
|
||||
case UtilCtxt.STRD_TIME_PENALTY_SUB:
|
||||
id = R.string.strd_time_penalty_sub;
|
||||
break;
|
||||
case UtilCtxt.STR_PASS:
|
||||
id = R.string.str_pass;
|
||||
break;
|
||||
case UtilCtxt.STRS_MOVE_ACROSS:
|
||||
id = R.string.strs_move_across;
|
||||
break;
|
||||
case UtilCtxt.STRS_MOVE_DOWN:
|
||||
id = R.string.strs_move_down;
|
||||
break;
|
||||
case UtilCtxt.STRS_TRAY_AT_START:
|
||||
id = R.string.strs_tray_at_start;
|
||||
break;
|
||||
case UtilCtxt.STRSS_TRADED_FOR:
|
||||
id = R.string.strss_traded_for;
|
||||
break;
|
||||
case UtilCtxt.STR_PHONY_REJECTED:
|
||||
id = R.string.str_phony_rejected;
|
||||
break;
|
||||
case UtilCtxt.STRD_CUMULATIVE_SCORE:
|
||||
id = R.string.strd_cumulative_score;
|
||||
break;
|
||||
case UtilCtxt.STRS_NEW_TILES:
|
||||
id = R.string.strs_new_tiles;
|
||||
break;
|
||||
case UtilCtxt.STR_PASSED:
|
||||
id = R.string.str_passed;
|
||||
break;
|
||||
case UtilCtxt.STRSD_SUMMARYSCORED:
|
||||
id = R.string.strsd_summaryscored;
|
||||
break;
|
||||
case UtilCtxt.STRD_TRADED:
|
||||
id = R.string.strd_traded;
|
||||
break;
|
||||
case UtilCtxt.STR_LOSTTURN:
|
||||
id = R.string.str_lostturn;
|
||||
break;
|
||||
case UtilCtxt.STR_COMMIT_CONFIRM:
|
||||
id = R.string.str_commit_confirm;
|
||||
break;
|
||||
case UtilCtxt.STR_LOCAL_NAME:
|
||||
id = R.string.str_local_name;
|
||||
break;
|
||||
case UtilCtxt.STR_NONLOCAL_NAME:
|
||||
id = R.string.str_nonlocal_name;
|
||||
break;
|
||||
case UtilCtxt.STR_BONUS_ALL:
|
||||
id = R.string.str_bonus_all;
|
||||
break;
|
||||
case UtilCtxt.STRD_TURN_SCORE:
|
||||
id = R.string.strd_turn_score;
|
||||
break;
|
||||
default:
|
||||
Utils.logf( "no such stringCode: " + stringCode );
|
||||
}
|
||||
|
||||
String result;
|
||||
if ( 0 == id ) {
|
||||
result = "";
|
||||
} else {
|
||||
result = getString( id );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean userQuery( int id, String query )
|
||||
{
|
||||
boolean result;
|
||||
|
|
|
@ -547,6 +547,7 @@ public class GameUtils {
|
|||
|
||||
public FeedUtilsImpl( Context context, String path )
|
||||
{
|
||||
super( context );
|
||||
m_context = context;
|
||||
m_path = path;
|
||||
m_gotMsg = false;
|
||||
|
|
|
@ -20,9 +20,21 @@
|
|||
|
||||
package org.eehouse.android.xw4.jni;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.eehouse.android.xw4.Utils;
|
||||
import org.eehouse.android.xw4.R;
|
||||
|
||||
public class UtilCtxtImpl implements UtilCtxt {
|
||||
private Context m_context;
|
||||
|
||||
private UtilCtxtImpl() {} // force subclasses to pass context
|
||||
|
||||
public UtilCtxtImpl( Context context )
|
||||
{
|
||||
super();
|
||||
m_context = context;
|
||||
}
|
||||
|
||||
public void requestTime() {
|
||||
subclassOverride( "requestTime" );
|
||||
|
@ -83,8 +95,91 @@ public class UtilCtxtImpl implements UtilCtxt {
|
|||
|
||||
public String getUserString( int stringCode )
|
||||
{
|
||||
subclassOverride( "getUserString" );
|
||||
return "";
|
||||
int id = 0;
|
||||
switch( stringCode ) {
|
||||
case UtilCtxt.STRD_ROBOT_TRADED:
|
||||
id = R.string.strd_robot_traded;
|
||||
break;
|
||||
case UtilCtxt.STR_ROBOT_MOVED:
|
||||
id = R.string.str_robot_moved;
|
||||
break;
|
||||
case UtilCtxt.STRS_VALUES_HEADER:
|
||||
id = R.string.strs_values_header;
|
||||
break;
|
||||
case UtilCtxt.STRD_REMAINING_TILES_ADD:
|
||||
id = R.string.strd_remaining_tiles_add;
|
||||
break;
|
||||
case UtilCtxt.STRD_UNUSED_TILES_SUB:
|
||||
id = R.string.strd_unused_tiles_sub;
|
||||
break;
|
||||
case UtilCtxt.STR_REMOTE_MOVED:
|
||||
id = R.string.str_remote_moved;
|
||||
break;
|
||||
case UtilCtxt.STRD_TIME_PENALTY_SUB:
|
||||
id = R.string.strd_time_penalty_sub;
|
||||
break;
|
||||
case UtilCtxt.STR_PASS:
|
||||
id = R.string.str_pass;
|
||||
break;
|
||||
case UtilCtxt.STRS_MOVE_ACROSS:
|
||||
id = R.string.strs_move_across;
|
||||
break;
|
||||
case UtilCtxt.STRS_MOVE_DOWN:
|
||||
id = R.string.strs_move_down;
|
||||
break;
|
||||
case UtilCtxt.STRS_TRAY_AT_START:
|
||||
id = R.string.strs_tray_at_start;
|
||||
break;
|
||||
case UtilCtxt.STRSS_TRADED_FOR:
|
||||
id = R.string.strss_traded_for;
|
||||
break;
|
||||
case UtilCtxt.STR_PHONY_REJECTED:
|
||||
id = R.string.str_phony_rejected;
|
||||
break;
|
||||
case UtilCtxt.STRD_CUMULATIVE_SCORE:
|
||||
id = R.string.strd_cumulative_score;
|
||||
break;
|
||||
case UtilCtxt.STRS_NEW_TILES:
|
||||
id = R.string.strs_new_tiles;
|
||||
break;
|
||||
case UtilCtxt.STR_PASSED:
|
||||
id = R.string.str_passed;
|
||||
break;
|
||||
case UtilCtxt.STRSD_SUMMARYSCORED:
|
||||
id = R.string.strsd_summaryscored;
|
||||
break;
|
||||
case UtilCtxt.STRD_TRADED:
|
||||
id = R.string.strd_traded;
|
||||
break;
|
||||
case UtilCtxt.STR_LOSTTURN:
|
||||
id = R.string.str_lostturn;
|
||||
break;
|
||||
case UtilCtxt.STR_COMMIT_CONFIRM:
|
||||
id = R.string.str_commit_confirm;
|
||||
break;
|
||||
case UtilCtxt.STR_LOCAL_NAME:
|
||||
id = R.string.str_local_name;
|
||||
break;
|
||||
case UtilCtxt.STR_NONLOCAL_NAME:
|
||||
id = R.string.str_nonlocal_name;
|
||||
break;
|
||||
case UtilCtxt.STR_BONUS_ALL:
|
||||
id = R.string.str_bonus_all;
|
||||
break;
|
||||
case UtilCtxt.STRD_TURN_SCORE:
|
||||
id = R.string.strd_turn_score;
|
||||
break;
|
||||
default:
|
||||
Utils.logf( "no such stringCode: " + stringCode );
|
||||
}
|
||||
|
||||
String result;
|
||||
if ( 0 == id ) {
|
||||
result = "";
|
||||
} else {
|
||||
result = m_context.getString( id );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean userQuery( int id, String query )
|
||||
|
|
Loading…
Reference in a new issue