mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
add rematch menu item shown whenever the game's finished (but not
shown for games with > 2 players.
This commit is contained in:
parent
0b9e53df96
commit
037cc73f3e
3 changed files with 93 additions and 79 deletions
|
@ -85,30 +85,31 @@ public final class R {
|
|||
public static final int add_self_button=0x7f0a0073;
|
||||
public static final int advertise_new_room_check=0x7f0a0037;
|
||||
public static final int blessed_label=0x7f0a0057;
|
||||
public static final int board_menu_chat=0x7f0a00a0;
|
||||
public static final int board_menu_dict=0x7f0a009c;
|
||||
public static final int board_menu_done=0x7f0a0086;
|
||||
public static final int board_menu_file_about=0x7f0a0094;
|
||||
public static final int board_menu_file_prefs=0x7f0a0093;
|
||||
public static final int board_menu_flip=0x7f0a009e;
|
||||
public static final int board_menu_game_counts=0x7f0a008c;
|
||||
public static final int board_menu_game_history=0x7f0a008e;
|
||||
public static final int board_menu_game_left=0x7f0a008d;
|
||||
public static final int board_menu_game_netstats=0x7f0a0095;
|
||||
public static final int board_menu_game_resend=0x7f0a0090;
|
||||
public static final int board_menu_game_resign=0x7f0a008f;
|
||||
public static final int board_menu_hint_next=0x7f0a009a;
|
||||
public static final int board_menu_hint_prev=0x7f0a0099;
|
||||
public static final int board_menu_invite=0x7f0a0096;
|
||||
public static final int board_menu_juggle=0x7f0a009d;
|
||||
public static final int board_menu_toggle=0x7f0a00a1;
|
||||
public static final int board_menu_trade=0x7f0a0087;
|
||||
public static final int board_menu_trade_cancel=0x7f0a0088;
|
||||
public static final int board_menu_trade_commit=0x7f0a0089;
|
||||
public static final int board_menu_tray=0x7f0a008b;
|
||||
public static final int board_menu_undo_current=0x7f0a009b;
|
||||
public static final int board_menu_undo_last=0x7f0a008a;
|
||||
public static final int board_menu_zoom=0x7f0a009f;
|
||||
public static final int board_menu_chat=0x7f0a00a1;
|
||||
public static final int board_menu_dict=0x7f0a009d;
|
||||
public static final int board_menu_done=0x7f0a0087;
|
||||
public static final int board_menu_file_about=0x7f0a0095;
|
||||
public static final int board_menu_file_prefs=0x7f0a0094;
|
||||
public static final int board_menu_flip=0x7f0a009f;
|
||||
public static final int board_menu_game_counts=0x7f0a008d;
|
||||
public static final int board_menu_game_history=0x7f0a008f;
|
||||
public static final int board_menu_game_left=0x7f0a008e;
|
||||
public static final int board_menu_game_netstats=0x7f0a0096;
|
||||
public static final int board_menu_game_resend=0x7f0a0091;
|
||||
public static final int board_menu_game_resign=0x7f0a0090;
|
||||
public static final int board_menu_hint_next=0x7f0a009b;
|
||||
public static final int board_menu_hint_prev=0x7f0a009a;
|
||||
public static final int board_menu_invite=0x7f0a0097;
|
||||
public static final int board_menu_juggle=0x7f0a009e;
|
||||
public static final int board_menu_rematch=0x7f0a0086;
|
||||
public static final int board_menu_toggle=0x7f0a00a2;
|
||||
public static final int board_menu_trade=0x7f0a0088;
|
||||
public static final int board_menu_trade_cancel=0x7f0a0089;
|
||||
public static final int board_menu_trade_commit=0x7f0a008a;
|
||||
public static final int board_menu_tray=0x7f0a008c;
|
||||
public static final int board_menu_undo_current=0x7f0a009c;
|
||||
public static final int board_menu_undo_last=0x7f0a008b;
|
||||
public static final int board_menu_zoom=0x7f0a00a0;
|
||||
public static final int board_root=0x7f0a0002;
|
||||
public static final int board_view=0x7f0a0003;
|
||||
public static final int boardsize_spinner=0x7f0a0043;
|
||||
|
@ -124,7 +125,7 @@ public final class R {
|
|||
public static final int chat_button=0x7f0a0081;
|
||||
public static final int chat_edit=0x7f0a0010;
|
||||
public static final int chat_history=0x7f0a000f;
|
||||
public static final int chat_menu_clear=0x7f0a00a2;
|
||||
public static final int chat_menu_clear=0x7f0a00a3;
|
||||
public static final int checkbox=0x7f0a0051;
|
||||
public static final int color_display_sample=0x7f0a0012;
|
||||
public static final int color_edit_sample=0x7f0a0013;
|
||||
|
@ -139,11 +140,11 @@ public final class R {
|
|||
public static final int dict_label=0x7f0a0069;
|
||||
public static final int dict_spinner=0x7f0a002d;
|
||||
public static final int dictlist_button=0x7f0a0080;
|
||||
public static final int dicts_delete=0x7f0a00a5;
|
||||
public static final int dicts_deselect_all=0x7f0a00a4;
|
||||
public static final int dicts_download=0x7f0a00a3;
|
||||
public static final int dicts_move=0x7f0a00a6;
|
||||
public static final int dicts_select=0x7f0a00a7;
|
||||
public static final int dicts_delete=0x7f0a00a6;
|
||||
public static final int dicts_deselect_all=0x7f0a00a5;
|
||||
public static final int dicts_download=0x7f0a00a4;
|
||||
public static final int dicts_move=0x7f0a00a7;
|
||||
public static final int dicts_select=0x7f0a00a8;
|
||||
public static final int divider=0x7f0a0024;
|
||||
public static final int download_button=0x7f0a0075;
|
||||
public static final int dwnld_message=0x7f0a004f;
|
||||
|
@ -161,36 +162,36 @@ public final class R {
|
|||
public static final int flip_button=0x7f0a0083;
|
||||
public static final int game_locked_check=0x7f0a0028;
|
||||
public static final int game_name=0x7f0a0046;
|
||||
public static final int gamel_menu_checkmoves=0x7f0a0092;
|
||||
public static final int games_game_config=0x7f0a00b3;
|
||||
public static final int games_game_copy=0x7f0a00b8;
|
||||
public static final int games_game_delete=0x7f0a00b2;
|
||||
public static final int games_game_move=0x7f0a00b4;
|
||||
public static final int games_game_new_from=0x7f0a00b6;
|
||||
public static final int games_game_rename=0x7f0a00b7;
|
||||
public static final int games_game_reset=0x7f0a00b5;
|
||||
public static final int games_group_default=0x7f0a00bc;
|
||||
public static final int games_group_delete=0x7f0a00bb;
|
||||
public static final int games_group_movedown=0x7f0a00ba;
|
||||
public static final int games_group_moveup=0x7f0a00b9;
|
||||
public static final int games_group_rename=0x7f0a00bd;
|
||||
public static final int games_menu_about=0x7f0a00af;
|
||||
public static final int games_menu_checkmoves=0x7f0a00b1;
|
||||
public static final int games_menu_checkupdates=0x7f0a00be;
|
||||
public static final int games_menu_dicts=0x7f0a00ad;
|
||||
public static final int games_menu_email=0x7f0a00ae;
|
||||
public static final int games_menu_loaddb=0x7f0a00c0;
|
||||
public static final int games_menu_newgame_net=0x7f0a00a9;
|
||||
public static final int games_menu_newgame_solo=0x7f0a00a8;
|
||||
public static final int games_menu_newgroup=0x7f0a00aa;
|
||||
public static final int games_menu_prefs=0x7f0a00ab;
|
||||
public static final int games_menu_rateme=0x7f0a00ac;
|
||||
public static final int games_menu_resend=0x7f0a00b0;
|
||||
public static final int games_menu_storedb=0x7f0a00bf;
|
||||
public static final int games_menu_study=0x7f0a0091;
|
||||
public static final int gamel_menu_checkmoves=0x7f0a0093;
|
||||
public static final int games_game_config=0x7f0a00b4;
|
||||
public static final int games_game_copy=0x7f0a00b9;
|
||||
public static final int games_game_delete=0x7f0a00b3;
|
||||
public static final int games_game_move=0x7f0a00b5;
|
||||
public static final int games_game_new_from=0x7f0a00b7;
|
||||
public static final int games_game_rename=0x7f0a00b8;
|
||||
public static final int games_game_reset=0x7f0a00b6;
|
||||
public static final int games_group_default=0x7f0a00bd;
|
||||
public static final int games_group_delete=0x7f0a00bc;
|
||||
public static final int games_group_movedown=0x7f0a00bb;
|
||||
public static final int games_group_moveup=0x7f0a00ba;
|
||||
public static final int games_group_rename=0x7f0a00be;
|
||||
public static final int games_menu_about=0x7f0a00b0;
|
||||
public static final int games_menu_checkmoves=0x7f0a00b2;
|
||||
public static final int games_menu_checkupdates=0x7f0a00bf;
|
||||
public static final int games_menu_dicts=0x7f0a00ae;
|
||||
public static final int games_menu_email=0x7f0a00af;
|
||||
public static final int games_menu_loaddb=0x7f0a00c1;
|
||||
public static final int games_menu_newgame_net=0x7f0a00aa;
|
||||
public static final int games_menu_newgame_solo=0x7f0a00a9;
|
||||
public static final int games_menu_newgroup=0x7f0a00ab;
|
||||
public static final int games_menu_prefs=0x7f0a00ac;
|
||||
public static final int games_menu_rateme=0x7f0a00ad;
|
||||
public static final int games_menu_resend=0x7f0a00b1;
|
||||
public static final int games_menu_storedb=0x7f0a00c0;
|
||||
public static final int games_menu_study=0x7f0a0092;
|
||||
public static final int group_done=0x7f0a0085;
|
||||
public static final int group_exchange=0x7f0a0097;
|
||||
public static final int group_hint=0x7f0a0098;
|
||||
public static final int group_exchange=0x7f0a0098;
|
||||
public static final int group_hint=0x7f0a0099;
|
||||
public static final int hideable=0x7f0a004b;
|
||||
public static final int hints_allowed=0x7f0a003c;
|
||||
public static final int invite_desc=0x7f0a0009;
|
||||
|
@ -202,10 +203,10 @@ public final class R {
|
|||
public static final int label=0x7f0a0025;
|
||||
public static final int lang_separator=0x7f0a002b;
|
||||
public static final int lang_spinner=0x7f0a002c;
|
||||
public static final int loc_item_check=0x7f0a00c2;
|
||||
public static final int loc_item_clear=0x7f0a00c1;
|
||||
public static final int loc_item_copy_bless=0x7f0a00c4;
|
||||
public static final int loc_item_copy_eng=0x7f0a00c3;
|
||||
public static final int loc_item_check=0x7f0a00c3;
|
||||
public static final int loc_item_clear=0x7f0a00c2;
|
||||
public static final int loc_item_copy_bless=0x7f0a00c5;
|
||||
public static final int loc_item_copy_eng=0x7f0a00c4;
|
||||
public static final int loc_search_button=0x7f0a005e;
|
||||
public static final int loc_search_field=0x7f0a005d;
|
||||
public static final int local_label=0x7f0a0059;
|
||||
|
@ -253,11 +254,11 @@ public final class R {
|
|||
public static final int send_button=0x7f0a0011;
|
||||
public static final int show_remote=0x7f0a001e;
|
||||
public static final int shuffle_button=0x7f0a007e;
|
||||
public static final int slmenu_clear_sel=0x7f0a00c9;
|
||||
public static final int slmenu_copy_sel=0x7f0a00c8;
|
||||
public static final int slmenu_deselect_all=0x7f0a00c7;
|
||||
public static final int slmenu_lookup_sel=0x7f0a00c5;
|
||||
public static final int slmenu_select_all=0x7f0a00c6;
|
||||
public static final int slmenu_clear_sel=0x7f0a00ca;
|
||||
public static final int slmenu_copy_sel=0x7f0a00c9;
|
||||
public static final int slmenu_deselect_all=0x7f0a00c8;
|
||||
public static final int slmenu_lookup_sel=0x7f0a00c6;
|
||||
public static final int slmenu_select_all=0x7f0a00c7;
|
||||
public static final int smart_robot=0x7f0a0040;
|
||||
public static final int state=0x7f0a004d;
|
||||
public static final int summary=0x7f0a0060;
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
<group android:id="@+id/group_done">
|
||||
<!-- title set in BoardActivity -->
|
||||
|
||||
<item android:id="@+id/board_menu_rematch"
|
||||
android:title="@string/button_rematch"
|
||||
android:showAsAction="ifRoom"
|
||||
/>
|
||||
<item android:id="@+id/board_menu_done"
|
||||
android:alphabeticShortcut="D"
|
||||
android:showAsAction="ifRoom"
|
||||
|
|
|
@ -237,7 +237,8 @@ public class BoardDelegate extends DelegateBase
|
|||
}
|
||||
};
|
||||
ab.setNegativeButton( R.string.button_retry, lstnr );
|
||||
} else if ( DlgID.GAME_OVER == dlgID && rematchSupported() ) {
|
||||
} else if ( DlgID.GAME_OVER == dlgID
|
||||
&& rematchSupported( true ) ) {
|
||||
lstnr = new OnClickListener() {
|
||||
public void onClick( DialogInterface dlg,
|
||||
int whichButton ) {
|
||||
|
@ -739,6 +740,7 @@ public class BoardDelegate extends DelegateBase
|
|||
boolean inTrade = false;
|
||||
MenuItem item;
|
||||
int strId;
|
||||
boolean enable;
|
||||
|
||||
if ( null != m_gsi ) {
|
||||
inTrade = m_gsi.inTrade;
|
||||
|
@ -783,10 +785,10 @@ public class BoardDelegate extends DelegateBase
|
|||
Utils.setItemVisible( menu, R.id.board_menu_game_resign, !inTrade );
|
||||
|
||||
if ( !inTrade ) {
|
||||
boolean enabled = null == m_gsi || m_gsi.curTurnSelected;
|
||||
enable = null == m_gsi || m_gsi.curTurnSelected;
|
||||
item = menu.findItem( R.id.board_menu_done );
|
||||
item.setVisible( enabled );
|
||||
if ( enabled ) {
|
||||
item.setVisible( enable );
|
||||
if ( enable ) {
|
||||
if ( 0 >= m_view.curPending() ) {
|
||||
strId = R.string.board_menu_pass;
|
||||
} else {
|
||||
|
@ -801,7 +803,10 @@ public class BoardDelegate extends DelegateBase
|
|||
}
|
||||
}
|
||||
|
||||
boolean enable = null != m_gi
|
||||
enable = m_gameOver && rematchSupported( false );
|
||||
Utils.setItemVisible( menu, R.id.board_menu_rematch, enable );
|
||||
|
||||
enable = null != m_gi
|
||||
&& DeviceRole.SERVER_STANDALONE != m_gi.serverRole;
|
||||
Utils.setItemVisible( menu, R.id.gamel_menu_checkmoves, enable );
|
||||
Utils.setItemVisible( menu, R.id.board_menu_game_resend,
|
||||
|
@ -838,6 +843,10 @@ public class BoardDelegate extends DelegateBase
|
|||
}
|
||||
break;
|
||||
|
||||
case R.id.board_menu_rematch:
|
||||
doRematchIf();
|
||||
break;
|
||||
|
||||
case R.id.board_menu_trade_commit:
|
||||
cmd = JNICmd.CMD_COMMIT;
|
||||
break;
|
||||
|
@ -2507,7 +2516,7 @@ public class BoardDelegate extends DelegateBase
|
|||
}
|
||||
|
||||
// For now, supported if standalone or either BT or SMS used for transport
|
||||
private boolean rematchSupported()
|
||||
private boolean rematchSupported( boolean showMulti )
|
||||
{
|
||||
boolean supported = false;
|
||||
if ( XWApp.REMATCH_SUPPORTED ) {
|
||||
|
@ -2515,16 +2524,16 @@ public class BoardDelegate extends DelegateBase
|
|||
supported = m_gi.serverRole == DeviceRole.SERVER_STANDALONE;
|
||||
|
||||
if ( !supported )
|
||||
if ( 2 != m_gi.nPlayers ) {
|
||||
if ( 2 == m_gi.nPlayers ) {
|
||||
supported = m_connTypes.contains( CommsConnType.COMMS_CONN_BT )
|
||||
|| m_connTypes.contains( CommsConnType.COMMS_CONN_SMS )
|
||||
|| m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY );
|
||||
} else if ( showMulti ) {
|
||||
// show the button if people haven't dismissed the hint yet
|
||||
supported = ! XWPrefs
|
||||
.getPrefsBoolean( m_activity,
|
||||
R.string.key_na_rematch_two_only,
|
||||
false );
|
||||
} else {
|
||||
supported = m_connTypes.contains( CommsConnType.COMMS_CONN_BT )
|
||||
|| m_connTypes.contains( CommsConnType.COMMS_CONN_SMS )
|
||||
|| m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY );
|
||||
}
|
||||
}
|
||||
return supported;
|
||||
|
|
Loading…
Add table
Reference in a new issue