mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-24 07:58:34 +01:00
Merge branch 'android_branch' into android_translate
This commit is contained in:
commit
5bf674ca76
13 changed files with 79 additions and 12 deletions
|
@ -2435,6 +2435,7 @@ public final class R {
|
||||||
placed, i.e. they do not form a single word.
|
placed, i.e. they do not form a single word.
|
||||||
*/
|
*/
|
||||||
public static final int str_no_empties_in_turn=0x7f05017d;
|
public static final int str_no_empties_in_turn=0x7f05017d;
|
||||||
|
public static final int str_no_hint_found=0x7f05030a;
|
||||||
/** Same as above, but used when you try to show tiles belonging
|
/** Same as above, but used when you try to show tiles belonging
|
||||||
to a player on another device (a remote player.)
|
to a player on another device (a remote player.)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2529,4 +2529,6 @@
|
||||||
<string name="not_again_comms_bt">Use Bluetooth to play against a
|
<string name="not_again_comms_bt">Use Bluetooth to play against a
|
||||||
nearby device that\'s \"paired\" with yours.</string>
|
nearby device that\'s \"paired\" with yours.</string>
|
||||||
|
|
||||||
|
<string name="str_no_hint_found">Cannot find any moves</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2178,4 +2178,5 @@
|
||||||
i.e. yreve reirrac ni eht dlrow tpecxe Nozirev dna Tnirps.</string>
|
i.e. yreve reirrac ni eht dlrow tpecxe Nozirev dna Tnirps.</string>
|
||||||
<string name="not_again_comms_bt">Esu Htooteulb ot yalp tsniaga a
|
<string name="not_again_comms_bt">Esu Htooteulb ot yalp tsniaga a
|
||||||
ybraen ecived taht\'s \"deriap\" htiw sruoy.</string>
|
ybraen ecived taht\'s \"deriap\" htiw sruoy.</string>
|
||||||
|
<string name="str_no_hint_found">Tonnac dnif yna sevom</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -2178,4 +2178,5 @@
|
||||||
I.E. EVERY CARRIER IN THE WORLD EXCEPT VERIZON AND SPRINT.</string>
|
I.E. EVERY CARRIER IN THE WORLD EXCEPT VERIZON AND SPRINT.</string>
|
||||||
<string name="not_again_comms_bt">USE BLUETOOTH TO PLAY AGAINST A
|
<string name="not_again_comms_bt">USE BLUETOOTH TO PLAY AGAINST A
|
||||||
NEARBY DEVICE THAT\'S \"PAIRED\" WITH YOURS.</string>
|
NEARBY DEVICE THAT\'S \"PAIRED\" WITH YOURS.</string>
|
||||||
|
<string name="str_no_hint_found">CANNOT FIND ANY MOVES</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1719,6 +1719,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
public void userError( int code )
|
public void userError( int code )
|
||||||
{
|
{
|
||||||
int resid = 0;
|
int resid = 0;
|
||||||
|
boolean asToast = false;
|
||||||
switch( code ) {
|
switch( code ) {
|
||||||
case UtilCtxt.ERR_TILES_NOT_IN_LINE:
|
case UtilCtxt.ERR_TILES_NOT_IN_LINE:
|
||||||
resid = R.string.str_tiles_not_in_line;
|
resid = R.string.str_tiles_not_in_line;
|
||||||
|
@ -1764,10 +1765,23 @@ public class BoardDelegate extends DelegateBase
|
||||||
case ERR_REG_SERVER_SANS_REMOTE:
|
case ERR_REG_SERVER_SANS_REMOTE:
|
||||||
resid = R.string.str_reg_server_sans_remote;
|
resid = R.string.str_reg_server_sans_remote;
|
||||||
break;
|
break;
|
||||||
|
case ERR_NO_HINT_FOUND:
|
||||||
|
resid = R.string.str_no_hint_found;
|
||||||
|
asToast = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( resid != 0 ) {
|
if ( resid != 0 ) {
|
||||||
nonBlockingDialog( DlgID.DLG_OKONLY, getString( resid ) );
|
if ( asToast ) {
|
||||||
|
final int residf = resid;
|
||||||
|
runOnUiThread( new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
showToast( residf );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
} else {
|
||||||
|
nonBlockingDialog( DlgID.DLG_OKONLY, getString( resid ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // userError
|
} // userError
|
||||||
|
|
||||||
|
|
|
@ -1598,6 +1598,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
for ( long row : rows ) {
|
for ( long row : rows ) {
|
||||||
m_selGames.remove( row );
|
m_selGames.remove( row );
|
||||||
}
|
}
|
||||||
|
invalidateOptionsMenuIf();
|
||||||
setTitleBar();
|
setTitleBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,9 @@ public interface UtilCtxt {
|
||||||
static final int ERR_NO_EMPTY_TRADE = 13;
|
static final int ERR_NO_EMPTY_TRADE = 13;
|
||||||
static final int ERR_CANT_UNDO_TILEASSIGN = 14;
|
static final int ERR_CANT_UNDO_TILEASSIGN = 14;
|
||||||
static final int ERR_CANT_HINT_WHILE_DISABLED = 15;
|
static final int ERR_CANT_HINT_WHILE_DISABLED = 15;
|
||||||
static final int ERR_RELAY_BASE = 16;
|
static final int ERR_NO_HINT_FOUND = 16;
|
||||||
|
|
||||||
|
static final int ERR_RELAY_BASE = 17;
|
||||||
void userError( int id );
|
void userError( int id );
|
||||||
|
|
||||||
void informMove( String expl, String words );
|
void informMove( String expl, String words );
|
||||||
|
|
|
@ -110,4 +110,16 @@
|
||||||
</exec>
|
</exec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="-post-build" >
|
||||||
|
<if condition="${build.is.packaging.debug}">
|
||||||
|
<then>
|
||||||
|
<exec executable="git" outputproperty="git-rev" >
|
||||||
|
<arg value="describe" />
|
||||||
|
</exec>
|
||||||
|
<copy file="bin/XWords4-debug.apk" tofile="XWords4-debug-${git-rev}.apk"/>
|
||||||
|
<echo>Created XWords4-debug-${git-rev}.apk</echo>
|
||||||
|
</then>
|
||||||
|
</if>
|
||||||
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Script meant to be installed on eehouse.org.
|
# Script meant to be installed on eehouse.org.
|
||||||
|
|
||||||
import logging, shelve, hashlib, sys, json, subprocess, glob, os, struct, random
|
import logging, shelve, hashlib, sys, json, subprocess, glob, os, struct, random, string
|
||||||
import mk_for_download, mygit
|
import mk_for_download, mygit
|
||||||
import xwconfig
|
import xwconfig
|
||||||
|
|
||||||
|
@ -161,10 +161,13 @@ def getDictSums():
|
||||||
openShelf()
|
openShelf()
|
||||||
return s_shelf[k_SUMS]
|
return s_shelf[k_SUMS]
|
||||||
|
|
||||||
def getOrderedApks( path ):
|
def getOrderedApks( path, debug ):
|
||||||
|
# logging.debug( "getOrderedApks(" + path + ")" )
|
||||||
apks = []
|
apks = []
|
||||||
|
|
||||||
pattern = path + "/XWords4-release_*android_beta_*.apk"
|
pattern = path
|
||||||
|
if debug: pattern += "/XWords4-debug-android_*.apk"
|
||||||
|
else: pattern += "/XWords4-release_*android_beta_*.apk"
|
||||||
|
|
||||||
files = ((os.stat(apk).st_mtime, apk) for apk in glob.glob(pattern))
|
files = ((os.stat(apk).st_mtime, apk) for apk in glob.glob(pattern))
|
||||||
for mtime, file in sorted(files, reverse=True):
|
for mtime, file in sorted(files, reverse=True):
|
||||||
|
@ -173,6 +176,14 @@ def getOrderedApks( path ):
|
||||||
|
|
||||||
return apks
|
return apks
|
||||||
|
|
||||||
|
def getVariantDir( name ):
|
||||||
|
result = ''
|
||||||
|
splits = string.split( name, '.' )
|
||||||
|
last = splits[-1]
|
||||||
|
if not last == 'xw4': result = last + '/'
|
||||||
|
# logging.debug( 'getVariantDir(' + name + ") => " + result )
|
||||||
|
return result
|
||||||
|
|
||||||
# public, but deprecated
|
# public, but deprecated
|
||||||
def curVersion( req, name, avers = 41, gvers = None, installer = None ):
|
def curVersion( req, name, avers = 41, gvers = None, installer = None ):
|
||||||
global k_versions
|
global k_versions
|
||||||
|
@ -218,12 +229,22 @@ def getApp( params, name ):
|
||||||
if k_NAME in params:
|
if k_NAME in params:
|
||||||
name = params[k_NAME]
|
name = params[k_NAME]
|
||||||
if name:
|
if name:
|
||||||
|
variantDir = getVariantDir( name )
|
||||||
# If we're a dev device, always push the latest
|
# If we're a dev device, always push the latest
|
||||||
if k_DEBUG in params and params[k_DEBUG]:
|
if k_DEBUG in params and params[k_DEBUG]:
|
||||||
url = k_urlbase + '/' + k_apkDir + 'XWords4-debug.apk'
|
dir = k_filebase + k_apkDir + variantDir
|
||||||
result = {k_URL: url}
|
apks = getOrderedApks( dir, True )
|
||||||
|
if 0 < len(apks):
|
||||||
|
apk = apks[0]
|
||||||
|
curApk = params[k_GVERS] + '.apk'
|
||||||
|
if curApk in apk:
|
||||||
|
logging.debug( "already have " + curApk )
|
||||||
|
else:
|
||||||
|
url = k_urlbase + '/' + k_apkDir + variantDir + apk[len(dir):]
|
||||||
|
logging.debug("url: " + url)
|
||||||
|
result = {k_URL: url}
|
||||||
elif k_DEVOK in params and params[k_DEVOK]:
|
elif k_DEVOK in params and params[k_DEVOK]:
|
||||||
apks = getOrderedApks( k_filebase + k_apkDir )
|
apks = getOrderedApks( k_filebase + k_apkDir, False )
|
||||||
if 0 < len(apks):
|
if 0 < len(apks):
|
||||||
apk = apks[0]
|
apk = apks[0]
|
||||||
# Does path NOT contain name of installed file
|
# Does path NOT contain name of installed file
|
||||||
|
@ -439,7 +460,6 @@ def getUpdates( req, params ):
|
||||||
else:
|
else:
|
||||||
logging.debug( "NOT FOUND xlate info" )
|
logging.debug( "NOT FOUND xlate info" )
|
||||||
|
|
||||||
logging.debug( 'getUpdates done:', )
|
|
||||||
result = json.dumps( result )
|
result = json.dumps( result )
|
||||||
# logging.debug( result )
|
# logging.debug( result )
|
||||||
return result
|
return result
|
||||||
|
@ -494,7 +514,7 @@ def main():
|
||||||
if argc >= 4: usage()
|
if argc >= 4: usage()
|
||||||
path = ""
|
path = ""
|
||||||
if argc >= 3: path = sys.argv[2]
|
if argc >= 3: path = sys.argv[2]
|
||||||
apks = getOrderedApks( path )
|
apks = getOrderedApks( path, False )
|
||||||
if 0 == len(apks): print "No apks in", path
|
if 0 == len(apks): print "No apks in", path
|
||||||
for apk in apks:
|
for apk in apks:
|
||||||
print apk
|
print apk
|
||||||
|
|
|
@ -2107,6 +2107,7 @@ board_requestHint( BoardCtxt* board,
|
||||||
if ( searchComplete && canMove ) {
|
if ( searchComplete && canMove ) {
|
||||||
model_makeTurnFromMoveInfo( model, selPlayer, &newMove);
|
model_makeTurnFromMoveInfo( model, selPlayer, &newMove);
|
||||||
} else {
|
} else {
|
||||||
|
result = XP_FALSE;
|
||||||
XP_STATUSF( "unable to complete hint request\n" );
|
XP_STATUSF( "unable to complete hint request\n" );
|
||||||
}
|
}
|
||||||
*workRemainsP = !searchComplete;
|
*workRemainsP = !searchComplete;
|
||||||
|
@ -2122,6 +2123,10 @@ board_requestHint( BoardCtxt* board,
|
||||||
setArrowVisible( board, wasVisible );
|
setArrowVisible( board, wasVisible );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !result ) {
|
||||||
|
util_userError( board->util, ERR_NO_HINT_FOUND );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result || redraw;
|
return result || redraw;
|
||||||
} /* board_requestHint */
|
} /* board_requestHint */
|
||||||
|
|
|
@ -393,6 +393,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
{
|
{
|
||||||
XP_Bool result = XP_TRUE;
|
XP_Bool result = XP_TRUE;
|
||||||
XP_U16 star_row;
|
XP_U16 star_row;
|
||||||
|
XP_Bool canMove = XP_FALSE;
|
||||||
|
|
||||||
engine->nTilesMax = XP_MIN( MAX_TRAY_TILES, nTiles );
|
engine->nTilesMax = XP_MIN( MAX_TRAY_TILES, nTiles );
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
|
@ -445,9 +446,9 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
dictionary's emtpy or there are no tiles, still return TRUE so we don't
|
dictionary's emtpy or there are no tiles, still return TRUE so we don't
|
||||||
get scheduled again. Fixes infinite loop with empty dict and a
|
get scheduled again. Fixes infinite loop with empty dict and a
|
||||||
robot. */
|
robot. */
|
||||||
*canMoveP = NULL != dict_getTopEdge(engine->dict)
|
canMove = NULL != dict_getTopEdge(engine->dict)
|
||||||
&& initTray( engine, tiles, nTiles );
|
&& initTray( engine, tiles, nTiles );
|
||||||
if ( *canMoveP ) {
|
if ( canMove ) {
|
||||||
|
|
||||||
util_engineStarting( engine->util,
|
util_engineStarting( engine->util,
|
||||||
engine->rack[engine->blankTile] );
|
engine->rack[engine->blankTile] );
|
||||||
|
@ -528,6 +529,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
XP_MEMCPY( newMove, &move->moveInfo, sizeof(*newMove) );
|
XP_MEMCPY( newMove, &move->moveInfo, sizeof(*newMove) );
|
||||||
} else {
|
} else {
|
||||||
newMove->nTiles = 0;
|
newMove->nTiles = 0;
|
||||||
|
canMove = XP_FALSE;
|
||||||
}
|
}
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -540,6 +542,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
newMove->nTiles = 0;
|
newMove->nTiles = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*canMoveP = canMove;
|
||||||
return result;
|
return result;
|
||||||
} /* engine_findMove */
|
} /* engine_findMove */
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ typedef enum {
|
||||||
/* ERR_NOT_YOUR_TURN_TO_MOVE, */
|
/* ERR_NOT_YOUR_TURN_TO_MOVE, */
|
||||||
ERR_CANT_UNDO_TILEASSIGN,
|
ERR_CANT_UNDO_TILEASSIGN,
|
||||||
ERR_CANT_HINT_WHILE_DISABLED,
|
ERR_CANT_HINT_WHILE_DISABLED,
|
||||||
|
ERR_NO_HINT_FOUND, /* not really an error... */
|
||||||
|
|
||||||
ERR_RELAY_BASE,
|
ERR_RELAY_BASE,
|
||||||
ERR_RELAY_END = ERR_RELAY_BASE + XWRELAY_ERROR_LASTERR
|
ERR_RELAY_END = ERR_RELAY_BASE + XWRELAY_ERROR_LASTERR
|
||||||
|
|
|
@ -492,6 +492,10 @@ linux_getErrString( UtilErrID id, XP_Bool* silent )
|
||||||
message = "No tiles selected; trade cancelled.";
|
message = "No tiles selected; trade cancelled.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ERR_NO_HINT_FOUND:
|
||||||
|
message = "Unable to suggest any moves.";
|
||||||
|
break;
|
||||||
|
|
||||||
case ERR_CANT_UNDO_TILEASSIGN:
|
case ERR_CANT_UNDO_TILEASSIGN:
|
||||||
message = "Tile assignment can't be undone.";
|
message = "Tile assignment can't be undone.";
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue