Merge branch 'android_branch' of ssh://xwords.git.sourceforge.net/gitroot/xwords/xwords into android_branch

This commit is contained in:
eehouse@eehouse.org 2011-03-31 18:19:31 -07:00 committed by Andy2
commit 32143d8116
9 changed files with 126 additions and 106 deletions

View file

@ -6,14 +6,11 @@
</head>
<body>
<b>Crosswords 4.4 beta 23 release</b>
<b>Crosswords 4.4 beta 24 release</b>
<ul>
<li>Fix history formatting.</li>
<li>Change menus when in tile-exchange mode to make things clearer</li>
<li>Make hint on how to open games permanent but hideable via a preference</li>
<li>Stop screen rotation when displaying board: portrait only from now on.</li>
<li>Fix a couple of minor UI glitches.</li>
</ul>
<p>Please remember that this is beta software. Please let me know (at eehouse@eehouse.org) what's broken and what features you'd most like to see.</p>

View file

@ -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;

View file

@ -547,6 +547,7 @@ public class GameUtils {
public FeedUtilsImpl( Context context, String path )
{
super( context );
m_context = context;
m_path = path;
m_gotMsg = false;

View file

@ -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 )

View file

@ -774,7 +774,7 @@ CookieRef::send_stored_messages( HostID dest, int socket )
if ( ! send_with_length( socket, buf, buflen, true ) ) {
break;
}
DBMgr::Get()->RemoveStoredMessage( msgID );
DBMgr::Get()->RemoveStoredMessages( &msgID, 1 );
}
} /* send_stored_messages */

View file

@ -495,11 +495,22 @@ DBMgr::GetStoredMessage( const char* const connName, int hid,
}
void
DBMgr::RemoveStoredMessage( int msgID )
DBMgr::RemoveStoredMessages( const int* msgIDs, int nMsgIDs )
{
const char* fmt = "DELETE from " MSGS_TABLE " WHERE id = %d";
char query[256];
snprintf( query, sizeof(query), fmt, msgID );
char ids[1024];
int len = 0;
int ii;
assert( nMsgIDs > 0 );
for ( ii = 0; ; ) {
len += snprintf( ids + len, sizeof(ids) - len, "%d,", msgIDs[ii] );
if ( ++ii == nMsgIDs ) {
ids[len-1] = '\0'; /* overwrite last comma */
break;
}
}
const char* fmt = "DELETE from " MSGS_TABLE " WHERE id in (%s)";
char query[1024];
snprintf( query, sizeof(query), fmt, ids );
logf( XW_LOGINFO, "%s: query: %s", __func__, query );
execSql( query );

View file

@ -78,7 +78,7 @@ class DBMgr {
unsigned char* buf, size_t* buflen, int* msgID );
bool GetNthStoredMessage( const char* const connName, int hid, int nn,
unsigned char* buf, size_t* buflen, int* msgID );
void RemoveStoredMessage( int msgID );
void RemoveStoredMessages( const int* msgID, int nMsgIDs );
private:
DBMgr();

View file

@ -26,8 +26,8 @@ GAME_PORTS=10997
# What ports do we listen on for per-device incoming connections?
DEVICE_PORTS=10998
# default 20
SOCK_TIMEOUT_SECONDS=20
# default 5
SOCK_TIMEOUT_SECONDS=5
# And the control port is?
CTLPORT=11000

View file

@ -850,7 +850,7 @@ set_timeouts( int sock )
struct timeval tv;
int result;
int timeout = 20;
int timeout = 5;
(void)RelayConfigs::GetConfigs()->GetValueFor( "SOCK_TIMEOUT_SECONDS",
&timeout );