show a toast when hint can't find anything, on the principle that user

should see some response to every action.
This commit is contained in:
Eric House 2015-07-11 16:24:21 -07:00
parent fb80032b38
commit 5dc8291981
9 changed files with 30 additions and 2 deletions

View file

@ -2444,6 +2444,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=0x7f05017f; public static final int str_no_empties_in_turn=0x7f05017f;
public static final int str_no_hint_found=0x7f050313;
/** 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.)
*/ */

View file

@ -2526,4 +2526,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>

View file

@ -2184,4 +2184,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>

View file

@ -2184,4 +2184,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>

View file

@ -1733,6 +1733,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;
@ -1778,10 +1779,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

View file

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

View file

@ -2121,6 +2121,8 @@ board_requestHint( BoardCtxt* board,
} }
setArrowVisible( board, wasVisible ); setArrowVisible( board, wasVisible );
} }
} else {
util_userError( board->util, ERR_NO_HINT_FOUND );
} }
} }
return result || redraw; return result || redraw;

View file

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

View file

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