License.
copyright info
*/
- public static final int about_copyright=0x7f0501d3;
+ public static final int about_copyright=0x7f0501d4;
/** Another paragraph giving credit for work done other than by
Eric House and translators
Another paragraph giving credit for work done other than by
@@ -592,7 +593,7 @@ tous les chevalets :\n
Another paragraph giving credit for work done other than by
Eric House and translators
*/
- public static final int about_credits=0x7f0501d6;
+ public static final int about_credits=0x7f0501d7;
/**
###########################################################
# :Dialogs:
@@ -625,7 +626,7 @@ tous les chevalets :\n
String giving version info, which is substituted in.
*/
- public static final int about_vers_fmt=0x7f0501d2;
+ public static final int about_vers_fmt=0x7f0501d3;
/** Another paragraph in the about dialog
Another paragraph in the about dialog
For a manual or sourcecode see:
@@ -634,42 +635,42 @@ tous les chevalets :\n
xwords@eehouse.org.
Another paragraph in the about dialog
*/
- public static final int about_web=0x7f0501d4;
+ public static final int about_web=0x7f0501d5;
/** %1$s added to %2$s studylist
*/
- public static final int add_done_fmt=0x7f05028f;
+ public static final int add_done_fmt=0x7f050290;
/** Add %1$s to studylist
*/
- public static final int add_to_study_fmt=0x7f050289;
+ public static final int add_to_study_fmt=0x7f05028a;
/** Debugging stuff. Localize if you think your langauge users will
care.
XLATE-ME
For debugging
*/
- public static final int advanced=0x7f0502fc;
+ public static final int advanced=0x7f0502ff;
/** This button takes you to the normal Game Configure screen
This button takes you to the normal Game Configure screen
Advanced game settings
This button takes you to the normal Game Configure screen
*/
- public static final int advanced_config=0x7f05018e;
+ public static final int advanced_config=0x7f05018f;
/** XLATE-ME
You should never need these...
*/
- public static final int advanced_summary=0x7f0502fd;
+ public static final int advanced_summary=0x7f050300;
/**
The wordlist %1$s contains only
tile information. There are no words to browse.
*/
- public static final int alert_empty_dict_fmt=0x7f0501f1;
- public static final int app_name=0x7f050082;
+ public static final int alert_empty_dict_fmt=0x7f0501f2;
+ public static final int app_name=0x7f050083;
/** Unable to connect to Crosswords
on the device %1$s. Please check that the device is within range
and that Crosswords is installed on it.
*/
- public static final int app_not_found_fmt=0x7f0502d4;
+ public static final int app_not_found_fmt=0x7f0502d7;
public static final int app_version=0x7f050000;
/** the background color of the area outside the board,
e.g. between entries in the scoreboard
@@ -679,7 +680,7 @@ XLATE-ME
the background color of the area outside the board,
e.g. between entries in the scoreboard
*/
- public static final int background=0x7f05014d;
+ public static final int background=0x7f05014e;
/** Appended to the above in the phonies_warn case. User may
ignore the warning
Appended to the above in the phonies_warn case. User may
@@ -689,7 +690,7 @@ XLATE-ME
Appended to the above in the phonies_warn case. User may
ignore the warning
*/
- public static final int badwords_accept=0x7f0500f8;
+ public static final int badwords_accept=0x7f0500f9;
/** Appended to the above in the phonies_disallow case. User has
lost his turn.
Appended to the above in the phonies_disallow case. User has
@@ -698,22 +699,22 @@ XLATE-ME
Appended to the above in the phonies_disallow case. User has
lost his turn.
*/
- public static final int badwords_lost=0x7f0500f9;
+ public static final int badwords_lost=0x7f0500fa;
/** title of the dialog in which the above is posted.
title of the dialog in which the above is posted.
Illegal word[s]
title of the dialog in which the above is posted.
*/
- public static final int badwords_title=0x7f0500fa;
+ public static final int badwords_title=0x7f0500fb;
/** Blue
*/
- public static final int blue=0x7f050151;
+ public static final int blue=0x7f050152;
/** board menu for small devices only
board menu for small devices only
Browse wordlist
board menu for small devices only
*/
- public static final int board_menu_dict=0x7f05022d;
+ public static final int board_menu_dict=0x7f05022e;
/**
############################################################
# :Menus:
@@ -742,18 +743,18 @@ XLATE-ME
This menu commits the current move as it's been laid out on
the board
*/
- public static final int board_menu_done=0x7f0500fb;
+ public static final int board_menu_done=0x7f0500fc;
/** Brings up "About Crosswords" dialog
Brings up "About Crosswords" dialog
Brings up "About Crosswords" dialog
*/
- public static final int board_menu_file_about=0x7f050098;
+ public static final int board_menu_file_about=0x7f050099;
/**
Email author
*/
- public static final int board_menu_file_email=0x7f0501f6;
+ public static final int board_menu_file_email=0x7f0501f7;
/** menu on Game submenu: brings up dialog listing all tiles in
the language of the game along with how many of each there
are and how many points each is worth. This display is the
@@ -768,7 +769,7 @@ XLATE-ME
are and how many points each is worth. This display is the
same throughout the game.
*/
- public static final int board_menu_game_counts=0x7f050101;
+ public static final int board_menu_game_counts=0x7f050102;
/** Brings up explanation of the game's final score. If the game
is not yet over, gives you a choice whether to end it now,
and if you decline does nothing.
@@ -780,13 +781,13 @@ XLATE-ME
is not yet over, gives you a choice whether to end it now,
and if you decline does nothing.
*/
- public static final int board_menu_game_final=0x7f050104;
+ public static final int board_menu_game_final=0x7f050105;
/** Brings up listing of all moves played so far this game.
Brings up listing of all moves played so far this game.
Game history…
Brings up listing of all moves played so far this game.
*/
- public static final int board_menu_game_history=0x7f050103;
+ public static final int board_menu_game_history=0x7f050104;
/** menu on Game submenu: brings up dialog listing all tiles not
yet played and not in the rack of the player whose rack is
visible (whose turn it is, generally). This display will
@@ -804,11 +805,11 @@ XLATE-ME
change as tiles are used and depending on what player is
asking.
*/
- public static final int board_menu_game_left=0x7f050102;
+ public static final int board_menu_game_left=0x7f050103;
/** XLATE-ME
Network stats
*/
- public static final int board_menu_game_netstats=0x7f050307;
+ public static final int board_menu_game_netstats=0x7f05030a;
/** Meaningful only for networked games, this menu causes all
messages that have not yet been acknowledged by a remote
device in the game to be resent. Eventually I hope to be
@@ -826,20 +827,20 @@ XLATE-ME
able to remove this from non-debug versions of the game
because users should not have to do do this EVER.
*/
- public static final int board_menu_game_resend=0x7f050106;
+ public static final int board_menu_game_resend=0x7f050107;
/** Resign
*/
- public static final int board_menu_game_resign=0x7f050105;
- public static final int board_menu_game_showInvites=0x7f050308;
+ public static final int board_menu_game_resign=0x7f050106;
+ public static final int board_menu_game_showInvites=0x7f05030b;
/** Invite
*/
- public static final int board_menu_invite=0x7f050282;
+ public static final int board_menu_invite=0x7f050283;
/**
Pass
*/
- public static final int board_menu_pass=0x7f0501e2;
+ public static final int board_menu_pass=0x7f0501e3;
/** This menu begins an exchange of tiles: puts the board into
trade mode.
This menu begins an exchange of tiles: puts the board into
@@ -847,7 +848,7 @@ XLATE-ME
This menu begins an exchange of tiles: puts the board into
trade mode.
*/
- public static final int board_menu_trade=0x7f0500fc;
+ public static final int board_menu_trade=0x7f0500fd;
/** hide and shows the tray. On devices where there is enough
room for the full board and tray to be shown then hiding the
tray just "turns it over", i.e. shows tiles with '?'
@@ -861,14 +862,14 @@ XLATE-ME
tray just "turns it over", i.e. shows tiles with '?'
characters.
*/
- public static final int board_menu_tray_hide=0x7f0500fd;
- public static final int board_menu_tray_show=0x7f0500fe;
+ public static final int board_menu_tray_hide=0x7f0500fe;
+ public static final int board_menu_tray_show=0x7f0500ff;
/**
Undo/Redo
*/
- public static final int board_menu_undo_current=0x7f050226;
+ public static final int board_menu_undo_current=0x7f050227;
/** Undos the last *committed* turn. Note that this is different
from the undo button that undoes or redoes an in-progress
not-yet-committed turn. This is disabled for networked
@@ -883,7 +884,7 @@ XLATE-ME
not-yet-committed turn. This is disabled for networked
games.
*/
- public static final int board_menu_undo_last=0x7f0500ff;
+ public static final int board_menu_undo_last=0x7f050100;
/** preference for board size (15x15, 13x13 etc.)
default new-game setting for handline phonies (words not
found in the word list)
@@ -902,7 +903,7 @@ XLATE-ME
Board size
preference for board size (15x15, 13x13 etc.)
*/
- public static final int board_size=0x7f050134;
+ public static final int board_size=0x7f050135;
/** Title of submenu
Undos the last *committed* turn. Note that this is different
from the undo button that undoes or redoes an in-progress
@@ -915,7 +916,7 @@ XLATE-ME
Title of submenu
Title of submenu
*/
- public static final int board_submenu_game=0x7f050100;
+ public static final int board_submenu_game=0x7f050101;
/** The remaining strings (down to the color edit dialog below)
are showns as the names of editable colors and as the the
title of the color editor that comes up when the name is
@@ -933,7 +934,7 @@ XLATE-ME
tapped.
(color for) double-letter bonus squares on the board
*/
- public static final int bonus_l2x=0x7f050146;
+ public static final int bonus_l2x=0x7f050147;
/** Bonus value hint that's displayed in gray text in the colored
bonus square. Double-letter
Bonus value hint that's displayed in gray text in the colored
@@ -941,13 +942,13 @@ XLATE-ME
Bonus value hint that's displayed in gray text in the colored
bonus square. Double-letter
*/
- public static final int bonus_l2x_summary=0x7f0500e3;
+ public static final int bonus_l2x_summary=0x7f0500e4;
/** (color for) triple-letter bonus squares on the board
(color for) triple-letter bonus squares on the board
Triple letter
(color for) triple-letter bonus squares on the board
*/
- public static final int bonus_l3x=0x7f050147;
+ public static final int bonus_l3x=0x7f050148;
/** Bonus value hint that's displayed in gray text in the colored
bonus square. Triple-letter
Bonus value hint that's displayed in gray text in the colored
@@ -955,13 +956,13 @@ XLATE-ME
Bonus value hint that's displayed in gray text in the colored
bonus square. Triple-letter
*/
- public static final int bonus_l3x_summary=0x7f0500e5;
+ public static final int bonus_l3x_summary=0x7f0500e6;
/** (color for) double-word squares on the board
(color for) double-word squares on the board
Double word
(color for) double-word squares on the board
*/
- public static final int bonus_w2x=0x7f050148;
+ public static final int bonus_w2x=0x7f050149;
/** Bonus value hint that's displayed in gray text in the colored
bonus square. Double-word
Bonus value hint that's displayed in gray text in the colored
@@ -969,13 +970,13 @@ XLATE-ME
Bonus value hint that's displayed in gray text in the colored
bonus square. Double-word
*/
- public static final int bonus_w2x_summary=0x7f0500e4;
+ public static final int bonus_w2x_summary=0x7f0500e5;
/** (color for) triple-word squares on the board
(color for) triple-word squares on the board
Triple word
(color for) triple-word squares on the board
*/
- public static final int bonus_w3x=0x7f050149;
+ public static final int bonus_w3x=0x7f05014a;
/** Bonus value hint that's displayed in gray text in the colored
bonus square. Triple-word
Bonus value hint that's displayed in gray text in the colored
@@ -983,7 +984,7 @@ XLATE-ME
Bonus value hint that's displayed in gray text in the colored
bonus square. Triple-word
*/
- public static final int bonus_w3x_summary=0x7f0500e6;
+ public static final int bonus_w3x_summary=0x7f0500e7;
/**
The version of Crosswords on
@@ -992,38 +993,38 @@ XLATE-ME
continue.
*/
- public static final int bt_bad_proto_fmt=0x7f050205;
+ public static final int bt_bad_proto_fmt=0x7f050206;
/**
Bluetooth sends to %1$s have failed too many
times. Re-open the game to try again.
*/
- public static final int bt_fail_fmt=0x7f05020a;
+ public static final int bt_fail_fmt=0x7f05020b;
/** Title of device picker during invitation to a game via Bluetooth
Title of device picker during invitation to a game via Bluetooth
Bluetooth Invitation
*/
- public static final int bt_invite_title=0x7f05020c;
+ public static final int bt_invite_title=0x7f05020d;
/** You currently have no paired Bluetooth
devices. Would you like to open the Android Settings Panel to add
one or more?\n\n(You may also need to open it on the device you
want to pair with.)
*/
- public static final int bt_no_devs=0x7f0502d3;
+ public static final int bt_no_devs=0x7f0502d6;
/** Turn Bluetooth on
In the Bluetooth invite device dialog
In the Bluetooth invite device dialog
Add all Paired
*/
- public static final int bt_pick_addall_button=0x7f0501fa;
+ public static final int bt_pick_addall_button=0x7f0501fb;
/**
Remove checked
*/
- public static final int bt_pick_clear_button=0x7f0501fb;
+ public static final int bt_pick_clear_button=0x7f0501fc;
/**
Bluetooth send to %1$s failed; retry %3$d in
@@ -1033,7 +1034,7 @@ XLATE-ME
*/
- public static final int bt_resend_fmt=0x7f050209;
+ public static final int bt_resend_fmt=0x7f05020a;
/** text of button for adding new player to game
text for separator above the list of players that's used for
networked games. The numbers of local and non-local players
@@ -1042,22 +1043,22 @@ XLATE-ME
Add player
text of button for adding new player to game
*/
- public static final int button_add_player=0x7f0500b9;
+ public static final int button_add_player=0x7f0500ba;
/** The only button available when the above message is displayed
The only button available when the above message is displayed
Close game
The only button available when the above message is displayed
*/
- public static final int button_close_game=0x7f05019f;
+ public static final int button_close_game=0x7f0501a0;
/** Decline
*/
- public static final int button_decline=0x7f050262;
+ public static final int button_decline=0x7f050263;
/**
*/
- public static final int button_default_both=0x7f0500af;
+ public static final int button_default_both=0x7f0500b0;
/** These three strings are the text for three buttons giving
choices in respose to the dialog launched in response to the
dicts_item_select menu (see dicts_item_select above.)
@@ -1095,11 +1096,11 @@ XLATE-ME
choices in respose to the dialog launched in response to the
dicts_item_select menu (see dicts_item_select above.)
*/
- public static final int button_default_human=0x7f0500ad;
+ public static final int button_default_human=0x7f0500ae;
/**
*/
- public static final int button_default_robot=0x7f0500ae;
+ public static final int button_default_robot=0x7f0500af;
/** When you select the gamel_menu_delete_all menuitem or
list_item_delete contextual menu, you are asked to confirm.
This is the text of the first button ("Cancel" is the
@@ -1125,8 +1126,8 @@ XLATE-ME
This is the text of the first button ("Cancel" is the
second).
*/
- public static final int button_delete=0x7f050091;
- public static final int button_disable_relay=0x7f05024d;
+ public static final int button_delete=0x7f050092;
+ public static final int button_disable_relay=0x7f05024e;
/** Used for button in dialog put up with the relay says the
remote partner of this game has deleted it. Ok, meaning
"don't discard", is the other option. This same button is
@@ -1147,23 +1148,23 @@ XLATE-ME
the other option, for discarding changes that would otherwise
reset a game.
*/
- public static final int button_discard=0x7f0501af;
+ public static final int button_discard=0x7f0501b0;
/** XLATE-ME
Discard changes
*/
- public static final int button_discard_changes=0x7f0502f3;
+ public static final int button_discard_changes=0x7f0502f6;
/**
Done
*/
- public static final int button_done=0x7f0501df;
+ public static final int button_done=0x7f0501e0;
/**
Done with %1$s
*/
- public static final int button_done_fmt=0x7f0501e0;
+ public static final int button_done_fmt=0x7f0501e1;
/** Text of button displayed when downloading is an option
This is an alternative message presented when there's also
the option of downloading another wordlist. Game name,
@@ -1183,38 +1184,38 @@ XLATE-ME
Download
Text of button displayed when downloading is an option
*/
- public static final int button_download=0x7f0501a2;
+ public static final int button_download=0x7f0501a3;
/** XLATE-ME
Edit
*/
- public static final int button_edit=0x7f0502f2;
- public static final int button_enable=0x7f050337;
+ public static final int button_edit=0x7f0502f5;
+ public static final int button_enable=0x7f05033b;
/** XLATE-ME
Enable Bluetooth
*/
- public static final int button_enable_bt=0x7f05024b;
- public static final int button_enable_relay=0x7f05024c;
+ public static final int button_enable_bt=0x7f05024c;
+ public static final int button_enable_relay=0x7f05024d;
/** XLATE-ME
Enable SMS
*/
- public static final int button_enable_sms=0x7f05024a;
- public static final int button_go_settings=0x7f050284;
+ public static final int button_enable_sms=0x7f05024b;
+ public static final int button_go_settings=0x7f050285;
/**
Invite checked
*/
- public static final int button_invite=0x7f05020b;
+ public static final int button_invite=0x7f05020c;
/** text of button to juggle (randomly rearrange order of) players
text of button to juggle (randomly rearrange order of) players
Shuffle players
text of button to juggle (randomly rearrange order of) players
*/
- public static final int button_juggle_players=0x7f0500ba;
+ public static final int button_juggle_players=0x7f0500bb;
/** XLATE-ME
Later
*/
- public static final int button_later=0x7f05024e;
+ public static final int button_later=0x7f05024f;
/** New strings that need to be documented and found a home
above.
New strings that need to be documented and found a home
@@ -1223,25 +1224,25 @@ XLATE-ME
New strings that need to be documented and found a home
above.
*/
- public static final int button_lookup=0x7f0501d9;
+ public static final int button_lookup=0x7f0501da;
/**
Look up %1$s
*/
- public static final int button_lookup_fmt=0x7f0501db;
+ public static final int button_lookup_fmt=0x7f0501dc;
/** Look up/study words
*/
- public static final int button_lookup_study=0x7f0501da;
+ public static final int button_lookup_study=0x7f0501db;
/** Look up/study %1$s
*/
- public static final int button_lookup_study_fmt=0x7f0501dc;
+ public static final int button_lookup_study_fmt=0x7f0501dd;
/**
Move
*/
- public static final int button_move=0x7f0501e4;
+ public static final int button_move=0x7f0501e5;
/** What is \u200C? English strings are used as keys, so they all
need to be unique. This glyph is non-printing and of
zero-width, so it should do the trick:
@@ -1258,33 +1259,28 @@ XLATE-ME
Text of menuitem in main games-list screen's menu
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-ca/strings.xml).
+ It was generated (from res_src/values-ca/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-ja/strings.xml).
+ It was generated (from res_src/values-ja/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-de/strings.xml).
- Any changes you make to it will be lost.
-
-
- DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-sk/strings.xml).
+ It was generated (from res_src/values-sk/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
Text of menuitem in main games-list screen's menu
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-nl/strings.xml).
+ It was generated (from res_src/values-nl/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-fr/strings.xml).
+ It was generated (from res_src/values-fr/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
What is \u200C? English strings are used as keys, so they all
@@ -1303,12 +1299,12 @@ XLATE-ME
Text of menuitem in main games-list screen's menu
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-cs/strings.xml).
+ It was generated (from res_src/values-cs/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
DO NOT EDIT THIS FILE!!!!
- It was generated (from res_src/values-pt/strings.xml).
+ It was generated (from res_src/values-pt/strings.xml, by copy-strings.py).
Any changes you make to it will be lost.
@@ -1323,17 +1319,17 @@ XLATE-ME
menuitem in main games-list screen's menu. (The botton can
be hidden in the same way as the above text.)
*/
- public static final int button_new_game=0x7f050086;
+ public static final int button_new_game=0x7f050087;
/** Games list screen menuitem text for creating a new group
Games list screen menuitem text for creating a new group
*/
- public static final int button_new_group=0x7f050087;
+ public static final int button_new_group=0x7f050088;
/** New group
*/
- public static final int button_newgroup=0x7f0501e5;
+ public static final int button_newgroup=0x7f0501e6;
/** No
*/
- public static final int button_no=0x7f0501ad;
+ public static final int button_no=0x7f0501ae;
/** Text for button in new-user-info dialog with title just
above.
Text for button in new-user-info dialog with title just
@@ -1342,14 +1338,14 @@ XLATE-ME
Text for button in new-user-info dialog with title just
above.
*/
- public static final int button_notagain=0x7f0501bb;
+ public static final int button_notagain=0x7f0501bc;
/** Reconnect
*/
- public static final int button_reconnect=0x7f050274;
- public static final int button_reinvite=0x7f0502ed;
+ public static final int button_reconnect=0x7f050275;
+ public static final int button_reinvite=0x7f0502f0;
/**
*/
- public static final int button_relay_add=0x7f050217;
+ public static final int button_relay_add=0x7f050218;
/** Button shown in game over dialog triggering creation of new
game with the same players and parameters as the one that
just ended.
@@ -1361,7 +1357,7 @@ XLATE-ME
game with the same players and parameters as the one that
just ended.
*/
- public static final int button_rematch=0x7f050273;
+ public static final int button_rematch=0x7f050274;
/** When you select the list_item_reset contextual menu, you are
asked to confirm. This is the text of the first button
("Cancel" is the second).
@@ -1372,7 +1368,7 @@ XLATE-ME
asked to confirm. This is the text of the first button
("Cancel" is the second).
*/
- public static final int button_reset=0x7f050092;
+ public static final int button_reset=0x7f050093;
/** Used for a button when informing user that his attempt to
connect to the relay failed because the room named does not
exist. (I believe this no longer occurs.)
@@ -1384,7 +1380,7 @@ XLATE-ME
connect to the relay failed because the room named does not
exist. (I believe this no longer occurs.)
*/
- public static final int button_retry=0x7f0501b0;
+ public static final int button_retry=0x7f0501b1;
/**
############################################################
# :Menus:
@@ -1420,7 +1416,7 @@ XLATE-ME
text of first menu item. Will revert all preferences to
their default/original values
*/
- public static final int button_revert_all=0x7f05011c;
+ public static final int button_revert_all=0x7f05011d;
/** Second menu item. Reverts only the colors to their
default/original values
Second menu item. Reverts only the colors to their
@@ -1429,26 +1425,26 @@ XLATE-ME
Second menu item. Reverts only the colors to their
default/original values
*/
- public static final int button_revert_colors=0x7f05011e;
+ public static final int button_revert_colors=0x7f05011f;
/** Used in Game config dialog to confirm saving changes that reset a game
Used in Game config dialog to confirm saving changes that reset a game
Save
Used in Game config dialog to confirm saving changes that reset a game
*/
- public static final int button_save=0x7f0501ae;
+ public static final int button_save=0x7f0501af;
/**
Find
*/
- public static final int button_search=0x7f0501e6;
+ public static final int button_search=0x7f0501e7;
/**
Import contact
*/
- public static final int button_sms_add=0x7f050216;
+ public static final int button_sms_add=0x7f050217;
/** Text of button allowing user to choose to open with a
different (but same-language wordlist)
Text of button allowing user to choose to open with a
@@ -1457,10 +1453,10 @@ XLATE-ME
Text of button allowing user to choose to open with a
different (but same-language wordlist)
*/
- public static final int button_substdict=0x7f0501a3;
+ public static final int button_substdict=0x7f0501a4;
/** Cancel trade
*/
- public static final int button_trade_cancel=0x7f0500e1;
+ public static final int button_trade_cancel=0x7f0500e2;
/**
############################################################
# :Screens:
@@ -1499,10 +1495,10 @@ XLATE-ME
Buttons shown at bottom when board is in exchange mode,
i.e. after user has picked board_menu_trade menu item
*/
- public static final int button_trade_commit=0x7f0500e0;
+ public static final int button_trade_commit=0x7f0500e1;
/** Button for alert with title above
*/
- public static final int button_wait=0x7f0502ec;
+ public static final int button_wait=0x7f0502ef;
/**
############################################################
# Dialogs
@@ -1545,14 +1541,14 @@ XLATE-ME
Text for buttons at the bottom of dialogs. These first are
in many places.
*/
- public static final int button_yes=0x7f0501ac;
+ public static final int button_yes=0x7f0501ad;
/** The group for new games, %1$s,
cannot be deleted.
*/
- public static final int cannot_delete_default_group_fmt=0x7f050272;
+ public static final int cannot_delete_default_group_fmt=0x7f050273;
/** Move selected games to:
*/
- public static final int change_group=0x7f050277;
+ public static final int change_group=0x7f050278;
/** text of button in About Crosswords dialog summoning above
dialog
text of button in About Crosswords dialog summoning above
@@ -1561,7 +1557,7 @@ XLATE-ME
text of button in About Crosswords dialog summoning above
dialog
*/
- public static final int changes_button=0x7f0501d8;
+ public static final int changes_button=0x7f0501d9;
/** text of dialog showing the set of changes made since the last
release
text of dialog showing the set of changes made since the last
@@ -1570,16 +1566,16 @@ XLATE-ME
text of dialog showing the set of changes made since the last
release
*/
- public static final int changes_title=0x7f0501d7;
+ public static final int changes_title=0x7f0501d8;
/** "Hint" in empty chat text field
*/
- public static final int chat_hint=0x7f05018b;
+ public static final int chat_hint=0x7f05018c;
/** Prefix for local messages
Prefix for local messages
Me:\u0020
Prefix for local messages
*/
- public static final int chat_local_id=0x7f050188;
+ public static final int chat_local_id=0x7f050189;
/**
############################################################
# :Menus:
@@ -1612,13 +1608,13 @@ XLATE-ME
other devices in the game: no "clear chat" message is
transmitted.
*/
- public static final int chat_menu_clear=0x7f05018c;
+ public static final int chat_menu_clear=0x7f05018d;
/** Prefix for remote messages
Prefix for remote messages
Not me:\u0020
Prefix for remote messages
*/
- public static final int chat_other_id=0x7f050189;
+ public static final int chat_other_id=0x7f05018a;
/** Text on the button that causes the contents of the
message-composition field to be sent.
Text on the button that causes the contents of the
@@ -1627,8 +1623,8 @@ XLATE-ME
Text on the button that causes the contents of the
message-composition field to be sent.
*/
- public static final int chat_send=0x7f05018a;
- public static final int chat_sender_fmt=0x7f05022b;
+ public static final int chat_send=0x7f05018b;
+ public static final int chat_sender_fmt=0x7f05022c;
/** ############################################################
# :Screens:
# Chat screen
@@ -1672,20 +1668,20 @@ XLATE-ME
title of the chat screen. The name of the current game is
substituted for %s.
*/
- public static final int chat_title_fmt=0x7f050187;
+ public static final int chat_title_fmt=0x7f050188;
/** Checking for wordlists in %1$s…
*/
- public static final int checking_for_fmt=0x7f05032e;
+ public static final int checking_for_fmt=0x7f050332;
/** Checking
*/
- public static final int checking_title=0x7f05032d;
+ public static final int checking_title=0x7f050331;
/** Everything is up-to-date.
*/
- public static final int checkupdates_none_found=0x7f050250;
+ public static final int checkupdates_none_found=0x7f050251;
/** EXPERIMENTAL: "label" for invite on clipboard. If it's shown
it's by some Android utility
*/
- public static final int clip_label=0x7f050340;
+ public static final int clip_label=0x7f050344;
/** color of the "crosshairs", lines drawn vertically and
horizontally through the square the user is currently
touching in order to guide the fat-fingered (most of us) in
@@ -1703,15 +1699,15 @@ XLATE-ME
operations that require accurately selecting a single square
on the board.
*/
- public static final int clr_crosshairs=0x7f05014a;
+ public static final int clr_crosshairs=0x7f05014b;
/** XLATE-ME
This game has no way to connect
and cannot be saved. Would you like to discard your changes, or
edit to give it a way to connect?
*/
- public static final int config_no_connvia=0x7f0502f1;
- public static final int confirm_clear_chat=0x7f050342;
- public static final int confirm_clear_relay=0x7f05021e;
+ public static final int config_no_connvia=0x7f0502f4;
+ public static final int confirm_clear_chat=0x7f050346;
+ public static final int confirm_clear_relay=0x7f05021f;
/** Additional text appended to text confirm_delete_dictf in the
wordlist delete confiration dialog in the case where the
wordlist to be deleted is the last in its language. The name
@@ -1721,29 +1717,29 @@ XLATE-ME
wordlist to be deleted is the last in its language. The name
of the language is substituted for %1$s.
*/
- public static final int confirm_deleteonly_dicts_fmt=0x7f0500ab;
- public static final int confirm_drop_relay=0x7f050333;
- public static final int confirm_drop_relay_bt=0x7f050335;
- public static final int confirm_drop_relay_sms=0x7f050336;
+ public static final int confirm_deleteonly_dicts_fmt=0x7f0500ac;
+ public static final int confirm_drop_relay=0x7f050337;
+ public static final int confirm_drop_relay_bt=0x7f050339;
+ public static final int confirm_drop_relay_sms=0x7f05033a;
/** Your device is set up for
%1$s. Would you like to download a wordlist so you can play
Crosswords in %1$s?
*/
- public static final int confirm_get_locdict_fmt=0x7f0502fb;
+ public static final int confirm_get_locdict_fmt=0x7f0502fe;
/** Text of confirmation dialog for above
Text of confirmation dialog for above
Are you sure you want to restore
all settings to their original values?
Text of confirmation dialog for above
*/
- public static final int confirm_revert_all=0x7f05011f;
+ public static final int confirm_revert_all=0x7f050120;
/** Text of confirmation dialog for above
Text of confirmation dialog for above
Are you sure you want to
restore all color settings to their original values?
Text of confirmation dialog for above
*/
- public static final int confirm_revert_colors=0x7f05011d;
+ public static final int confirm_revert_colors=0x7f05011e;
/** title of confirmation dialog put up when user has unlocked an
in-progress game and wants to save changes (has hit the
play button).
@@ -1757,7 +1753,7 @@ XLATE-ME
in-progress game and wants to save changes (has hit the
play button).
*/
- public static final int confirm_save=0x7f0500d3;
+ public static final int confirm_save=0x7f0500d4;
/** title of above confirmation dialog
############################################################
@@ -1788,7 +1784,7 @@ XLATE-ME
Confirm save
title of above confirmation dialog
*/
- public static final int confirm_save_title=0x7f0500d4;
+ public static final int confirm_save_title=0x7f0500d5;
/**
Warning: This feature is meant for
@@ -1799,37 +1795,37 @@ XLATE-ME
enabled?
*/
- public static final int confirm_sms_expl=0x7f05023f;
+ public static final int confirm_sms_expl=0x7f050240;
/**
No: leave disabled
*/
- public static final int confirm_sms_leave=0x7f050241;
+ public static final int confirm_sms_leave=0x7f050242;
/**
Enable play via SMS?
*/
- public static final int confirm_sms_prompt=0x7f050240;
+ public static final int confirm_sms_prompt=0x7f050241;
/**
Confirm your SMS plan
*/
- public static final int confirm_sms_title=0x7f05023e;
+ public static final int confirm_sms_title=0x7f05023f;
/**
Yes: I have unlimited texting
*/
- public static final int confirm_sms_unlimited=0x7f050242;
+ public static final int confirm_sms_unlimited=0x7f050243;
/**
Yes: I\'ll pay all carrier charges
*/
- public static final int confirm_sms_willpay=0x7f050243;
+ public static final int confirm_sms_willpay=0x7f050244;
/** text of dialog shown when the menu item board_menu_undo_last
is chosen.
text of dialog shown when the menu item board_menu_undo_last
@@ -1842,16 +1838,16 @@ XLATE-ME
text of dialog shown when the menu item board_menu_undo_last
is chosen.
*/
- public static final int confirm_undo_last=0x7f05011a;
+ public static final int confirm_undo_last=0x7f05011b;
/** Once every day
*/
- public static final int connect_daily=0x7f05016d;
+ public static final int connect_daily=0x7f05016e;
/** Every 15 minutes
*/
- public static final int connect_fifteen_mins=0x7f050169;
+ public static final int connect_fifteen_mins=0x7f05016a;
/** Every 5 minutes
*/
- public static final int connect_five_mins=0x7f050168;
+ public static final int connect_five_mins=0x7f050169;
/**
############################################################
# :Screens:
@@ -1887,12 +1883,12 @@ XLATE-ME
new moves available and fetches them. This controls how
frequently that check is done.
*/
- public static final int connect_frequency=0x7f050166;
+ public static final int connect_frequency=0x7f050167;
/** text of separator marking out the connection area of the dialog
XLATE-ME
Connection (via %1$s)
*/
- public static final int connect_label_fmt=0x7f0500bd;
+ public static final int connect_label_fmt=0x7f0500be;
/**
@@ -1902,7 +1898,7 @@ XLATE-ME
Connection (via SMS/text)
*/
- public static final int connect_label_sms=0x7f05021f;
+ public static final int connect_label_sms=0x7f050220;
/** These are the possible values for the connect_frequency
setting presented as a drop-down list.
These are the possible values for the connect_frequency
@@ -1911,83 +1907,83 @@ XLATE-ME
These are the possible values for the connect_frequency
setting presented as a drop-down list.
*/
- public static final int connect_never=0x7f050167;
+ public static final int connect_never=0x7f050168;
/** Every hour
*/
- public static final int connect_one_hour=0x7f05016b;
+ public static final int connect_one_hour=0x7f05016c;
/** Every six hours
*/
- public static final int connect_six_hours=0x7f05016c;
+ public static final int connect_six_hours=0x7f05016d;
/** Every 30 minutes
*/
- public static final int connect_thirty_mins=0x7f05016a;
+ public static final int connect_thirty_mins=0x7f05016b;
/** XLATE-ME
Change Communicate via
*/
- public static final int connection_via_label=0x7f0502e6;
+ public static final int connection_via_label=0x7f0502e9;
/**
(Last failure was %1$s)
*/
- public static final int connstat_lastother_succ_fmt=0x7f050236;
+ public static final int connstat_lastother_succ_fmt=0x7f050237;
/**
(Last successful send was
%1$s)
*/
- public static final int connstat_lastother_unsucc_fmt=0x7f050237;
+ public static final int connstat_lastother_unsucc_fmt=0x7f050238;
/**
Last receipt was %1$s
*/
- public static final int connstat_lastreceipt_fmt=0x7f050238;
+ public static final int connstat_lastreceipt_fmt=0x7f050239;
/**
Last send was %1$s (%2$s)
*/
- public static final int connstat_lastsend_fmt=0x7f050235;
+ public static final int connstat_lastsend_fmt=0x7f050236;
/**
Network status for game connected via
%1$s:
*/
- public static final int connstat_net_fmt=0x7f050231;
- public static final int connstat_net_noaddr=0x7f050230;
+ public static final int connstat_net_fmt=0x7f050232;
+ public static final int connstat_net_noaddr=0x7f050231;
/**
No messages have been received.
*/
- public static final int connstat_noreceipt=0x7f050239;
+ public static final int connstat_noreceipt=0x7f05023a;
/**
internet/relay
*/
- public static final int connstat_relay=0x7f05023a;
+ public static final int connstat_relay=0x7f05023b;
/**
sms/texting
*/
- public static final int connstat_sms=0x7f05023b;
+ public static final int connstat_sms=0x7f05023c;
/**
successful
*/
- public static final int connstat_succ=0x7f050233;
+ public static final int connstat_succ=0x7f050234;
/**
unsuccessful
*/
- public static final int connstat_unsucc=0x7f050234;
+ public static final int connstat_unsucc=0x7f050235;
/** title of dialog brought up in response to the
board_menu_game_counts menu. The dialog lists all tiles in
the language being used for the game together with how many
@@ -2002,31 +1998,31 @@ XLATE-ME
the language being used for the game together with how many
of each there are are and how many points each is worth.
*/
- public static final int counts_values_title=0x7f0501b5;
+ public static final int counts_values_title=0x7f0501b6;
/** %1$s (in use)
*/
- public static final int cur_menu_marker_fmt=0x7f050281;
+ public static final int cur_menu_marker_fmt=0x7f050282;
/**
Tile picker\n(so far: %1$s)
*/
- public static final int cur_tiles_fmt=0x7f0501ea;
+ public static final int cur_tiles_fmt=0x7f0501eb;
/** SMS Data is only available on GSM phones.
*/
- public static final int data_gsm_only=0x7f05029e;
+ public static final int data_gsm_only=0x7f05029f;
/** SD card write complete.
*/
- public static final int db_store_done=0x7f05032f;
+ public static final int db_store_done=0x7f050333;
/** XLATE-ME
Enable debug features
*/
- public static final int debug_features=0x7f050303;
+ public static final int debug_features=0x7f050306;
/** XLATE-ME
Menuitems etc. (release builds
only)
*/
- public static final int debug_features_summary=0x7f050304;
+ public static final int debug_features_summary=0x7f050307;
/** dictionary used by default for human players when creating
new game
clarification of above
@@ -2046,21 +2042,21 @@ XLATE-ME
dictionary used by default for human players when creating
new game
*/
- public static final int default_dict=0x7f05012c;
+ public static final int default_dict=0x7f05012d;
/** other
*/
- public static final int default_host=0x7f05007c;
+ public static final int default_host=0x7f05007d;
/** label within default wordlists in app preferences
label within default wordlists in app preferences
Default language
*/
- public static final int default_language=0x7f0502d5;
+ public static final int default_language=0x7f0502d8;
/** Store wordlists internally
*/
- public static final int default_loc=0x7f050265;
+ public static final int default_loc=0x7f050266;
/** (Not in external/sdcard memory)
*/
- public static final int default_loc_summary=0x7f050266;
+ public static final int default_loc_summary=0x7f050267;
/** Welcome dialog text
Welcome dialog text
Thanks for installing
@@ -2069,7 +2065,7 @@ XLATE-ME
game default\" section of Settings.)
Welcome dialog text
*/
- public static final int default_name_message=0x7f0501d1;
+ public static final int default_name_message=0x7f0501d2;
/**
###########################################################
# :Dialogs:
@@ -2111,7 +2107,7 @@ XLATE-ME
Welcome dialog title
*/
- public static final int default_name_title=0x7f0501d0;
+ public static final int default_name_title=0x7f0501d1;
/** default new-game setting for handline phonies (words not
found in the word list)
default new-game setting for handline phonies (words not
@@ -2120,7 +2116,7 @@ XLATE-ME
default new-game setting for handline phonies (words not
found in the word list)
*/
- public static final int default_phonies=0x7f050132;
+ public static final int default_phonies=0x7f050133;
/** dictionary used by default for robot players when creating
new game
dictionary used by default for robot players when creating
@@ -2129,12 +2125,12 @@ XLATE-ME
dictionary used by default for robot players when creating
new game
*/
- public static final int default_robodict=0x7f05012d;
- public static final int default_update_url=0x7f050081;
+ public static final int default_robodict=0x7f05012e;
+ public static final int default_update_url=0x7f050082;
/** Delete wordlist[s]
*/
- public static final int delete_dicts=0x7f0502c0;
- public static final int devid_title=0x7f05030b;
+ public static final int delete_dicts=0x7f0502c1;
+ public static final int devid_title=0x7f05030e;
/**
Playing via SMS is currently disabled.
You can enable it in Settings->Network game settings.
@@ -2145,7 +2141,7 @@ XLATE-ME
*/
- public static final int dft_sms_name_fmt=0x7f050214;
+ public static final int dft_sms_name_fmt=0x7f050215;
/**
No word in %1$s starts with
@@ -2154,14 +2150,14 @@ XLATE-ME
*/
- public static final int dict_browse_nowords_fmt=0x7f0501ee;
+ public static final int dict_browse_nowords_fmt=0x7f0501ef;
/**
%1$s (%2$d words using %3$d
tiles)
%1$s (%2$d mots utilisant %3$d jetons)
*/
- public static final int dict_browse_title1_fmt=0x7f0501ed;
+ public static final int dict_browse_title1_fmt=0x7f0501ee;
/**
%1$s (%2$d words using %3$d-%4$d
@@ -2169,18 +2165,18 @@ XLATE-ME
%1$s (%2$d mots utilisant de %3$d à
%4$d jetons)
*/
- public static final int dict_browse_title_fmt=0x7f0501ec;
+ public static final int dict_browse_title_fmt=0x7f0501ed;
/** %1$s (%2$s/%3$d words)
*/
- public static final int dict_desc_fmt=0x7f0502c7;
+ public static final int dict_desc_fmt=0x7f0502c8;
/** XLATE-ME
Wordlist download URL
*/
- public static final int dict_host=0x7f050300;
+ public static final int dict_host=0x7f050303;
/** Number of words: %1$d\nDownload size:
%2$dK\nNote: %3$s
*/
- public static final int dict_info_fmt=0x7f0502c4;
+ public static final int dict_info_fmt=0x7f0502c5;
/** label for dropdown by which wordlist is chosen that this
player will use. The language the game will use (which
constrains the choice of wordlists) is substituted in for
@@ -2195,13 +2191,13 @@ XLATE-ME
constrains the choice of wordlists) is substituted in for
"%s".
*/
- public static final int dict_lang_label_fmt=0x7f0500dc;
+ public static final int dict_lang_label_fmt=0x7f0500dd;
/** Tap to download
*/
- public static final int dict_on_server=0x7f0502c6;
+ public static final int dict_on_server=0x7f0502c7;
/** string name="invite_mime">text/plain Do not notify me no matter
how long it\'s been my turn
*/
- public static final int disable_nag_summary=0x7f0502f9;
+ public static final int disable_nag_summary=0x7f0502fc;
/** Disable turn reminders
*/
- public static final int disable_nag_title=0x7f0502f8;
- public static final int disable_nags_title=0x7f0502f7;
- public static final int disable_relay=0x7f050164;
- public static final int disable_relay_summary=0x7f050165;
+ public static final int disable_nag_title=0x7f0502fb;
+ public static final int disable_nags_title=0x7f0502fa;
+ public static final int disable_relay=0x7f050165;
+ public static final int disable_relay_summary=0x7f050166;
/** text of item at bottom of dicts choice spinner. It
launches the browser pointed at the site where additional
wordlists can be found.
@@ -2313,26 +2309,26 @@ XLATE-ME
browser pointed at the site where additional wordlists can be
found.
*/
- public static final int download_dicts=0x7f0500a6;
+ public static final int download_dicts=0x7f0500a7;
/** Download finished
*/
- public static final int download_done=0x7f050263;
+ public static final int download_done=0x7f050264;
/** Download unsuccessful
*/
- public static final int download_failed=0x7f050264;
+ public static final int download_failed=0x7f050265;
/** Downloads Directory
*/
- public static final int download_path_title=0x7f050267;
+ public static final int download_path_title=0x7f050268;
/** Downloading %1$s…
*/
- public static final int downloading_dict_fmt=0x7f05019c;
- public static final int drop_relay_warning_fmt=0x7f050332;
+ public static final int downloading_dict_fmt=0x7f05019d;
+ public static final int drop_relay_warning_fmt=0x7f050336;
/** Display snapshots of games
Display snapshots of games
Invitation received but ignored: it
has already been used to create a game.
*/
- public static final int dropped_dupe=0x7f050280;
+ public static final int dropped_dupe=0x7f050281;
/** Shown in the main screen when you launch Crosswords from an
invitation (received in email or messaging app, say) and
there's already a game running that matches that invitation.
@@ -2358,37 +2354,37 @@ XLATE-ME
the same room name over and over so they'll get this warning
and it's harmless to ignore it.
*/
- public static final int dup_game_query_fmt=0x7f0501b1;
+ public static final int dup_game_query_fmt=0x7f0501b2;
/**
Send comment via
*/
- public static final int email_author_chooser=0x7f0501f8;
+ public static final int email_author_chooser=0x7f0501f9;
/** Nor is my email address
*/
- public static final int email_author_email=0x7f05007b;
+ public static final int email_author_email=0x7f05007c;
/**
Should not be translated
*/
- public static final int email_author_subject=0x7f0501f7;
+ public static final int email_author_subject=0x7f0501f8;
/**
Should not be translated
*/
- public static final int email_body_rev_fmt=0x7f0501f9;
+ public static final int email_body_rev_fmt=0x7f0501fa;
/** color of empty squares on the board (that are not bonus squares)
color of empty squares on the board (that are not bonus squares)
Empty cell/background
color of empty squares on the board (that are not bonus squares)
*/
- public static final int empty=0x7f05014c;
+ public static final int empty=0x7f05014d;
/**
*/
- public static final int empty_relay_inviter=0x7f05021b;
+ public static final int empty_relay_inviter=0x7f05021c;
/** Shows in SMS Invite dialog when no phone numbers have been saved previously
Shows in SMS Invite dialog when no phone numbers have been saved previously
This phone list is empty. Use the
@@ -2396,71 +2392,73 @@ XLATE-ME
button to enter numbers directly.
*/
- public static final int empty_sms_inviter=0x7f05021a;
+ public static final int empty_sms_inviter=0x7f05021b;
+ public static final int enable_dualpane_summary=0x7f0502ce;
+ public static final int enable_dualpane_title=0x7f0502cd;
/** XLATE-ME
Accept invitations more than once
*/
- public static final int enable_dupes_summary=0x7f050313;
+ public static final int enable_dupes_summary=0x7f050316;
/** XLATE-ME
Accept duplicate invites
*/
- public static final int enable_dupes_title=0x7f050311;
+ public static final int enable_dupes_title=0x7f050314;
/** NFC is turned off on this device. You
can use the Android Settings app to turn it on .
*/
- public static final int enable_nfc=0x7f050283;
+ public static final int enable_nfc=0x7f050284;
/** XLATE-ME
Fake invitation to aid debugging
*/
- public static final int enable_nfc_toself_summary=0x7f050316;
+ public static final int enable_nfc_toself_summary=0x7f050319;
/** XLATE-ME
Enable NFC to self
*/
- public static final int enable_nfc_toself_title=0x7f050315;
+ public static final int enable_nfc_toself_title=0x7f050318;
/** XLATE-ME
Rooms others can see and join
*/
- public static final int enable_pubroom_summary=0x7f0502e5;
+ public static final int enable_pubroom_summary=0x7f0502e8;
/** XLATE-ME
Enable public rooms
*/
- public static final int enable_pubroom_title=0x7f0502e4;
- public static final int enable_relay_toself_summary=0x7f05033e;
- public static final int enable_relay_toself_title=0x7f05033d;
+ public static final int enable_pubroom_title=0x7f0502e7;
+ public static final int enable_relay_toself_summary=0x7f050342;
+ public static final int enable_relay_toself_title=0x7f050341;
/**
Allow games via SMS
*/
- public static final int enable_sms=0x7f05023c;
+ public static final int enable_sms=0x7f05023d;
/**
Only if you have unlimited texting!
*/
- public static final int enable_sms_summary=0x7f05023d;
+ public static final int enable_sms_summary=0x7f05023e;
/** XLATE-ME
Skip radio when phone numbers same
*/
- public static final int enable_sms_toself_summary=0x7f050318;
+ public static final int enable_sms_toself_summary=0x7f05031b;
/** XLATE-ME
Short-circuit SMS to self
*/
- public static final int enable_sms_toself_title=0x7f050317;
+ public static final int enable_sms_toself_title=0x7f05031a;
/** Tap tiles to select…
*/
- public static final int entering_trade=0x7f0500e2;
+ public static final int entering_trade=0x7f0500e3;
/** XLATE-ME
Duplicate invitation rejected:
device \"%1$s\" has already accepted an invitation to this
game.
*/
- public static final int err_dup_invite_fmt=0x7f0502df;
+ public static final int err_dup_invite_fmt=0x7f0502e2;
/** XLATE-ME
Update checks URL
*/
- public static final int expl_update_url=0x7f050322;
+ public static final int expl_update_url=0x7f050325;
/** if this preference is checked, a dialog will be posted every
time a robot makes a move or a move is received from a remote
player.
@@ -2477,15 +2475,15 @@ XLATE-ME
time a robot makes a move or a move is received from a remote
player.
*/
- public static final int explain_robot=0x7f050154;
+ public static final int explain_robot=0x7f050155;
/** explanation of the above
explanation of the above
Display score summary after
every robot or remote turn
explanation of the above
*/
- public static final int explain_robot_summary=0x7f050155;
- public static final int fetching_from_relay=0x7f050344;
+ public static final int explain_robot_summary=0x7f050156;
+ public static final int fetching_from_relay=0x7f050348;
/** title of dialog brought up in response to the
board_menu_game_final menu. The dialog displays the final
score and an accounting of it (including subtractions for
@@ -2503,7 +2501,7 @@ XLATE-ME
running out the game timer if there is one.)
*/
- public static final int finalscores_title=0x7f0501b7;
+ public static final int finalscores_title=0x7f0501b8;
/** Explanatory text appears in the dialog
Explanatory text appears in the dialog
In a multi-device game there must be at
@@ -2511,17 +2509,17 @@ XLATE-ME
check off-device players.
Explanatory text appears in the dialog
*/
- public static final int force_expl=0x7f0500d7;
+ public static final int force_expl=0x7f0500d8;
/** XLATE-ME
Pretend to have radio
*/
- public static final int force_radio_title=0x7f050319;
+ public static final int force_radio_title=0x7f05031c;
/** Even if my screen is too small
*/
- public static final int force_tablet_summary=0x7f0502cb;
+ public static final int force_tablet_summary=0x7f0502cc;
/** Force tablet layout
*/
- public static final int force_tablet_title=0x7f0502ca;
+ public static final int force_tablet_title=0x7f0502cb;
/**
############################################################
# :Dialogs:
@@ -2563,7 +2561,7 @@ XLATE-ME
title of this dialog
*/
- public static final int force_title=0x7f0500d6;
+ public static final int force_title=0x7f0500d7;
/** Displayed as a "Toast" (mini window briefly displayed) if you
didn't choose a remote player and I was forced to pick one. I
always pick the first.
@@ -2575,7 +2573,7 @@ XLATE-ME
didn't choose a remote player and I was forced to pick one. I
always pick the first.
*/
- public static final int forced_consistent=0x7f0500d8;
+ public static final int forced_consistent=0x7f0500d9;
/** Games that have ended are listed with this string
Displayed as a "Toast" (mini window briefly displayed) if you
didn't choose a remote player and I was forced to pick one. I
@@ -2583,7 +2581,7 @@ XLATE-ME
Games that have ended are listed with this string
Games that have ended are listed with this string
*/
- public static final int gameOver=0x7f050090;
+ public static final int gameOver=0x7f050091;
/**
Bluetooth game name
@@ -2591,7 +2589,7 @@ XLATE-ME
*/
- public static final int game_btname_title=0x7f05020f;
+ public static final int game_btname_title=0x7f050210;
/** used to create default names of games (when user has not
named them.)
used to create default names of games (when user has not
@@ -2602,7 +2600,7 @@ XLATE-ME
used to create default names of games (when user has not
named them.)
*/
- public static final int game_fmt=0x7f0501a6;
+ public static final int game_fmt=0x7f0501a7;
/**
############################################################
# :Menus:
@@ -2628,13 +2626,13 @@ XLATE-ME
title of contextual menu. Name of the selected game is
substituted in.
*/
- public static final int game_item_menu_title_fmt=0x7f050099;
+ public static final int game_item_menu_title_fmt=0x7f05009a;
/**
Building game summary…
*/
- public static final int game_list_tmp=0x7f05022e;
+ public static final int game_list_tmp=0x7f05022f;
/** text of checkbox at top of dialog allowing to unlock in-play
game to make changes
text of checkbox at top of dialog allowing to unlock in-play
@@ -2643,55 +2641,55 @@ XLATE-ME
text of checkbox at top of dialog allowing to unlock in-play
game to make changes
*/
- public static final int game_locked=0x7f0500b6;
+ public static final int game_locked=0x7f0500b7;
/** Name group
*/
- public static final int game_name_group_title=0x7f050271;
+ public static final int game_name_group_title=0x7f050272;
/**
XLATE-ME
New game name:
*/
- public static final int game_name_label=0x7f050211;
+ public static final int game_name_label=0x7f050212;
/**
XLATE-ME
Name your game
*/
- public static final int game_name_title=0x7f050210;
+ public static final int game_name_title=0x7f050211;
/**
*/
- public static final int game_rename_title=0x7f0500a2;
+ public static final int game_rename_title=0x7f0500a3;
/** Put nothing in the summary space, so it just reads "Game 2"
Put nothing in the summary space, so it just reads "Game 2"
\u003CNothing\u003E
Put nothing in the summary space, so it just reads "Game 2"
*/
- public static final int game_summary_field_empty=0x7f050138;
+ public static final int game_summary_field_empty=0x7f050139;
/** XLATE-ME
gameid
*/
- public static final int game_summary_field_gameid=0x7f050320;
+ public static final int game_summary_field_gameid=0x7f050323;
/** Put the language there, so it reads "Game 2 (English)"
Put the language there, so it reads "Game 2 (English)"
Game language\u200C
Put the language there, so it reads "Game 2 (English)"
*/
- public static final int game_summary_field_language=0x7f050139;
+ public static final int game_summary_field_language=0x7f05013a;
/** XLATE-ME
Pending packet count
*/
- public static final int game_summary_field_npackets=0x7f050321;
+ public static final int game_summary_field_npackets=0x7f050324;
/** List names of opponents (summarized), e.g. "Game 2 (vs Kati)"
List names of opponents (summarized), e.g. "Game 2 (vs Kati)"
Opponent name[s]
List names of opponents (summarized), e.g. "Game 2 (vs Kati)"
*/
- public static final int game_summary_field_opponents=0x7f05013a;
+ public static final int game_summary_field_opponents=0x7f05013b;
/** XLATE-ME
rowid
*/
- public static final int game_summary_field_rowid=0x7f05031f;
+ public static final int game_summary_field_rowid=0x7f050322;
/** List the state of the game, "Game over" or "10 moves made"
etc.
List the state of the game, "Game over" or "10 moves made"
@@ -2700,7 +2698,7 @@ XLATE-ME
List the state of the game, "Game over" or "10 moves made"
etc.
*/
- public static final int game_summary_field_state=0x7f05013b;
+ public static final int game_summary_field_state=0x7f05013c;
/** Regardless of the setting of the connect_frequency
preference, checks the relay immediately for any moves for
networked games on this device and posts a notification if
@@ -2714,13 +2712,13 @@ XLATE-ME
networked games on this device and posts a notification if
any is downloaded.
*/
- public static final int gamel_menu_checkmoves=0x7f050095;
+ public static final int gamel_menu_checkmoves=0x7f050096;
/**
Check for updates
*/
- public static final int gamel_menu_checkupdates=0x7f05024f;
+ public static final int gamel_menu_checkupdates=0x7f050250;
/**
############################################################
# :Menus:
@@ -2759,50 +2757,50 @@ XLATE-ME
Brings up the Wordlists (formerly Dictionaries) screen
*/
- public static final int gamel_menu_dicts=0x7f050093;
+ public static final int gamel_menu_dicts=0x7f050094;
/** XLATE-ME
Load DB from SD card
*/
- public static final int gamel_menu_loaddb=0x7f050310;
+ public static final int gamel_menu_loaddb=0x7f050313;
/** XLATE-ME
%1$s/%2$s
XLATE-ME
Write DB to SD card
*/
- public static final int gamel_menu_storedb=0x7f05030f;
+ public static final int gamel_menu_storedb=0x7f050312;
/** Studylist…
*/
- public static final int gamel_menu_study=0x7f05028c;
- public static final int get_relay_number=0x7f05021d;
+ public static final int gamel_menu_study=0x7f05028d;
+ public static final int get_relay_number=0x7f05021e;
/**
Enter phone number:
*/
- public static final int get_sms_number=0x7f05021c;
+ public static final int get_sms_number=0x7f05021d;
/** Get info
*/
- public static final int getinfo=0x7f0502bf;
- public static final int git_rev=0x7f050083;
+ public static final int getinfo=0x7f0502c0;
+ public static final int git_rev=0x7f050084;
/** XLATE-ME
Source version id
*/
- public static final int git_rev_title=0x7f05030a;
+ public static final int git_rev_title=0x7f05030d;
/** Don\'t try a second time
*/
- public static final int got_langdict_summary=0x7f050324;
+ public static final int got_langdict_summary=0x7f050327;
/** Fetch default wordlist for language
*/
- public static final int got_langdict_title=0x7f050323;
+ public static final int got_langdict_title=0x7f050326;
/** Green
*/
- public static final int green=0x7f050150;
+ public static final int green=0x7f050151;
/** My games
*/
- public static final int group_cur_games=0x7f05026e;
+ public static final int group_cur_games=0x7f05026f;
/** New games
*/
- public static final int group_new_games=0x7f05026f;
+ public static final int group_new_games=0x7f050270;
/** Used as the default name for remote players displayed within
the Game configure screen
Final state: game is over.
@@ -2829,7 +2827,7 @@ XLATE-ME
Used as the default name for remote players displayed within
the Game configure screen
*/
- public static final int guest_name=0x7f0500d2;
+ public static final int guest_name=0x7f0500d3;
/** If this preference is checked the "crosshairs" (vertical and
horzontal lines through the cell your finger is on that help
you tell where the app thinks you're actually tapping) will
@@ -2853,25 +2851,25 @@ XLATE-ME
large enough screens that they always know where they're
tapping.
*/
- public static final int hide_crosshairs=0x7f05015e;
+ public static final int hide_crosshairs=0x7f05015f;
/** explanation of the above
explanation of the above
Do not visually indicate which board cell is touched
explanation of the above
*/
- public static final int hide_crosshairs_summary=0x7f05015f;
+ public static final int hide_crosshairs_summary=0x7f050160;
/** clarification of above
XLATE-ME
Hiding the newgame buttons in
the main screen makes more games visible
*/
- public static final int hide_newgames_summary=0x7f05013f;
+ public static final int hide_newgames_summary=0x7f050140;
/** Checkbox that when set prevents showing the newgame buttons
on the main screen to save space
XLATE-ME
Hide newgame buttons
*/
- public static final int hide_newgames_title=0x7f05013e;
+ public static final int hide_newgames_title=0x7f05013f;
/** Checkbox that when set prevents showing a title bar in the
game board window to save space
Checkbox that when set prevents showing a title bar in the
@@ -2880,14 +2878,14 @@ XLATE-ME
Checkbox that when set prevents showing a title bar in the
game board window to save space
*/
- public static final int hide_title=0x7f05013c;
+ public static final int hide_title=0x7f05013d;
/** clarification of above
clarification of above
Hiding the game name lets the
board be slightly larger
clarification of above
*/
- public static final int hide_title_summary=0x7f05013d;
+ public static final int hide_title_summary=0x7f05013e;
/** text of checkbox. If this checkbox is checked, buttons will
appear by which the user can get high- and low-scoring moves
generated based on his tray. Can be used to cheat.
@@ -2899,7 +2897,7 @@ XLATE-ME
appear by which the user can get high- and low-scoring moves
generated based on his tray. Can be used to cheat.
*/
- public static final int hints_allowed=0x7f0500c5;
+ public static final int hints_allowed=0x7f0500c6;
/** clarification on hints_allowed, whether new games will
default to having the hint feature enabled(string elsewhere
in this file)
@@ -2911,7 +2909,7 @@ XLATE-ME
default to having the hint feature enabled(string elsewhere
in this file)
*/
- public static final int hints_allowed_sum=0x7f05012e;
+ public static final int hints_allowed_sum=0x7f05012f;
/** title of dialog brought up in response to the
board_menu_game_history menu. A full history of the game up
to the last turn is displayed, though details about what's in
@@ -2926,7 +2924,7 @@ XLATE-ME
to the last turn is displayed, though details about what's in
players' racks is left out if the game is not yet over.
*/
- public static final int history_title=0x7f0501b6;
+ public static final int history_title=0x7f0501b7;
/** Partial text of alert posted when phonies_warn or
phonies_disallow is the current setting and a "phony" is
played. One of the two following strings will be appended
@@ -2948,7 +2946,7 @@ XLATE-ME
played. One of the two following strings will be appended
*/
- public static final int ids_badwords_fmt=0x7f0500f7;
+ public static final int ids_badwords_fmt=0x7f0500f8;
/** text of confirmation dialog shown when user chooses the menu
item with text board_menu_game_final and the game is not over
@@ -2960,7 +2958,7 @@ XLATE-ME
item with text board_menu_game_final and the game is not over
*/
- public static final int ids_endnow=0x7f0501b8;
+ public static final int ids_endnow=0x7f0501b9;
/** Title of generic dialog used to display information
If the dropdown is selected, this is the title displayed
above the list of selectable items. The language the game
@@ -2973,7 +2971,7 @@ XLATE-ME
FYI…
Title of generic dialog used to display information
*/
- public static final int info_title=0x7f0501b2;
+ public static final int info_title=0x7f0501b3;
/**
You are using the wordlist
@@ -2981,7 +2979,7 @@ XLATE-ME
too?
*/
- public static final int inform_dict_diffdict_fmt=0x7f05025a;
+ public static final int inform_dict_diffdict_fmt=0x7f05025b;
/**
You and the host of this
@@ -2990,14 +2988,14 @@ XLATE-ME
Used in formatting final scores display
*/
- public static final int inform_dict_diffversion_fmt=0x7f050258;
+ public static final int inform_dict_diffversion_fmt=0x7f050259;
/** \u0020(You will have to download it
first.)
*/
- public static final int inform_dict_download=0x7f05025b;
+ public static final int inform_dict_download=0x7f05025c;
/** Wordlist mismatch
*/
- public static final int inform_dict_title=0x7f050259;
+ public static final int inform_dict_title=0x7f05025a;
/** Will new games, on default, randomly rearrange the start
order of players.
Will new games, on default, randomly rearrange the start
@@ -3006,13 +3004,13 @@ XLATE-ME
Will new games, on default, randomly rearrange the start
order of players.
*/
- public static final int init_autojuggle=0x7f050130;
+ public static final int init_autojuggle=0x7f050131;
/** clarification on above
clarification on above
Randomly, for new games
clarification on above
*/
- public static final int init_autojuggle_sum=0x7f050131;
+ public static final int init_autojuggle_sum=0x7f050132;
/** default number of minutes on timer for new games
clarification of the above
@@ -3026,19 +3024,19 @@ XLATE-ME
Timer minutes per player
default number of minutes on timer for new games
*/
- public static final int initial_player_minutes=0x7f050133;
- public static final int invit_expl_bt_fmt=0x7f0500ec;
- public static final int invit_expl_notarget_fmt=0x7f0500ee;
- public static final int invit_expl_relay_fmt=0x7f0500ed;
- public static final int invit_expl_sms_fmt=0x7f0500eb;
- public static final int invite_choice_bt=0x7f05017d;
- public static final int invite_choice_email=0x7f05017c;
+ public static final int initial_player_minutes=0x7f050134;
+ public static final int invit_expl_bt_fmt=0x7f0500ed;
+ public static final int invit_expl_notarget_fmt=0x7f0500ef;
+ public static final int invit_expl_relay_fmt=0x7f0500ee;
+ public static final int invit_expl_sms_fmt=0x7f0500ec;
+ public static final int invite_choice_bt=0x7f05017e;
+ public static final int invite_choice_email=0x7f05017d;
/** Email
Bluetooth
NFC (\"Android beaming\")
*/
- public static final int invite_choice_nfc=0x7f05017e;
- public static final int invite_choice_relay=0x7f05017f;
+ public static final int invite_choice_nfc=0x7f05017f;
+ public static final int invite_choice_relay=0x7f050180;
/** EXPLAIN ME
Bluetooth is not available. This may
mean that your device doesn\'t support it, or that it\'s been
@@ -3051,11 +3049,11 @@ XLATE-ME
explanation/guidance.
SMS (texting)
*/
- public static final int invite_choice_sms=0x7f05017b;
+ public static final int invite_choice_sms=0x7f05017c;
/** Inviting players: How?
*/
- public static final int invite_choice_title=0x7f050180;
- public static final int invite_chooser_email=0x7f050185;
+ public static final int invite_choice_title=0x7f050181;
+ public static final int invite_chooser_email=0x7f050186;
/** When I've created the invitation, in text or html, I ask
Android to launch an app that can send it, typically an email
or messaging app. Android then asks the user to choose which
@@ -3076,28 +3074,28 @@ XLATE-ME
to have launched. This string is passed to Android and used
as the title of the dialog that presents that choice.
*/
- public static final int invite_chooser_fmt=0x7f050184;
+ public static final int invite_chooser_fmt=0x7f050185;
/** email
sms
*/
- public static final int invite_chooser_sms=0x7f050186;
- public static final int invite_copied=0x7f05033f;
+ public static final int invite_chooser_sms=0x7f050187;
+ public static final int invite_copied=0x7f050343;
/** %1$s has invited you to
play Crosswords using the wordlist %2$s (for play in %3$s), but it
is not installed. Would you like to download the wordlist or
decline the invitation?
*/
- public static final int invite_dict_missing_body_fmt=0x7f050260;
+ public static final int invite_dict_missing_body_fmt=0x7f050261;
/** You have been
invited to play Crosswords using the wordlist %2$s (for play in
%3$s), but it is not installed. Would you like to download the
wordlist?
*/
- public static final int invite_dict_missing_body_noname_fmt=0x7f050261;
+ public static final int invite_dict_missing_body_noname_fmt=0x7f050262;
/** Missing wordlist
*/
- public static final int invite_dict_missing_title=0x7f05025f;
- public static final int invite_host=0x7f05007e;
+ public static final int invite_dict_missing_title=0x7f050260;
+ public static final int invite_host=0x7f05007f;
/** This is the body of the html version of the invitation. A URL
is created with parameters describing the game and
substituted for "%1$s". (The funky \u003c and friends are
@@ -3123,22 +3121,22 @@ XLATE-ME
encodings for the greater-than and less-than symbols which
are not legal in xml strings.)
*/
- public static final int invite_htm_fmt=0x7f050182;
+ public static final int invite_htm_fmt=0x7f050183;
/** Appended to message above if local device has NFC available
Appended to message above if local device has NFC available
(Or just Tap to Invite - if the
other device also has Android Beaming and is nearby.)
*/
- public static final int invite_if_nfc=0x7f0500e9;
- public static final int invite_mime=0x7f05007f;
+ public static final int invite_if_nfc=0x7f0500ea;
+ public static final int invite_mime=0x7f050080;
/** XLATE-ME
Invite more than one player per remote device
*/
- public static final int invite_multi_summary=0x7f0502e3;
+ public static final int invite_multi_summary=0x7f0502e6;
/** XLATE-ME
Invite multiple
*/
- public static final int invite_multi_title=0x7f0502e2;
+ public static final int invite_multi_title=0x7f0502e5;
/** Most users create games with only two players, which is the
default, but Crosswords supports up to four. When I'm using
the above string to encourage the opener of a game missing
@@ -3168,27 +3166,27 @@ XLATE-ME
players to invite, IF the number of missing players is
greater than one this text is appended to the above.
*/
- public static final int invite_multiple=0x7f0500ea;
+ public static final int invite_multiple=0x7f0500eb;
/**
*/
- public static final int invite_notice_title=0x7f050202;
- public static final int invite_prefix=0x7f050085;
+ public static final int invite_notice_title=0x7f050203;
+ public static final int invite_prefix=0x7f050086;
/** Sending invitation to Crosswords on %1$s
*/
- public static final int invite_progress_fmt=0x7f0501fd;
+ public static final int invite_progress_fmt=0x7f0501fe;
/**
Connecting...
*/
- public static final int invite_progress_title=0x7f0501fc;
+ public static final int invite_progress_title=0x7f0501fd;
/** XLATE-ME
(This dialog will stay up until all
remote players have connected. You can close the game if you
expect it to take a while. They will still be able to
connect.)
*/
- public static final int invite_stays=0x7f0502ee;
+ public static final int invite_stays=0x7f0502f1;
/** Send invitation using SMS (texting) or
via email?
Send invitation using NFC (Android
@@ -3220,7 +3218,7 @@ XLATE-ME
This is the subject line of the email/text sent to invite
someone to join a game.
*/
- public static final int invite_subject_fmt=0x7f050181;
+ public static final int invite_subject_fmt=0x7f050182;
/** This is the body of the text version of the invitation. A URL
is created with parameters describing the game and
substituted for "%1$s".
@@ -3233,11 +3231,11 @@ XLATE-ME
is created with parameters describing the game and
substituted for "%1$s".
*/
- public static final int invite_txt_fmt=0x7f050183;
- public static final int invited_msg=0x7f0500e8;
+ public static final int invite_txt_fmt=0x7f050184;
+ public static final int invited_msg=0x7f0500e9;
/** First line of debug-only Invites list dialog
*/
- public static final int invites_net_fmt=0x7f050232;
+ public static final int invites_net_fmt=0x7f050233;
/** text of checkbox asking if user wants to search for open
public rooms
text of checkbox asking if user wants to search for open
@@ -3247,7 +3245,7 @@ XLATE-ME
text of checkbox asking if user wants to search for open
public rooms
*/
- public static final int join_room=0x7f0500be;
+ public static final int join_room=0x7f0500bf;
/** Checkbox that when set keeps the device screen from dimming
if the board screen is what's displayed. This is to allow
users to think about a move without having to touch the
@@ -3262,14 +3260,14 @@ XLATE-ME
users to think about a move without having to touch the
screen all the time.
*/
- public static final int keep_screenon=0x7f050142;
+ public static final int keep_screenon=0x7f050143;
/** clarification of above
clarification of above
Keep board screen on 10 mins
clarification of above
*/
- public static final int keep_screenon_summary=0x7f050143;
- public static final int key_addrs_pref=0x7f05003f;
+ public static final int keep_screenon_summary=0x7f050144;
+ public static final int key_addrs_pref=0x7f050040;
public static final int key_background=0x7f05001a;
public static final int key_board_size=0x7f050029;
public static final int key_bonus_l2x=0x7f050014;
@@ -3284,47 +3282,46 @@ XLATE-ME
the color of text, e.g. "2L", shown on a bonus square on the
board
*/
- public static final int key_bonushint=0x7f05014e;
- public static final int key_bt_addrs=0x7f050041;
+ public static final int key_bonushint=0x7f05014f;
+ public static final int key_bt_addrs=0x7f050042;
/** database keys whose entries aren't visible prefs
*/
- public static final int key_closed_langs=0x7f050040;
+ public static final int key_closed_langs=0x7f050041;
public static final int key_clr_bonushint=0x7f05001c;
public static final int key_clr_crosshairs=0x7f05001b;
/** prefs keys
*/
public static final int key_color_tiles=0x7f050001;
public static final int key_connect_frequency=0x7f050032;
- public static final int key_connstat_data=0x7f050044;
+ public static final int key_connstat_data=0x7f050045;
public static final int key_default_dict=0x7f05002c;
- public static final int key_default_group=0x7f050049;
+ public static final int key_default_group=0x7f05004a;
public static final int key_default_language=0x7f05002b;
public static final int key_default_loc=0x7f05003c;
public static final int key_default_phonies=0x7f050030;
public static final int key_default_robodict=0x7f05002f;
public static final int key_default_timerenabled=0x7f050031;
- public static final int key_dev_id=0x7f050045;
+ public static final int key_dev_id=0x7f050046;
public static final int key_dict_host=0x7f050023;
public static final int key_disable_nag=0x7f050006;
public static final int key_disable_nag_solo=0x7f050007;
public static final int key_disable_relay=0x7f050034;
- public static final int key_download_path=0x7f050070;
+ public static final int key_download_path=0x7f050071;
public static final int key_empty=0x7f050019;
- public static final int key_enable_debug=0x7f05006a;
- public static final int key_enable_dup_invite=0x7f05006b;
- public static final int key_enable_nfc_toself=0x7f05006c;
+ public static final int key_enable_debug=0x7f05006b;
+ public static final int key_enable_dualpane=0x7f05003e;
+ public static final int key_enable_dup_invite=0x7f05006c;
+ public static final int key_enable_nfc_toself=0x7f05006d;
public static final int key_enable_pubroom=0x7f05000f;
- public static final int key_enable_relay_toself=0x7f05006e;
+ public static final int key_enable_relay_toself=0x7f05006f;
public static final int key_enable_sms=0x7f050036;
- public static final int key_enable_sms_toself=0x7f05006d;
+ public static final int key_enable_sms_toself=0x7f05006e;
public static final int key_explain_robot=0x7f050004;
- /** key_enable_dualpane
- */
- public static final int key_force_radio=0x7f05003e;
+ public static final int key_force_radio=0x7f05003f;
public static final int key_force_tablet=0x7f05003d;
- public static final int key_gcmvers_regid=0x7f050046;
- public static final int key_got_langdict=0x7f050071;
- public static final int key_group_posns=0x7f05004a;
+ public static final int key_gcmvers_regid=0x7f050047;
+ public static final int key_got_langdict=0x7f050072;
+ public static final int key_group_posns=0x7f05004b;
public static final int key_hide_crosshairs=0x7f05000a;
public static final int key_hide_newgames=0x7f05000e;
public static final int key_hide_title=0x7f05000d;
@@ -3333,49 +3330,49 @@ XLATE-ME
public static final int key_init_hintsallowed=0x7f050026;
public static final int key_init_nethintsallowed=0x7f050027;
public static final int key_initial_player_minutes=0x7f05002a;
- public static final int key_invite_multi=0x7f050074;
+ public static final int key_invite_multi=0x7f050075;
public static final int key_keep_screenon=0x7f050038;
- public static final int key_last_packet=0x7f05004b;
+ public static final int key_last_packet=0x7f05004c;
public static final int key_logging_on=0x7f050024;
- public static final int key_na_browse=0x7f050063;
- public static final int key_na_browseall=0x7f050064;
- public static final int key_na_clip_expl=0x7f050068;
- public static final int key_na_comms_bt=0x7f050078;
- public static final int key_na_comms_relay=0x7f05007a;
- public static final int key_na_comms_sms=0x7f050079;
- public static final int key_na_dicts=0x7f050069;
- public static final int key_na_fmt_expl=0x7f050067;
- public static final int key_na_lookup=0x7f050062;
- public static final int key_na_rematch_two_only=0x7f050076;
- public static final int key_na_studycopy=0x7f050066;
- public static final int key_na_values=0x7f050065;
- public static final int key_nag_intervals=0x7f05006f;
+ public static final int key_na_browse=0x7f050064;
+ public static final int key_na_browseall=0x7f050065;
+ public static final int key_na_clip_expl=0x7f050069;
+ public static final int key_na_comms_bt=0x7f050079;
+ public static final int key_na_comms_relay=0x7f05007b;
+ public static final int key_na_comms_sms=0x7f05007a;
+ public static final int key_na_dicts=0x7f05006a;
+ public static final int key_na_fmt_expl=0x7f050068;
+ public static final int key_na_lookup=0x7f050063;
+ public static final int key_na_rematch_two_only=0x7f050077;
+ public static final int key_na_studycopy=0x7f050067;
+ public static final int key_na_values=0x7f050066;
+ public static final int key_nag_intervals=0x7f050070;
public static final int key_network_behavior=0x7f050037;
- public static final int key_notagain_arrow=0x7f05005d;
- public static final int key_notagain_backclears=0x7f05004f;
- public static final int key_notagain_chat=0x7f050050;
- public static final int key_notagain_conndall=0x7f05005a;
- public static final int key_notagain_conndfirst=0x7f05005b;
- public static final int key_notagain_conndmid=0x7f05005c;
- public static final int key_notagain_dfltname=0x7f050077;
- public static final int key_notagain_done=0x7f050058;
- public static final int key_notagain_enablepublic=0x7f050075;
- public static final int key_notagain_flip=0x7f050055;
- public static final int key_notagain_hidenewgamebuttons=0x7f050061;
- public static final int key_notagain_hintnext=0x7f050053;
- public static final int key_notagain_hintprev=0x7f050052;
- public static final int key_notagain_juggle=0x7f050054;
- public static final int key_notagain_newfrom=0x7f05005f;
+ public static final int key_notagain_arrow=0x7f05005e;
+ public static final int key_notagain_backclears=0x7f050050;
+ public static final int key_notagain_chat=0x7f050051;
+ public static final int key_notagain_conndall=0x7f05005b;
+ public static final int key_notagain_conndfirst=0x7f05005c;
+ public static final int key_notagain_conndmid=0x7f05005d;
+ public static final int key_notagain_dfltname=0x7f050078;
+ public static final int key_notagain_done=0x7f050059;
+ public static final int key_notagain_enablepublic=0x7f050076;
+ public static final int key_notagain_flip=0x7f050056;
+ public static final int key_notagain_hidenewgamebuttons=0x7f050062;
+ public static final int key_notagain_hintnext=0x7f050054;
+ public static final int key_notagain_hintprev=0x7f050053;
+ public static final int key_notagain_juggle=0x7f050055;
+ public static final int key_notagain_newfrom=0x7f050060;
/** key_notagain_sms_ready
*/
- public static final int key_notagain_newselect=0x7f05004e;
- public static final int key_notagain_relay=0x7f050051;
- public static final int key_notagain_sync=0x7f05004d;
- public static final int key_notagain_trading=0x7f050060;
- public static final int key_notagain_turnchanged=0x7f05005e;
- public static final int key_notagain_undo=0x7f050057;
- public static final int key_notagain_unlock=0x7f050059;
- public static final int key_notagain_zoom=0x7f050056;
+ public static final int key_notagain_newselect=0x7f05004f;
+ public static final int key_notagain_relay=0x7f050052;
+ public static final int key_notagain_sync=0x7f05004e;
+ public static final int key_notagain_trading=0x7f050061;
+ public static final int key_notagain_turnchanged=0x7f05005f;
+ public static final int key_notagain_undo=0x7f050058;
+ public static final int key_notagain_unlock=0x7f05005a;
+ public static final int key_notagain_zoom=0x7f050057;
public static final int key_notify_sound=0x7f050033;
public static final int key_notify_vibrate=0x7f050035;
public static final int key_peek_other=0x7f050009;
@@ -3386,16 +3383,16 @@ XLATE-ME
public static final int key_player3=0x7f050013;
public static final int key_proxy_port=0x7f050021;
public static final int key_relay_host=0x7f05001d;
- public static final int key_relay_ids=0x7f050043;
+ public static final int key_relay_ids=0x7f050044;
public static final int key_relay_port=0x7f05001e;
- public static final int key_relay_regid=0x7f050047;
- public static final int key_relay_regid_ackd=0x7f050048;
+ public static final int key_relay_regid=0x7f050048;
+ public static final int key_relay_regid_ackd=0x7f050049;
public static final int key_ringer_zoom=0x7f05000c;
public static final int key_robot_name=0x7f05002e;
public static final int key_show_arrow=0x7f050002;
public static final int key_show_sms=0x7f050025;
public static final int key_skip_confirm=0x7f050005;
- public static final int key_sms_phones=0x7f050042;
+ public static final int key_sms_phones=0x7f050043;
public static final int key_sms_port=0x7f050022;
public static final int key_sort_tiles=0x7f050008;
public static final int key_square_tiles=0x7f050003;
@@ -3403,11 +3400,11 @@ XLATE-ME
public static final int key_summary_field=0x7f05003b;
public static final int key_thumbsize=0x7f050039;
public static final int key_tile_back=0x7f050018;
- public static final int key_udp_interval=0x7f05004c;
+ public static final int key_udp_interval=0x7f05004d;
public static final int key_update_prerel=0x7f050020;
public static final int key_update_url=0x7f05001f;
- public static final int key_xlations_enabled=0x7f050073;
- public static final int key_xlations_locale=0x7f050072;
+ public static final int key_xlations_enabled=0x7f050074;
+ public static final int key_xlations_locale=0x7f050073;
/** text of separator marking out the language area of the
dialog. First is used for single-device games, and second
for networked games (where players aren't allowed to have
@@ -3422,45 +3419,45 @@ XLATE-ME
for networked games (where players aren't allowed to have
different wordlists.)
*/
- public static final int lang_label=0x7f0500bb;
- public static final int lang_name_arabic=0x7f0502a9;
- public static final int lang_name_catalan=0x7f0502b0;
- public static final int lang_name_czech=0x7f0502b3;
- public static final int lang_name_danish=0x7f0502ad;
- public static final int lang_name_dutch=0x7f0502af;
- public static final int lang_name_english=0x7f0502a5;
- public static final int lang_name_french=0x7f0502a6;
- public static final int lang_name_german=0x7f0502a7;
- public static final int lang_name_greek=0x7f0502b4;
- public static final int lang_name_italian=0x7f0502ae;
- public static final int lang_name_polish=0x7f0502ac;
- public static final int lang_name_portuguese=0x7f0502b1;
- public static final int lang_name_russian=0x7f0502b2;
- public static final int lang_name_slovak=0x7f0502b5;
- public static final int lang_name_spanish=0x7f0502aa;
- public static final int lang_name_swedish=0x7f0502ab;
- public static final int lang_name_turkish=0x7f0502a8;
+ public static final int lang_label=0x7f0500bc;
+ public static final int lang_name_arabic=0x7f0502aa;
+ public static final int lang_name_catalan=0x7f0502b1;
+ public static final int lang_name_czech=0x7f0502b4;
+ public static final int lang_name_danish=0x7f0502ae;
+ public static final int lang_name_dutch=0x7f0502b0;
+ public static final int lang_name_english=0x7f0502a6;
+ public static final int lang_name_french=0x7f0502a7;
+ public static final int lang_name_german=0x7f0502a8;
+ public static final int lang_name_greek=0x7f0502b5;
+ public static final int lang_name_italian=0x7f0502af;
+ public static final int lang_name_polish=0x7f0502ad;
+ public static final int lang_name_portuguese=0x7f0502b2;
+ public static final int lang_name_russian=0x7f0502b3;
+ public static final int lang_name_slovak=0x7f0502b6;
+ public static final int lang_name_spanish=0x7f0502ab;
+ public static final int lang_name_swedish=0x7f0502ac;
+ public static final int lang_name_turkish=0x7f0502a9;
/** Unknown
*/
- public static final int lang_unknown=0x7f0502c8;
+ public static final int lang_unknown=0x7f0502c9;
/** Game language/wordlist
*/
- public static final int langdict_label=0x7f0500bc;
+ public static final int langdict_label=0x7f0500bd;
/** Put new games here
*/
- public static final int list_group_default=0x7f05026b;
+ public static final int list_group_default=0x7f05026c;
/** Delete group
*/
- public static final int list_group_delete=0x7f050269;
+ public static final int list_group_delete=0x7f05026a;
/** Move down
*/
- public static final int list_group_movedown=0x7f05026d;
+ public static final int list_group_movedown=0x7f05026e;
/** Move up
*/
- public static final int list_group_moveup=0x7f05026c;
+ public static final int list_group_moveup=0x7f05026d;
/** Rename
*/
- public static final int list_group_rename=0x7f05026a;
+ public static final int list_group_rename=0x7f05026b;
/** ############## menu items ##############
pulls up dialog to configure the selected game
Used to format game name plus some other information as the
@@ -3475,7 +3472,7 @@ XLATE-ME
############## menu items ##############
pulls up dialog to configure the selected game
*/
- public static final int list_item_config=0x7f05009a;
+ public static final int list_item_config=0x7f05009b;
/** makes a copy of the selected game. This is currently
disabled for networked games since there would be problems if
two identically configured games started trying to talk to a
@@ -3489,20 +3486,20 @@ XLATE-ME
two identically configured games started trying to talk to a
remote game that expected there was only one of them.
*/
- public static final int list_item_copy=0x7f0500a0;
+ public static final int list_item_copy=0x7f0500a1;
/** pulls up dialog to delete the selected game
pulls up dialog to change the group of the selected game
pulls up dialog to rename (change name of) the selected game
pulls up dialog to delete the selected game
pulls up dialog to delete the selected game
*/
- public static final int list_item_delete=0x7f05009d;
- public static final int list_item_deselect=0x7f050347;
+ public static final int list_item_delete=0x7f05009e;
+ public static final int list_item_deselect=0x7f05034b;
/** pulls up dialog to change the group of the selected game
pulls up dialog to change the group of the selected game
pulls up dialog to change the group of the selected game
*/
- public static final int list_item_move=0x7f05009c;
+ public static final int list_item_move=0x7f05009d;
/** creates a new game with all configuation copied from the
selected game
creates a new game with all configuation copied from the
@@ -3510,12 +3507,12 @@ XLATE-ME
creates a new game with all configuation copied from the
selected game
*/
- public static final int list_item_new_from=0x7f05009f;
+ public static final int list_item_new_from=0x7f0500a0;
/** pulls up dialog to rename (change name of) the selected game
pulls up dialog to rename (change name of) the selected game
pulls up dialog to rename (change name of) the selected game
*/
- public static final int list_item_rename=0x7f05009b;
+ public static final int list_item_rename=0x7f05009c;
/** pulls up dialog to reset the selected game, that is to remove
all moves so that it's the same as a newly created game
except for any configuration.
@@ -3535,19 +3532,19 @@ XLATE-ME
all moves so that it's the same as a newly created game
except for any configuration.
*/
- public static final int list_item_reset=0x7f05009e;
- public static final int list_item_select=0x7f050346;
+ public static final int list_item_reset=0x7f05009f;
+ public static final int list_item_select=0x7f05034a;
/** formatting for last move summary in notifications
formatting for last move summary in notifications
%1$s passed (0 points)
*/
- public static final int lmi_pass_fmt=0x7f0502d0;
+ public static final int lmi_pass_fmt=0x7f0502d3;
/** %1$s lost a turn
*/
- public static final int lmi_phony_fmt=0x7f0502d1;
+ public static final int lmi_phony_fmt=0x7f0502d4;
/** Tiles assigned to %1$s
*/
- public static final int lmi_tiles_fmt=0x7f0502d2;
+ public static final int lmi_tiles_fmt=0x7f0502d5;
/** One of the strings used in the right column of the list of
installed wordlists to describe those that are part of
Crosswords and that cannot be uninstalled or moved.
@@ -3564,7 +3561,7 @@ XLATE-ME
loc_internal and loc_external are the other possible strings
in this column.
*/
- public static final int loc_builtin=0x7f0500a7;
+ public static final int loc_builtin=0x7f0500a8;
/** Used to describe wordlists that are in the Downloads
directory. Currently I don't look there so this is unused,
but I will eventually do so. This should be the same name as
@@ -3581,63 +3578,63 @@ XLATE-ME
the built-in Android web browser uses for the directory where
it saves files it downloads.
*/
- public static final int loc_downloads=0x7f0500a8;
+ public static final int loc_downloads=0x7f0500a9;
/**
*/
- public static final int loc_external=0x7f0500b2;
+ public static final int loc_external=0x7f0500b3;
/** All
*/
- public static final int loc_filters_all=0x7f0502a1;
+ public static final int loc_filters_all=0x7f0502a2;
/** Latest menu
*/
- public static final int loc_filters_menu=0x7f0502a3;
+ public static final int loc_filters_menu=0x7f0502a4;
/** Modified by me
*/
- public static final int loc_filters_modified=0x7f0502a4;
+ public static final int loc_filters_modified=0x7f0502a5;
/** Filter by:
*/
- public static final int loc_filters_prompt=0x7f05029f;
+ public static final int loc_filters_prompt=0x7f0502a0;
/** Latest screen
*/
- public static final int loc_filters_screen=0x7f0502a2;
+ public static final int loc_filters_screen=0x7f0502a3;
/** Illegal translation: a translated
string must have the same format specifiers (e.g. %1$s) as the
original.
*/
- public static final int loc_fmts_mismatch=0x7f0502ba;
+ public static final int loc_fmts_mismatch=0x7f0502bb;
/** see move_dictf above
see move_dictf above
see move_dictf above
*/
- public static final int loc_internal=0x7f0500b1;
+ public static final int loc_internal=0x7f0500b2;
/** Check
*/
- public static final int loc_item_check=0x7f0502b7;
+ public static final int loc_item_check=0x7f0502b8;
/** for loc item edit menu
for loc item edit menu
Clear
*/
- public static final int loc_item_clear=0x7f0502b6;
+ public static final int loc_item_clear=0x7f0502b7;
/** Copy official
*/
- public static final int loc_item_copy_bless=0x7f0502b9;
+ public static final int loc_item_copy_bless=0x7f0502ba;
/** Copy English
*/
- public static final int loc_item_copy_eng=0x7f0502b8;
+ public static final int loc_item_copy_eng=0x7f0502b9;
/** %1$s (official)
*/
- public static final int loc_lang_blessed=0x7f05029a;
+ public static final int loc_lang_blessed=0x7f05029b;
/** %1$s (yours)
*/
- public static final int loc_lang_local=0x7f05029b;
+ public static final int loc_lang_local=0x7f05029c;
/** Translate
*/
- public static final int loc_menu_xlate=0x7f050299;
+ public static final int loc_menu_xlate=0x7f05029a;
/** Search for:
*/
- public static final int loc_search_prompt=0x7f0502a0;
+ public static final int loc_search_prompt=0x7f0502a1;
/** This is the "hint" printed in light text in the empty player
name field
############################################################
@@ -3684,107 +3681,107 @@ XLATE-ME
This is the "hint" printed in light text in the empty player
name field
*/
- public static final int local_name_hint=0x7f05018d;
+ public static final int local_name_hint=0x7f05018e;
/** XLATE-ME
Enable logging
*/
- public static final int logging_on=0x7f050301;
+ public static final int logging_on=0x7f050304;
/** XLATE-ME
(release builds only)
*/
- public static final int logging_on_summary=0x7f050302;
+ public static final int logging_on_summary=0x7f050305;
/** Word lookup
*/
- public static final int lookup_title=0x7f050295;
+ public static final int lookup_title=0x7f050296;
/**
(Not in contacts)
*/
- public static final int manual_owner_name=0x7f050218;
+ public static final int manual_owner_name=0x7f050219;
/**
Max length
*/
- public static final int max_len=0x7f0501f3;
+ public static final int max_len=0x7f0501f4;
/**
Chat
*/
- public static final int menu_chat=0x7f05022a;
+ public static final int menu_chat=0x7f05022b;
/**
Flip board
*/
- public static final int menu_flip=0x7f050228;
+ public static final int menu_flip=0x7f050229;
/**
Next hint
*/
- public static final int menu_hint_next=0x7f050225;
+ public static final int menu_hint_next=0x7f050226;
/**
Prev hint
*/
- public static final int menu_hint_prev=0x7f050224;
+ public static final int menu_hint_prev=0x7f050225;
/**
Juggle rack
*/
- public static final int menu_juggle=0x7f050227;
+ public static final int menu_juggle=0x7f050228;
/** text of menu that brings up the Settings (preferences) dialog
text of menu that brings up the Settings (preferences) dialog
text of menu that brings up the Settings (preferences) dialog
*/
- public static final int menu_prefs=0x7f050094;
+ public static final int menu_prefs=0x7f050095;
/** Rate Crosswords
*/
- public static final int menu_rateme=0x7f050287;
+ public static final int menu_rateme=0x7f050288;
/**
Toggle values
*/
- public static final int menu_toggle_values=0x7f05022c;
+ public static final int menu_toggle_values=0x7f05022d;
/**
Zoom in/out
*/
- public static final int menu_zoom=0x7f050229;
+ public static final int menu_zoom=0x7f05022a;
/**
Min length
*/
- public static final int min_len=0x7f0501f2;
+ public static final int min_len=0x7f0501f3;
/** label for the field used to set the timer's inital value
label for the field used to set the timer's inital value
Minutes per player
label for the field used to set the timer's inital value
*/
- public static final int minutes_label=0x7f0500c8;
+ public static final int minutes_label=0x7f0500c9;
/** body of notification shown when invitation requires a
wordslist that's not installed
body of notification shown when invitation requires a
wordslist that's not installed
Tap to download missing wordlist
*/
- public static final int missing_dict_detail=0x7f05025e;
+ public static final int missing_dict_detail=0x7f05025f;
/** Title of notification shown when invitation requires a
wordslist that's not installed
Title of notification shown when invitation requires a
wordslist that's not installed
Game invitation pending
*/
- public static final int missing_dict_title=0x7f05025d;
+ public static final int missing_dict_title=0x7f05025e;
/** Used as a substitute for the names of remote players when
they aren't available yet because the connection is not
complete. Displayed in the lists of players found in each
@@ -3806,7 +3803,7 @@ XLATE-ME
complete. Displayed in the lists of players found in each
game listing.
*/
- public static final int missing_player=0x7f05008a;
+ public static final int missing_player=0x7f05008b;
/** When the dicts_item_move menu is chosen, this text is used in
the confirmation dialog. The name of the selected wordlist
is substituted for %1$s. The strings loc_internal and
@@ -3823,7 +3820,7 @@ XLATE-ME
loc_internal are substitued for %2$s and %3$s (or vice-versa,
depending on the current location of the wordlist.)
*/
- public static final int move_dict_fmt=0x7f0500b0;
+ public static final int move_dict_fmt=0x7f0500b1;
/**
############################################################
# :Dialogs:
@@ -3864,7 +3861,7 @@ XLATE-ME
Text of dialog. Player name is substituted
*/
- public static final int msg_ask_password_fmt=0x7f0501a5;
+ public static final int msg_ask_password_fmt=0x7f0501a6;
/** When a game has been connected and the relay is notified that
a device in the game has deleted its part of the game, this
message is posted when you connect your end of it to the
@@ -3887,27 +3884,27 @@ XLATE-ME
game so you might as well delete it (unless you're saving it
for its history etc.)
*/
- public static final int msg_dev_deleted=0x7f0500f6;
+ public static final int msg_dev_deleted=0x7f0500f7;
/** (I believe this can no longer occur)
(I believe this can no longer occur)
Another host has already registered a
room using that name. Rename yours or retry later.
(I believe this can no longer occur)
*/
- public static final int msg_dup_room=0x7f0500f4;
+ public static final int msg_dup_room=0x7f0500f5;
/** (I believe this can no longer occur)
(I believe this can no longer occur)
The relay has lost contact with
another device in this game.
(I believe this can no longer occur)
*/
- public static final int msg_lost_other=0x7f0500f5;
+ public static final int msg_lost_other=0x7f0500f6;
/** (I believe this can no longer occur)
(I believe this can no longer occur)
No host has registered a room by that name.
(I believe this can no longer occur)
*/
- public static final int msg_no_room=0x7f0500f3;
+ public static final int msg_no_room=0x7f0500f4;
/** Text of "toast" shown when a game is notified by the relay
that all expected players have registered. At this point
play can begin.
@@ -3926,44 +3923,42 @@ XLATE-ME
that all expected players have registered. At this point
play can begin.
*/
- public static final int msg_relay_all_here_fmt=0x7f0500f0;
+ public static final int msg_relay_all_here_fmt=0x7f0500f1;
/** (I believe this can no longer occur)
(I believe this can no longer occur)
You are providing more players than
the host expects.
(I believe this can no longer occur)
*/
- public static final int msg_too_many=0x7f0500f2;
+ public static final int msg_too_many=0x7f0500f3;
/** Text of progress indicator shown while check is being conducted
Text of progress indicator shown while check is being conducted
Text of progress indicator shown while check is being conducted
*/
- public static final int msgs_progress=0x7f050096;
+ public static final int msgs_progress=0x7f050097;
/** %1$s moved more than %2$s ago.
*/
- public static final int nag_body_fmt=0x7f0502cd;
+ public static final int nag_body_fmt=0x7f0502d0;
/** XLATE-ME
Reminder intervals (minutes1,minutes2,...)
*/
- public static final int nag_intervals=0x7f050314;
- /** Enable dualpane
- Side-by-side views, very experimental!
- Nagging: title of notification reminder message
+ public static final int nag_intervals=0x7f050317;
+ /** Nagging: title of notification reminder message
Nagging: title of notification reminder message
Reminder: It\'s your turn
*/
- public static final int nag_title=0x7f0502cc;
+ public static final int nag_title=0x7f0502cf;
/** above is inserted in this the last time I warn
above is inserted in this the last time I warn
Last warning: %1$s
*/
- public static final int nag_warn_last_fmt=0x7f0502ce;
+ public static final int nag_warn_last_fmt=0x7f0502d1;
/** XLATE-ME
%1$s copy
*/
- public static final int name_copy_fmt=0x7f050212;
- public static final int name_dict_fmt=0x7f05030e;
- public static final int nbs_port=0x7f050084;
+ public static final int name_copy_fmt=0x7f050213;
+ public static final int name_dict_fmt=0x7f050311;
+ public static final int nbs_port=0x7f050085;
/** text of checkbox. If this checkbox is checked, games created
for network play will by default have the hint feature
enabled.
@@ -3975,7 +3970,7 @@ XLATE-ME
for network play will by default have the hint feature
enabled.
*/
- public static final int nethints_allowed=0x7f0500c6;
+ public static final int nethints_allowed=0x7f0500c7;
/** clarification on hints_allowed, whether new NETWORKED games
will default to having the hint feature enabled(string
elsewhere in this file)
@@ -3987,41 +3982,41 @@ XLATE-ME
will default to having the hint feature enabled(string
elsewhere in this file)
*/
- public static final int nethints_allowed_sum=0x7f05012f;
+ public static final int nethints_allowed_sum=0x7f050130;
/** XLATE-ME
Game network stats
*/
- public static final int netstats_title=0x7f050309;
+ public static final int netstats_title=0x7f05030c;
/** XLATE-ME
For experienced players
*/
- public static final int network_advanced_summary=0x7f0502e1;
+ public static final int network_advanced_summary=0x7f0502e4;
/** XLATE-ME
Advanced
*/
- public static final int network_advanced_title=0x7f0502e0;
+ public static final int network_advanced_title=0x7f0502e3;
/** Network game settings
*/
- public static final int network_behavior=0x7f050160;
+ public static final int network_behavior=0x7f050161;
/** explanation of the above
explanation of the above
Settings that apply to
networked games
explanation of the above
*/
- public static final int network_behavior_summary=0x7f050161;
+ public static final int network_behavior_summary=0x7f050162;
/**
Tap to download and install
*/
- public static final int new_app_avail=0x7f050254;
+ public static final int new_app_avail=0x7f050255;
/**
New version of %1$s
*/
- public static final int new_app_avail_fmt=0x7f050253;
+ public static final int new_app_avail_fmt=0x7f050254;
/**
New game via Bluetooth
@@ -4030,67 +4025,67 @@ XLATE-ME
*/
- public static final int new_bt_body_fmt=0x7f050203;
+ public static final int new_bt_body_fmt=0x7f050204;
/**
*/
- public static final int new_btmove_title=0x7f050207;
+ public static final int new_btmove_title=0x7f050208;
/**
New wordlist available
*/
- public static final int new_dict_avail=0x7f050251;
+ public static final int new_dict_avail=0x7f050252;
/**
Tap to update %1$s
*/
- public static final int new_dict_avail_fmt=0x7f050252;
+ public static final int new_dict_avail_fmt=0x7f050253;
/** XLATE-ME
New one-device game
*/
- public static final int new_game=0x7f0502d7;
+ public static final int new_game=0x7f0502da;
/** XLATE-ME
Would you like to create this game
using default settings?\n\nOr would you like to configure it
first?
*/
- public static final int new_game_message=0x7f0502da;
+ public static final int new_game_message=0x7f0502dd;
/** XLATE-ME
(You will have a chance to
invite other players when it is open.)
*/
- public static final int new_game_message_net=0x7f0502dc;
+ public static final int new_game_message_net=0x7f0502df;
/** XLATE-ME
This game must be
configured before it can be opened.
*/
- public static final int new_game_message_nodflt=0x7f0502db;
+ public static final int new_game_message_nodflt=0x7f0502de;
/** XLATE-ME
New networked game
*/
- public static final int new_game_networked=0x7f0502d8;
+ public static final int new_game_networked=0x7f0502db;
/**
One or more moves has arrived
*/
- public static final int new_move_body=0x7f050208;
+ public static final int new_move_body=0x7f050209;
/**
%1$s has invited you to play
*/
- public static final int new_name_body_fmt=0x7f050215;
- public static final int new_relay_body=0x7f050204;
+ public static final int new_name_body_fmt=0x7f050216;
+ public static final int new_relay_body=0x7f050205;
/** hint (text shown when field is empty) for room name field
hint (text shown when field is empty) for room name field
Room name
hint (text shown when field is empty) for room name field
*/
- public static final int new_room_hint=0x7f0500bf;
+ public static final int new_room_hint=0x7f0500c0;
/**
###########################################################
# :Dialogs:
@@ -4126,7 +4121,7 @@ XLATE-ME
Title of New user info dialog
*/
- public static final int newbie_title=0x7f0501ba;
+ public static final int newbie_title=0x7f0501bb;
/** section separator (white-on-gray bar) for third section:
bluetooth games
section separator (white-on-gray bar) for third section:
@@ -4135,15 +4130,15 @@ XLATE-ME
section separator (white-on-gray bar) for third section:
bluetooth games
*/
- public static final int newgame_bt_header=0x7f05017a;
+ public static final int newgame_bt_header=0x7f05017b;
/** Text of second of two buttons for new standalone games. Tap
this and you'll get taken to the "Game configure" screen
Text of second of two buttons for new standalone games. Tap
this and you'll get taken to the "Game configure" screen
Configure first
*/
- public static final int newgame_configure_first=0x7f050174;
- public static final int newgame_drop_relay=0x7f050179;
+ public static final int newgame_configure_first=0x7f050175;
+ public static final int newgame_drop_relay=0x7f05017a;
/** Text of first of two buttons for new networked games. Tap
this and a game will be created, but you probably won't see
it immediately because an email or messaging app will be
@@ -4158,8 +4153,8 @@ XLATE-ME
it immediately because an email or messaging app will be
launched to send your invitation.
*/
- public static final int newgame_invite=0x7f050177;
- public static final int newgame_invite_more=0x7f050178;
+ public static final int newgame_invite=0x7f050178;
+ public static final int newgame_invite_more=0x7f050179;
/** Text of first of two buttons for new standalone games. Tap
this and a new game will be created and opened. If the first
player is a robot it will immediately take its turn.
@@ -4171,7 +4166,7 @@ XLATE-ME
this and a new game will be created and opened. If the first
player is a robot it will immediately take its turn.
*/
- public static final int newgame_local=0x7f050173;
+ public static final int newgame_local=0x7f050174;
/** This is one of two descriptions on this screen. It explains
what standalone games are and describes the two buttons used
to create them. The name of the language of the default
@@ -4190,7 +4185,7 @@ XLATE-ME
to create them. The name of the language of the default
wordlist is substituted in for %1$s.
*/
- public static final int newgame_local_desc_fmt=0x7f050172;
+ public static final int newgame_local_desc_fmt=0x7f050173;
/** ############################################################
# :Screens:
# New game screen
@@ -4229,7 +4224,7 @@ XLATE-ME
section separator (white-on-gray bar) for first section:
standalone games
*/
- public static final int newgame_local_header=0x7f050171;
+ public static final int newgame_local_header=0x7f050172;
/** This is the second of two descriptions on this screen. It
explains what networked games are and describes the two
buttons used to create them.
@@ -4246,7 +4241,7 @@ XLATE-ME
explains what networked games are and describes the two
buttons used to create them.
*/
- public static final int newgame_networked_desc=0x7f050176;
+ public static final int newgame_networked_desc=0x7f050177;
/** section separator (white-on-gray bar) for second section:
networked games
section separator (white-on-gray bar) for second section:
@@ -4255,7 +4250,7 @@ XLATE-ME
section separator (white-on-gray bar) for second section:
networked games
*/
- public static final int newgame_networked_header=0x7f050175;
+ public static final int newgame_networked_header=0x7f050176;
/**
New SMS Game
@@ -4263,16 +4258,16 @@ XLATE-ME
*/
- public static final int newgame_sms_header=0x7f050213;
+ public static final int newgame_sms_header=0x7f050214;
/** Name your new group:
*/
- public static final int newgroup_label=0x7f050268;
+ public static final int newgroup_label=0x7f050269;
/** XLATE-ME
To invite via NFC just touch the back
of this device against the one you want to invite—any time the
game is open.
*/
- public static final int nfc_just_tap=0x7f0502ef;
+ public static final int nfc_just_tap=0x7f0502f2;
/** XLATE-ME
GSM
XLATE-ME
@@ -4280,7 +4275,7 @@ XLATE-ME
XLATE-ME
Send via NFC to self?
*/
- public static final int nfc_to_self=0x7f05031e;
+ public static final int nfc_to_self=0x7f050321;
/** Title of dialog for renaming game (triggered by selecting
list_item_rename)
If you try to copy a networked game you get this error
@@ -4294,7 +4289,7 @@ XLATE-ME
If you try to copy a networked game you get this error
message.
*/
- public static final int no_copy_network=0x7f0500a1;
+ public static final int no_copy_network=0x7f0500a2;
/** If the wordlist disappears mid-game there are no choices,
just an explanation and this button, after which the game
closes.
@@ -4308,7 +4303,7 @@ XLATE-ME
just an explanation and this button, after which the game
closes.
*/
- public static final int no_dict_finish=0x7f05019e;
+ public static final int no_dict_finish=0x7f05019f;
/** If the missing wordlist is discovered when trying to open the
game, we have more options. If there's another wordlist in
the same language, we can offer to substitute without needing
@@ -4333,7 +4328,7 @@ XLATE-ME
takes wordlist name and language substituted in for %1$ and
%2$
*/
- public static final int no_dict_fmt=0x7f0501a0;
+ public static final int no_dict_fmt=0x7f0501a1;
/** This is an alternative message presented when there's also
the option of downloading another wordlist. Game name,
wordlist name and language are substituted in.
@@ -4349,7 +4344,7 @@ XLATE-ME
the option of downloading another wordlist. Game name,
wordlist name and language are substituted in.
*/
- public static final int no_dict_subst_fmt=0x7f0501a1;
+ public static final int no_dict_subst_fmt=0x7f0501a2;
/**
############################################################
# :Dialogs:
@@ -4503,7 +4498,7 @@ XLATE-ME
title of alert
*/
- public static final int no_dict_title=0x7f05019d;
+ public static final int no_dict_title=0x7f05019e;
/** If you click on the Play button without having entered a room
name you get an alert with this error message.
If you click on the Play button without having entered a room
@@ -4513,7 +4508,7 @@ XLATE-ME
If you click on the Play button without having entered a room
name you get an alert with this error message.
*/
- public static final int no_empty_rooms=0x7f05018f;
+ public static final int no_empty_rooms=0x7f050190;
/** If you choose the above option and have no networked games
you get this error message
If you choose the above option and have no networked games
@@ -4521,11 +4516,11 @@ XLATE-ME
If you choose the above option and have no networked games
you get this error message
*/
- public static final int no_games_to_refresh=0x7f050097;
- public static final int no_invites=0x7f050349;
+ public static final int no_games_to_refresh=0x7f050098;
+ public static final int no_invites=0x7f05034d;
/** Google Play app not found
*/
- public static final int no_market=0x7f050288;
+ public static final int no_market=0x7f050289;
/** displayed when you long-tap a scoreboard entry and there's no
most recent score to show
displayed when you long-tap a scoreboard entry and there's no
@@ -4534,7 +4529,7 @@ XLATE-ME
displayed when you long-tap a scoreboard entry and there's no
most recent score to show
*/
- public static final int no_moves_made=0x7f0500e7;
+ public static final int no_moves_made=0x7f0500e8;
/** If the query returns no rooms, this message is displayed,
with the number of players in the game and its language
substituted.
@@ -4548,8 +4543,8 @@ XLATE-ME
with the number of players in the game and its language
substituted.
*/
- public static final int no_name_found_fmt=0x7f0500c3;
- public static final int no_relay_conn=0x7f050331;
+ public static final int no_name_found_fmt=0x7f0500c4;
+ public static final int no_relay_conn=0x7f050335;
/** This is not currently shown
Crosswords wordlists, which are
just compressed lists of words plus tile information, determine
@@ -4591,25 +4586,25 @@ XLATE-ME
figuring out how to play and when you tap an empty cell the
arrow appears. This explains it.
*/
- public static final int not_again_arrow=0x7f0501cd;
+ public static final int not_again_arrow=0x7f0501ce;
/** The back button clears any
selection instead of exiting. Hit it again to exit the
app.
*/
- public static final int not_again_backclears=0x7f05027b;
+ public static final int not_again_backclears=0x7f05027c;
/**
This button opens the wordlist
browser on the current player\'s wordlist.
*/
- public static final int not_again_browse=0x7f0501ef;
+ public static final int not_again_browse=0x7f0501f0;
/**
This button opens the wordlist
browser on the wordlist of your choice.
*/
- public static final int not_again_browseall=0x7f0501f0;
+ public static final int not_again_browseall=0x7f0501f1;
/** Shown when you tap the chat button on the toolbar of the
main Board screen
Shown when you tap the chat button on the toolbar of the
@@ -4620,14 +4615,14 @@ XLATE-ME
Shown when you tap the chat button on the toolbar of the
main Board screen
*/
- public static final int not_again_chat=0x7f0501c6;
+ public static final int not_again_chat=0x7f0501c7;
/** EXPERIMENTAL: Newbie hint next when invite_choice_clip shown
when chosen
*/
- public static final int not_again_clip_expl_fmt=0x7f050341;
- public static final int not_again_comms_bt=0x7f05033a;
- public static final int not_again_comms_relay=0x7f050338;
- public static final int not_again_comms_sms=0x7f050339;
+ public static final int not_again_clip_expl_fmt=0x7f050345;
+ public static final int not_again_comms_bt=0x7f05033e;
+ public static final int not_again_comms_relay=0x7f05033c;
+ public static final int not_again_comms_sms=0x7f05033d;
/** This is shown in the Board screen when you successfully
connecting a game to the relay and are the last device in the
game to do so, i.e. the game is now complete and you should
@@ -4645,7 +4640,7 @@ XLATE-ME
game to do so, i.e. the game is now complete and you should
expect play to begin.
*/
- public static final int not_again_conndall=0x7f0501cc;
+ public static final int not_again_conndall=0x7f0501cd;
/** This is shown in the Board screen when you successfully
connect a game to the relay and are the first device in the
game to do so.
@@ -4660,7 +4655,7 @@ XLATE-ME
connect a game to the relay and are the first device in the
game to do so.
*/
- public static final int not_again_conndfirst=0x7f0501ca;
+ public static final int not_again_conndfirst=0x7f0501cb;
/** This is shown in the Board screen when you successfully
connecting a game to the relay and are not the first device
in the game but not the last either. So it will only occur
@@ -4677,8 +4672,8 @@ XLATE-ME
in the game but not the last either. So it will only occur
for games with more than two devices, which are rare.
*/
- public static final int not_again_conndmid=0x7f0501cb;
- public static final int not_again_dfltname_fmt=0x7f050348;
+ public static final int not_again_conndmid=0x7f0501cc;
+ public static final int not_again_dfltname_fmt=0x7f05034c;
/** This screen lets you install new
wordslists and view the ones you already have.\n\nWhat wordlists
you have installed determines:\n• What languages you can play
@@ -4686,7 +4681,7 @@ XLATE-ME
legal.\n\nCheck the \"Show downloadable\" box at the top to see
what\'s available.
*/
- public static final int not_again_dicts=0x7f0502c9;
+ public static final int not_again_dicts=0x7f0502ca;
/** This is shown when you choose the board_menu_done menu item.
It's to let you know that there's a shortcut that does almost
the same thing.
@@ -4700,14 +4695,14 @@ XLATE-ME
It's to let you know that there's a shortcut that does almost
the same thing.
*/
- public static final int not_again_done=0x7f0501c8;
+ public static final int not_again_done=0x7f0501c9;
/** XLATE-ME
Public rooms have been made
an \"advanced\" feature in this release. If you were using them
and want them back, enable them now. You can turn them off again
in Settings.
*/
- public static final int not_again_enablepublic=0x7f0502f6;
+ public static final int not_again_enablepublic=0x7f0502f9;
/** Shown when you tap the flip button on the toolbar of the main
Board screen
Shown when you tap the flip button on the toolbar of the main
@@ -4717,13 +4712,13 @@ XLATE-ME
Shown when you tap the flip button on the toolbar of the main
Board screen
*/
- public static final int not_again_flip=0x7f0501c3;
+ public static final int not_again_flip=0x7f0501c4;
/** This string has special format
specifiers (e.g. %1$s). Please be sure that your translation has
the same ones as the original.\n\n(You will not be able to save it
unless it does.)
*/
- public static final int not_again_fmt_expl=0x7f0502bb;
+ public static final int not_again_fmt_expl=0x7f0502bc;
/** XLATE-ME
These two buttons do
the same thing as the first two items in this window\'s Action Bar
@@ -4732,7 +4727,7 @@ XLATE-ME
section of App settings).
*/
- public static final int not_again_hidenewgamebuttons=0x7f0502e8;
+ public static final int not_again_hidenewgamebuttons=0x7f0502eb;
/** Shown when you tap the next hint button on the toolbar of the
main Board screen
Shown when you tap the next hint button on the toolbar of the
@@ -4743,7 +4738,7 @@ XLATE-ME
Shown when you tap the next hint button on the toolbar of the
main Board screen
*/
- public static final int not_again_hintnext=0x7f0501c1;
+ public static final int not_again_hintnext=0x7f0501c2;
/** Currently not used
The new game you have created has
two players. Player 1 is a robot; Player 2 is you. Tap the game
@@ -4769,7 +4764,7 @@ XLATE-ME
Shown when you tap the Previous Hint button on the toolbar of
the main Board screen
*/
- public static final int not_again_hintprev=0x7f0501c0;
+ public static final int not_again_hintprev=0x7f0501c1;
/** Shown when you tap the juggle button on the toolbar of the
main Board screen
Shown when you tap the juggle button on the toolbar of the
@@ -4779,14 +4774,14 @@ XLATE-ME
Shown when you tap the juggle button on the toolbar of the
main Board screen
*/
- public static final int not_again_juggle=0x7f0501c2;
+ public static final int not_again_juggle=0x7f0501c3;
/**
This button lets you look up,
online, the words just played.
*/
- public static final int not_again_lookup=0x7f0501e3;
+ public static final int not_again_lookup=0x7f0501e4;
/** Shown when you first pick the list_item_new_from menuitem
Shown when you first pick the list_item_new_from menuitem
Create a new ready-to-play game
@@ -4794,19 +4789,19 @@ XLATE-ME
as a template.
Shown when you first pick the list_item_new_from menuitem
*/
- public static final int not_again_newfrom=0x7f0501cf;
+ public static final int not_again_newfrom=0x7f0501d0;
/** Tapping a game opens it.\n\nYou
can instead tap the icons at the left to select or deselect games,
then act on selected games, e.g. to delete them, using the menu or
\"Actionbar.\"
*/
- public static final int not_again_newselect=0x7f05027a;
- public static final int not_again_rematch_two_only=0x7f05033c;
+ public static final int not_again_newselect=0x7f05027b;
+ public static final int not_again_rematch_two_only=0x7f050340;
/** The selected words will be
copied to the system clipboard. You can then paste them into any
app that supports pasting text, e.g. an email app.
*/
- public static final int not_again_studycopy=0x7f050294;
+ public static final int not_again_studycopy=0x7f050295;
/** The following strings (all whose names start with
"not_again") appear in the New user info dialog.
@@ -4825,7 +4820,7 @@ XLATE-ME
shown when user chooses the gamel_menu_checkmoves menu
*/
- public static final int not_again_sync=0x7f0501bc;
+ public static final int not_again_sync=0x7f0501bd;
/** Shown when the user chooses the "board_menu_trade" menu
Shown when the user chooses the "board_menu_trade" menu
You are entering tile-exchange
@@ -4833,15 +4828,15 @@ XLATE-ME
exchanged.\n\n
Shown when the user chooses the "board_menu_trade" menu
*/
- public static final int not_again_trading=0x7f0501bd;
+ public static final int not_again_trading=0x7f0501be;
/** Use the buttons to
commit your turn or exit exchange mode.
*/
- public static final int not_again_trading_buttons=0x7f0501be;
+ public static final int not_again_trading_buttons=0x7f0501bf;
/** Use the menu or action bar
to commit your turn or exit exchange mode.
*/
- public static final int not_again_trading_menu=0x7f0501bf;
+ public static final int not_again_trading_menu=0x7f0501c0;
/** Shown when the board screen is visible and it's just become
another players turn. The idea is to give a hint about how to
find out about recent moves.
@@ -4856,7 +4851,7 @@ XLATE-ME
another players turn. The idea is to give a hint about how to
find out about recent moves.
*/
- public static final int not_again_turnchanged=0x7f0501ce;
+ public static final int not_again_turnchanged=0x7f0501cf;
/** Shown when you tap the undo/redo button on the toolbar of the
main Board screen
Shown when you tap the undo/redo button on the toolbar of the
@@ -4866,7 +4861,7 @@ XLATE-ME
Shown when you tap the undo/redo button on the toolbar of the
main Board screen
*/
- public static final int not_again_undo=0x7f0501c5;
+ public static final int not_again_undo=0x7f0501c6;
/** Shown in the Game configure screen when the game_locked
checkbox is checked and you uncheck it.
Shown in the Game configure screen when the game_locked
@@ -4878,7 +4873,7 @@ XLATE-ME
Shown in the Game configure screen when the game_locked
checkbox is checked and you uncheck it.
*/
- public static final int not_again_unlock=0x7f0501c9;
+ public static final int not_again_unlock=0x7f0501ca;
/** Shown when you tap the values button on the toolbar of the
main Board screen. This is intended to allow players to
remind themselves how much played tiles are worth while
@@ -4895,7 +4890,7 @@ XLATE-ME
remind themselves how much played tiles are worth while
planning a move.
*/
- public static final int not_again_values=0x7f0501c7;
+ public static final int not_again_values=0x7f0501c8;
/** Shown when you tap the zoom (+/-) button on the toolbar of
the main Board screen
Shown when you tap the zoom (+/-) button on the toolbar of
@@ -4906,12 +4901,12 @@ XLATE-ME
Shown when you tap the zoom (+/-) button on the toolbar of
the main Board screen
*/
- public static final int not_again_zoom=0x7f0501c4;
+ public static final int not_again_zoom=0x7f0501c5;
/** (None)
*/
- public static final int note_none=0x7f0502c5;
- public static final int notify_chat_body_fmt=0x7f0501ab;
- public static final int notify_chat_title_fmt=0x7f0501aa;
+ public static final int note_none=0x7f0502c6;
+ public static final int notify_chat_body_fmt=0x7f0501ac;
+ public static final int notify_chat_title_fmt=0x7f0501ab;
/** This text is displayed as the "summary" for both of the
notify choices above, as extra information. (There could be
different strings if it makes more sense in your language.)
@@ -4926,7 +4921,7 @@ XLATE-ME
different strings if it makes more sense in your language.)
*/
- public static final int notify_other_summary=0x7f050170;
+ public static final int notify_other_summary=0x7f050171;
/** When one or more new moves is found, should I play a
notification sound
When one or more new moves is found, should I play a
@@ -4935,7 +4930,7 @@ XLATE-ME
When one or more new moves is found, should I play a
notification sound
*/
- public static final int notify_sound=0x7f05016e;
+ public static final int notify_sound=0x7f05016f;
/** When a move is fetched from the relay a Notification is
posted. These are its title, which appears in the top bar of the
device, and the body that appears when you pull the notifications
@@ -4946,8 +4941,8 @@ XLATE-ME
down.
Move in game %1$s
*/
- public static final int notify_title_fmt=0x7f0501a8;
- public static final int notify_title_turn_fmt=0x7f0501a9;
+ public static final int notify_title_fmt=0x7f0501a9;
+ public static final int notify_title_turn_fmt=0x7f0501aa;
/** When one or more new moves is found, should I vibrate the
device
When one or more new moves is found, should I vibrate the
@@ -4956,11 +4951,11 @@ XLATE-ME
When one or more new moves is found, should I vibrate the
device
*/
- public static final int notify_vibrate=0x7f05016f;
+ public static final int notify_vibrate=0x7f050170;
/** XLATE-ME
Number on this device
*/
- public static final int nplayers_prompt=0x7f0502de;
+ public static final int nplayers_prompt=0x7f0502e1;
/** text of label identifying the field where human players can
enter an option password. The label and field disappear when
the robot player checkbox is checked because it makes no
@@ -4984,14 +4979,14 @@ XLATE-ME
player on a device, so they are infrequently used in network
games as well.
*/
- public static final int password_label=0x7f0500df;
+ public static final int password_label=0x7f0500e0;
/** You have NFC enabled. That
means that any time a board that\'s missing a player is open, you
can tap a nearby person\'s device to invite him/her to
play – if he/she is also using NFC.
\u0020pct.
*/
- public static final int pct_suffix=0x7f050286;
+ public static final int pct_suffix=0x7f050287;
/** If this preference is checked, tapping on the scoreboard
entry for any player reveals that player's tiles and any
pending move (after asking for his password if one is set.)
@@ -5018,20 +5013,20 @@ XLATE-ME
though it's not his turn e.g. while the player whose turn it
is is temporarily unable to play.
*/
- public static final int peek_other=0x7f05015c;
+ public static final int peek_other=0x7f05015d;
/** explanation of the above
explanation of the above
Tapping on scoreboard name shows
that player\'s tiles
explanation of the above
*/
- public static final int peek_other_summary=0x7f05015d;
+ public static final int peek_other_summary=0x7f05015e;
/**
Connected number[s]:
*/
- public static final int phone_label=0x7f050220;
+ public static final int phone_label=0x7f050221;
/** Don't warn, but simply force to skip turn (give 0 points)
when user attempts to play word not in the wordlist.
Don't warn, but simply force to skip turn (give 0 points)
@@ -5040,7 +5035,7 @@ XLATE-ME
Don't warn, but simply force to skip turn (give 0 points)
when user attempts to play word not in the wordlist.
*/
- public static final int phonies_disallow=0x7f0500d0;
+ public static final int phonies_disallow=0x7f0500d1;
/** These are the three choices in the popup above whose text is
phonies_spinner_prompt
Don't care if words played are in the wordlist or not
@@ -5200,7 +5195,7 @@ XLATE-ME
phonies_spinner_prompt
Don't care if words played are in the wordlist or not
*/
- public static final int phonies_ignore=0x7f0500ce;
+ public static final int phonies_ignore=0x7f0500cf;
/** title of popup used to determine how words are handled that
are not in the wordlist used for the game (or player if using
different wordlists per player)
@@ -5213,7 +5208,7 @@ XLATE-ME
are not in the wordlist used for the game (or player if using
different wordlists per player)
*/
- public static final int phonies_spinner_prompt=0x7f0500cd;
+ public static final int phonies_spinner_prompt=0x7f0500ce;
/** warn player when word played is not in the wordlist, but
allow him to play it.
warn player when word played is not in the wordlist, but
@@ -5222,19 +5217,19 @@ XLATE-ME
warn player when word played is not in the wordlist, but
allow him to play it.
*/
- public static final int phonies_warn=0x7f0500cf;
+ public static final int phonies_warn=0x7f0500d0;
/**
Pick tiles face-up
*/
- public static final int pick_faceup=0x7f0501eb;
+ public static final int pick_faceup=0x7f0501ec;
/**
Look up %1$s at
*/
- public static final int pick_url_title_fmt=0x7f0501e1;
+ public static final int pick_url_title_fmt=0x7f0501e2;
/** Text of button at bottom. Press it and you exit this
configure screen and open the game into the Board screen
Text of button at bottom. Press it and you exit this
@@ -5243,7 +5238,7 @@ XLATE-ME
Text of button at bottom. Press it and you exit this
configure screen and open the game into the Board screen
*/
- public static final int play=0x7f0500d5;
+ public static final int play=0x7f0500d6;
/**
############################################################
# :Dialogs:
@@ -5323,7 +5318,7 @@ XLATE-ME
dialog title
*/
- public static final int player_edit_title=0x7f0500d9;
+ public static final int player_edit_title=0x7f0500da;
/** used to create default player names. Number between 1 and 4
is substituted
When a move is fetched from the relay a Notification is
@@ -5338,7 +5333,7 @@ XLATE-ME
used to create default player names. Number between 1 and 4
is substituted
*/
- public static final int player_fmt=0x7f0501a7;
+ public static final int player_fmt=0x7f0501a8;
/** text of lable identifying the field in which player's name is
set/displayed
Shown in the main screen when you launch Crosswords from an
@@ -5357,7 +5352,7 @@ XLATE-ME
text of lable identifying the field in which player's name is
set/displayed
*/
- public static final int player_label=0x7f0500db;
+ public static final int player_label=0x7f0500dc;
/** text for separator above the list of players that's used for
networked games. The numbers of local and non-local players
are substituted for %1$d and %2$d.
@@ -5370,7 +5365,7 @@ XLATE-ME
networked games. The numbers of local and non-local players
are substituted for %1$d and %2$d.
*/
- public static final int players_label_host_fmt=0x7f0500b8;
+ public static final int players_label_host_fmt=0x7f0500b9;
/** text for separator above the list of players that's used for
non-networked games
text for separator above the list of players that's used for
@@ -5379,61 +5374,61 @@ XLATE-ME
text for separator above the list of players that's used for
non-networked games
*/
- public static final int players_label_standalone=0x7f0500b7;
- /** Tablets Stuff
-Prefs related to in-app localization
+ public static final int players_label_standalone=0x7f0500b8;
+ /** Prefs related to in-app localization
*/
- public static final int pref_group_l10n_summary=0x7f05032a;
+ public static final int pref_group_l10n_summary=0x7f05032e;
/** Localization Stuff
*/
- public static final int pref_group_l10n_title=0x7f050329;
+ public static final int pref_group_l10n_title=0x7f05032c;
/** Prefs related to play via internet/relay
*/
- public static final int pref_group_relay_summary=0x7f050328;
+ public static final int pref_group_relay_summary=0x7f05032b;
/** Relay Stuff
*/
- public static final int pref_group_relay_title=0x7f050327;
+ public static final int pref_group_relay_title=0x7f05032a;
/** Prefs related to play-via-sms
*/
- public static final int pref_group_sms_summary=0x7f050326;
+ public static final int pref_group_sms_summary=0x7f050329;
/** SMS Stuff
*/
- public static final int pref_group_sms_title=0x7f050325;
+ public static final int pref_group_sms_title=0x7f050328;
+ public static final int pref_group_tablets_title=0x7f05032d;
/** Label for the first "human player" name preference
Label for the first "human player" name preference
Human player
*/
- public static final int pref_human_name=0x7f050128;
+ public static final int pref_human_name=0x7f050129;
/** Get intermediate builds
*/
- public static final int pref_item_update_summary=0x7f05032c;
+ public static final int pref_item_update_summary=0x7f050330;
/** Update between releases
*/
- public static final int pref_item_update_title=0x7f05032b;
+ public static final int pref_item_update_title=0x7f05032f;
/** Label for the first player color preference
Label for the first player color preference
First player
Label for the first "player name" preference
*/
- public static final int pref_player1_name=0x7f050124;
+ public static final int pref_player1_name=0x7f050125;
/** Label for the second player color preference
Label for the second player color preference
Second player
Label for the second "player name" preference (unused)
*/
- public static final int pref_player2_name=0x7f050125;
+ public static final int pref_player2_name=0x7f050126;
/** Label for the third player color preference
Label for the third player color preference
Third player
Label for the third "player name" preference (unused)
*/
- public static final int pref_player3_name=0x7f050126;
+ public static final int pref_player3_name=0x7f050127;
/** Label for the fourth player color preference
Label for the fourth player color preference
Fourth player
Label for the fourth "player name" preference (unused)
*/
- public static final int pref_player4_name=0x7f050127;
+ public static final int pref_player4_name=0x7f050128;
/**
############################################################
# :Screens:
@@ -5457,14 +5452,14 @@ XLATE-ME
title of this sub-preference
*/
- public static final int prefs_appearance=0x7f050135;
+ public static final int prefs_appearance=0x7f050136;
/** clarification of the above
clarification of the above
Settings controlling
appearance
clarification of the above
*/
- public static final int prefs_appearance_summary=0x7f050136;
+ public static final int prefs_appearance_summary=0x7f050137;
/**
############################################################
# :Screens:
@@ -5488,13 +5483,13 @@ XLATE-ME
title of this sub-preference
*/
- public static final int prefs_behavior=0x7f050152;
+ public static final int prefs_behavior=0x7f050153;
/** clarification of the above
clarification of the above
Settings controlling app behavior
clarification of the above
*/
- public static final int prefs_behavior_summary=0x7f050153;
+ public static final int prefs_behavior_summary=0x7f050154;
/**
############################################################
# :Screens:
@@ -5544,13 +5539,13 @@ XLATE-ME
title of this sub-preference
*/
- public static final int prefs_colors=0x7f050144;
+ public static final int prefs_colors=0x7f050145;
/** clarification of the above
clarification of the above
Edit colors used on the board
clarification of the above
*/
- public static final int prefs_colors_summary=0x7f050145;
+ public static final int prefs_colors_summary=0x7f050146;
/**
############################################################
# :Screens:
@@ -5574,26 +5569,26 @@ XLATE-ME
title of this sub-preference
*/
- public static final int prefs_defaults=0x7f050120;
+ public static final int prefs_defaults=0x7f050121;
/** clarification of the above
clarification of the above
Default settings for new
games
clarification of the above
*/
- public static final int prefs_defaults_summary=0x7f050121;
+ public static final int prefs_defaults_summary=0x7f050122;
/** sub-preference for dictionaries (soon to be called "word lists")
sub-preference for dictionaries (soon to be called "word lists")
Wordlists
sub-preference for dictionaries (soon to be called "word lists")
*/
- public static final int prefs_dicts=0x7f05012a;
+ public static final int prefs_dicts=0x7f05012b;
/** clarification of above
clarification of above
Default wordlists
clarification of above
*/
- public static final int prefs_dicts_summary=0x7f05012b;
+ public static final int prefs_dicts_summary=0x7f05012c;
/** sub-preference title for editing default player names.
There's only enabled now, though.
sub-preference title for editing default player names.
@@ -5602,38 +5597,38 @@ XLATE-ME
sub-preference title for editing default player names.
There's only enabled now, though.
*/
- public static final int prefs_names=0x7f050122;
+ public static final int prefs_names=0x7f050123;
/** clarification of the above
clarification of the above
Default player names
clarification of the above
*/
- public static final int prefs_names_summary=0x7f050123;
+ public static final int prefs_names_summary=0x7f050124;
/** Used when prev player's name can't be looked up
Used when prev player's name can't be looked up
Your opponent
*/
- public static final int prev_player=0x7f0502cf;
- public static final int processing_games=0x7f050345;
+ public static final int prev_player=0x7f0502d2;
+ public static final int processing_games=0x7f050349;
/** Downloading
*/
- public static final int progress_title=0x7f0502c3;
+ public static final int progress_title=0x7f0502c4;
/**
Words no longer than
*/
- public static final int prompt_max_len=0x7f0501f5;
+ public static final int prompt_max_len=0x7f0501f6;
/**
Words no shorter than
*/
- public static final int prompt_min_len=0x7f0501f4;
+ public static final int prompt_min_len=0x7f0501f5;
/** XLATE-ME
Relay device port
*/
- public static final int proxy_port=0x7f05030d;
+ public static final int proxy_port=0x7f050310;
/** Short for "points", this is shown at the right end of the
tray in place of the first tile placed along with the points
the current move would earn if committed.
@@ -5641,7 +5636,7 @@ XLATE-ME
tray in place of the first tile placed along with the points
the current move would earn if committed.
*/
- public static final int pts=0x7f0500ef;
+ public static final int pts=0x7f0500f0;
/** If you check the join_room checkbox Crosswords queries the
relay. This is the text of the progress indicator displayed what
that's going on. (It's often visible for only a very short
@@ -5657,7 +5652,7 @@ XLATE-ME
that's going on. (It's often visible for only a very short
time.)
*/
- public static final int public_names_progress_fmt=0x7f0500c2;
+ public static final int public_names_progress_fmt=0x7f0500c3;
/** Title for generic dialog asking a question, usually in the
middle of a game, like "do you want to commit this move?"
Title for generic dialog asking a question, usually in the
@@ -5666,17 +5661,17 @@ XLATE-ME
Title for generic dialog asking a question, usually in the
middle of a game, like "do you want to commit this move?"
*/
- public static final int query_title=0x7f0501b9;
- public static final int radio_name_cdma=0x7f05031d;
- public static final int radio_name_gsm=0x7f05031c;
+ public static final int query_title=0x7f0501ba;
+ public static final int radio_name_cdma=0x7f050320;
+ public static final int radio_name_gsm=0x7f05031f;
/** XLATE-ME
Don\'t pretend
*/
- public static final int radio_name_real=0x7f05031a;
+ public static final int radio_name_real=0x7f05031d;
/** XLATE-ME
Tablet/no radio
*/
- public static final int radio_name_tablet=0x7f05031b;
+ public static final int radio_name_tablet=0x7f05031e;
/**
############################################################
# :Dialogs:
@@ -5712,12 +5707,12 @@ XLATE-ME
Names of the three colors by which colors can be edited in
the color preferences dialog
*/
- public static final int red=0x7f05014f;
+ public static final int red=0x7f050150;
/** XLATE-ME
Invite redirect host
*/
- public static final int redir_host=0x7f0502ff;
- public static final int rel_invite_title=0x7f050343;
+ public static final int redir_host=0x7f050302;
+ public static final int rel_invite_title=0x7f050347;
/** Title of dialog used to alert players to relay-related
problems with the current game.
the color of text, e.g. "2L", shown on a bonus square on the
@@ -5730,44 +5725,44 @@ XLATE-ME
Title of dialog used to alert players to relay-related
problems with the current game.
*/
- public static final int relay_alert=0x7f0500f1;
+ public static final int relay_alert=0x7f0500f2;
/** Message from relay
*/
- public static final int relay_alert_title=0x7f050279;
- public static final int relay_behavior=0x7f050162;
+ public static final int relay_alert_title=0x7f05027a;
+ public static final int relay_behavior=0x7f050163;
/** explanation of the above
*/
- public static final int relay_behavior_summary=0x7f050163;
+ public static final int relay_behavior_summary=0x7f050164;
/** XLATE-ME
Relay host
*/
- public static final int relay_host=0x7f0502fe;
- public static final int relay_invite_title=0x7f05020e;
+ public static final int relay_host=0x7f050301;
+ public static final int relay_invite_title=0x7f05020f;
/** XLATE-ME
Relay game port
*/
- public static final int relay_port=0x7f05030c;
+ public static final int relay_port=0x7f05030f;
/** Shown in toast when relaunching after switching dicts
Shown in toast when relaunching after switching dicts
Reloading game with %1$s
Shown in toast when relaunching after switching dicts
*/
- public static final int reload_new_dict_fmt=0x7f05025c;
+ public static final int reload_new_dict_fmt=0x7f05025d;
/** XLATE-ME
Issuing rematch invitation. You will
see this message until it has been accepted.\n\nYou do not need to
keep this game open while waiting. You will be notified when the
game is ready to play.
*/
- public static final int rematch_msg=0x7f0502f5;
- public static final int rematch_name_fmt=0x7f0502d9;
- public static final int rematch_sent_toast=0x7f0502f4;
+ public static final int rematch_msg=0x7f0502f8;
+ public static final int rematch_name_fmt=0x7f0502dc;
+ public static final int rematch_sent_toast=0x7f0502f7;
/** Processing wordlist information…
*/
- public static final int remote_digesting=0x7f0502bd;
+ public static final int remote_digesting=0x7f0502be;
/** Fetching wordlist information from server…
*/
- public static final int remote_empty=0x7f0502bc;
+ public static final int remote_empty=0x7f0502bd;
/** checkbox determining of this player is on this device or
remote. If remote, then the rest of the fields disappear
(since they will be set by the remote device.)
@@ -5779,20 +5774,20 @@ XLATE-ME
remote. If remote, then the rest of the fields disappear
(since they will be set by the remote device.)
*/
- public static final int remote_label=0x7f0500da;
+ public static final int remote_label=0x7f0500db;
/** Unable to fetch wordlist information
from server.
*/
- public static final int remote_no_net=0x7f0502be;
+ public static final int remote_no_net=0x7f0502bf;
/**
Remote device undid a turn.
*/
- public static final int remote_undone=0x7f050223;
+ public static final int remote_undone=0x7f050224;
/** Change the name of this group to:
*/
- public static final int rename_group_label=0x7f050270;
+ public static final int rename_group_label=0x7f050271;
/** text within rename dialog (triggered by selecting
list_item_rename)
text within rename dialog (triggered by selecting
@@ -5800,12 +5795,12 @@ XLATE-ME
text within rename dialog (triggered by selecting
list_item_rename)
*/
- public static final int rename_label=0x7f0500a3;
+ public static final int rename_label=0x7f0500a4;
/** XLATE-ME
Change the name of this game
(on this device only) to:
*/
- public static final int rename_label_caveat=0x7f0500a4;
+ public static final int rename_label_caveat=0x7f0500a5;
/** if this preference is checked, the hardware volume keys will
work to zoom the board in and out (and will not control
volume) This only applies when the Board screen is
@@ -5824,19 +5819,19 @@ XLATE-ME
volume) This only applies when the Board screen is
frontmost.
*/
- public static final int ringer_zoom=0x7f05015a;
+ public static final int ringer_zoom=0x7f05015b;
/** explanation of the above
explanation of the above
Zoom board using volume keys
explanation of the above
*/
- public static final int ringer_zoom_summary=0x7f05015b;
+ public static final int ringer_zoom_summary=0x7f05015c;
/** checkbox determining if player is robot/automated or human
checkbox determining if player is robot/automated or human
Robot player
checkbox determining if player is robot/automated or human
*/
- public static final int robot_label=0x7f0500de;
+ public static final int robot_label=0x7f0500df;
/** Used to format robot player names in the lists of players
found in each game listing
Used to format game name plus some other information as the
@@ -5848,19 +5843,19 @@ XLATE-ME
Used to format robot player names in the lists of players
found in each game listing
*/
- public static final int robot_name_fmt=0x7f050089;
+ public static final int robot_name_fmt=0x7f05008a;
/** Three possible choices presented in the popup above
Three possible choices presented in the popup above
Smart robot
Three possible choices presented in the popup above
*/
- public static final int robot_smart=0x7f0500ca;
+ public static final int robot_smart=0x7f0500cb;
/** Smarter robot
*/
- public static final int robot_smarter=0x7f0500cb;
+ public static final int robot_smarter=0x7f0500cc;
/** Smartest robot
*/
- public static final int robot_smartest=0x7f0500cc;
+ public static final int robot_smartest=0x7f0500cd;
/** title of popup used to select how "smart" (how capable) the
robot player will be.
title of popup used to select how "smart" (how capable) the
@@ -5869,29 +5864,29 @@ XLATE-ME
title of popup used to select how "smart" (how capable) the
robot player will be.
*/
- public static final int robot_spinner_prompt=0x7f0500c9;
+ public static final int robot_spinner_prompt=0x7f0500ca;
/** text of checkbox
text of checkbox
Make new room public
text of checkbox
*/
- public static final int room_public=0x7f0500c0;
+ public static final int room_public=0x7f0500c1;
/** title for popup of public rooms found on server
title for popup of public rooms found on server
Select public room
title for popup of public rooms found on server
*/
- public static final int room_public_prompt=0x7f0500c1;
- public static final int seeking_relay=0x7f050330;
+ public static final int room_public_prompt=0x7f0500c2;
+ public static final int seeking_relay=0x7f050334;
/** Games: %1$d
*/
- public static final int sel_games_fmt=0x7f05027c;
+ public static final int sel_games_fmt=0x7f05027d;
/** Groups: %1$d
*/
- public static final int sel_groups_fmt=0x7f05027d;
+ public static final int sel_groups_fmt=0x7f05027e;
/** Selected: %1$d
*/
- public static final int sel_items_fmt=0x7f050298;
+ public static final int sel_items_fmt=0x7f050299;
/**
############################################################
# :Dialogs:
@@ -5911,11 +5906,11 @@ XLATE-ME
up when the dicts_item_select menuitem is chosen. The
possible answers are the three button text strings below.
*/
- public static final int set_default_message_fmt=0x7f0500ac;
+ public static final int set_default_message_fmt=0x7f0500ad;
/** XLATE-ME
Hide buttons
*/
- public static final int set_pref=0x7f0502e7;
+ public static final int set_pref=0x7f0502ea;
/** text of separator marking out other-setting area of the dialog
see move_dictf above
@@ -5954,7 +5949,7 @@ XLATE-ME
Other settings
text of separator marking out other-setting area of the dialog
*/
- public static final int settings_label=0x7f0500c4;
+ public static final int settings_label=0x7f0500c5;
/** Checkbox that when set makes taps on the board manipulate an
arrow that then directs where tiles go when tapped in the
tray.
@@ -5966,20 +5961,20 @@ XLATE-ME
arrow that then directs where tiles go when tapped in the
tray.
*/
- public static final int show_arrow=0x7f050140;
+ public static final int show_arrow=0x7f050141;
/** clarification of above
clarification of above
Tapped rack tiles land on this
arrow when it is visible
clarification of above
*/
- public static final int show_arrow_summary=0x7f050141;
+ public static final int show_arrow_summary=0x7f050142;
/** Show downloadable
*/
- public static final int show_remote=0x7f0502c1;
+ public static final int show_remote=0x7f0502c2;
/** Wordlist browser
*/
- public static final int show_wordlist_browser=0x7f050278;
+ public static final int show_wordlist_browser=0x7f050279;
/** If this preference is checked, the user will not be asked to
confirm after selecting the "Turn done" menu (or tapping the
points display at the right end of the tray)
@@ -5991,47 +5986,47 @@ XLATE-ME
confirm after selecting the "Turn done" menu (or tapping the
points display at the right end of the tray)
*/
- public static final int skip_confirm_turn=0x7f050156;
+ public static final int skip_confirm_turn=0x7f050157;
/** explanation of the above
explanation of the above
Do NOT display score
summary after every human turn
explanation of the above
*/
- public static final int skip_confirm_turn_summary=0x7f050157;
+ public static final int skip_confirm_turn_summary=0x7f050158;
/** Delete selected
*/
- public static final int slmenu_clear_sel=0x7f05028e;
+ public static final int slmenu_clear_sel=0x7f05028f;
/** Copy to clipboard
*/
- public static final int slmenu_copy_sel=0x7f05028d;
+ public static final int slmenu_copy_sel=0x7f05028e;
/** Unselect all
*/
- public static final int slmenu_deselect_all=0x7f050297;
+ public static final int slmenu_deselect_all=0x7f050298;
/** Select all
*/
- public static final int slmenu_select_all=0x7f050296;
+ public static final int slmenu_select_all=0x7f050297;
/** XLATE-ME
The version of Crosswords on the
phone with number \"%1$s\" is incompatible with this one for play
using SMS. One of you may need to upgrade before you can
continue.
*/
- public static final int sms_bad_proto_fmt=0x7f050206;
+ public static final int sms_bad_proto_fmt=0x7f050207;
/** Title of phone number picker during invitation to a game via SMS
Title of phone number picker during invitation to a game via SMS
SMS Invitation
*/
- public static final int sms_invite_title=0x7f05020d;
+ public static final int sms_invite_title=0x7f05020e;
/** Tap the receiving device now
*/
- public static final int sms_ready_text=0x7f050285;
+ public static final int sms_ready_text=0x7f050286;
/** Square rack tiles
*/
- public static final int square_tiles=0x7f050275;
+ public static final int square_tiles=0x7f050276;
/** Even if they can be taller
*/
- public static final int square_tiles_summary=0x7f050276;
+ public static final int square_tiles_summary=0x7f050277;
/** Used in formatting moves and history
Used to separate names of players when listing them on one
line in a game summary. The \u0020 is a space in xml.
@@ -6043,7 +6038,7 @@ XLATE-ME
line in a game summary. The \u0020 is a space in xml.
Used in formatting moves and history
*/
- public static final int str_bonus_all=0x7f050118;
+ public static final int str_bonus_all=0x7f050119;
/** Using the hint feature is cheating by some players, and it
can be disabled via the hints_allowed preference. I should
be disabling the buttons in this case, but if I don't and you
@@ -6060,7 +6055,7 @@ XLATE-ME
be disabling the buttons in this case, but if I don't and you
try to get a hint you'll get this message instead.
*/
- public static final int str_cant_hint_while_disabled=0x7f050199;
+ public static final int str_cant_hint_while_disabled=0x7f05019a;
/** Displayed if you try to use the undo menuitem or button and
there are no tiles on the board (no move has yet been made.)
[If I'm being clever and disabling those features in this
@@ -6076,7 +6071,7 @@ XLATE-ME
[If I'm being clever and disabling those features in this
case there may be no way to see this.]
*/
- public static final int str_cant_undo_tileassign=0x7f050198;
+ public static final int str_cant_undo_tileassign=0x7f050199;
/** Beginning of the message presented to a user when asking him
to confirm committing the current turn
Used in formatting reports of trades (exchanges of tiles).
@@ -6097,7 +6092,7 @@ XLATE-ME
Beginning of the message presented to a user when asking him
to confirm committing the current turn
*/
- public static final int str_commit_confirm=0x7f050115;
+ public static final int str_commit_confirm=0x7f050116;
/** Used to format game name plus some other information as the
one-line summary for each game in the main screen. The name
of the game is substituted for %1$s. Something else
@@ -6105,7 +6100,7 @@ XLATE-ME
does not require translation unless the parentheses or
ordering is wrong for your language.
*/
- public static final int str_game_name_fmt=0x7f050088;
+ public static final int str_game_name_fmt=0x7f050089;
/** Displayed when you try to commit a turn that is illegal
because there is empty space between some of the tiles
placed, i.e. they do not form a single word.
@@ -6118,8 +6113,8 @@ XLATE-ME
because there is empty space between some of the tiles
placed, i.e. they do not form a single word.
*/
- public static final int str_no_empties_in_turn=0x7f050191;
- public static final int str_no_hint_found=0x7f05033b;
+ public static final int str_no_empties_in_turn=0x7f050192;
+ public static final int str_no_hint_found=0x7f05033f;
/** Same as above, but used when you try to show tiles belonging
to a player on another device (a remote player.)
Same as above, but used when you try to show tiles belonging
@@ -6129,7 +6124,7 @@ XLATE-ME
Same as above, but used when you try to show tiles belonging
to a player on another device (a remote player.)
*/
- public static final int str_no_peek_remote_tiles=0x7f050196;
+ public static final int str_no_peek_remote_tiles=0x7f050197;
/** Displayed when you try to reveal a robot player's tiles,
either by tapping on its "hidden" rack (marked by "?"
characters) or by tapping on its scoreboard entry. (The
@@ -6151,7 +6146,7 @@ XLATE-ME
controlled by the peek_other preference and is disabled by
default.)
*/
- public static final int str_no_peek_robot_tiles=0x7f050195;
+ public static final int str_no_peek_robot_tiles=0x7f050196;
/** Used, with remote player's name substituted for %1$s, to
indicate that the player is remote.
Used, with remote player's name substituted for %1$s, to
@@ -6160,7 +6155,7 @@ XLATE-ME
Used, with remote player's name substituted for %s, to
indicate that the player is remote.
*/
- public static final int str_nonlocal_name_fmt=0x7f050116;
+ public static final int str_nonlocal_name_fmt=0x7f050117;
/** Displyed when you try to commit a move and it's not your
turn.
Displyed when you try to commit a move and it's not your
@@ -6170,12 +6165,12 @@ XLATE-ME
Displyed when you try to commit a move and it's not your
turn.
*/
- public static final int str_not_your_turn=0x7f050194;
+ public static final int str_not_your_turn=0x7f050195;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
pass\n
*/
- public static final int str_pass=0x7f05010f;
+ public static final int str_pass=0x7f050110;
/** Used to alert user to loss of turn when a move is made and
phonies is set to lose turn when word used not in wordlist
@@ -6187,10 +6182,10 @@ XLATE-ME
phonies is set to lose turn when word used not in wordlist
*/
- public static final int str_phony_rejected=0x7f050114;
+ public static final int str_phony_rejected=0x7f050115;
/** [#%d] %s: %d
*/
- public static final int str_placer_fmt=0x7f050257;
+ public static final int str_placer_fmt=0x7f050258;
/** Shown when using the the Game configure screen to configure a
networked game and you try to make all players local.
Shown when using the the Game configure screen to configure a
@@ -6200,7 +6195,7 @@ XLATE-ME
Shown when using the the Game configure screen to configure a
networked game and you try to make all players local.
*/
- public static final int str_reg_server_sans_remote=0x7f0500d1;
+ public static final int str_reg_server_sans_remote=0x7f0500d2;
/** This error message is shown when a remote device tries to
join a game and is providing more players than that game
expects. I do not believe it is possible to see this message
@@ -6222,17 +6217,17 @@ XLATE-ME
many players are expected and only connects devices where the
numbers match.
*/
- public static final int str_reg_unexpected_user=0x7f05019a;
+ public static final int str_reg_unexpected_user=0x7f05019b;
/** Used in formatting remote player move summaries
Used in formatting remote player move summaries
Remote player %1$s made this
move:\u0020
Used in formatting remote player move summaries
*/
- public static final int str_remote_moved_fmt=0x7f05010d;
+ public static final int str_remote_moved_fmt=0x7f05010e;
/** [Resigned] %s: %d
*/
- public static final int str_resigned_fmt=0x7f050256;
+ public static final int str_resigned_fmt=0x7f050257;
/**
############################################################
# Board info/error dialog messages
@@ -6253,7 +6248,7 @@ XLATE-ME
Notifies user of a normal robot move
The robot %1$s made this move:\u0020
*/
- public static final int str_robot_moved_fmt=0x7f050107;
+ public static final int str_robot_moved_fmt=0x7f050108;
/** Shown when a remote device tries to join a game and wants to
play in a different language. As with the above, this should
be impossible when connecting via the relay.
@@ -6266,7 +6261,7 @@ XLATE-ME
play in a different language. As with the above, this should
be impossible when connecting via the relay.
*/
- public static final int str_server_dict_wins=0x7f05019b;
+ public static final int str_server_dict_wins=0x7f05019c;
/** Displayed when you try to commit a turn that is illegal
because tiles played do not touch other tiles already on the
board (or the middle/star square in the case of the initial
@@ -6283,7 +6278,7 @@ XLATE-ME
board (or the middle/star square in the case of the initial
move.)
*/
- public static final int str_tiles_must_contact=0x7f050193;
+ public static final int str_tiles_must_contact=0x7f050194;
/**
error messages
@@ -6313,7 +6308,7 @@ XLATE-ME
because the tiles placed are not all in the same row or
column.
*/
- public static final int str_tiles_not_in_line=0x7f050190;
+ public static final int str_tiles_not_in_line=0x7f050191;
/** Displayed when you try to begin a trade but there are not
seven or more tiles in the pool. The rules don't allow
trading in this case.
@@ -6326,7 +6321,7 @@ XLATE-ME
seven or more tiles in the pool. The rules don't allow
trading in this case.
*/
- public static final int str_too_few_tiles_left_to_trade=0x7f050197;
+ public static final int str_too_few_tiles_left_to_trade=0x7f050198;
/** Displayed when you try to commit the first move of the game
and are playing a single tile. The first move must include
two or more tiles.
@@ -6339,12 +6334,12 @@ XLATE-ME
and are playing a single tile. The first move must include
two or more tiles.
*/
- public static final int str_two_tiles_first_move=0x7f050192;
+ public static final int str_two_tiles_first_move=0x7f050193;
/** Used in formatting final scores display
Used in formatting final scores display
[Winner] %s: %d
*/
- public static final int str_winner_fmt=0x7f050255;
+ public static final int str_winner_fmt=0x7f050256;
/** Used in formatting game history (not move summaries since
information about the current rack is hidden then)
Used in formatting game history (not move summaries since
@@ -6353,19 +6348,19 @@ XLATE-ME
Used in formatting game history (not move summaries since
information about the current rack is hidden then)
*/
- public static final int strd_cumulative_score_fmt=0x7f05010c;
+ public static final int strd_cumulative_score_fmt=0x7f05010d;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
+ %1$d [all remaining tiles]
Used in formatting game history and move summaries
*/
- public static final int strd_remaining_tiles_add_fmt=0x7f050109;
+ public static final int strd_remaining_tiles_add_fmt=0x7f05010a;
/** I don't know how this is used. :-)
I don't know how this is used. :-)
- %1$d [time]
I don't know how this is used. :-)
*/
- public static final int strd_time_penalty_sub_fmt=0x7f05010e;
+ public static final int strd_time_penalty_sub_fmt=0x7f05010f;
/** Used in formatting moves and history. The total score for
one turn is substituted for %1$d.
Used in formatting moves and history. The total score for
@@ -6374,38 +6369,38 @@ XLATE-ME
Used in formatting moves and history. The total score for
one turn is substituted for %d.
*/
- public static final int strd_turn_score_fmt=0x7f050119;
+ public static final int strd_turn_score_fmt=0x7f05011a;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
- %1$d [unused tiles]
Used in formatting game history and move summaries
*/
- public static final int strd_unused_tiles_sub_fmt=0x7f05010a;
+ public static final int strd_unused_tiles_sub_fmt=0x7f05010b;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
move (from %1$s across)\n
Used in formatting game history and move summaries
*/
- public static final int strs_move_across_fmt=0x7f050110;
+ public static final int strs_move_across_fmt=0x7f050111;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
move (from %1$s down)\n
Used in formatting game history and move summaries
*/
- public static final int strs_move_down_fmt=0x7f050111;
+ public static final int strs_move_down_fmt=0x7f050112;
/** Used in formatting game history and move summaries
Used in formatting remote player move summaries
Used in formatting game history and move summaries
New tiles: %1$s
Used in formatting game history and move summaries
*/
- public static final int strs_new_tiles_fmt=0x7f05010b;
+ public static final int strs_new_tiles_fmt=0x7f05010c;
/** Used in formatting game history and move summaries
Used in formatting game history and move summaries
Rack at start: %1$s\n
Used in formatting game history and move summaries
*/
- public static final int strs_tray_at_start_fmt=0x7f050112;
+ public static final int strs_tray_at_start_fmt=0x7f050113;
/** title for window you get when you select menu with text
board_menu_game_counts
string name="str_robot_moved">El robot ha fet aquesta jugada: O robô fez esta jogada:\u0020 Exchanged %1$s for %2$s.
Used in formatting exchange move summaries
*/
- public static final int strss_traded_for_fmt=0x7f050113;
+ public static final int strss_traded_for_fmt=0x7f050114;
/** Your words for:
*/
- public static final int study_langpick=0x7f050291;
+ public static final int study_langpick=0x7f050292;
/** You have not yet saved any words
into a studylist for %1$s.
*/
- public static final int study_no_lang_fmt=0x7f050292;
+ public static final int study_no_lang_fmt=0x7f050293;
/** You have not yet saved any words
into a studylist.
*/
- public static final int study_no_lists=0x7f050293;
+ public static final int study_no_lists=0x7f050294;
/** Studylist for %1$s
*/
- public static final int studylist_title_fmt=0x7f050290;
+ public static final int studylist_title_fmt=0x7f050291;
/** If substituting an existing same-language wordlist by
choosing button_substdict user gets to choose from a list of
wordlists. This is the title of that list.
@@ -6460,20 +6455,20 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020 Game in play
*/
- public static final int summary_conn=0x7f050201;
+ public static final int summary_conn=0x7f050202;
/**
Game in play with %1$s
*/
- public static final int summary_conn_sms_fmt=0x7f050221;
+ public static final int summary_conn_sms_fmt=0x7f050222;
/** Preference to control what's listed next to game name in the
first line of a game summary in the main games-list screen,
e.g., if the option is "Game Language", "English" in the
@@ -6497,14 +6492,14 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020 Game over\u200C
*/
- public static final int summary_gameover=0x7f050200;
- public static final int summary_invites_out=0x7f05008f;
+ public static final int summary_gameover=0x7f050201;
+ public static final int summary_invites_out=0x7f050090;
/** The display of each networked game includes one of three
states it can be in in the process of connecting to the
relay. These next three strings are used to create those
@@ -6524,7 +6519,7 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020O robô fez esta jogada:\u0020O robô fez esta jogada:\u0020(GSM phones only)
*/
- public static final int summary_send_data_sms=0x7f050306;
+ public static final int summary_send_data_sms=0x7f050309;
/** explanation of the above
explanation of the above
Sort racks whenever new tiles
are added
explanation of the above
*/
- public static final int summary_sort_tiles=0x7f050159;
+ public static final int summary_sort_tiles=0x7f05015a;
/** Offer to add to and display lists
of words to remember
*/
- public static final int summary_studyon=0x7f05028b;
+ public static final int summary_studyon=0x7f05028c;
/** Thumbnail size
*/
- public static final int summary_thumbsize=0x7f05027e;
+ public static final int summary_thumbsize=0x7f05027f;
/**
Unconnected
*/
- public static final int summary_wait_guest=0x7f0501ff;
+ public static final int summary_wait_guest=0x7f050200;
/**
Waiting for connection[s]
@@ -6586,7 +6581,7 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020O robô fez esta jogada:\u0020Disabled
*/
- public static final int thumb_off=0x7f05027f;
+ public static final int thumb_off=0x7f050280;
/** color of the tiles' background
color of the "crosshairs", lines drawn vertically and
horizontally through the square the user is currently
@@ -6609,19 +6604,19 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Tile background
color of the tiles' background
*/
- public static final int tile_back=0x7f05014b;
+ public static final int tile_back=0x7f05014c;
/**
Pick for me
*/
- public static final int tilepick_all=0x7f0501e9;
+ public static final int tilepick_all=0x7f0501ea;
/**
Undo last\u200C
*/
- public static final int tilepick_undo=0x7f0501e8;
+ public static final int tilepick_undo=0x7f0501e9;
/** title of dialog brought up in response to the
board_menu_game_left menu. The dialog lists all tiles
remaining in the pool, i.e. not on the board or in the rack
@@ -6636,14 +6631,14 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Communicate via
*/
- public static final int title_addrs_pref=0x7f0502d6;
+ public static final int title_addrs_pref=0x7f0502d9;
/**
############################################################
# :Screens:
@@ -6672,7 +6667,7 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020O robô fez esta jogada:\u0020%1$s settings (networked)
alternate window title used when game is networked
*/
- public static final int title_gamenet_config_fmt=0x7f0500b4;
+ public static final int title_gamenet_config_fmt=0x7f0500b5;
/** title for popup list of langugages from which user picks
title for popup list of langugages from which user picks
Languages (based on installed
@@ -6710,16 +6705,16 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020 Tap to look up
*/
- public static final int title_lookup=0x7f0501dd;
+ public static final int title_lookup=0x7f0501de;
/** Tap to look up or study
*/
- public static final int title_lookup_study=0x7f0501de;
+ public static final int title_lookup_study=0x7f0501df;
/**
############################################################
# :Screens:
@@ -6760,11 +6755,11 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Send SMS as data
*/
- public static final int title_send_data_sms=0x7f050305;
+ public static final int title_send_data_sms=0x7f050308;
/** If this preference is checked, tiles in the rack will be
re-ordered alphabetically whenever tiles are added,
i.e. after ever move.
@@ -6776,10 +6771,10 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Enable studylists
*/
- public static final int title_studyon=0x7f05028a;
+ public static final int title_studyon=0x7f05028b;
/** title of dialog allowing user to pick tiles "face up". (This
feature is not yet supported on Android.)
@@ -6883,16 +6878,16 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Updates are available for one or more
installed wordlists. Would you like to download the new
version[s] of %1$s now?
*/
- public static final int update_dicts_fmt=0x7f0502c2;
+ public static final int update_dicts_fmt=0x7f0502c3;
/** XLATE-ME
Use defaults
*/
- public static final int use_defaults=0x7f0502dd;
+ public static final int use_defaults=0x7f0502e0;
/** text of checkbox controlling whether there's a game timer
text of checkbox. If this checkbox is checked, games created
for network play will by default have the hint feature
@@ -6901,47 +6896,47 @@ string name="str_robot_moved">O robô fez esta jogada:\u0020Enable game timer
text of checkbox controlling whether there's a game timer
*/
- public static final int use_timer=0x7f0500c7;
+ public static final int use_timer=0x7f0500c8;
/** Used to separate names of players when listing them on one
line in a game summary. The \u0020 is a space in xml.
Used to separate names of players when listing them on one
line in a game summary. The \u0020 is a space in xml.
\u0020vs.\u0020
*/
- public static final int vs_join=0x7f050117;
+ public static final int vs_join=0x7f050118;
/** Button for alert with title above
*/
- public static final int waiting_invite_title=0x7f0502ea;
- public static final int waiting_rematch_title=0x7f0502eb;
+ public static final int waiting_invite_title=0x7f0502ed;
+ public static final int waiting_rematch_title=0x7f0502ee;
/** XLATE-ME
Waiting for players
*/
- public static final int waiting_title=0x7f0502e9;
+ public static final int waiting_title=0x7f0502ec;
/** XLATE-ME
Bluetooth is currently off on this
device. No moves will be sent via Bluetooth.\n\nYou can enable
Bluetooth now, or later.
*/
- public static final int warn_bt_disabled=0x7f050245;
+ public static final int warn_bt_disabled=0x7f050246;
/** XLATE-ME
Every networked game must have at
least one way of communicating. If you have no default connection
options every new networked game will have to be configured
manually.
*/
- public static final int warn_no_comms=0x7f0502f0;
+ public static final int warn_no_comms=0x7f0502f3;
/**
The number %1$s for %2$s is not
a \"mobile\" number. Import anyway?
*/
- public static final int warn_nomobile_fmt=0x7f050219;
- public static final int warn_relay_disabled=0x7f050246;
- public static final int warn_relay_havegames=0x7f050249;
- public static final int warn_relay_later=0x7f050247;
- public static final int warn_relay_remove=0x7f050248;
+ public static final int warn_nomobile_fmt=0x7f05021a;
+ public static final int warn_relay_disabled=0x7f050247;
+ public static final int warn_relay_havegames=0x7f05024a;
+ public static final int warn_relay_later=0x7f050248;
+ public static final int warn_relay_remove=0x7f050249;
/**
Play via SMS is currently
@@ -6954,31 +6949,31 @@ activer les parties par SMS, allez dans Paramètres->Paramètres des parties en
réseau.)
*/
- public static final int warn_sms_disabled=0x7f050244;
+ public static final int warn_sms_disabled=0x7f050245;
/**
Are you certain this number is on an
account with unlimited texting? Click cancel if you are not.
*/
- public static final int warn_unlimited=0x7f050222;
- public static final int wifi_warning=0x7f050334;
+ public static final int warn_unlimited=0x7f050223;
+ public static final int wifi_warning=0x7f050338;
/**
First letters
*/
- public static final int word_search_hint=0x7f0501e7;
+ public static final int word_search_hint=0x7f0501e8;
/** Add option to every screen menu
*/
- public static final int xlations_enabled_summary=0x7f05029d;
+ public static final int xlations_enabled_summary=0x7f05029e;
/** Enable local translating
*/
- public static final int xlations_enabled_title=0x7f05029c;
+ public static final int xlations_enabled_title=0x7f05029d;
/** XLATE-ME
Fake locale for translation
*/
- public static final int xlations_locale=0x7f050312;
+ public static final int xlations_locale=0x7f050315;
/** Empty in English, this should contain the name of the
translator/creator of the strings.xml file for this
language
@@ -6992,8 +6987,8 @@ réseau.)
translator/creator of the strings.xml file for this
language
*/
- public static final int xlator=0x7f0501d5;
- public static final int xwords_nfc_mime=0x7f05007d;
+ public static final int xlator=0x7f0501d6;
+ public static final int xwords_nfc_mime=0x7f05007e;
}
public static final class style {
public static final int about_items=0x7f090005;
diff --git a/xwords4/android/XWords4/assets/changes.html b/xwords4/android/XWords4/assets/changes.html
index cace9b2c8..452f4e4c0 100644
--- a/xwords4/android/XWords4/assets/changes.html
+++ b/xwords4/android/XWords4/assets/changes.html
@@ -13,10 +13,10 @@
- Crosswords 4.4.107 release
+ Crosswords 4.4.108 release
- This version, for F-droid release only, fixes build problems that
- caused a number of crashes and other issues.
+ This release fixes a nasty bug in invitations on older Android
+ and improves in-game chat functionality.
Please take
@@ -26,7 +26,18 @@
New with this release
- Force release builds to be done with ant rather than gradle
+ Fix problem with invitations on older Android versions
+ (e.g. 4.2 and 4.3)
+
+ Chat fixes: send without closing the window, expand for
+ longer messages, smart editing, etc.
+
+ Fix so Bluetooth finds tablets as well as phones
+
+ Add ability to disable relay play (to save battery for users
+ who play standalone only)
+
+ Improvements to French and Japanese translations
(The full changelog
@@ -34,8 +45,8 @@
Next up
- More chat improvements, especially allowing to send and
- receive without closing the chat window
+ Working on dual-pane mode (so e.g. board and chat can be
+ side-by-side on tablets)
Take advantage of Marshmallow's new permissions model (where
the app only asks for them when it needs them.)
diff --git a/xwords4/android/XWords4/build.gradle b/xwords4/android/XWords4/build.gradle
index bc13a3dc6..dda53eecf 100644
--- a/xwords4/android/XWords4/build.gradle
+++ b/xwords4/android/XWords4/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.1.0'
+ classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/xwords4/android/XWords4/build.xml b/xwords4/android/XWords4/build.xml
index 4611718c1..d04aea9f4 100644
--- a/xwords4/android/XWords4/build.xml
+++ b/xwords4/android/XWords4/build.xml
@@ -58,12 +58,13 @@
+
-
+
diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk
index f33d7dd9b..c88334119 100644
--- a/xwords4/android/XWords4/jni/Android.mk
+++ b/xwords4/android/XWords4/jni/Android.mk
@@ -38,6 +38,7 @@ LOCAL_DEFINES += \
-DHASH_STREAM \
-DXWFEATURE_BASE64 \
-DXWFEATURE_DEVID \
+ -DXWFEATURE_CHAT \
-DCOMMON_LAYOUT \
-DNATIVE_NLI \
-DCOMMS_VERSION=1 \
@@ -46,10 +47,6 @@ LOCAL_DEFINES += \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \
-ifeq ($(CHAT_ENABLED),true)
- LOCAL_DEFINES += -DXWFEATURE_CHAT
-endif
-
# -DXWFEATURE_SCOREONEPASS \
LOCAL_SRC_FILES += \
diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c
index 87f8c8596..09365a86c 100644
--- a/xwords4/android/XWords4/jni/xwjni.c
+++ b/xwords4/android/XWords4/jni/xwjni.c
@@ -62,6 +62,8 @@ typedef struct _JNIGlobalState {
MPSLOT
} JNIGlobalState;
+// #define LOG_MAPPING
+
#define GAMEPTR_IS_OBJECT
#ifdef GAMEPTR_IS_OBJECT
typedef jobject GamePtrType;
@@ -69,6 +71,22 @@ typedef jobject GamePtrType;
typedef int GamePtrType;
#endif
+#ifdef LOG_MAPPING
+static int
+countUsed(const EnvThreadInfo* ti)
+{
+ int count = 0;
+ for ( int ii = 0; ii < ti->nEntries; ++ii ) {
+ EnvThreadEntry* entry = &ti->entries[ii];
+ if ( 0 != entry->owner ) {
+ XP_LOGF( "%s(): ii=%d; owner: %x", __func__, ii, (unsigned int)entry->owner );
+ ++count;
+ }
+ }
+ return count;
+}
+#endif
+
static void
map_thread( EnvThreadInfo* ti, JNIEnv* env )
{
@@ -100,17 +118,20 @@ map_thread( EnvThreadInfo* ti, JNIEnv* env )
if ( !firstEmpty ) { /* out of slots */
if ( 0 == nEntries ) { /* first time */
nEntries = 2;
- ti->entries =
- XP_MALLOC( ti->mpool, nEntries * sizeof(*ti->entries) );
+ XP_ASSERT( !ti->entries );
} else {
nEntries *= 2;
- ti->entries = XP_REALLOC( ti->mpool, ti->entries,
- nEntries * sizeof(*ti->entries) );
}
- // XP_LOGF( "%s: num env entries now %d", __func__, nEntries );
- firstEmpty = &ti->entries[ti->nEntries]; /* first new entry */
- XP_MEMSET( firstEmpty, 0, nEntries - ti->nEntries );
+ EnvThreadEntry* entries = XP_CALLOC( ti->mpool, nEntries * sizeof(*entries) );
+ if ( !!ti->entries ) {
+ XP_MEMCPY( entries, ti->entries, ti->nEntries * sizeof(*ti->entries) );
+ }
+ firstEmpty = &entries[ti->nEntries]; /* first new entry */
+ ti->entries = entries;
ti->nEntries = nEntries;
+#ifdef LOG_MAPPING
+ XP_LOGF( "%s: num env entries now %d", __func__, nEntries );
+#endif
}
XP_ASSERT( !!firstEmpty );
@@ -119,6 +140,7 @@ map_thread( EnvThreadInfo* ti, JNIEnv* env )
#ifdef LOG_MAPPING
XP_LOGF( "%s: entry %d: mapped env %p to thread %x", __func__,
firstEmpty - ti->entries, env, (int)self );
+ XP_LOGF( "%s: num entries USED now %d", __func__, countUsed(ti) );
#endif
}
@@ -150,6 +172,9 @@ map_remove( EnvThreadInfo* ti, JNIEnv* env )
#endif
ti->entries[ii].env = NULL;
ti->entries[ii].owner = 0;
+#ifdef LOG_MAPPING
+ XP_LOGF( "%s: %d entries left", __func__, countUsed( ti ) );
+#endif
}
}
pthread_mutex_unlock( &ti->mtxThreads );
@@ -1261,6 +1286,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1do
{
jboolean result;
XWJNI_START();
+ XP_ASSERT( !!state->game.server );
result = server_do( state->game.server );
XWJNI_END();
return result;
diff --git a/xwords4/android/XWords4/res/.gitignore b/xwords4/android/XWords4/res/.gitignore
new file mode 100644
index 000000000..1e3315a64
--- /dev/null
+++ b/xwords4/android/XWords4/res/.gitignore
@@ -0,0 +1 @@
+values-??/strings.xml
diff --git a/xwords4/android/XWords4/res/layout/chat.xml b/xwords4/android/XWords4/res/layout/chat.xml
index 269bc4d2c..1e79e298c 100644
--- a/xwords4/android/XWords4/res/layout/chat.xml
+++ b/xwords4/android/XWords4/res/layout/chat.xml
@@ -21,14 +21,26 @@
-
+
+
+
diff --git a/xwords4/android/XWords4/res/layout/fragact.xml b/xwords4/android/XWords4/res/layout/dualcontainer.xml
similarity index 100%
rename from xwords4/android/XWords4/res/layout/fragact.xml
rename to xwords4/android/XWords4/res/layout/dualcontainer.xml
diff --git a/xwords4/android/XWords4/res/values-ca/.gitignore b/xwords4/android/XWords4/res/values-ca/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-ca/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-cs/.gitignore b/xwords4/android/XWords4/res/values-cs/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-cs/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-fr/.gitignore b/xwords4/android/XWords4/res/values-fr/.gitignore
deleted file mode 100644
index aa5ea40dd..000000000
--- a/xwords4/android/XWords4/res/values-fr/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/strings.xml
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-ja/.gitignore b/xwords4/android/XWords4/res/values-ja/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-ja/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-nl/.gitignore b/xwords4/android/XWords4/res/values-nl/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-nl/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-pt/.gitignore b/xwords4/android/XWords4/res/values-pt/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-pt/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values-sk/.gitignore b/xwords4/android/XWords4/res/values-sk/.gitignore
deleted file mode 100644
index be5186f01..000000000
--- a/xwords4/android/XWords4/res/values-sk/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-strings.xml
diff --git a/xwords4/android/XWords4/res/values/app_name.xml b/xwords4/android/XWords4/res/values/app_name.xml
index 43c5bb3dc..6197ce619 100644
--- a/xwords4/android/XWords4/res/values/app_name.xml
+++ b/xwords4/android/XWords4/res/values/app_name.xml
@@ -1,5 +1,5 @@
- 4.4.107
+ 4.4.108
diff --git a/xwords4/android/XWords4/res/values/common_rsrc.xml b/xwords4/android/XWords4/res/values/common_rsrc.xml
index 799cd128c..856e6a1e9 100644
--- a/xwords4/android/XWords4/res/values/common_rsrc.xml
+++ b/xwords4/android/XWords4/res/values/common_rsrc.xml
@@ -67,7 +67,7 @@
key_summary_field
key_default_loc
key_force_tablet
-
+ key_enable_dualpane
key_force_radio
key_addrs_pref
diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml
index c9391da51..ac6b7aa4b 100644
--- a/xwords4/android/XWords4/res/values/strings.xml
+++ b/xwords4/android/XWords4/res/values/strings.xml
@@ -1095,7 +1095,8 @@
tapping. -->
Disable crosshairs
- Do not visually indicate which board cell is touched
+ Do not show which board
+ cell is touched
Network game settings
@@ -2396,8 +2397,8 @@
Force tablet layout
Even if my screen is too small
-
-
+ Enable dualpane
+ Side-by-side views, very experimental!
Reminder: It\'s your turn
@@ -2596,7 +2597,7 @@
Relay Stuff
Prefs related to play via internet/relay
Localization Stuff
-
+ Tablets Stuff
Prefs related to in-app localization
Update between releases
Get intermediate builds
diff --git a/xwords4/android/XWords4/res/xml/xwprefs.xml b/xwords4/android/XWords4/res/xml/xwprefs.xml
index d17f02828..626ede216 100644
--- a/xwords4/android/XWords4/res/xml/xwprefs.xml
+++ b/xwords4/android/XWords4/res/xml/xwprefs.xml
@@ -423,19 +423,19 @@
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
Elbasid sriahssorc
- Od ton yllausiv etacidni hcihw draob llec si dehcuot
+ Od ton wohs hcihw draob
+ llec si dehcuot
Krowten emag sgnittes
Sgnittes taht ylppa ot
@@ -2057,8 +2058,8 @@
tahw\'s elbaliava.
Ecrof telbat tuoyal
Neve fi ym neercs si oot llams
-
-
+ Elbane enaplaud
+ Edis-yb-edis ,sweiv yrev !latnemirepxe
Rednimer: Ti\'s ruoy nrut
+ Stelbat Ffuts
Sferp detaler ot ppa-ni noitazilacol
Etadpu neewteb sesaeler
Teg etaidemretni sdliub
diff --git a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
index 9d4895b01..0d8b9bea5 100644
--- a/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
+++ b/xwords4/android/XWords4/res_src/values-ca_PS/strings.xml
@@ -943,7 +943,8 @@
tapping. -->
DISABLE CROSSHAIRS
- DO NOT VISUALLY INDICATE WHICH BOARD CELL IS TOUCHED
+ DO NOT SHOW WHICH BOARD
+ CELL IS TOUCHED
NETWORK GAME SETTINGS
SETTINGS THAT APPLY TO
@@ -2057,8 +2058,8 @@
WHAT\'S AVAILABLE.
FORCE TABLET LAYOUT
EVEN IF MY SCREEN IS TOO SMALL
-
-
+ ENABLE DUALPANE
+ SIDE-BY-SIDE VIEWS, VERY EXPERIMENTAL!
REMINDER: IT\'S YOUR TURN
+ TABLETS STUFF
PREFS RELATED TO IN-APP LOCALIZATION
UPDATE BETWEEN RELEASES
GET INTERMEDIATE BUILDS
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java
index 7e193a846..500b25667 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ABUtils.java
@@ -25,13 +25,13 @@ import android.content.Context;
import android.view.ViewConfiguration;
public class ABUtils {
- private static int s_sdkVersion =
+ private static int s_sdkVersion =
Integer.valueOf( android.os.Build.VERSION.SDK );
private static interface SafeInvalOptionsMenu {
public void doInval( Activity activity );
}
- private static class SafeInvalOptionsMenuImpl
+ private static class SafeInvalOptionsMenuImpl
implements SafeInvalOptionsMenu {
public void doInval( Activity activity ) {
activity.invalidateOptionsMenu();
@@ -42,7 +42,7 @@ public class ABUtils {
private static interface SafeHasMenuKey {
public boolean hasMenuKey( Context context );
}
- private static class SafeHasMenuKeyImpl
+ private static class SafeHasMenuKeyImpl
implements SafeHasMenuKey {
public boolean hasMenuKey( Context context )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java
index 4b3d16e9b..b83589a5b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTInviteDelegate.java
@@ -84,9 +84,9 @@ public class BTInviteDelegate extends InviteDelegate {
m_counts = new HashMap();
String msg = getString( R.string.bt_pick_addall_button );
- msg = getQuantityString( R.plurals.invite_bt_desc_fmt, m_nMissing,
+ msg = getQuantityString( R.plurals.invite_bt_desc_fmt, m_nMissing,
m_nMissing, msg );
- super.init( R.id.button_invite, R.id.button_rescan,
+ super.init( R.id.button_invite, R.id.button_rescan,
R.id.button_clear, R.id.invite_desc, msg );
BTService.clearDevices( m_activity, null ); // will return names
}
@@ -134,7 +134,7 @@ public class BTInviteDelegate extends InviteDelegate {
if ( 0 < count ) {
BTService.scan( m_activity );
} else {
- showConfirmThen( R.string.bt_no_devs, R.string.button_go_settings,
+ showConfirmThen( R.string.bt_no_devs, R.string.button_go_settings,
Action.OPEN_BT_PREFS_ACTION );
}
}
@@ -171,7 +171,7 @@ public class BTInviteDelegate extends InviteDelegate {
}
}
- protected void tryEnable()
+ protected void tryEnable()
{
String[][] devs = new String[1][];
int[][] counts = new int[1][];
@@ -210,7 +210,7 @@ public class BTInviteDelegate extends InviteDelegate {
if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
Spinner spinner = (Spinner)
layout.findViewById(R.id.nperdev_spinner);
- ArrayAdapter adapter =
+ ArrayAdapter adapter =
new ArrayAdapter( m_activity, android.R.layout
.simple_spinner_item );
for ( int ii = 1; ii <= m_nMissing; ++ii ) {
@@ -220,8 +220,8 @@ public class BTInviteDelegate extends InviteDelegate {
spinner.setAdapter( adapter );
spinner.setVisibility( View.VISIBLE );
spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
- public void onItemSelected( AdapterView> parent,
- View view, int pos,
+ public void onItemSelected( AdapterView> parent,
+ View view, int pos,
long id )
{
m_counts.put( btAddr, 1 + pos );
@@ -232,9 +232,9 @@ public class BTInviteDelegate extends InviteDelegate {
} );
}
- CompoundButton.OnCheckedChangeListener listener =
+ CompoundButton.OnCheckedChangeListener listener =
new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean isChecked ) {
if ( isChecked ) {
m_checked.add( layout );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTReceiver.java
index 5f2d5157a..645cd34d0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTReceiver.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTReceiver.java
@@ -39,7 +39,7 @@ public class BTReceiver extends BroadcastReceiver {
if ( action.equals( BluetoothDevice.ACTION_ACL_CONNECTED ) ) {
BTService.startService( context );
} else if ( action.equals( BluetoothAdapter.ACTION_STATE_CHANGED ) ) {
- int newState =
+ int newState =
intent.getIntExtra( BluetoothAdapter.EXTRA_STATE, -1 );
switch ( newState ) {
case BluetoothAdapter.STATE_OFF:
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java
index fcc30c6a1..5a1ffacc8 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java
@@ -53,7 +53,6 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CommsAddrRec;
import org.eehouse.android.xw4.jni.LastMoveInfo;
import org.eehouse.android.xw4.jni.XwJNI;
-import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.XWService.ReceiveResult;
@@ -98,7 +97,7 @@ public class BTService extends XWService {
private static final String BT_NAME_KEY = "BT_NAME";
private static final String BT_ADDRESS_KEY = "BT_ADDRESS";
- private enum BTCmd {
+ private enum BTCmd {
BAD_PROTO,
PING,
PONG,
@@ -135,7 +134,7 @@ public class BTService extends XWService {
public BTQueueElem( BTCmd cmd, byte[] buf, String btAddr, int gameID ) {
this( cmd );
Assert.assertTrue( null != btAddr && 0 < btAddr.length() );
- m_msg = buf; m_btAddr = btAddr;
+ m_msg = buf; m_btAddr = btAddr;
m_gameID = gameID;
checkAddr();
}
@@ -194,7 +193,7 @@ public class BTService extends XWService {
public static String[] getBTNameAndAddress()
{
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- return null == adapter ? null
+ return null == adapter ? null
: new String[] { adapter.getName(), adapter.getAddress() };
}
@@ -213,7 +212,7 @@ public class BTService extends XWService {
{
Intent intent = new Intent();
intent.setAction( android.provider.Settings.ACTION_BLUETOOTH_SETTINGS );
- activity.startActivity( intent );
+ activity.startActivity( intent );
}
public static String nameForAddr( String btAddr )
@@ -265,9 +264,9 @@ public class BTService extends XWService {
intent.putExtra( ADDR_KEY, hostAddr );
intent.putExtra( GAMEID_KEY, gameID );
context.startService( intent );
- }
+ }
- public static void inviteRemote( Context context, String btAddr,
+ public static void inviteRemote( Context context, String btAddr,
NetLaunchInfo nli )
{
Assert.assertTrue( null != btAddr && 0 < btAddr.length() );
@@ -292,7 +291,7 @@ public class BTService extends XWService {
context.startService( intent );
}
- public static int enqueueFor( Context context, byte[] buf,
+ public static int enqueueFor( Context context, byte[] buf,
CommsAddrRec targetAddr, int gameID )
{
int nSent = -1;
@@ -313,7 +312,7 @@ public class BTService extends XWService {
}
return nSent;
}
-
+
public static void gameDied( Context context, int gameID )
{
Intent intent = getIntentTo( context, BTAction.REMOVE );
@@ -335,7 +334,7 @@ public class BTService extends XWService {
? BluetoothAdapter.getDefaultAdapter() : null;
if ( null != adapter && adapter.isEnabled() ) {
m_adapter = adapter;
- DbgUtils.logf( "BTService.onCreate(); bt name = %s; bt addr = %s",
+ DbgUtils.logf( "BTService.onCreate(); bt name = %s; bt addr = %s",
adapter.getName(), adapter.getAddress() );
initAddrs();
startListener();
@@ -390,7 +389,7 @@ public class BTService extends XWService {
int nPlayersT = intent.getIntExtra( NTO_KEY, -1 );
String btName = intent.getStringExtra( BT_NAME_KEY );
btAddr = intent.getStringExtra( BT_ADDRESS_KEY );
- // /*(void)*/makeOrNotify( this, gameID, null, lang, dict,
+ // /*(void)*/makeOrNotify( this, gameID, null, lang, dict,
// nPlayersT, 1, btName, btAddr );
Assert.fail();
break;
@@ -400,7 +399,7 @@ public class BTService extends XWService {
btAddr = intent.getStringExtra( ADDR_KEY );
gameID = intent.getIntExtra( GAMEID_KEY, -1 );
if ( -1 != gameID ) {
- m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf,
+ m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf,
btAddr, gameID ) );
}
break;
@@ -414,7 +413,7 @@ public class BTService extends XWService {
false );
} else {
ConnStatusHandler.updateStatus( this, null,
- CommsConnType.COMMS_CONN_BT,
+ CommsConnType.COMMS_CONN_BT,
false );
stopListener();
stopSender();
@@ -454,7 +453,7 @@ public class BTService extends XWService {
try {
BluetoothSocket socket = m_serverSocket.accept(); // blocks
addAddr( socket );
- DataInputStream inStream =
+ DataInputStream inStream =
new DataInputStream( socket.getInputStream() );
byte proto = inStream.readByte();
@@ -477,7 +476,7 @@ public class BTService extends XWService {
}
updateStatusIn( true );
} else {
- DataOutputStream os =
+ DataOutputStream os =
new DataOutputStream( socket.getOutputStream() );
os.writeByte( BTCmd.BAD_PROTO.ordinal() );
os.flush();
@@ -575,16 +574,16 @@ public class BTService extends XWService {
BluetoothDevice host = socket.getRemoteDevice();
addAddr( host );
- CommsAddrRec addr = new CommsAddrRec( host.getName(),
+ CommsAddrRec addr = new CommsAddrRec( host.getName(),
host.getAddress() );
ReceiveResult rslt
- = BTService.this.receiveMessage( BTService.this, gameID,
+ = BTService.this.receiveMessage( BTService.this, gameID,
m_btMsgSink, buffer, addr );
- BTCmd result = rslt == ReceiveResult.GAME_GONE ?
+ BTCmd result = rslt == ReceiveResult.GAME_GONE ?
BTCmd.MESG_GAMEGONE : BTCmd.MESG_ACCPT;
- DataOutputStream os =
+ DataOutputStream os =
new DataOutputStream( socket.getOutputStream() );
os.writeByte( result.ordinal() );
os.flush();
@@ -767,7 +766,7 @@ public class BTService extends XWService {
os.flush();
Thread killer = killSocketIn( socket, 5 );
- DataInputStream is =
+ DataInputStream is =
new DataInputStream( socket.getInputStream() );
BTCmd reply = BTCmd.values()[is.readByte()];
if ( BTCmd.BAD_PROTO == reply ) {
@@ -804,9 +803,9 @@ public class BTService extends XWService {
private void sendInvite( BTQueueElem elem )
{
try {
- BluetoothDevice dev =
+ BluetoothDevice dev =
m_adapter.getRemoteDevice( elem.m_btAddr );
- BluetoothSocket socket =
+ BluetoothSocket socket =
dev.createRfcommSocketToServiceRecord( XWApp.getAppUUID() );
if ( null != socket ) {
BTCmd reply = null;
@@ -822,7 +821,7 @@ public class BTService extends XWService {
DbgUtils.logf( "sending invite for %d players", elem.m_nPlayersH );
outStream.flush();
- DataInputStream inStream =
+ DataInputStream inStream =
new DataInputStream( socket.getInputStream() );
reply = BTCmd.values()[inStream.readByte()];
}
@@ -862,19 +861,19 @@ public class BTService extends XWService {
MultiEvent evt;
if ( success ) {
evt = MultiEvent.MESSAGE_DROPPED;
- DbgUtils.logf( "BTService.sendMsg: dropping message %s because game %X dead",
+ DbgUtils.logf( "BTService.sendMsg: dropping message %s because game %X dead",
elem.m_cmd, elem.m_gameID );
} else {
evt = MultiEvent.MESSAGE_REFUSED;
}
if ( !success ) {
try {
- BluetoothDevice dev =
+ BluetoothDevice dev =
m_adapter.getRemoteDevice( elem.m_btAddr );
BluetoothSocket socket = dev.
createRfcommSocketToServiceRecord( XWApp.getAppUUID() );
if ( null != socket ) {
- DataOutputStream outStream =
+ DataOutputStream outStream =
connect( socket, BTCmd.MESG_SEND );
if ( null != outStream ) {
outStream.writeInt( elem.m_gameID );
@@ -886,7 +885,7 @@ public class BTService extends XWService {
outStream.flush();
Thread killer = killSocketIn( socket );
- DataInputStream inStream =
+ DataInputStream inStream =
new DataInputStream( socket.getInputStream() );
BTCmd reply = BTCmd.values()[inStream.readByte()];
killer.interrupt();
@@ -942,7 +941,7 @@ public class BTService extends XWService {
iter.remove();
}
}
-
+
}
return success;
}
@@ -1073,7 +1072,7 @@ public class BTService extends XWService {
m_sender = null;
}
- private BTCmd makeOrNotify( NetLaunchInfo nli, String btName,
+ private BTCmd makeOrNotify( NetLaunchInfo nli, String btName,
String btAddr )
{
BTCmd result;
@@ -1082,27 +1081,27 @@ public class BTService extends XWService {
result = makeGame( nli, btName, btAddr );
} else {
Intent intent = MultiService
- .makeMissingDictIntent( this, nli,
+ .makeMissingDictIntent( this, nli,
DictFetchOwner.OWNER_BT );
// NetLaunchInfo.putExtras( intent, gameID, btName, btAddr );
- MultiService.postMissingDictNotification( this, intent,
+ MultiService.postMissingDictNotification( this, intent,
nli.gameID() );
result = BTCmd.INVITE_ACCPT; // ???
}
} else {
- result = BTCmd.INVITE_DUP_INVITE; // dupe of rematch
+ result = BTCmd.INVITE_DUP_INVITE; // dupe of rematch
}
return result;
}
- private BTCmd makeGame( NetLaunchInfo nli, String sender,
+ private BTCmd makeGame( NetLaunchInfo nli, String sender,
String senderAddress )
{
BTCmd result;
long[] rowids = DBUtils.getRowIDsFor( BTService.this, nli.gameID() );
if ( null == rowids || 0 == rowids.length ) {
CommsAddrRec addr = nli.makeAddrRec( BTService.this );
- long rowid = GameUtils.makeNewMultiGame( BTService.this, nli,
+ long rowid = GameUtils.makeNewMultiGame( BTService.this, nli,
m_btMsgSink,
getUtilCtxt() );
if ( DBUtils.ROWID_NOTFOUND == rowid ) {
@@ -1112,11 +1111,11 @@ public class BTService extends XWService {
DBUtils.setName( BTService.this, rowid, nli.gameName );
}
result = BTCmd.INVITE_ACCPT;
- String body = LocUtils.getString( BTService.this,
- R.string.new_bt_body_fmt,
+ String body = LocUtils.getString( BTService.this,
+ R.string.new_bt_body_fmt,
sender );
- GameUtils.postInvitedNotification( this, nli.gameID(), body,
+ GameUtils.postInvitedNotification( this, nli.gameID(), body,
rowid );
sendResult( MultiEvent.BT_GAME_CREATED, rowid );
@@ -1133,9 +1132,9 @@ public class BTService extends XWService {
// DbgUtils.logf( "connecting to %s to send cmd %s", name, cmd.toString() );
// Docs say always call cancelDiscovery before trying to connect
m_adapter.cancelDiscovery();
-
+
DataOutputStream dos;
- try {
+ try {
socket.connect();
dos = new DataOutputStream( socket.getOutputStream() );
dos.writeByte( BT_PROTO );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java
index 4231d73f1..81d6c39a9 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java
@@ -34,13 +34,13 @@ public class BoardActivity extends XWActivity {
private BoardDelegate m_dlgt;
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
if ( CommonPrefs.getHideTitleBar( this )
&& ABUtils.haveMenuKey( this ) ) {
requestWindowFeature( Window.FEATURE_NO_TITLE );
}
-
+
m_dlgt = new BoardDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
index 0a08a8308..770de3b3e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardCanvas.java
@@ -136,7 +136,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
this( activity, activity, bitmap, jniThread, dims );
}
- private BoardCanvas( Context context, Activity activity, Bitmap bitmap,
+ private BoardCanvas( Context context, Activity activity, Bitmap bitmap,
JNIThread jniThread, BoardDims dims )
{
super( bitmap );
@@ -193,12 +193,12 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return m_trayOwner;
}
- public int curPending()
+ public int curPending()
{
return m_pendingScore;
}
- public void setInTrade( boolean inTrade )
+ public void setInTrade( boolean inTrade )
{
if ( m_inTrade != inTrade ) {
m_inTrade = inTrade;
@@ -207,7 +207,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
// DrawCtxt interface implementation
- public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
+ public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
int remCount )
{
fillRectOther( rect, CommonPrefs.COLOR_BACKGRND );
@@ -215,15 +215,15 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return true;
}
- public boolean measureRemText( Rect r, int nTilesLeft, int[] width,
- int[] height )
+ public boolean measureRemText( Rect r, int nTilesLeft, int[] width,
+ int[] height )
{
boolean showREM = 0 <= nTilesLeft;
if ( showREM ) {
// should cache a formatter
m_remText = String.format( "%d", nTilesLeft );
m_fillPaint.setTextSize( m_mediumFontHt );
- m_fillPaint.getTextBounds( m_remText, 0, m_remText.length(),
+ m_fillPaint.getTextBounds( m_remText, 0, m_remText.length(),
m_boundsScratch );
int minWidth = m_boundsScratch.width();
@@ -236,7 +236,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
return showREM;
}
- public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
+ public void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft,
boolean focussed )
{
int indx = focussed ? CommonPrefs.COLOR_FOCUS
@@ -247,7 +247,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
drawCentered( m_remText, rInner, null );
}
- public void measureScoreText( Rect rect, DrawScoreInfo dsi,
+ public void measureScoreText( Rect rect, DrawScoreInfo dsi,
int[] width, int[] height )
{
String[] scoreInfo = new String[dsi.isTurn?1:2];
@@ -283,7 +283,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
int needWidth = 0;
for ( int ii = 0; ii < scoreInfo.length; ++ii ) {
- m_fillPaint.getTextBounds( scoreInfo[ii], 0, scoreInfo[ii].length(),
+ m_fillPaint.getTextBounds( scoreInfo[ii], 0, scoreInfo[ii].length(),
m_boundsScratch );
if ( needWidth < m_boundsScratch.width() ) {
needWidth = m_boundsScratch.width();
@@ -297,7 +297,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
height[0] = rect.height();
}
- public void score_drawPlayer( Rect rInner, Rect rOuter,
+ public void score_drawPlayer( Rect rInner, Rect rOuter,
int gotPct, DrawScoreInfo dsi )
{
if ( 0 != (dsi.flags & CELL_ISCURSOR) ) {
@@ -332,7 +332,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
String negSign = secondsLeft < 0? "-":"";
secondsLeft = Math.abs( secondsLeft );
- String time = String.format( "%s%d:%02d", negSign, secondsLeft/60,
+ String time = String.format( "%s%d:%02d", negSign, secondsLeft/60,
secondsLeft%60 );
fillRectOther( rect, CommonPrefs.COLOR_BACKGRND );
@@ -352,8 +352,8 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
public boolean drawCell( final Rect rect, String text, int tile, int value,
- int owner, int bonus, int hintAtts,
- final int flags )
+ int owner, int bonus, int hintAtts,
+ final int flags )
{
boolean canDraw = figureFontDims();
if ( canDraw ) {
@@ -425,7 +425,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} // drawCell
private boolean m_arrowHintShown = false;
- public void drawBoardArrow( Rect rect, int bonus, boolean vert,
+ public void drawBoardArrow( Rect rect, int bonus, boolean vert,
int hintAtts, int flags )
{
// figure out if the background is more dark than light
@@ -458,7 +458,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
// handler.post( new Runnable() {
// public void run() {
// m_parent.
- // showNotAgainDlgThen( R.string.not_again_arrow,
+ // showNotAgainDlgThen( R.string.not_again_arrow,
// R.string.
// key_notagain_arrow );
// } } );
@@ -466,30 +466,30 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
- public boolean trayBegin( Rect rect, int owner, int score )
+ public boolean trayBegin( Rect rect, int owner, int score )
{
m_trayOwner = owner;
m_pendingScore = score;
return true;
}
- public boolean drawTile( Rect rect, String text, int val, int flags )
+ public boolean drawTile( Rect rect, String text, int val, int flags )
{
return drawTileImpl( rect, text, val, flags, true );
}
- public boolean drawTileMidDrag( Rect rect, String text, int val, int owner,
- int flags )
+ public boolean drawTileMidDrag( Rect rect, String text, int val, int owner,
+ int flags )
{
return drawTileImpl( rect, text, val, flags, false );
}
- public boolean drawTileBack( Rect rect, int flags )
+ public boolean drawTileBack( Rect rect, int flags )
{
return drawTileImpl( rect, "?", -1, flags, true );
}
- public void drawTrayDivider( Rect rect, int flags )
+ public void drawTrayDivider( Rect rect, int flags )
{
boolean isCursor = 0 != (flags & CELL_ISCURSOR);
boolean selected = 0 != (flags & CELL_HIGHLIGHT);
@@ -505,11 +505,11 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
- public void score_pendingScore( Rect rect, int score, int playerNum,
- int curTurn, int flags )
+ public void score_pendingScore( Rect rect, int score, int playerNum,
+ int curTurn, int flags )
{
String text = score >= 0? String.format( "%d", score ) : "??";
- int otherIndx = (0 == (flags & CELL_ISCURSOR))
+ int otherIndx = (0 == (flags & CELL_ISCURSOR))
? CommonPrefs.COLOR_BACKGRND : CommonPrefs.COLOR_FOCUS;
++rect.top;
fillRectOther( rect, otherIndx );
@@ -524,7 +524,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
drawCentered( text, rect, null );
rect.offset( 0, rect.height() );
- drawCentered( LocUtils.getString( m_context, R.string.pts ),
+ drawCentered( LocUtils.getString( m_context, R.string.pts ),
rect, null );
}
@@ -569,7 +569,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
- private boolean drawTileImpl( Rect rect, String text, int val,
+ private boolean drawTileImpl( Rect rect, String text, int val,
int flags, boolean clearBack )
{
boolean canDraw = figureFontDims();
@@ -587,7 +587,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
if ( isCursor || notEmpty ) {
- int color = m_otherColors[isCursor? CommonPrefs.COLOR_FOCUS
+ int color = m_otherColors[isCursor? CommonPrefs.COLOR_FOCUS
: CommonPrefs.COLOR_TILE_BACK];
if ( !clearBack ) {
color &= 0x7FFFFFFF; // translucent if being dragged.
@@ -628,23 +628,23 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
- private void drawCentered( String text, Rect rect, FontDims fontDims )
+ private void drawCentered( String text, Rect rect, FontDims fontDims )
{
drawIn( text, rect, fontDims, Paint.Align.CENTER );
}
- private void drawIn( String text, Rect rect, FontDims fontDims,
- Paint.Align align )
+ private void drawIn( String text, Rect rect, FontDims fontDims,
+ Paint.Align align )
{
int descent = -1;
int textSize;
if ( null == fontDims ) {
textSize = rect.height() - SCORE_HT_DROP;
} else {
- int height = rect.height() - 4; // borders and padding, 2 each
+ int height = rect.height() - 4; // borders and padding, 2 each
descent = fontDims.descentFor( height );
textSize = fontDims.heightFor( height );
- // DbgUtils.logf( "using descent: " + descent + " and textSize: "
+ // DbgUtils.logf( "using descent: " + descent + " and textSize: "
// + textSize + " in height " + height );
}
m_fillPaint.setTextSize( textSize );
@@ -671,13 +671,13 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
} // drawCentered
- private void drawScaled( String text, final Rect rect,
+ private void drawScaled( String text, final Rect rect,
Rect textBounds, int descent )
{
textBounds.bottom = rect.height();
Bitmap bitmap = Bitmap.createBitmap( textBounds.width(),
- rect.height(),
+ rect.height(),
Bitmap.Config.ARGB_8888 );
Canvas canvas = new Canvas( bitmap );
@@ -705,7 +705,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
if ( val >= 0 ) {
int divisor = m_hasSmallScreen ? 3 : 4;
if ( null == m_valRect ) {
- m_valRect = new Rect( 0, 0, rect.width() / divisor,
+ m_valRect = new Rect( 0, 0, rect.width() / divisor,
rect.height() / divisor );
m_valRect.inset( offset, offset );
}
@@ -714,7 +714,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
text = String.format( "%d", val );
m_fillPaint.setTextSize( m_valRect.height() );
m_fillPaint.setTextAlign( Paint.Align.RIGHT );
- drawText( text, m_valRect.right, m_valRect.bottom,
+ drawText( text, m_valRect.right, m_valRect.bottom,
m_fillPaint );
if ( FRAME_TRAY_RECTS ) {
drawRect( m_valRect, m_strokePaint );
@@ -745,7 +745,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
paint.setTextAlign( Paint.Align.LEFT );
paint.setTextSize( ht );
- Bitmap bitmap = Bitmap.createBitmap( width, (ht*3)/2,
+ Bitmap bitmap = Bitmap.createBitmap( width, (ht*3)/2,
Bitmap.Config.ARGB_8888 );
Canvas canvas = new Canvas( bitmap );
@@ -800,7 +800,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
}
-
+
m_fontDims = new FontDims( ht, topRow, bottomRow, maxWidth );
}
return null != m_fontDims;
@@ -855,7 +855,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
}
}
- arrow = new BitmapDrawable(bitmap);
+ arrow = new BitmapDrawable(bitmap);
}
return arrow;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
index 805c4fd0b..8e7034421 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardDelegate.java
@@ -65,7 +65,7 @@ import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
public class BoardDelegate extends DelegateBase
implements TransportProcs.TPMsgHandler, View.OnClickListener,
- DwnldDelegate.DownloadFinishedListener,
+ DwnldDelegate.DownloadFinishedListener,
ConnStatusHandler.ConnStatusCBacks,
NFCUtils.NFCActor {
@@ -141,6 +141,7 @@ public class BoardDelegate extends DelegateBase
private int m_nGuestDevs = -1;
private boolean m_haveInvited = false;
private boolean m_overNotShown;
+ private boolean m_dropOnDismiss;
public class TimerRunnable implements Runnable {
private int m_why;
@@ -154,11 +155,11 @@ public class BoardDelegate extends DelegateBase
public void run() {
m_timers[m_why] = null;
if ( null != m_jniThread ) {
- m_jniThread.handleBkgrnd( JNICmd.CMD_TIMER_FIRED,
+ m_jniThread.handleBkgrnd( JNICmd.CMD_TIMER_FIRED,
m_why, m_when, m_handle );
}
}
- }
+ }
protected Dialog onCreateDialog( int id )
{
@@ -178,18 +179,18 @@ public class BoardDelegate extends DelegateBase
.setPositiveButton( android.R.string.ok, null );
if ( DlgID.DLG_RETRY == dlgID ) {
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- handleViaThread( JNICmd.CMD_RESET );
+ curThis().handleViaThread( JNICmd.CMD_RESET );
}
};
ab.setNegativeButton( R.string.button_retry, lstnr );
} else if ( DlgID.GAME_OVER == dlgID
&& rematchSupported( true ) ) {
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- doRematchIf();
+ curThis().doRematchIf();
}
};
ab.setNegativeButton( R.string.button_rematch, lstnr );
@@ -197,7 +198,7 @@ public class BoardDelegate extends DelegateBase
&& BuildConfig.DEBUG && null != m_connTypes
&& m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
NetStateCache.reset( m_activity );
RelayService.reset( m_activity );
@@ -212,16 +213,16 @@ public class BoardDelegate extends DelegateBase
case DLG_USEDICT:
case DLG_GETDICT:
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
+ BoardDelegate self = curThis();
if ( DlgID.DLG_USEDICT == dlgID ) {
- setGotGameDict( m_getDict );
+ self.setGotGameDict( m_getDict );
} else {
DwnldDelegate
- .downloadDictInBack( m_activity,
- m_gi.dictLang,
- m_getDict,
- BoardDelegate.this );
+ .downloadDictInBack( self.m_activity,
+ self.m_gi.dictLang,
+ self.m_getDict, self );
}
}
};
@@ -238,9 +239,9 @@ public class BoardDelegate extends DelegateBase
.setMessage( R.string.msg_dev_deleted )
.setPositiveButton( android.R.string.ok, null );
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- deleteAndClose();
+ curThis().deleteAndClose();
}
};
ab.setNegativeButton( R.string.button_delete, lstnr );
@@ -250,15 +251,15 @@ public class BoardDelegate extends DelegateBase
case QUERY_REQUEST_BLK:
case QUERY_INFORM_BLK:
case DLG_SCORES:
- case DLG_BADWORDS_BLK:
+ case DLG_BADWORDS_BLK:
ab = ab.setMessage( m_dlgBytes );
if ( 0 != m_dlgTitle ) {
ab.setTitle( m_dlgTitle );
}
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int whichButton ) {
- m_resultCode = 1;
+ curThis().m_resultCode = 1;
}
};
ab.setPositiveButton( DlgID.QUERY_REQUEST_BLK == dlgID ?
@@ -266,9 +267,9 @@ public class BoardDelegate extends DelegateBase
lstnr );
if ( DlgID.QUERY_REQUEST_BLK == dlgID ) {
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int whichButton ) {
- m_resultCode = 0;
+ curThis().m_resultCode = 0;
}
};
ab.setNegativeButton( R.string.button_no, lstnr );
@@ -277,7 +278,7 @@ public class BoardDelegate extends DelegateBase
String buttonTxt;
boolean studyOn = XWPrefs.getStudyEnabled( m_activity );
if ( m_words.length == 1 ) {
- int resID = studyOn
+ int resID = studyOn
? R.string.button_lookup_study_fmt
: R.string.button_lookup_fmt;
buttonTxt = getString( resID, m_words[0] );
@@ -287,12 +288,13 @@ public class BoardDelegate extends DelegateBase
buttonTxt = getString( resID );
}
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int whichButton ) {
- showNotAgainDlgThen( R.string.not_again_lookup,
- R.string.
- key_na_lookup,
- Action.LOOKUP_ACTION );
+ curThis().
+ showNotAgainDlgThen( R.string.not_again_lookup,
+ R.string.
+ key_na_lookup,
+ Action.LOOKUP_ACTION );
}
};
ab.setNegativeButton( buttonTxt, lstnr );
@@ -306,9 +308,9 @@ public class BoardDelegate extends DelegateBase
case PICK_TILE_REQUESTBLANK_BLK:
case PICK_TILE_REQUESTTRAY_BLK:
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int item ) {
- m_resultCode = item;
+ curThis().m_resultCode = item;
}
};
ab.setItems( m_texts, lstnr );
@@ -319,20 +321,22 @@ public class BoardDelegate extends DelegateBase
ab.setTitle( getString( R.string.cur_tiles_fmt, m_curTiles ) );
if ( m_canUndoTiles ) {
OnClickListener undoClicked = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int whichButton ) {
- m_resultCode = UtilCtxt.PICKER_BACKUP;
- removeDialog( dlgID );
+ BoardDelegate self = curThis();
+ self.m_resultCode = UtilCtxt.PICKER_BACKUP;
+ self.removeDialog( dlgID );
}
};
- ab.setPositiveButton( R.string.tilepick_undo,
+ ab.setPositiveButton( R.string.tilepick_undo,
undoClicked );
}
OnClickListener doAllClicked = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int whichButton ) {
- m_resultCode = UtilCtxt.PICKER_PICKALL;
- removeDialog( dlgID );
+ BoardDelegate self = curThis();
+ self.m_resultCode = UtilCtxt.PICKER_PICKALL;
+ self.removeDialog( dlgID );
}
};
ab.setNegativeButton( R.string.tilepick_all, doAllClicked );
@@ -344,7 +348,7 @@ public class BoardDelegate extends DelegateBase
case ASK_PASSWORD_BLK:
m_dlgTitleStr = getString( R.string.msg_ask_password_fmt, m_pwdName );
- LinearLayout pwdLayout =
+ LinearLayout pwdLayout =
(LinearLayout)inflate( R.layout.passwd_view );
m_passwdEdit = (EditText)pwdLayout.findViewById( R.id.edit );
m_passwdEdit.setText( "", TextView.BufferType.EDITABLE );
@@ -352,7 +356,7 @@ public class BoardDelegate extends DelegateBase
.setView( pwdLayout )
.setPositiveButton( android.R.string.ok,
new OnClickListener() {
- public void
+ public void
onClick( DialogInterface dlg,
int whichButton ) {
m_resultCode = 1;
@@ -367,8 +371,8 @@ public class BoardDelegate extends DelegateBase
.setMessage( R.string.ids_endnow )
.setPositiveButton( R.string.button_yes,
new OnClickListener() {
- public void
- onClick( DialogInterface dlg,
+ public void
+ onClick( DialogInterface dlg,
int item ) {
handleViaThread(JNICmd.CMD_ENDGAME);
}
@@ -378,35 +382,37 @@ public class BoardDelegate extends DelegateBase
break;
case DLG_INVITE:
lstnr = new OnClickListener() {
- public void onClick( DialogInterface dialog,
- int item ) {
- if ( !m_relayMissing ||
- ! m_connTypes.contains(CommsConnType.COMMS_CONN_RELAY) ) {
- Assert.assertTrue( 0 < m_nMissing );
- if ( m_summary.hasRematchInfo() ) {
- tryRematchInvites( true );
- } else {
- showInviteChoicesThen( Action.LAUNCH_INVITE_ACTION,
- m_sentInfo );
+ public void onClick( DialogInterface dialog, int item ){
+ BoardDelegate self = curThis();
+ if ( !self.m_relayMissing ||
+ ! self.m_connTypes.contains(CommsConnType.COMMS_CONN_RELAY) ) {
+ Assert.assertTrue( 0 < self.m_nMissing );
+ if ( self.m_summary.hasRematchInfo() ) {
+ self.tryRematchInvites( true );
+ } else {
+ self.showInviteChoicesThen( Action.LAUNCH_INVITE_ACTION,
+ self.m_sentInfo );
}
} else {
- askDropRelay();
+ self.askDropRelay();
}
}
};
OnClickListener lstnrWait = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int item ) {
- finish();
+ curThis().finish();
}
};
OnClickListener lstnrMore = new OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int item ) {
- showOKOnlyDialog( m_sentInfo.getAsText( m_activity ) );
+ BoardDelegate self = curThis();
+ self.showOKOnlyDialog( self.m_sentInfo
+ .getAsText( self.m_activity ) );
}
};
-
+
dialog = ab.setTitle( "foo" )
.setMessage( "" )
.setPositiveButton( "", lstnr )
@@ -457,8 +463,8 @@ public class BoardDelegate extends DelegateBase
CommsConnTypeSet without = (CommsConnTypeSet)
m_connTypes.clone();
without.remove( CommsConnType.COMMS_CONN_RELAY );
- message += "\n\n"
- + getString( R.string.drop_relay_warning_fmt,
+ message += "\n\n"
+ + getString( R.string.drop_relay_warning_fmt,
without.toString( m_activity ) );
buttonTxt = R.string.newgame_drop_relay;
}
@@ -472,7 +478,7 @@ public class BoardDelegate extends DelegateBase
message = getString( R.string.rematch_msg );
} else {
titleID = R.string.waiting_invite_title;
- message = getQuantityString( R.plurals.invite_sent_fmt,
+ message = getQuantityString( R.plurals.invite_sent_fmt,
nSent, nSent, m_nMissing );
}
buttonTxt = R.string.button_reinvite;
@@ -484,7 +490,7 @@ public class BoardDelegate extends DelegateBase
nukeInviteButton = true;
} else {
titleID = R.string.waiting_title;
- message = getQuantityString( R.plurals.invite_msg_fmt,
+ message = getQuantityString( R.plurals.invite_msg_fmt,
m_nMissing, m_nMissing );
}
@@ -516,7 +522,7 @@ public class BoardDelegate extends DelegateBase
}
button = ad.getButton( AlertDialog.BUTTON_NEUTRAL );
button.setVisibility( nukeNeutButton ? View.GONE : View.VISIBLE );
-
+
break;
default:
super.prepareDialog( dlgID, dialog );
@@ -530,13 +536,11 @@ public class BoardDelegate extends DelegateBase
m_activity = delegator.getActivity();
}
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
getBundledData( savedInstanceState );
- if ( BuildConstants.CHAT_SUPPORTED ) {
- m_pendingChats = new ArrayList();
- }
+ m_pendingChats = new ArrayList();
m_utils = new BoardUtilCtxt();
m_jniu = JNIUtilsImpl.get( m_activity );
@@ -563,53 +567,7 @@ public class BoardDelegate extends DelegateBase
m_haveInvited = args.getBoolean( GameUtils.INVITED, false );
m_overNotShown = true;
- Handler handler = new Handler() {
- public void handleMessage( Message msg ) {
- switch( msg.what ) {
- case JNIThread.DIALOG:
- m_dlgBytes = (String)msg.obj;
- m_dlgTitle = msg.arg1;
- showDialog( DlgID.DLG_OKONLY );
- break;
- case JNIThread.QUERY_ENDGAME:
- showDialog( DlgID.QUERY_ENDGAME );
- break;
- case JNIThread.TOOLBAR_STATES:
- if ( null != m_jniThread ) {
- m_gsi =
- m_jniThread.getGameStateInfo();
- updateToolbar();
- if ( m_inTrade != m_gsi.inTrade ) {
- m_inTrade = m_gsi.inTrade;
- }
- m_view.setInTrade( m_inTrade );
- adjustTradeVisibility();
- invalidateOptionsMenuIf();
- }
- break;
- case JNIThread.GOT_WORDS:
- CurGameInfo gi = m_jniThreadRef.getGI();
- launchLookup( wordsToArray((String)msg.obj),
- gi.dictLang );
- break;
- case JNIThread.GAME_OVER:
- m_dlgBytes = (String)msg.obj;
- m_dlgTitle = msg.arg1;
- showDialog( DlgID.GAME_OVER );
- break;
- case JNIThread.MSGS_SENT:
- int nSent = (Integer)msg.obj;
- showToast( getQuantityString( R.plurals.resent_msgs_fmt,
- nSent, nSent ) );
- break;
- }
- }
- };
-
- m_jniThreadRef = JNIThread.getRetained( m_rowid, true ).
- configure( m_activity, m_view, m_utils, this, handler );
- m_jniGamePtr = m_jniThreadRef.getGamePtr();
- Assert.assertNotNull( m_jniGamePtr );
+ m_jniThreadRef = JNIThread.getRetained( m_rowid, true );
// see http://stackoverflow.com/questions/680180/where-to-stop- \
// destroy-threads-in-android-service-class
@@ -635,7 +593,7 @@ public class BoardDelegate extends DelegateBase
super.onResume();
doResume( false );
}
-
+
protected void onPause()
{
closeIfFinishing( false );
@@ -669,7 +627,7 @@ public class BoardDelegate extends DelegateBase
super.onDestroy();
}
- protected void onSaveInstanceState( Bundle outState )
+ protected void onSaveInstanceState( Bundle outState )
{
outState.putInt( DLG_TITLE, m_dlgTitle );
outState.putString( DLG_TITLESTR, m_dlgTitleStr );
@@ -701,15 +659,6 @@ public class BoardDelegate extends DelegateBase
if ( Activity.RESULT_CANCELED != resultCode ) {
InviteMeans missingMeans = null;
switch ( requestCode ) {
- case CHAT_REQUEST:
- if ( BuildConstants.CHAT_SUPPORTED ) {
- String msg = data.getStringExtra( INTENT_KEY_CHAT );
- if ( null != msg && msg.length() > 0 ) {
- m_pendingChats.add( msg );
- trySendChats();
- }
- }
- break;
case BT_INVITE_RESULT:
missingMeans = InviteMeans.BLUETOOTH;
break;
@@ -743,10 +692,6 @@ public class BoardDelegate extends DelegateBase
// in case of change...
setBackgroundColor();
setKeepScreenOn();
- } else if ( ! isFinishing() ) {
- if ( m_relayMissing || 0 < m_nMissing ) {
- showDialog( DlgID.DLG_INVITE );
- }
}
}
}
@@ -808,7 +753,7 @@ public class BoardDelegate extends DelegateBase
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
boolean inTrade = false;
MenuItem item;
@@ -828,33 +773,31 @@ public class BoardDelegate extends DelegateBase
item = menu.findItem( R.id.board_menu_tray );
item.setTitle( getString( strId ) );
- Utils.setItemVisible( menu, R.id.board_menu_flip,
+ Utils.setItemVisible( menu, R.id.board_menu_flip,
m_gsi.visTileCount >= 1 );
- Utils.setItemVisible( menu, R.id.board_menu_toggle,
+ Utils.setItemVisible( menu, R.id.board_menu_toggle,
m_gsi.visTileCount >= 1 );
- Utils.setItemVisible( menu, R.id.board_menu_juggle,
+ Utils.setItemVisible( menu, R.id.board_menu_juggle,
m_gsi.canShuffle );
- Utils.setItemVisible( menu, R.id.board_menu_undo_current,
+ Utils.setItemVisible( menu, R.id.board_menu_undo_current,
m_gsi.canRedo );
- Utils.setItemVisible( menu, R.id.board_menu_hint_prev,
+ Utils.setItemVisible( menu, R.id.board_menu_hint_prev,
m_gsi.canHint );
- Utils.setItemVisible( menu, R.id.board_menu_hint_next,
+ Utils.setItemVisible( menu, R.id.board_menu_hint_next,
m_gsi.canHint );
- Utils.setItemVisible( menu, R.id.board_menu_chat,
- BuildConstants.CHAT_SUPPORTED
- && m_gsi.canChat );
- Utils.setItemVisible( menu, R.id.board_menu_tray,
+ Utils.setItemVisible( menu, R.id.board_menu_chat,
+ m_gsi.canChat );
+ Utils.setItemVisible( menu, R.id.board_menu_tray,
!inTrade && m_gsi.canHideRack );
- Utils.setItemVisible( menu, R.id.board_menu_trade,
+ Utils.setItemVisible( menu, R.id.board_menu_trade,
m_gsi.canTrade );
- Utils.setItemVisible( menu, R.id.board_menu_undo_last,
+ Utils.setItemVisible( menu, R.id.board_menu_undo_last,
m_gsi.canUndo );
}
Utils.setItemVisible( menu, R.id.board_menu_trade_cancel, inTrade );
- Utils.setItemVisible( menu, R.id.board_menu_trade_commit,
- inTrade && m_gsi.tradeTilesSelected
- && m_gsi.curTurnSelected );
+ Utils.setItemVisible( menu, R.id.board_menu_trade_commit,
+ inTrade && m_gsi.tradeTilesSelected );
Utils.setItemVisible( menu, R.id.board_menu_game_resign, !inTrade );
if ( !inTrade ) {
@@ -889,7 +832,7 @@ public class BoardDelegate extends DelegateBase
|| XWPrefs.getDebugEnabled( m_activity ) );
Utils.setItemVisible( menu, R.id.board_menu_game_netstats, enable );
Utils.setItemVisible( menu, R.id.board_menu_game_invites, enable );
-
+
enable = XWPrefs.getStudyEnabled( m_activity );
Utils.setItemVisible( menu, R.id.games_menu_study, enable );
@@ -897,7 +840,7 @@ public class BoardDelegate extends DelegateBase
} // onPrepareOptionsMenu
@Override
- public boolean onOptionsItemSelected( MenuItem item )
+ public boolean onOptionsItemSelected( MenuItem item )
{
boolean handled = true;
JNICmd cmd = JNICmd.CMD_NONE;
@@ -906,11 +849,11 @@ public class BoardDelegate extends DelegateBase
int id = item.getItemId();
switch ( id ) {
case R.id.board_menu_done:
- int nTiles = XwJNI.model_getNumTilesInTray( m_jniGamePtr,
+ int nTiles = XwJNI.model_getNumTilesInTray( m_jniGamePtr,
m_view.getCurPlayer() );
if ( XWApp.MAX_TRAY_TILES > nTiles ) {
- showNotAgainDlgThen( R.string.not_again_done,
- R.string.key_notagain_done,
+ showNotAgainDlgThen( R.string.not_again_done,
+ R.string.key_notagain_done,
Action.COMMIT_ACTION );
} else {
dlgButtonClicked( Action.COMMIT_ACTION, AlertDialog.BUTTON_POSITIVE, null );
@@ -986,7 +929,7 @@ public class BoardDelegate extends DelegateBase
break;
case R.id.board_menu_game_counts:
- handleViaThread( JNICmd.CMD_COUNTS_VALUES,
+ handleViaThread( JNICmd.CMD_COUNTS_VALUES,
R.string.counts_values_title );
break;
case R.id.board_menu_game_left:
@@ -1036,14 +979,15 @@ public class BoardDelegate extends DelegateBase
{
boolean handled = false;
boolean positive = AlertDialog.BUTTON_POSITIVE == which;
- DbgUtils.logf("BoardDelegate.dlgButtonClicked(%s, %b)", action.toString(), positive );
+ DbgUtils.logdf("BoardDelegate.dlgButtonClicked(%s, %b)", action.toString(), positive );
- if ( Action.ENABLE_RELAY_DO == action ) {
+ if ( Action.ENABLE_RELAY_DO_OR == action ) {
handled = true;
if ( positive ) {
RelayService.setEnabled( m_activity, true );
- } else {
- // Things get very confused if askDropRelay() is called here.
+ } else if ( AlertDialog.BUTTON_NEGATIVE == which ) {
+ m_dropOnDismiss = true;
+ } else if ( DlgDelegate.DISMISS_BUTTON == which && m_dropOnDismiss ) {
postDelayed( new Runnable() {
public void run() {
askDropRelay();
@@ -1075,7 +1019,7 @@ public class BoardDelegate extends DelegateBase
String curDict = m_gi.dictName( m_view.getCurPlayer() );
View button = m_toolbar.getViewFor( Toolbar.BUTTON_BROWSE_DICT );
if ( Action.BUTTON_BROWSEALL_ACTION == action &&
- DictsDelegate.handleDictsPopup( getDelegator(), button,
+ DictsDelegate.handleDictsPopup( getDelegator(), button,
curDict, m_gi.dictLang ) ){
break;
}
@@ -1131,7 +1075,7 @@ public class BoardDelegate extends DelegateBase
}
} );
break;
-
+
default:
handled = false;
}
@@ -1146,7 +1090,7 @@ public class BoardDelegate extends DelegateBase
}
} // dlgButtonClicked
- public void inviteChoiceMade( Action action, InviteMeans means,
+ public void inviteChoiceMade( Action action, InviteMeans means,
Object[] params )
{
if ( action == Action.LAUNCH_INVITE_ACTION ) {
@@ -1171,7 +1115,7 @@ public class BoardDelegate extends DelegateBase
RequestCode.SMS_INVITE_RESULT );
break;
case RELAY:
- RelayInviteDelegate.launchForResult( m_activity, m_nMissing,
+ RelayInviteDelegate.launchForResult( m_activity, m_nMissing,
RequestCode.RELAY_INVITE_RESULT );
break;
case EMAIL:
@@ -1199,7 +1143,7 @@ public class BoardDelegate extends DelegateBase
// View.OnClickListener interface
//////////////////////////////////////////////////
@Override
- public void onClick( View view )
+ public void onClick( View view )
{
if ( view == m_exchCommmitButton ) {
handleViaThread( JNICmd.CMD_COMMIT );
@@ -1219,7 +1163,7 @@ public class BoardDelegate extends DelegateBase
case MESSAGE_ACCEPTED:
case MESSAGE_REFUSED:
ConnStatusHandler.
- updateStatusIn( m_activity, this, CommsConnType.COMMS_CONN_BT,
+ updateStatusIn( m_activity, this, CommsConnType.COMMS_CONN_BT,
MultiService.MultiEvent.MESSAGE_ACCEPTED == event);
break;
case MESSAGE_NOGAME:
@@ -1247,7 +1191,7 @@ public class BoardDelegate extends DelegateBase
m_progressShown = false;
stopProgress(); // in case it's a BT invite
}
- final String msg =
+ final String msg =
getString( R.string.err_dup_invite_fmt, (String)args[0] );
post( new Runnable() {
public void run() {
@@ -1266,7 +1210,7 @@ public class BoardDelegate extends DelegateBase
case SMS_SEND_FAILED_NORADIO:
// if ( null != m_jniThread ) {
- // boolean accepted =
+ // boolean accepted =
// MultiService.MultiEvent.SMS_RECEIVE_OK == event
// || MultiService.MultiEvent.SMS_SEND_OK == event;
// m_jniThread.handle( JNICmd.CMD_DRAW_SMS_STATUS, accepted );
@@ -1356,7 +1300,7 @@ public class BoardDelegate extends DelegateBase
//////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface
//////////////////////////////////////////////////
- public void downloadFinished( String lang, final String name,
+ public void downloadFinished( String lang, final String name,
boolean success )
{
if ( success ) {
@@ -1364,7 +1308,7 @@ public class BoardDelegate extends DelegateBase
public void run() {
setGotGameDict( name );
}
- } );
+ } );
}
}
@@ -1442,6 +1386,12 @@ public class BoardDelegate extends DelegateBase
return m_handler;
}
+ @Override
+ protected BoardDelegate curThis()
+ {
+ return (BoardDelegate)super.curThis();
+ }
+
private void deleteAndClose()
{
GameUtils.deleteGame( m_activity, m_gameLock, false );
@@ -1451,7 +1401,7 @@ public class BoardDelegate extends DelegateBase
private void askNoAddrsDelete()
{
- showConfirmThen( R.string.connstat_net_noaddr,
+ showConfirmThen( R.string.connstat_net_noaddr,
R.string.list_item_delete,
Action.DELETE_AND_EXIT );
}
@@ -1506,10 +1456,10 @@ public class BoardDelegate extends DelegateBase
case KeyEvent.KEYCODE_DPAD_RIGHT:
xpKey = XwJNI.XP_Key.XP_CURSOR_KEY_RIGHT;
break;
- case KeyEvent.KEYCODE_DPAD_UP:
+ case KeyEvent.KEYCODE_DPAD_UP:
xpKey = XwJNI.XP_Key.XP_CURSOR_KEY_UP;
break;
- case KeyEvent.KEYCODE_SPACE:
+ case KeyEvent.KEYCODE_SPACE:
xpKey = XwJNI.XP_Key.XP_RAISEFOCUS_KEY;
break;
}
@@ -1568,7 +1518,7 @@ public class BoardDelegate extends DelegateBase
private void handleConndMessage( String room, int devOrder, // <- hostID
boolean allHere, int nMissing )
{
- dismissInviteAlert( nMissing, true );
+ boolean skipDismiss = false;
int naMsg = 0;
int naKey = 0;
@@ -1596,6 +1546,7 @@ public class BoardDelegate extends DelegateBase
m_room = room;
showDialog( DlgID.DLG_INVITE );
invalidateOptionsMenuIf();
+ skipDismiss = true;
} else {
toastStr = getQuantityString( R.plurals.msg_relay_waiting_fmt, nMissing,
devOrder, room, nMissing );
@@ -1613,13 +1564,17 @@ public class BoardDelegate extends DelegateBase
if ( null != toastStr ) {
m_toastStr = toastStr;
if ( naMsg == 0 ) {
- dlgButtonClicked( Action.SHOW_EXPL_ACTION,
+ dlgButtonClicked( Action.SHOW_EXPL_ACTION,
AlertDialog.BUTTON_POSITIVE, null );
} else {
showNotAgainDlgThen( naMsg, naKey, Action.SHOW_EXPL_ACTION );
}
}
+ if ( !skipDismiss ) {
+ dismissInviteAlert( nMissing, true ); // NO!!!
+ }
+
invalidateOptionsMenuIf();
} // handleConndMessage
@@ -1631,7 +1586,7 @@ public class BoardDelegate extends DelegateBase
}
@Override
- public void requestTime()
+ public void requestTime()
{
runOnUiThread( new Runnable() {
public void run() {
@@ -1643,7 +1598,7 @@ public class BoardDelegate extends DelegateBase
}
@Override
- public void remSelected()
+ public void remSelected()
{
handleViaThread( JNICmd.CMD_REMAINING, R.string.tiles_left_title );
}
@@ -1743,7 +1698,7 @@ public class BoardDelegate extends DelegateBase
}
@Override
- public void clearTimer( int why )
+ public void clearTimer( int why )
{
if ( null != m_timers[why] ) {
removeCallbacks( m_timers[why] );
@@ -1761,13 +1716,13 @@ public class BoardDelegate extends DelegateBase
}
@Override
- public int userPickTileTray( int playerNum, String[] texts,
+ public int userPickTileTray( int playerNum, String[] texts,
String[] curTiles, int nPicked )
{
m_texts = texts;
m_curTiles = TextUtils.join( ", ", curTiles );
m_canUndoTiles = 0 < nPicked;
- waitBlockingDialog( DlgID.PICK_TILE_REQUESTTRAY_BLK,
+ waitBlockingDialog( DlgID.PICK_TILE_REQUESTTRAY_BLK,
UtilCtxt.PICKER_PICKALL );
return m_resultCode;
}
@@ -1793,11 +1748,12 @@ public class BoardDelegate extends DelegateBase
m_nMissing = 0;
post( new Runnable() {
public void run() {
- showNotAgainDlg( R.string.not_again_turnchanged,
+ showNotAgainDlg( R.string.not_again_turnchanged,
R.string.key_notagain_turnchanged );
}
} );
handleViaThread( JNICmd. CMD_ZOOM, -8 );
+ handleViaThread( JNICmd.CMD_SAVE );
}
}
@@ -1842,7 +1798,7 @@ public class BoardDelegate extends DelegateBase
public boolean confirmTrade( String[] tiles )
{
m_dlgTitle = R.string.info_title;
- m_dlgBytes =
+ m_dlgBytes =
getQuantityString( R.plurals.query_trade_fmt, tiles.length,
tiles.length, TextUtils.join( ", ", tiles ));
return 0 != waitBlockingDialog( DlgID.QUERY_REQUEST_BLK, 0 );
@@ -1924,26 +1880,30 @@ public class BoardDelegate extends DelegateBase
public void informMissing( boolean isServer, CommsConnTypeSet connTypes,
int nDevs, final int nMissing )
{
+ boolean doDismiss = true;
m_connTypes = connTypes;
Assert.assertTrue( isServer || 0 == nMissing );
- // DbgUtils.logf( "BoardDelegate.informMissing(isServer=%b, nDevs=%d, nMissing=%d)",
+ // DbgUtils.logf( "BoardDelegate.informMissing(isServer=%b, nDevs=%d, nMissing=%d)",
// isServer, nDevs, nMissing );
m_nGuestDevs = nDevs;
- // If we might have put up an alert earlier, take it down
- dismissInviteAlert( nMissing, !m_relayMissing );
-
m_nMissing = nMissing; // will be 0 unless isServer is true
if ( null != connTypes && 0 == connTypes.size() ) {
askNoAddrsDelete();
} else if ( 0 < nMissing && isServer && !m_haveInvited ) {
+ doDismiss = false;
post( new Runnable() {
public void run() {
showDialog( DlgID.DLG_INVITE );
}
} );
}
+
+ // If we might have put up an alert earlier, take it down
+ if ( doDismiss ) {
+ dismissInviteAlert( nMissing, !m_relayMissing );
+ }
}
@Override
@@ -1959,7 +1919,7 @@ public class BoardDelegate extends DelegateBase
GameUtils.BackMoveResult bmr = new GameUtils.BackMoveResult();
bmr.m_lmi = lmi;
boolean[] locals = m_gi.playersLocal();
- GameUtils.postMoveNotification( m_activity, m_rowid,
+ GameUtils.postMoveNotification( m_activity, m_rowid,
bmr, locals[turn] );
}
}
@@ -1967,13 +1927,13 @@ public class BoardDelegate extends DelegateBase
@Override
public void informUndo()
{
- nonBlockingDialog( DlgID.DLG_OKONLY,
+ nonBlockingDialog( DlgID.DLG_OKONLY,
getString( R.string.remote_undone ) );
}
@Override
- public void informNetDict( int code, String oldName,
- String newName, String newSum,
+ public void informNetDict( int code, String oldName,
+ String newName, String newSum,
CurGameInfo.XWPhoniesChoice phonies )
{
// If it's same dict and same sum, we're good. That
@@ -1995,7 +1955,7 @@ public class BoardDelegate extends DelegateBase
DlgID dlgID;
msg = getString( R.string.inform_dict_diffdict_fmt,
oldName, newName, newName );
- if ( DictLangCache.haveDict( m_activity, code,
+ if ( DictLangCache.haveDict( m_activity, code,
newName ) ) {
dlgID = DlgID.DLG_USEDICT;
} else {
@@ -2020,13 +1980,13 @@ public class BoardDelegate extends DelegateBase
// m_view.setVerticalScrollBarEnabled( maxOffset > 0 );
// }
@Override
- public boolean warnIllegalWord( String dict, String[] words, int turn,
+ public boolean warnIllegalWord( String dict, String[] words, int turn,
boolean turnLost )
{
boolean accept = turnLost;
String wordsString = TextUtils.join( ", ", words );
- String message =
+ String message =
getString( R.string.ids_badwords_fmt, wordsString, dict );
if ( turnLost ) {
@@ -2050,20 +2010,18 @@ public class BoardDelegate extends DelegateBase
public void showChat( final String msg, final int fromIndx,
String fromPlayer )
{
- if ( BuildConstants.CHAT_SUPPORTED ) {
- runOnUiThread( new Runnable() {
- public void run() {
- DBUtils.appendChatHistory( m_activity, m_rowid, msg,
- fromIndx );
- if ( ! ChatDelegate.append( m_rowid, msg,
- fromIndx ) ) {
- startChatActivity();
- }
+ runOnUiThread( new Runnable() {
+ public void run() {
+ DBUtils.appendChatHistory( m_activity, m_rowid, msg,
+ fromIndx );
+ if ( ! ChatDelegate.append( m_rowid, msg,
+ fromIndx ) ) {
+ startChatActivity();
}
- } );
- }
+ }
+ } );
}
- } // class BoardUtilCtxt
+ } // class BoardUtilCtxt
private void doResume( boolean isStart )
{
@@ -2071,6 +2029,11 @@ public class BoardDelegate extends DelegateBase
if ( firstStart ) {
m_handler = new Handler();
m_blockingDlgID = DlgID.NONE;
+
+ m_jniThreadRef.configure( m_activity, m_view, m_utils, this,
+ makeJNIHandler() );
+ m_jniGamePtr = m_jniThreadRef.getGamePtr();
+ Assert.assertNotNull( m_jniGamePtr );
}
try {
@@ -2084,6 +2047,53 @@ public class BoardDelegate extends DelegateBase
}
}
+ private Handler makeJNIHandler()
+ {
+ Handler handler = new Handler() {
+ public void handleMessage( Message msg ) {
+ switch( msg.what ) {
+ case JNIThread.DIALOG:
+ m_dlgBytes = (String)msg.obj;
+ m_dlgTitle = msg.arg1;
+ showDialog( DlgID.DLG_OKONLY );
+ break;
+ case JNIThread.QUERY_ENDGAME:
+ showDialog( DlgID.QUERY_ENDGAME );
+ break;
+ case JNIThread.TOOLBAR_STATES:
+ if ( null != m_jniThread ) {
+ m_gsi =
+ m_jniThread.getGameStateInfo();
+ updateToolbar();
+ if ( m_inTrade != m_gsi.inTrade ) {
+ m_inTrade = m_gsi.inTrade;
+ }
+ m_view.setInTrade( m_inTrade );
+ adjustTradeVisibility();
+ invalidateOptionsMenuIf();
+ }
+ break;
+ case JNIThread.GOT_WORDS:
+ CurGameInfo gi = m_jniThreadRef.getGI();
+ launchLookup( wordsToArray((String)msg.obj),
+ gi.dictLang );
+ break;
+ case JNIThread.GAME_OVER:
+ m_dlgBytes = (String)msg.obj;
+ m_dlgTitle = msg.arg1;
+ showDialog( DlgID.GAME_OVER );
+ break;
+ case JNIThread.MSGS_SENT:
+ int nSent = (Integer)msg.obj;
+ showToast( getQuantityString( R.plurals.resent_msgs_fmt,
+ nSent, nSent ) );
+ break;
+ }
+ }
+ };
+ return handler;
+ }
+
private void resumeGame( boolean isStart )
{
if ( null == m_jniThread ) {
@@ -2106,7 +2116,12 @@ public class BoardDelegate extends DelegateBase
int flags = DBUtils.getMsgFlags( m_activity, m_rowid );
if ( 0 != (GameSummary.MSG_FLAGS_CHAT & flags) ) {
- startChatActivity();
+ post( new Runnable() {
+ @Override
+ public void run() {
+ startChatActivity();
+ }
+ } );
}
if ( m_overNotShown ) {
boolean auto = false;
@@ -2149,7 +2164,7 @@ public class BoardDelegate extends DelegateBase
case COMMS_CONN_SMS:
break;
default:
- DbgUtils.logf( "tickle: unexpected type %s",
+ DbgUtils.logf( "tickle: unexpected type %s",
typ.toString() );
Assert.fail();
}
@@ -2169,7 +2184,7 @@ public class BoardDelegate extends DelegateBase
}
if ( 0 == nMissing || !m_relayMissing ) {
dismissDialog( DlgID.DLG_INVITE );
- }
+ }
}
} );
}
@@ -2199,7 +2214,7 @@ public class BoardDelegate extends DelegateBase
R.string.not_again_browse,
R.string.key_na_browse,
Action.BUTTON_BROWSE_ACTION );
- m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV,
+ m_toolbar.setListener( Toolbar.BUTTON_HINT_PREV,
R.string.not_again_hintprev,
R.string.key_notagain_hintprev,
Action.PREV_HINT_ACTION );
@@ -2227,12 +2242,10 @@ public class BoardDelegate extends DelegateBase
R.string.not_again_undo,
R.string.key_notagain_undo,
Action.UNDO_ACTION );
- if ( BuildConstants.CHAT_SUPPORTED ) {
- m_toolbar.setListener( Toolbar.BUTTON_CHAT,
- R.string.not_again_chat,
- R.string.key_notagain_chat,
- Action.CHAT_ACTION );
- }
+ m_toolbar.setListener( Toolbar.BUTTON_CHAT,
+ R.string.not_again_chat,
+ R.string.key_notagain_chat,
+ Action.CHAT_ACTION );
}
} // populateToolbar
@@ -2285,7 +2298,7 @@ public class BoardDelegate extends DelegateBase
return result;
}
- private void nonBlockingDialog( final DlgID dlgID, String txt )
+ private void nonBlockingDialog( final DlgID dlgID, String txt )
{
switch ( dlgID ) {
case DLG_OKONLY:
@@ -2320,13 +2333,11 @@ public class BoardDelegate extends DelegateBase
private void startChatActivity()
{
- if ( BuildConstants.CHAT_SUPPORTED ) {
- int curPlayer = XwJNI.board_getSelPlayer( m_jniGamePtr );
- String[] names = m_gi.playerNames();
- boolean[] locs = m_gi.playersLocal(); // to convert old histories
- ChatDelegate.startForResult( getDelegator(), RequestCode.CHAT_REQUEST,
- m_rowid, curPlayer, names, locs );
- }
+ int curPlayer = XwJNI.board_getSelPlayer( m_jniGamePtr );
+ String[] names = m_gi.playerNames();
+ boolean[] locs = m_gi.playersLocal(); // to convert old histories
+ ChatDelegate.start( getDelegator(), m_rowid, curPlayer,
+ names, locs );
}
private void closeIfFinishing( boolean force )
@@ -2354,18 +2365,10 @@ public class BoardDelegate extends DelegateBase
m_view.stopHandling();
- if ( XWPrefs.getThumbEnabled( m_activity ) ) {
- // Before we dispose, and after JNIThread has
- // relinquished interest, redraw on smaller scale.
- Bitmap thumb =
- GameUtils.takeSnapshot( m_activity, m_jniGamePtr, m_gi );
- DBUtils.saveThumbnail( m_activity, m_gameLock, thumb );
- }
-
m_gameLock = null;
}
}
-
+
private void waitCloseGame( boolean save )
{
pauseGame();
@@ -2382,7 +2385,7 @@ public class BoardDelegate extends DelegateBase
{
if ( m_connTypes.contains( CommsConnType.COMMS_CONN_SMS ) ) {
if ( XWApp.SMSSUPPORTED && !XWPrefs.getSMSEnabled( m_activity ) ) {
- showConfirmThen( R.string.warn_sms_disabled,
+ showConfirmThen( R.string.warn_sms_disabled,
R.string.button_enable_sms,
R.string.button_later,
Action.ENABLE_SMS_ASK );
@@ -2390,24 +2393,23 @@ public class BoardDelegate extends DelegateBase
}
if ( m_connTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
if ( !RelayService.relayEnabled( m_activity ) ) {
+ m_dropOnDismiss = false;
String msg = getString( R.string.warn_relay_disabled )
+ "\n\n" + getString( R.string.warn_relay_remove );
showConfirmThen( msg, R.string.button_enable_relay,
R.string.newgame_drop_relay,
- Action.ENABLE_RELAY_DO );
+ Action.ENABLE_RELAY_DO_OR );
}
}
}
-
+
private void trySendChats()
{
- if ( BuildConstants.CHAT_SUPPORTED && null != m_jniThread ) {
- Iterator iter = m_pendingChats.iterator();
- while ( iter.hasNext() ) {
- handleViaThread( JNICmd.CMD_SENDCHAT, iter.next() );
- }
- m_pendingChats.clear();
+ Iterator iter = m_pendingChats.iterator();
+ while ( iter.hasNext() ) {
+ handleViaThread( JNICmd.CMD_SENDCHAT, iter.next() );
}
+ m_pendingChats.clear();
}
private void tryInvites()
@@ -2423,7 +2425,7 @@ public class BoardDelegate extends DelegateBase
int nPlayers = m_missingCounts[ii];
Assert.assertTrue( 0 <= m_nGuestDevs );
int forceChannel = ii + m_nGuestDevs + 1;
- NetLaunchInfo nli = new NetLaunchInfo( m_summary, m_gi,
+ NetLaunchInfo nli = new NetLaunchInfo( m_summary, m_gi,
nPlayers, forceChannel );
if ( m_relayMissing ) {
nli.removeAddress( CommsConnType.COMMS_CONN_RELAY );
@@ -2452,7 +2454,7 @@ public class BoardDelegate extends DelegateBase
case RELAY:
try {
int destDevID = Integer.parseInt( dev ); // failing
- RelayService.inviteRemote( m_activity, destDevID,
+ RelayService.inviteRemote( m_activity, destDevID,
null, nli );
} catch (NumberFormatException nfi) {
DbgUtils.loge( nfi );
@@ -2479,9 +2481,8 @@ public class BoardDelegate extends DelegateBase
m_toolbar.update( Toolbar.BUTTON_UNDO, m_gsi.canRedo );
m_toolbar.update( Toolbar.BUTTON_HINT_PREV, m_gsi.canHint );
m_toolbar.update( Toolbar.BUTTON_HINT_NEXT, m_gsi.canHint );
- m_toolbar.update( Toolbar.BUTTON_CHAT,
- BuildConstants.CHAT_SUPPORTED && m_gsi.canChat );
- m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT,
+ m_toolbar.update( Toolbar.BUTTON_CHAT, m_gsi.canChat );
+ m_toolbar.update( Toolbar.BUTTON_BROWSE_DICT,
null != m_gi.dictName( m_view.getCurPlayer() ) );
}
}
@@ -2557,7 +2558,7 @@ public class BoardDelegate extends DelegateBase
if ( null != m_handler ) {
m_handler.removeCallbacks( which );
} else {
- DbgUtils.logf( "removeCallbacks: dropping %h because handler null",
+ DbgUtils.logf( "removeCallbacks: dropping %h because handler null",
which );
}
}
@@ -2585,7 +2586,7 @@ public class BoardDelegate extends DelegateBase
return null != summary && rematchSupported( null, summary );
}
- private static boolean rematchSupported( Context context,
+ private static boolean rematchSupported( Context context,
GameSummary summary )
{
boolean supported = false;
@@ -2604,8 +2605,8 @@ public class BoardDelegate extends DelegateBase
} else if ( null != context ) {
// show the button if people haven't dismissed the hint yet
supported = ! XWPrefs
- .getPrefsBoolean( context,
- R.string.key_na_rematch_two_only,
+ .getPrefsBoolean( context,
+ R.string.key_na_rematch_two_only,
false );
}
}
@@ -2615,14 +2616,14 @@ public class BoardDelegate extends DelegateBase
private void doRematchIf()
{
- if ( doRematchIf( m_activity, this, m_rowid, m_summary, m_gi,
+ if ( doRematchIf( m_activity, this, m_rowid, m_summary, m_gi,
m_jniGamePtr ) ) {
finish();
}
}
- private static boolean doRematchIf( Activity activity, DelegateBase dlgt,
- long rowid, GameSummary summary,
+ private static boolean doRematchIf( Activity activity, DelegateBase dlgt,
+ long rowid, GameSummary summary,
CurGameInfo gi, GamePtr jniGamePtr )
{
boolean success = false;
@@ -2636,7 +2637,7 @@ public class BoardDelegate extends DelegateBase
} else if ( 2 != gi.nPlayers ) {
Assert.assertNotNull( dlgt );
if ( null != dlgt ) {
- dlgt.showNotAgainDlg( R.string.not_again_rematch_two_only,
+ dlgt.showNotAgainDlg( R.string.not_again_rematch_two_only,
R.string.key_na_rematch_two_only );
}
doIt = false;
@@ -2647,7 +2648,7 @@ public class BoardDelegate extends DelegateBase
if ( addr.contains( CommsConnType.COMMS_CONN_BT ) ) {
Assert.assertNull( btAddr );
btAddr = addr.bt_btAddr;
- }
+ }
if ( addr.contains( CommsConnType.COMMS_CONN_SMS ) ) {
Assert.assertNull( phone );
phone = addr.sms_phone;
@@ -2663,7 +2664,7 @@ public class BoardDelegate extends DelegateBase
CommsConnTypeSet connTypes = summary.conTypes;
String newName = summary.getRematchName();
Intent intent = GamesListDelegate
- .makeRematchIntent( activity, rowid, gi, connTypes, btAddr,
+ .makeRematchIntent( activity, rowid, gi, connTypes, btAddr,
phone, relayID, newName );
if ( null != intent ) {
activity.startActivity( intent );
@@ -2705,7 +2706,7 @@ public class BoardDelegate extends DelegateBase
// only supports a single invite for now!
int numHere = 1;
int forceChannel = 1;
- NetLaunchInfo nli = new NetLaunchInfo( m_summary, m_gi, numHere,
+ NetLaunchInfo nli = new NetLaunchInfo( m_summary, m_gi, numHere,
forceChannel );
String value;
@@ -2745,7 +2746,7 @@ public class BoardDelegate extends DelegateBase
private void retrySMSInvites( Object[] params )
{
- if ( null != params && 2 == params.length
+ if ( null != params && 2 == params.length
&& params[0] instanceof NetLaunchInfo
&& params[1] instanceof String ) {
sendSMSInviteIf( (String)params[1], (NetLaunchInfo)params[0],
@@ -2754,7 +2755,7 @@ public class BoardDelegate extends DelegateBase
DbgUtils.logf( "retrySMSInvites: tests failed" );
}
}
-
+
private void recordInviteSent( InviteMeans means, String dev )
{
DBUtils.recordInviteSent( m_activity, m_rowid, means, dev );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardFrag.java
index 79fce7a33..4e43aa2b5 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardFrag.java
@@ -24,6 +24,8 @@ import android.os.Bundle;
public class BoardFrag extends XWFragment {
+ public BoardFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
index b60b6d67a..7bac9667a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java
@@ -22,21 +22,14 @@ package org.eehouse.android.xw4;
import android.app.Activity;
import android.content.Context;
-import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Paint.FontMetricsInt;
import android.graphics.Paint;
import android.graphics.Rect;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
import android.util.AttributeSet;
import android.util.FloatMath;
import android.view.MotionEvent;
import android.view.View;
-import java.nio.IntBuffer;
-import java.util.Set;
import org.eehouse.android.xw4.jni.*;
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
@@ -76,7 +69,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
// called when inflating xml
- public BoardView( Context context, AttributeSet attrs )
+ public BoardView( Context context, AttributeSet attrs )
{
super( context, attrs );
@@ -93,14 +86,14 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
}
@Override
- public boolean onTouchEvent( MotionEvent event )
+ public boolean onTouchEvent( MotionEvent event )
{
boolean wantMore = null != m_jniThread;
if ( wantMore ) {
int action = event.getAction();
int xx = (int)event.getX();
int yy = (int)event.getY();
-
+
switch ( action ) {
case MotionEvent.ACTION_DOWN:
m_lastSpacing = MULTI_INACTIVE;
@@ -115,7 +108,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
} else {
int zoomBy = figureZoom( event );
if ( 0 != zoomBy ) {
- handle( JNIThread.JNICmd.CMD_ZOOM,
+ handle( JNIThread.JNICmd.CMD_ZOOM,
zoomBy < 0 ? -2 : 2 );
}
}
@@ -147,7 +140,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
@Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec )
{
- // DbgUtils.logf( "onMeasure(width: %s, height: %s)",
+ // DbgUtils.logf( "onMeasure(width: %s, height: %s)",
// MeasureSpec.toString( widthMeasureSpec ),
// MeasureSpec.toString( heightMeasureSpec ) );
@@ -155,7 +148,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
if ( m_boardDlgt.isPortrait() != (m_dims.height > m_dims.width) ) {
// square possible; will break above!
Assert.assertTrue( m_dims.height != m_dims.width );
- DbgUtils.logf( "onMeasure: discarding m_dims" );
+ DbgUtils.logdf( "onMeasure: discarding m_dims" );
if ( ++m_dimsTossCount < 4 ) {
m_dims = null;
m_layoutWidth = m_layoutHeight = 0;
@@ -196,34 +189,34 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
// This will be called from the UI thread
@Override
- protected void onDraw( Canvas canvas )
+ protected void onDraw( Canvas canvas )
{
synchronized( this ) {
if ( layoutBoardOnce() && m_measuredFromDims ) {
canvas.drawBitmap( s_bitmap, 0, 0, new Paint() );
- ConnStatusHandler.draw( m_context, canvas, getResources(),
+ ConnStatusHandler.draw( m_context, canvas, getResources(),
m_connTypes, m_isSolo );
} else {
- DbgUtils.logf( "BoardView.onDraw(): board not laid out yet" );
+ DbgUtils.logdf( "BoardView.onDraw(): board not laid out yet" );
}
}
}
- private boolean layoutBoardOnce()
+ private boolean layoutBoardOnce()
{
final int width = getWidth();
final int height = getHeight();
boolean layoutDone = width == m_layoutWidth && height == m_layoutHeight;
if ( layoutDone ) {
- DbgUtils.logf( "layoutBoardOnce(): layoutDone true" );
+ DbgUtils.logdf( "layoutBoardOnce(): layoutDone true" );
} else if ( null == m_gi ) {
// nothing to do either
- DbgUtils.logf( "layoutBoardOnce(): no m_gi" );
+ DbgUtils.logdf( "layoutBoardOnce(): no m_gi" );
} else if ( null == m_jniThread ) {
// nothing to do either
- DbgUtils.logf( "layoutBoardOnce(): no m_jniThread" );
+ DbgUtils.logdf( "layoutBoardOnce(): no m_jniThread" );
} else if ( null == m_dims ) {
- DbgUtils.logf( "layoutBoardOnce(): null m_dims" );
+ DbgUtils.logdf( "layoutBoardOnce(): null m_dims" );
// m_canvas = null;
// need to synchronize??
Paint paint = new Paint();
@@ -232,14 +225,14 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
String timerTxt = "-00:00";
paint.getTextBounds( timerTxt, 0, timerTxt.length(), scratch );
int timerWidth = scratch.width();
- int fontWidth =
+ int fontWidth =
Math.min(m_defaultFontHt, timerWidth / timerTxt.length());
- DbgUtils.logf( "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)", width, height );
- handle( JNIThread.JNICmd.CMD_LAYOUT, width, height,
+ DbgUtils.logdf( "layoutBoardOnce(): posting JNICmd.CMD_LAYOUT(w=%d, h=%d)", width, height );
+ handle( JNIThread.JNICmd.CMD_LAYOUT, width, height,
fontWidth, m_defaultFontHt );
// We'll be back....
} else {
- DbgUtils.logf( "layoutBoardOnce(): DOING IT" );
+ DbgUtils.logdf( "layoutBoardOnce(): DOING IT" );
// If board size has changed we need a new bitmap
int bmHeight = 1 + m_dims.height;
int bmWidth = 1 + m_dims.width;
@@ -260,7 +253,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
s_bitmap.eraseColor( 0 );
}
if ( null == m_canvas ) {
- m_canvas = new BoardCanvas( m_parent, s_bitmap, m_jniThread,
+ m_canvas = new BoardCanvas( m_parent, s_bitmap, m_jniThread,
m_dims );
} else {
m_canvas.setJNIThread( m_jniThread );
@@ -273,7 +266,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
m_layoutHeight = height;
layoutDone = true;
}
- DbgUtils.logf( "layoutBoardOnce()=>%b", layoutDone );
+ DbgUtils.logdf( "layoutBoardOnce()=>%b", layoutDone );
return layoutDone;
} // layoutBoardOnce
@@ -283,10 +276,10 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
}
// BoardHandler interface implementation
- public void startHandling( Activity parent, JNIThread thread,
- CommsConnTypeSet connTypes )
+ public void startHandling( Activity parent, JNIThread thread,
+ CommsConnTypeSet connTypes )
{
- DbgUtils.logf( "BoardView.startHandling(thread=%H)", thread );
+ DbgUtils.logdf( "BoardView.startHandling(thread=%H)", thread );
m_parent = parent;
m_jniThread = thread;
m_jniGamePtr = thread.getGamePtr();
@@ -328,10 +321,10 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
}
}
- // Force update now that we have bits to copy
- if ( drew ) {
- m_parent.runOnUiThread( m_invalidator );
- }
+ // Force update now that we have bits to copy. I don't know why (yet),
+ // but on older versions of Android we need to run this even if drew
+ // is false
+ m_parent.runOnUiThread( m_invalidator );
}
public void dimsChanged( BoardDims dims )
@@ -354,7 +347,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
requestLayout();
}
- public void setInTrade( boolean inTrade )
+ public void setInTrade( boolean inTrade )
{
if ( null != m_canvas ) {
m_canvas.setInTrade( inTrade );
@@ -366,12 +359,12 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
return null == m_canvas? -1 : m_canvas.getCurPlayer();
}
- public int curPending()
+ public int curPending()
{
return null == m_canvas? 0 : m_canvas.curPending();
}
- private int getSpacing( MotionEvent event )
+ private int getSpacing( MotionEvent event )
{
int result;
if ( 1 == event.getPointerCount() ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java
index 762b5bcdd..dc3843d7b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java
@@ -25,11 +25,9 @@ import android.os.Bundle;
public class ChatActivity extends XWActivity {
@Override
- public void onCreate( Bundle savedInstanceState )
+ public void onCreate( Bundle savedInstanceState )
{
- if ( BuildConstants.CHAT_SUPPORTED ) {
- ChatDelegate dlgt = new ChatDelegate( this, savedInstanceState );
- super.onCreate( savedInstanceState, dlgt );
- }
+ ChatDelegate dlgt = new ChatDelegate( this, savedInstanceState );
+ super.onCreate( savedInstanceState, dlgt );
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatDelegate.java
index 724d9c801..c61e5c8c2 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatDelegate.java
@@ -30,6 +30,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View.OnLayoutChangeListener;
import android.view.View;
+import android.widget.Button;
import android.widget.EditText;
import android.widget.ScrollView;
import android.widget.TableLayout;
@@ -46,7 +47,7 @@ public class ChatDelegate extends DelegateBase {
private static final String INTENT_KEY_PLAYER = "intent_key_player";
private static final String INTENT_KEY_NAMES = "intent_key_names";
private static final String INTENT_KEY_LOCS = "intent_key_locs";
-
+
private static ChatDelegate s_visibleThis;
private long m_rowid;
private int m_curPlayer;
@@ -64,58 +65,67 @@ public class ChatDelegate extends DelegateBase {
}
@Override
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
DbgUtils.logf( "ChatDelegate.init()" );
- if ( BuildConstants.CHAT_SUPPORTED ) {
- m_edit = (EditText)findViewById( R.id.chat_edit );
- m_edit.addTextChangedListener( new TextWatcher() {
- public void afterTextChanged( Editable s ) {
- invalidateOptionsMenuIf();
- }
- public void beforeTextChanged( CharSequence s, int st,
- int cnt, int a ) {}
- public void onTextChanged( CharSequence s, int start,
- int before, int count ) {}
- } );
+ m_edit = (EditText)findViewById( R.id.chat_edit );
+ m_edit.addTextChangedListener( new TextWatcher() {
+ public void afterTextChanged( Editable s ) {
+ invalidateOptionsMenuIf();
+ }
+ public void beforeTextChanged( CharSequence s, int st,
+ int cnt, int a ) {}
+ public void onTextChanged( CharSequence s, int start,
+ int before, int count ) {}
+ } );
- Bundle args = getArguments();
- m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, -1 );
- m_curPlayer = args.getInt( INTENT_KEY_PLAYER, -1 );
- m_names = args.getStringArray( INTENT_KEY_NAMES );
- boolean[] locals = args.getBooleanArray( INTENT_KEY_LOCS );
+ Bundle args = getArguments();
+ m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, -1 );
+ m_curPlayer = args.getInt( INTENT_KEY_PLAYER, -1 );
+ m_names = args.getStringArray( INTENT_KEY_NAMES );
+ boolean[] locals = args.getBooleanArray( INTENT_KEY_LOCS );
- m_scroll = (ScrollView)findViewById( R.id.scroll );
- m_layout = (TableLayout)findViewById( R.id.chat_history );
+ m_scroll = (ScrollView)findViewById( R.id.scroll );
+ m_layout = (TableLayout)findViewById( R.id.chat_history );
+
+ // OnLayoutChangeListener added in API 11
+ if ( 11 <= Integer.valueOf( android.os.Build.VERSION.SDK ) ) {
m_layout.addOnLayoutChangeListener( new OnLayoutChangeListener() {
@Override
- public void onLayoutChange( View vv, int ll, int tt, int rr,
- int bb, int ol, int ot,
+ public void onLayoutChange( View vv, int ll, int tt, int rr,
+ int bb, int ol, int ot,
int or, int ob ) {
scrollDown();
}
});
-
- DBUtils.HistoryPair[] pairs
- = DBUtils.getChatHistory( m_activity, m_rowid, locals );
- if ( null != pairs ) {
- for ( DBUtils.HistoryPair pair : pairs ) {
- addRow( pair.msg, pair.playerIndx );
- }
- }
- // scrollDown();
-
- String title = getString( R.string.chat_title_fmt,
- GameUtils.getName( m_activity, m_rowid ) );
- setTitle( title );
- } else {
- // Should really assert....
- finish();
}
- }
+
+ Button sendButton = (Button)findViewById( R.id.chat_send );
+ if ( ABUtils.haveActionBar() ) {
+ sendButton.setVisibility( View.GONE );
+ } else {
+ sendButton.setOnClickListener( new View.OnClickListener() {
+ public void onClick( View view ) {
+ handleSend();
+ }
+ } );
+ }
+
+ DBUtils.HistoryPair[] pairs
+ = DBUtils.getChatHistory( m_activity, m_rowid, locals );
+ if ( null != pairs ) {
+ for ( DBUtils.HistoryPair pair : pairs ) {
+ addRow( pair.msg, pair.playerIndx );
+ }
+ }
+
+ String title = getString( R.string.chat_title_fmt,
+ GameUtils.getName( m_activity, m_rowid ) );
+ setTitle( title );
+ } // init
@Override
- protected void onResume()
+ protected void onResume()
{
super.onResume();
m_jniThreadRef = JNIThread.getRetained( m_rowid );
@@ -124,6 +134,13 @@ public class ChatDelegate extends DelegateBase {
finish();
} else {
s_visibleThis = this;
+ int[] startAndEnd = new int[2];
+ String curMsg = DBUtils.getCurChat( m_activity, m_rowid,
+ m_curPlayer, startAndEnd );
+ if ( null != curMsg && 0 < curMsg.length() ) {
+ m_edit.setText( curMsg );
+ m_edit.setSelection( startAndEnd[0], startAndEnd[1] );
+ }
}
}
@@ -134,6 +151,12 @@ public class ChatDelegate extends DelegateBase {
m_jniThreadRef.release();
}
s_visibleThis = null;
+
+ String curText = m_edit.getText().toString();
+ DBUtils.setCurChat( m_activity, m_rowid, m_curPlayer, curText,
+ m_edit.getSelectionStart(),
+ m_edit.getSelectionEnd() );
+
super.onPause();
}
@@ -146,7 +169,7 @@ public class ChatDelegate extends DelegateBase {
TextView view = (TextView)row.findViewById( R.id.chat_row_text );
view.setText( msg );
view = (TextView)row.findViewById( R.id.chat_row_name );
- view.setText( getString( R.string.chat_sender_fmt,
+ view.setText( getString( R.string.chat_sender_fmt,
m_names[playerIndx] ) );
m_layout.addView( row );
@@ -163,6 +186,15 @@ public class ChatDelegate extends DelegateBase {
});
}
+ private void handleSend() {
+ String text = m_edit.getText().toString();
+ DBUtils.appendChatHistory( m_activity, m_rowid, text, m_curPlayer );
+ addRow( text, m_curPlayer );
+ m_edit.setText( null );
+
+ m_jniThreadRef.sendChat( text );
+ }
+
@Override
public boolean onPrepareOptionsMenu( Menu menu )
{
@@ -173,7 +205,7 @@ public class ChatDelegate extends DelegateBase {
}
@Override
- public boolean onOptionsItemSelected( MenuItem item )
+ public boolean onOptionsItemSelected( MenuItem item )
{
boolean handled = true;
switch ( item.getItemId() ) {
@@ -183,26 +215,7 @@ public class ChatDelegate extends DelegateBase {
}
break;
case R.id.chat_menu_send:
- String text = m_edit.getText().toString();
- if ( null == text || text.length() == 0 ) {
- setResult( Activity.RESULT_CANCELED );
- finish();
- } else {
- DBUtils.appendChatHistory( m_activity, m_rowid, text, m_curPlayer );
- addRow( text, m_curPlayer );
- m_edit.setText( null );
-
- m_jniThreadRef.sendChat( text );
- // if ( null != jniThread ) {
- // jniThread.handle( JNIThread.JNICmd.CMD_SENDCHAT, text );
- // } else {
- // Intent result = new Intent();
- // result.putExtra( BoardDelegate.INTENT_KEY_CHAT, text );
- // setResult( Activity.RESULT_OK, result );
- // finish();
- // }
- }
- // finish();
+ handleSend();
break;
default:
handled = false;
@@ -218,7 +231,7 @@ public class ChatDelegate extends DelegateBase {
case CLEAR_ACTION:
if ( AlertDialog.BUTTON_POSITIVE == which ) {
DBUtils.clearChatHistory( m_activity, m_rowid );
- TableLayout layout =
+ TableLayout layout =
(TableLayout)findViewById( R.id.chat_history );
layout.removeAllViews();
}
@@ -239,10 +252,9 @@ public class ChatDelegate extends DelegateBase {
return handled;
}
- public static void startForResult( Delegator delegator,
- RequestCode requestCode,
- long rowID, int curPlayer,
- String[] names, boolean[] locs )
+ public static void start( Delegator delegator,
+ long rowID, int curPlayer,
+ String[] names, boolean[] locs )
{
Assert.assertFalse( -1 == curPlayer );
Bundle bundle = new Bundle();
@@ -251,13 +263,13 @@ public class ChatDelegate extends DelegateBase {
bundle.putStringArray( INTENT_KEY_NAMES, names );
bundle.putBooleanArray( INTENT_KEY_LOCS, locs );
- Activity activity = delegator.getActivity();
- if ( activity instanceof FragActivity ) {
- FragActivity.addFragment( new ChatFrag(), bundle, delegator );
+ if ( delegator.inDPMode() ) {
+ delegator.addFragment( new ChatFrag( delegator ), bundle );
} else {
+ Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, ChatActivity.class );
intent.putExtras( bundle );
- activity.startActivityForResult( intent, requestCode.ordinal() );
+ activity.startActivity( intent );
}
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatFrag.java
index add426c10..0b3fd7fd3 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatFrag.java
@@ -23,6 +23,8 @@ import android.os.Bundle;
public class ChatFrag extends XWFragment {
+ public ChatFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java
index d1679d4a9..0cae943fa 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/CommsTransport.java
@@ -38,7 +38,7 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
import org.eehouse.android.xw4.jni.JNIThread.*;
-public class CommsTransport implements TransportProcs,
+public class CommsTransport implements TransportProcs,
NetStateCache.StateChangedIf {
private Selector m_selector;
private SocketChannel m_socketChannel;
@@ -80,7 +80,7 @@ public class CommsTransport implements TransportProcs,
if ( !XWApp.UDP_ENABLED ) {
m_done = false;
boolean failed = true;
- try {
+ try {
if ( XWApp.onEmulator() ) {
System.setProperty("java.net.preferIPv6Addresses", "false");
}
@@ -94,13 +94,13 @@ public class CommsTransport implements TransportProcs,
DbgUtils.loge( ioe );
} catch ( UnresolvedAddressException uae ) {
DbgUtils.logf( "bad address: name: %s; port: %s; exception: %s",
- m_useHost, m_relayAddr.ip_relay_port,
+ m_useHost, m_relayAddr.ip_relay_port,
uae.toString() );
}
m_thread = null;
if ( failed ) {
- m_jniThread.handle( JNICmd.CMD_TRANSFAIL,
+ m_jniThread.handle( JNICmd.CMD_TRANSFAIL,
CommsConnType.COMMS_CONN_RELAY );
}
}
@@ -121,10 +121,10 @@ public class CommsTransport implements TransportProcs,
try {
m_socketChannel = SocketChannel.open();
m_socketChannel.configureBlocking( false );
- DbgUtils.logf( "connecting to %s:%d",
- m_useHost,
+ DbgUtils.logf( "connecting to %s:%d",
+ m_useHost,
m_relayAddr.ip_relay_port );
- InetSocketAddress isa = new
+ InetSocketAddress isa = new
InetSocketAddress(m_useHost,
m_relayAddr.ip_relay_port );
m_socketChannel.connect( isa );
@@ -163,10 +163,10 @@ public class CommsTransport implements TransportProcs,
SelectionKey key = iter.next();
SocketChannel channel = (SocketChannel)key.channel();
iter.remove();
- try {
+ try {
if (key.isValid() && key.isConnectable()) {
if ( !channel.finishConnect() ) {
- key.cancel();
+ key.cancel();
}
}
if (key.isValid() && key.isReadable()) {
@@ -181,7 +181,7 @@ public class CommsTransport implements TransportProcs,
}
ConnStatusHandler.
updateStatusIn( m_context, null,
- CommsConnType.COMMS_CONN_RELAY,
+ CommsConnType.COMMS_CONN_RELAY,
0 <= nRead );
}
if (key.isValid() && key.isWritable()) {
@@ -196,7 +196,7 @@ public class CommsTransport implements TransportProcs,
}
} catch ( java.io.IOException ioe ) {
DbgUtils.logf( "%s: cancelling key", ioe.toString() );
- key.cancel();
+ key.cancel();
failed = true;
break outer_loop;
} catch ( java.nio.channels.
@@ -210,7 +210,7 @@ public class CommsTransport implements TransportProcs,
return failed;
} // loop
}
-
+
public void setReceiver( JNIThread jnit )
{
m_jniThread = jnit;
@@ -229,7 +229,7 @@ public class CommsTransport implements TransportProcs,
{
if ( !nowAvailable ) {
waitToStopImpl();
- m_jniThread.handle( JNICmd.CMD_TRANSFAIL,
+ m_jniThread.handle( JNICmd.CMD_TRANSFAIL,
CommsConnType.COMMS_CONN_RELAY );
}
}
@@ -295,7 +295,7 @@ public class CommsTransport implements TransportProcs,
{
if ( !XWApp.UDP_ENABLED ) {
m_bytesIn.flip();
-
+
for ( ; ; ) {
int len = m_bytesIn.remaining();
if ( len <= 0 ) {
@@ -306,7 +306,7 @@ public class CommsTransport implements TransportProcs,
Assert.assertTrue( len > 1 ); // tell me if I see this case
if ( len == 1 ) { // half a length byte...
break; // can I leave it in the buffer?
- } else {
+ } else {
m_packetIn = new byte[m_bytesIn.getShort()];
m_haveLen = 0;
}
@@ -349,16 +349,16 @@ public class CommsTransport implements TransportProcs,
public int getFlags() { return COMMS_XPORT_FLAGS_NONE; }
- public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
+ public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
CommsConnType conType, int gameID )
{
- DbgUtils.logdf( "CommsTransport.transportSend(len=%d, typ=%s)",
+ DbgUtils.logdf( "CommsTransport.transportSend(len=%d, typ=%s)",
buf.length, conType.toString() );
int nSent = -1;
Assert.assertNotNull( addr );
Assert.assertTrue( addr.contains( conType ) );
- if ( !XWApp.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY
+ if ( !XWApp.UDP_ENABLED && conType == CommsConnType.COMMS_CONN_RELAY
&& null == m_relayAddr ) {
m_relayAddr = new CommsAddrRec( addr );
m_useHost = NetUtils.forceHost( m_relayAddr.ip_relay_hostName );
@@ -374,7 +374,7 @@ public class CommsTransport implements TransportProcs,
nSent = buf.length;
}
} else {
- nSent = sendForAddr( m_context, addr, conType, m_rowid,
+ nSent = sendForAddr( m_context, addr, conType, m_rowid,
gameID, buf );
}
@@ -388,30 +388,30 @@ public class CommsTransport implements TransportProcs,
public void relayStatus( CommsRelayState newState )
{
DbgUtils.logf( "relayStatus called; state=%s", newState.toString() );
-
+
switch( newState ) {
case COMMS_RELAYSTATE_UNCONNECTED:
case COMMS_RELAYSTATE_DENIED:
case COMMS_RELAYSTATE_CONNECT_PENDING:
ConnStatusHandler.updateStatus( m_context, null,
- CommsConnType.COMMS_CONN_RELAY,
+ CommsConnType.COMMS_CONN_RELAY,
false );
break;
- case COMMS_RELAYSTATE_CONNECTED:
- case COMMS_RELAYSTATE_RECONNECTED:
+ case COMMS_RELAYSTATE_CONNECTED:
+ case COMMS_RELAYSTATE_RECONNECTED:
ConnStatusHandler.updateStatusOut( m_context, null,
- CommsConnType.COMMS_CONN_RELAY,
+ CommsConnType.COMMS_CONN_RELAY,
true );
break;
case COMMS_RELAYSTATE_ALLCONNECTED:
ConnStatusHandler.updateStatusIn( m_context, null,
- CommsConnType.COMMS_CONN_RELAY,
+ CommsConnType.COMMS_CONN_RELAY,
true );
break;
}
}
- public void relayConnd( String room, int devOrder, boolean allHere,
+ public void relayConnd( String room, int devOrder, boolean allHere,
int nMissing )
{
m_tpHandler.tpmRelayConnd( room, devOrder, allHere, nMissing );
@@ -428,8 +428,8 @@ public class CommsTransport implements TransportProcs,
return false;
}
- private static int sendForAddr( Context context, CommsAddrRec addr,
- CommsConnType conType, long rowID,
+ private static int sendForAddr( Context context, CommsAddrRec addr,
+ CommsConnType conType, long rowID,
int gameID, byte[] buf )
{
int nSent = -1;
@@ -439,7 +439,7 @@ public class CommsTransport implements TransportProcs,
nSent = RelayService.sendPacket( context, rowID, buf );
break;
case COMMS_CONN_SMS:
- nSent = SMSService.sendPacket( context, addr.sms_phone,
+ nSent = SMSService.sendPacket( context, addr.sms_phone,
gameID, buf );
break;
case COMMS_CONN_BT:
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java
index 4de55ac34..bb224f24a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnStatusHandler.java
@@ -101,7 +101,7 @@ public class ConnStatusHandler {
return format( context, m_time );
}
- public void update( boolean success )
+ public void update( boolean success )
{
long now = System.currentTimeMillis();
if ( success ) {
@@ -112,19 +112,19 @@ public class ConnStatusHandler {
successNewer = success;
}
- private String format( Context context, Time time )
+ private String format( Context context, Time time )
{
- CharSequence seq =
- DateUtils.getRelativeDateTimeString( context,
+ CharSequence seq =
+ DateUtils.getRelativeDateTimeString( context,
time.toMillis(true),
DateUtils.SECOND_IN_MILLIS,
- DateUtils.WEEK_IN_MILLIS,
+ DateUtils.WEEK_IN_MILLIS,
0 );
return seq.toString();
}
// called during deserialization
- private void readObject( ObjectInputStream in )
+ private void readObject( ObjectInputStream in )
throws java.io.IOException, java.lang.ClassNotFoundException
{
in.defaultReadObject();
@@ -134,7 +134,7 @@ public class ConnStatusHandler {
private ConnStatusHandler() {}
- private static HashMap s_records =
+ private static HashMap s_records =
new HashMap();
private static Class s_lockObj = ConnStatusHandler.class;
private static boolean s_needsSave = false;
@@ -184,20 +184,20 @@ public class ConnStatusHandler {
StringBuffer sb = new StringBuffer();
String tmp;
synchronized( s_lockObj ) {
- sb.append( LocUtils.getString( context,
+ sb.append( LocUtils.getString( context,
R.string.connstat_net_fmt,
connTypes.toString( context )));
for ( CommsConnType typ : connTypes.getTypes() ) {
String did = "";
if ( BuildConfig.DEBUG
&& CommsConnType.COMMS_CONN_RELAY == typ ) {
- did = String.format( "(DevID: %d) ",
+ did = String.format( "(DevID: %d) ",
DevID.getRelayDevIDInt(context) );
}
- sb.append( String.format( "\n\n*** %s %s***\n",
+ sb.append( String.format( "\n\n*** %s %s***\n",
typ.longName( context ), did ) );
SuccessRecord record = recordFor( typ, false );
- tmp = LocUtils.getString( context, record.successNewer?
+ tmp = LocUtils.getString( context, record.successNewer?
R.string.connstat_succ :
R.string.connstat_unsucc );
sb.append( LocUtils
@@ -215,14 +215,14 @@ public class ConnStatusHandler {
}
}
if ( 0 != fmtId ) {
- sb.append( LocUtils.getString( context, fmtId,
+ sb.append( LocUtils.getString( context, fmtId,
record.olderStr( context )));
}
sb.append( "\n\n" );
record = recordFor( typ, true );
if ( record.haveSuccess() ) {
- sb.append( LocUtils.getString( context,
+ sb.append( LocUtils.getString( context,
R.string.connstat_lastreceipt_fmt,
record.newerStr( context ) ) );
} else {
@@ -300,7 +300,7 @@ public class ConnStatusHandler {
showSuccessOut( s_cbacks );
}
- public static void draw( Context context, Canvas canvas, Resources res,
+ public static void draw( Context context, Canvas canvas, Resources res,
CommsConnTypeSet connTypes, boolean isSolo )
{
if ( !isSolo && null != s_rect ) {
@@ -347,8 +347,8 @@ public class ConnStatusHandler {
}
}
- private static void drawQuarter( Canvas canvas, Resources res, Rect rect,
- CommsConnTypeSet connTypes,
+ private static void drawQuarter( Canvas canvas, Resources res, Rect rect,
+ CommsConnTypeSet connTypes,
boolean enabled, boolean isIn )
{
enabled = enabled && null != newestSuccess( connTypes, isIn );
@@ -358,10 +358,10 @@ public class ConnStatusHandler {
int arrowID;
boolean showSuccesses = s_showSuccesses[isIn? SUCCESS_IN : SUCCESS_OUT];
if ( isIn ) {
- arrowID = showSuccesses ?
+ arrowID = showSuccesses ?
R.drawable.in_arrow_active : R.drawable.in_arrow;
} else {
- arrowID = showSuccesses ?
+ arrowID = showSuccesses ?
R.drawable.out_arrow_active : R.drawable.out_arrow;
}
drawIn( canvas, res, arrowID, rect );
@@ -373,14 +373,14 @@ public class ConnStatusHandler {
public static void loadState( Context context )
{
synchronized( s_lockObj ) {
- String as64 = XWPrefs.getPrefsString( context,
+ String as64 = XWPrefs.getPrefsString( context,
R.string.key_connstat_data );
if ( null != as64 && 0 < as64.length() ) {
try {
byte[] bytes = XwJNI.base64Decode( as64 );
- ObjectInputStream ois =
+ ObjectInputStream ois =
new ObjectInputStream( new ByteArrayInputStream(bytes) );
- s_records =
+ s_records =
(HashMap)ois.readObject();
// } catch ( java.io.StreamCorruptedException sce ) {
// DbgUtils.logf( "loadState: %s", sce.toString() );
@@ -397,7 +397,7 @@ public class ConnStatusHandler {
}
}
- private static void saveState( final Context context,
+ private static void saveState( final Context context,
ConnStatusCBacks cbcks )
{
if ( null == cbcks ) {
@@ -463,7 +463,7 @@ public class ConnStatusHandler {
icon.draw( canvas );
}
- private static SuccessRecord newestSuccess( CommsConnTypeSet connTypes,
+ private static SuccessRecord newestSuccess( CommsConnTypeSet connTypes,
boolean isIn )
{
SuccessRecord result = null;
@@ -486,7 +486,7 @@ public class ConnStatusHandler {
{
SuccessRecord[] records = s_records.get( connType );
if ( null == records ) {
- records = new SuccessRecord[] { new SuccessRecord(),
+ records = new SuccessRecord[] { new SuccessRecord(),
new SuccessRecord(),
};
s_records.put( connType, records );
@@ -505,9 +505,9 @@ public class ConnStatusHandler {
= new ObjectOutputStream( bas );
out.writeObject(s_records);
out.flush();
- String as64 =
+ String as64 =
XwJNI.base64Encode( bas.toByteArray() );
- XWPrefs.setPrefsString( context, R.string.key_connstat_data,
+ XWPrefs.setPrefsString( context, R.string.key_connstat_data,
as64 );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
@@ -515,7 +515,7 @@ public class ConnStatusHandler {
s_needsSave = false;
}
}
-
+
private static boolean anyTypeEnabled( Context context, CommsConnTypeSet connTypes )
{
boolean enabled = false;
@@ -553,7 +553,7 @@ public class ConnStatusHandler {
return result;
}
- private static boolean getAirplaneModeOn( Context context )
+ private static boolean getAirplaneModeOn( Context context )
{
boolean result =
0 != Settings.System.getInt( context.getContentResolver(),
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnViaViewLayout.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnViaViewLayout.java
index 3c16dee77..6aff3425a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnViaViewLayout.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ConnViaViewLayout.java
@@ -54,7 +54,7 @@ public class ConnViaViewLayout extends LinearLayout {
}
protected void configure( CommsConnTypeSet types,
- CheckEnabledWarner cew,
+ CheckEnabledWarner cew,
SetEmptyWarner sew,
DlgDelegate.HasDlgDelegate dlgDlgt )
{
@@ -87,10 +87,10 @@ public class ConnViaViewLayout extends LinearLayout {
box.setText( typ.longName( context ) );
box.setChecked( m_curSet.contains( typ ) );
list.addView( item );
-
+
final CommsConnType typf = typ;
box.setOnCheckedChangeListener( new OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean isChecked ) {
if ( isChecked ) {
showNotAgainTypeTip( typf );
@@ -153,7 +153,7 @@ public class ConnViaViewLayout extends LinearLayout {
Assert.fail();
break;
}
- m_dlgDlgt.showNotAgainDlgThen( msgID, keyID,
+ m_dlgDlgt.showNotAgainDlgThen( msgID, keyID,
DlgDelegate.Action.SKIP_CALLBACK );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java
index 162801c5c..5303496d8 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java
@@ -87,7 +87,7 @@ public class DBHelper extends SQLiteOpenHelper {
public static final String WORDCOUNT = "WORDCOUNT";
public static final String WORDCOUNTS = "WORDCOUNTS";
public static final String LANGCODE = "LANGCODE";
- public static final String LOC = "LOC";
+ public static final String LOC = "LOC";
public static final String ITERMIN = "ITERMIN";
public static final String ITERMAX = "ITERMAX";
public static final String ITERPOS = "ITERPOS";
@@ -236,7 +236,7 @@ public class DBHelper extends SQLiteOpenHelper {
}
@Override
- public void onCreate( SQLiteDatabase db )
+ public void onCreate( SQLiteDatabase db )
{
createTable( db, TABLE_NAME_SUM, s_summaryColsAndTypes );
createTable( db, TABLE_NAME_OBITS, s_obitsColsAndTypes );
@@ -254,7 +254,7 @@ public class DBHelper extends SQLiteOpenHelper {
@Override
@SuppressWarnings("fallthrough")
- public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion )
+ public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion )
{
DbgUtils.logf( false, "onUpgrade: old: %d; new: %d", oldVersion, newVersion );
@@ -359,9 +359,9 @@ public class DBHelper extends SQLiteOpenHelper {
db.execSQL( cmd );
}
- private void createTable( SQLiteDatabase db, String name, String[][] data )
+ private void createTable( SQLiteDatabase db, String name, String[][] data )
{
- StringBuilder query =
+ StringBuilder query =
new StringBuilder( String.format("CREATE TABLE %s (", name ) );
for ( int ii = 0; ii < data.length; ++ii ) {
@@ -438,11 +438,11 @@ public class DBHelper extends SQLiteOpenHelper {
// Move all existing games to the row previously named "cur games'
private void moveToCurGames( SQLiteDatabase db )
{
- String name = LocUtils.getString( m_context, false,
+ String name = LocUtils.getString( m_context, false,
R.string.group_cur_games );
String[] columns = { "rowid" };
String selection = String.format( "%s = '%s'", GROUPNAME, name );
- Cursor cursor = db.query( DBHelper.TABLE_NAME_GROUPS, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_GROUPS, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
long rowid = cursor.getLong( cursor.getColumnIndex("rowid") );
@@ -454,7 +454,7 @@ public class DBHelper extends SQLiteOpenHelper {
cursor.close();
}
- private void makeAutoincrement( SQLiteDatabase db, String name,
+ private void makeAutoincrement( SQLiteDatabase db, String name,
String[][] data )
{
db.beginTransaction();
@@ -468,9 +468,9 @@ public class DBHelper extends SQLiteOpenHelper {
}
createTable( db, name, data );
forceRowidHigh( db, name );
-
+
if ( null != columnNames ) {
- ArrayList oldCols =
+ ArrayList oldCols =
new ArrayList( Arrays.asList( columnNames ) );
// Make a list of columns in the new DB, using it to
@@ -488,23 +488,23 @@ public class DBHelper extends SQLiteOpenHelper {
oldCols.retainAll( newCols );
String cols = TextUtils.join( ",", oldCols );
- query =
+ query =
String.format( "INSERT INTO %s (%s) SELECT %s from temp_%s",
name, cols, cols, name );
db.execSQL( query );
}
db.execSQL( String.format( "DROP table temp_%s", name ) );
-
+
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
- private void setColumnsEqual( SQLiteDatabase db, String table,
+ private void setColumnsEqual( SQLiteDatabase db, String table,
String dest, String src )
{
- String query = String.format( "UPDATE %s set %s = %s", table,
+ String query = String.format( "UPDATE %s set %s = %s", table,
dest, src );
db.execSQL( query );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java
index f6ff7a0ca..692bdbdc2 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java
@@ -85,7 +85,7 @@ public class DBUtils {
public static interface DBChangeListener {
public void gameSaved( long rowid, GameChangeType change );
}
- private static HashSet s_listeners =
+ private static HashSet s_listeners =
new HashSet();
private static SQLiteOpenHelper s_dbHelper = null;
@@ -117,7 +117,7 @@ public class DBUtils {
public int[] m_counts;
}
- public static GameSummary getSummary( Context context, long rowid,
+ public static GameSummary getSummary( Context context, long rowid,
long maxMillis )
{
GameSummary result = null;
@@ -138,7 +138,7 @@ public class DBUtils {
return getSummary( context, rowid, 0L );
}
- public static GameSummary getSummary( Context context,
+ public static GameSummary getSummary( Context context,
GameLock lock )
{
initDB( context );
@@ -149,10 +149,10 @@ public class DBUtils {
DBHelper.GAME_OVER, DBHelper.PLAYERS,
DBHelper.TURN, DBHelper.GIFLAGS,
DBHelper.CONTYPE, DBHelper.SERVERROLE,
- DBHelper.ROOMNAME, DBHelper.RELAYID,
- /*DBHelper.SMSPHONE,*/ DBHelper.SEED,
+ DBHelper.ROOMNAME, DBHelper.RELAYID,
+ /*DBHelper.SMSPHONE,*/ DBHelper.SEED,
DBHelper.DICTLANG, DBHelper.GAMEID,
- DBHelper.SCORES,
+ DBHelper.SCORES,
DBHelper.LASTPLAY_TIME, DBHelper.REMOTEDEVS,
DBHelper.LASTMOVE, DBHelper.NPACKETSPENDING,
DBHelper.EXTRAS,
@@ -161,16 +161,16 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
summary = new GameSummary( context );
summary.nMoves = cursor.getInt(cursor.
getColumnIndex(DBHelper.NUM_MOVES));
- summary.nPlayers =
+ summary.nPlayers =
cursor.getInt(cursor.
getColumnIndex(DBHelper.NUM_PLAYERS));
- summary.missingPlayers =
+ summary.missingPlayers =
cursor.getInt(cursor.
getColumnIndex(DBHelper.MISSINGPLYRS));
summary.
@@ -178,36 +178,36 @@ public class DBUtils {
getString( cursor.
getColumnIndex( DBHelper.
PLAYERS ) ) );
- summary.turn =
+ summary.turn =
cursor.getInt(cursor.
getColumnIndex(DBHelper.TURN));
summary.
setGiFlags( cursor.getInt(cursor.
getColumnIndex(DBHelper.GIFLAGS))
);
- summary.gameID =
- cursor.getInt(cursor.getColumnIndex(DBHelper.GAMEID) );
+ summary.gameID =
+ cursor.getInt(cursor.getColumnIndex(DBHelper.GAMEID) );
String players = cursor.
getString(cursor.getColumnIndex( DBHelper.PLAYERS ));
summary.readPlayers( players );
- summary.dictLang =
+ summary.dictLang =
cursor.getInt(cursor.
getColumnIndex(DBHelper.DICTLANG));
- summary.modtime =
+ summary.modtime =
cursor.getLong(cursor.
getColumnIndex(DBHelper.LASTPLAY_TIME));
int tmp = cursor.getInt(cursor.
getColumnIndex(DBHelper.GAME_OVER));
summary.gameOver = tmp != 0;
- summary.lastMoveTime =
+ summary.lastMoveTime =
cursor.getInt(cursor.getColumnIndex(DBHelper.LASTMOVE));
String str = cursor
.getString(cursor.getColumnIndex(DBHelper.EXTRAS));
summary.setExtras( str );
- String scoresStr =
+ String scoresStr =
cursor.getString( cursor.getColumnIndex(DBHelper.SCORES));
int[] scores = new int[summary.nPlayers];
if ( null != scoresStr && scoresStr.length() > 0 ) {
@@ -254,7 +254,7 @@ public class DBUtils {
case COMMS_CONN_SMS:
col = cursor.getColumnIndex( DBHelper.REMOTEDEVS );
if ( col >= 0 ) {
- summary.setRemoteDevs( context,
+ summary.setRemoteDevs( context,
cursor.getString( col ) );
}
break;
@@ -292,7 +292,7 @@ public class DBUtils {
values.put( DBHelper.MISSINGPLYRS, summary.missingPlayers );
values.put( DBHelper.TURN, summary.turn );
values.put( DBHelper.GIFLAGS, summary.giflags() );
- values.put( DBHelper.PLAYERS,
+ values.put( DBHelper.PLAYERS,
summary.summarizePlayers() );
values.put( DBHelper.DICTLANG, summary.dictLang );
values.put( DBHelper.GAMEID, summary.gameID );
@@ -308,11 +308,11 @@ public class DBUtils {
values.put( DBHelper.EXTRAS, summary.getExtras() );
}
long nextNag = summary.nextTurnIsLocal() ?
- NagTurnReceiver.figureNextNag( context,
+ NagTurnReceiver.figureNextNag( context,
1000*(long)summary.lastMoveTime )
: 0;
values.put( DBHelper.NEXTNAG, nextNag );
-
+
values.put( DBHelper.DICTLIST, summary.dictNames(DICTS_SEP) );
if ( null != summary.scores ) {
@@ -338,7 +338,7 @@ public class DBUtils {
break;
case COMMS_CONN_BT:
case COMMS_CONN_SMS:
- values.put( DBHelper.REMOTEDEVS,
+ values.put( DBHelper.REMOTEDEVS,
summary.summarizeDevs() );
break;
}
@@ -373,7 +373,7 @@ public class DBUtils {
}
} // saveSummary
- public static void addRematchInfo( Context context, long rowid, String btAddr,
+ public static void addRematchInfo( Context context, long rowid, String btAddr,
String phone, String relayID )
{
if ( XWApp.REMATCH_SUPPORTED ) {
@@ -403,7 +403,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
result = cursor.getCount();
@@ -416,17 +416,17 @@ public class DBUtils {
public static int countGamesUsingDict( Context context, String dict )
{
int result = 0;
- String pattern = String.format( "%%%s%s%s%%",
+ String pattern = String.format( "%%%s%s%s%%",
DICTS_SEP, dict, DICTS_SEP );
- String selection = String.format( "%s LIKE '%s'",
+ String selection = String.format( "%s LIKE '%s'",
DBHelper.DICTLIST, pattern );
// null for columns will return whole rows: bad. But
// might as well make it an int for speed
- String[] columns = { DBHelper.DICTLANG };
+ String[] columns = { DBHelper.DICTLANG };
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
result = cursor.getCount();
cursor.close();
@@ -549,26 +549,26 @@ public class DBUtils {
}
return result;
}
-
+
}
public static SentInvitesInfo getInvitesFor( Context context, long rowid )
{
SentInvitesInfo result = new SentInvitesInfo( rowid );
- String[] columns = { DBHelper.MEANS, DBHelper.TIMESTAMP, DBHelper.TARGET };
+ String[] columns = { DBHelper.MEANS, DBHelper.TIMESTAMP, DBHelper.TARGET };
String selection = String.format( "%s = %d", DBHelper.ROW, rowid );
String orderBy = DBHelper.TIMESTAMP + " DESC";
-
+
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_INVITES, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_INVITES, columns,
selection, null, null, null, orderBy );
if ( 0 < cursor.getCount() ) {
int indxMns = cursor.getColumnIndex( DBHelper.MEANS );
int indxTS = cursor.getColumnIndex( DBHelper.TIMESTAMP );
int indxTrgt = cursor.getColumnIndex( DBHelper.TARGET );
-
+
while ( cursor.moveToNext() ) {
InviteMeans means = InviteMeans.values()[cursor.getInt( indxMns )];
Timestamp ts = Timestamp.valueOf(cursor.getString(indxTS));
@@ -579,7 +579,7 @@ public class DBUtils {
cursor.close();
db.close();
}
-
+
return result;
}
@@ -629,7 +629,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result =
@@ -643,7 +643,7 @@ public class DBUtils {
public static int getMsgFlags( Context context, long rowid )
{
- return getInt( context, rowid, DBHelper.HASMSGS,
+ return getInt( context, rowid, DBHelper.HASMSGS,
GameSummary.MSG_FLAGS_NONE );
}
@@ -652,56 +652,52 @@ public class DBUtils {
return 0 == getInt( context, rowid, DBHelper.CONTRACTED, 0 );
}
- public static boolean gameOver( Context context, long rowid )
+ public static boolean gameOver( Context context, long rowid )
{
return 0 != getInt( context, rowid, DBHelper.GAME_OVER, 0 );
}
- public static void saveThumbnail( Context context, GameLock lock,
+ public static void saveThumbnail( Context context, GameLock lock,
Bitmap thumb )
{
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- long rowid = lock.getRowid();
- String selection = String.format( ROW_ID_FMT, rowid );
- ContentValues values = new ContentValues();
+ long rowid = lock.getRowid();
+ String selection = String.format( ROW_ID_FMT, rowid );
+ ContentValues values = new ContentValues();
- if ( null == thumb ) {
- values.putNull( DBHelper.THUMBNAIL );
- } else {
- ByteArrayOutputStream bas = new ByteArrayOutputStream();
- thumb.compress( CompressFormat.PNG, 0, bas );
- values.put( DBHelper.THUMBNAIL, bas.toByteArray() );
- }
+ if ( null == thumb ) {
+ values.putNull( DBHelper.THUMBNAIL );
+ } else {
+ ByteArrayOutputStream bas = new ByteArrayOutputStream();
+ thumb.compress( CompressFormat.PNG, 0, bas );
+ values.put( DBHelper.THUMBNAIL, bas.toByteArray() );
+ }
- initDB( context );
- synchronized( s_dbHelper ) {
- SQLiteDatabase db = s_dbHelper.getWritableDatabase();
+ initDB( context );
+ synchronized( s_dbHelper ) {
+ SQLiteDatabase db = s_dbHelper.getWritableDatabase();
- long result = db.update( DBHelper.TABLE_NAME_SUM,
- values, selection, null );
- Assert.assertTrue( result >= 0 );
+ long result = db.update( DBHelper.TABLE_NAME_SUM,
+ values, selection, null );
+ Assert.assertTrue( result >= 0 );
- db.close();
+ db.close();
- notifyListeners( rowid, GameChangeType.GAME_CHANGED );
- }
+ notifyListeners( rowid, GameChangeType.GAME_CHANGED );
}
}
public static void clearThumbnails( Context context )
{
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- ContentValues values = new ContentValues();
- values.putNull( DBHelper.THUMBNAIL );
- initDB( context );
- synchronized( s_dbHelper ) {
- SQLiteDatabase db = s_dbHelper.getWritableDatabase();
- long result = db.update( DBHelper.TABLE_NAME_SUM,
- values, null, null );
- db.close();
+ ContentValues values = new ContentValues();
+ values.putNull( DBHelper.THUMBNAIL );
+ initDB( context );
+ synchronized( s_dbHelper ) {
+ SQLiteDatabase db = s_dbHelper.getWritableDatabase();
+ long result = db.update( DBHelper.TABLE_NAME_SUM,
+ values, null, null );
+ db.close();
- notifyListeners( ROWIDS_ALL, GameChangeType.GAME_CHANGED );
- }
+ notifyListeners( ROWIDS_ALL, GameChangeType.GAME_CHANGED );
}
}
@@ -713,10 +709,10 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
- result =
+ result =
cursor.getString( cursor.getColumnIndex(DBHelper.RELAYID) );
}
cursor.close();
@@ -725,7 +721,7 @@ public class DBUtils {
return result;
}
- public static HashMap
+ public static HashMap
getGamesWithSendsPending( Context context )
{
HashMap result = new HashMap();
@@ -734,7 +730,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
int indx1 = cursor.getColumnIndex( ROW_ID );
int indx2 = cursor.getColumnIndex( DBHelper.CONTYPE );
@@ -759,7 +755,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
int indx = cursor.getColumnIndex( DBHelper.CONTYPE );
while ( cursor.moveToNext() ) {
@@ -782,7 +778,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
result = new long[cursor.getCount()];
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
@@ -802,7 +798,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
result = new long[cursor.getCount()];
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
@@ -818,13 +814,13 @@ public class DBUtils {
return result;
}
- public static boolean haveGame( Context context, int gameID )
+ public static boolean haveGame( Context context, int gameID )
{
long[] rows = getRowIDsFor( context, gameID );
return rows != null && 0 < rows.length;
}
- public static boolean haveGame( Context context, long rowid )
+ public static boolean haveGame( Context context, long rowid )
{
boolean result = false;
String[] columns = { ROW_ID };
@@ -832,7 +828,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
Assert.assertTrue( 1 >= cursor.getCount() );
result = 1 == cursor.getCount();
@@ -842,18 +838,18 @@ public class DBUtils {
return result;
}
- public static void listBTGames( Context context,
+ public static void listBTGames( Context context,
HashMap result )
{
HashSet set;
String[] columns = { DBHelper.GAMEID, DBHelper.REMOTEDEVS };
String selection = DBHelper.GAMEID + "!=0";
- HashMap > map =
+ HashMap > map =
new HashMap >();
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
while ( cursor.moveToNext() ) {
int col = cursor.getColumnIndex( DBHelper.GAMEID );
@@ -904,7 +900,7 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( cursor.moveToNext() ) {
int indx = cursor.getColumnIndex( columns[0] );
@@ -917,7 +913,7 @@ public class DBUtils {
return result;
}
- public static String[] getRelayIDs( Context context, long[][] rowIDs )
+ public static String[] getRelayIDs( Context context, long[][] rowIDs )
{
String[] result = null;
String[] columns = { ROW_ID, DBHelper.RELAYID };
@@ -928,7 +924,7 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
int count = cursor.getCount();
if ( 0 < count ) {
@@ -961,7 +957,7 @@ public class DBUtils {
return result;
}
- public static void addDeceased( Context context, String relayID,
+ public static void addDeceased( Context context, String relayID,
int seed )
{
ContentValues values = new ContentValues();
@@ -991,7 +987,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_OBITS, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_OBITS, columns,
null, null, null, null, null );
if ( 0 < cursor.getCount() ) {
int idIndex = cursor.getColumnIndex( DBHelper.RELAYID );
@@ -1015,7 +1011,7 @@ public class DBUtils {
public static void clearObits( Context context, Obit[] obits )
{
- String fmt = DBHelper.RELAYID + "= \"%s\" AND + "
+ String fmt = DBHelper.RELAYID + "= \"%s\" AND + "
+ DBHelper.SEED + " = %d";
initDB( context );
@@ -1023,7 +1019,7 @@ public class DBUtils {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
for ( Obit obit: obits ) {
- String selection = String.format( fmt, obit.m_relayID,
+ String selection = String.format( fmt, obit.m_relayID,
obit.m_seed );
db.delete( DBHelper.TABLE_NAME_OBITS, selection, null );
}
@@ -1068,7 +1064,7 @@ public class DBUtils {
return lock;
} // saveNewGame
- public static long saveGame( Context context, GameLock lock,
+ public static long saveGame( Context context, GameLock lock,
byte[] bytes, boolean setCreate )
{
Assert.assertTrue( lock.canWrite() );
@@ -1105,7 +1101,7 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result = cursor.getBlob( cursor
@@ -1150,7 +1146,9 @@ public class DBUtils {
// Delete chats too -- same sel as for invites
db.delete( DBHelper.TABLE_NAME_CHAT, selInvites, null );
-
+
+ deleteCurChatsSync( db, rowid );
+
db.close();
}
notifyListeners( lock.getRowid(), GameChangeType.GAME_DELETED );
@@ -1166,7 +1164,7 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result = cursor.getInt( cursor
@@ -1189,7 +1187,7 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result = cursor.getString( cursor
@@ -1270,43 +1268,81 @@ public class DBUtils {
boolean[] playersLocal )
{
HistoryPair[] result = null;
- if ( BuildConstants.CHAT_SUPPORTED ) {
- String[] columns = { DBHelper.SENDER, DBHelper.MESSAGE };
- String selection = String.format( "%s=%d", DBHelper.ROW, rowid );
- initDB( context );
- synchronized( s_dbHelper ) {
- SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_CHAT, columns,
- selection, null, null, null, null );
- if ( 0 < cursor.getCount() ) {
- result = new HistoryPair[cursor.getCount()];
- int msgIndex = cursor.getColumnIndex( DBHelper.MESSAGE );
- int plyrIndex = cursor.getColumnIndex( DBHelper.SENDER );
- for ( int ii = 0; cursor.moveToNext(); ++ii ) {
- String msg = cursor.getString( msgIndex );
- int plyr = cursor.getInt( plyrIndex );
- HistoryPair pair = new HistoryPair(msg, plyr );
- result[ii] = pair;
- }
+ String[] columns = { DBHelper.SENDER, DBHelper.MESSAGE };
+ String selection = String.format( "%s=%d", DBHelper.ROW, rowid );
+ initDB( context );
+ synchronized( s_dbHelper ) {
+ SQLiteDatabase db = s_dbHelper.getReadableDatabase();
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_CHAT, columns,
+ selection, null, null, null, null );
+ if ( 0 < cursor.getCount() ) {
+ result = new HistoryPair[cursor.getCount()];
+ int msgIndex = cursor.getColumnIndex( DBHelper.MESSAGE );
+ int plyrIndex = cursor.getColumnIndex( DBHelper.SENDER );
+ for ( int ii = 0; cursor.moveToNext(); ++ii ) {
+ String msg = cursor.getString( msgIndex );
+ int plyr = cursor.getInt( plyrIndex );
+ HistoryPair pair = new HistoryPair(msg, plyr );
+ result[ii] = pair;
}
- cursor.close();
- db.close();
- }
-
- if ( null == result ) {
- result = convertChatString( context, rowid, playersLocal );
}
+ cursor.close();
+ db.close();
+ }
+
+ if ( null == result ) {
+ result = convertChatString( context, rowid, playersLocal );
}
return result;
}
+ private static String formatCurChatKey( long rowid ) {
+ return formatCurChatKey( rowid, -1 );
+ }
+
+ private static String formatCurChatKey( long rowid, int player ) {
+ String playerMatch = 0 <= player ? String.format( "%d", player ) : "%";
+ String result = String.format("<>", rowid, playerMatch );
+ return result;
+ }
+
+ public static String getCurChat( Context context, long rowid, int player,
+ int[] startAndEndOut ) {
+ String result = null;
+ String key = formatCurChatKey( rowid, player );
+ String all = getStringFor( context, key, "" );
+ String[] parts = TextUtils.split( all, ":" );
+ if ( 3 <= parts.length ) {
+ result = all.substring( 2 + parts[0].length() + parts[1].length() );
+ startAndEndOut[0] = Math.min( result.length(),
+ Integer.parseInt( parts[0] ) );
+ startAndEndOut[1] = Math.min( result.length(),
+ Integer.parseInt( parts[1] ) );
+ }
+ DbgUtils.logdf( "getCurChat(): => %s [%d,%d]", result,
+ startAndEndOut[0], startAndEndOut[1] );
+ return result;
+ }
+
+ public static void setCurChat( Context context, long rowid, int player,
+ String text, int start, int end ) {
+ String key = formatCurChatKey( rowid, player );
+ text = String.format( "%d:%d:%s", start, end, text );
+ setStringFor( context, key, text );
+ }
+
+ private static void deleteCurChatsSync( SQLiteDatabase db, long rowid ) {
+ String like = formatCurChatKey( rowid );
+ delStringsLikeSync( db, like );
+ }
+
public static class NeedsNagInfo {
public long m_rowid;
public long m_nextNag;
public long m_lastMoveMillis;
private boolean m_isSolo;
- public NeedsNagInfo( long rowid, long nextNag, long lastMove,
+ public NeedsNagInfo( long rowid, long nextNag, long lastMove,
CurGameInfo.DeviceRole role ) {
m_rowid = rowid;
m_nextNag = nextNag;
@@ -1323,16 +1359,16 @@ public class DBUtils {
{
NeedsNagInfo[] result = null;
long now = new Date().getTime(); // in milliseconds
- String[] columns = { ROW_ID, DBHelper.NEXTNAG, DBHelper.LASTMOVE,
+ String[] columns = { ROW_ID, DBHelper.NEXTNAG, DBHelper.LASTMOVE,
DBHelper.SERVERROLE };
// where nextnag > 0 AND nextnag < now
- String selection =
- String.format( "%s > 0 AND %s < %s", DBHelper.NEXTNAG,
+ String selection =
+ String.format( "%s > 0 AND %s < %s", DBHelper.NEXTNAG,
DBHelper.NEXTNAG, now );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
int count = cursor.getCount();
if ( 0 < count ) {
@@ -1345,7 +1381,7 @@ public class DBUtils {
long rowid = cursor.getLong( rowIndex );
long nextNag = cursor.getLong( nagIndex );
long lastMove = cursor.getLong( lastMoveIndex );
- CurGameInfo.DeviceRole role =
+ CurGameInfo.DeviceRole role =
CurGameInfo.DeviceRole.values()[cursor.getInt( roleIndex )];
result[ii] = new NeedsNagInfo( rowid, nextNag, lastMove, role );
}
@@ -1365,7 +1401,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, null, null, null, null );
if ( cursor.moveToNext() ) {
result = cursor.getLong( cursor.getColumnIndex( "min" ) );
@@ -1415,7 +1451,7 @@ public class DBUtils {
private static HashMap s_groupsCache = null;
- private static void invalGroupsCache()
+ private static void invalGroupsCache()
{
s_groupsCache = null;
}
@@ -1423,27 +1459,25 @@ public class DBUtils {
public static Bitmap getThumbnail( Context context, long rowid )
{
Bitmap thumb = null;
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- byte[] data = null;
- String[] columns = { DBHelper.THUMBNAIL };
- String selection = String.format( ROW_ID_FMT, rowid );
+ byte[] data = null;
+ String[] columns = { DBHelper.THUMBNAIL };
+ String selection = String.format( ROW_ID_FMT, rowid );
- initDB( context );
- synchronized( s_dbHelper ) {
- SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
- selection, null, null, null, null );
- if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
- data = cursor.getBlob( cursor.
- getColumnIndex(DBHelper.THUMBNAIL));
- }
- cursor.close();
- db.close();
+ initDB( context );
+ synchronized( s_dbHelper ) {
+ SQLiteDatabase db = s_dbHelper.getReadableDatabase();
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ selection, null, null, null, null );
+ if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
+ data = cursor.getBlob( cursor.
+ getColumnIndex(DBHelper.THUMBNAIL));
}
+ cursor.close();
+ db.close();
+ }
- if ( null != data ) {
- thumb = BitmapFactory.decodeByteArray( data, 0, data.length );
- }
+ if ( null != data ) {
+ thumb = BitmapFactory.decodeByteArray( data, 0, data.length );
}
return thumb;
}
@@ -1454,7 +1488,7 @@ public class DBUtils {
String query = "SELECT %s, count(%s) as cnt FROM %s GROUP BY %s";
query = String.format( query, DBHelper.GROUPID, DBHelper.GROUPID,
DBHelper.TABLE_NAME_SUM, DBHelper.GROUPID );
-
+
Cursor cursor = db.rawQuery( query, null );
int rowIndex = cursor.getColumnIndex( DBHelper.GROUPID );
int cntIndex = cursor.getColumnIndex( "cnt" );
@@ -1471,7 +1505,7 @@ public class DBUtils {
protected static HashMap getGroups( Context context )
{
if ( null == s_groupsCache ) {
- HashMap result =
+ HashMap result =
new HashMap();
// Select all groups. For each group get the number of games in
@@ -1534,21 +1568,21 @@ public class DBUtils {
// }
// }
- private static void readTurnInfo( SQLiteDatabase db, long groupID,
+ private static void readTurnInfo( SQLiteDatabase db, long groupID,
GameGroupInfo ggi )
{
- String[] columns = { DBHelper.LASTMOVE, DBHelper.GIFLAGS,
+ String[] columns = { DBHelper.LASTMOVE, DBHelper.GIFLAGS,
DBHelper.TURN };
String orderBy = DBHelper.LASTMOVE;
String selection = String.format( "%s=%d", DBHelper.GROUPID, groupID );
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection,
null, // args
null, // groupBy,
null, // having
orderBy
);
-
+
// We want the earliest LASTPLAY_TIME (i.e. the first we see
// since they're in order) that's a local turn, if any,
// otherwise a non-local turn.
@@ -1580,9 +1614,9 @@ public class DBUtils {
} else {
ggi.m_lastMoveTime = lastPlayTimeRemote;
}
- // DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
+ // DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
// DateFormat.SHORT );
- // DbgUtils.logf( "using last play time %s for",
+ // DbgUtils.logf( "using last play time %s for",
// df.format( new Date( 1000 * ggi.m_lastMoveTime ) ) );
}
}
@@ -1594,7 +1628,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
null, // selection
null, // args
null, // groupBy
@@ -1617,7 +1651,7 @@ public class DBUtils {
String orderBy = DBHelper.CREATE_TIME + " DESC";
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, // selection
null, // args
null, // groupBy
@@ -1654,12 +1688,12 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, // selection
null, // args
null, // groupBy
null, // having
- null //orderby
+ null //orderby
);
if ( cursor.moveToNext() ) {
int index = cursor.getColumnIndex( DBHelper.GROUPID );
@@ -1696,7 +1730,7 @@ public class DBUtils {
// initDB( context ); <- getGroups will have called this
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
- rowid = db.insert( DBHelper.TABLE_NAME_GROUPS, null,
+ rowid = db.insert( DBHelper.TABLE_NAME_GROUPS, null,
values );
db.close();
}
@@ -1705,11 +1739,11 @@ public class DBUtils {
}
return rowid;
}
-
+
public static void deleteGroup( Context context, long groupid )
{
// Nuke games having this group id
- String selectionGames =
+ String selectionGames =
String.format( "%s=%d", DBHelper.GROUPID, groupid );
// And nuke the group record itself
@@ -1726,7 +1760,7 @@ public class DBUtils {
invalGroupsCache();
}
- public static void setGroupName( Context context, long groupid,
+ public static void setGroupName( Context context, long groupid,
String name )
{
ContentValues values = new ContentValues();
@@ -1735,7 +1769,7 @@ public class DBUtils {
invalGroupsCache();
}
- public static void setGroupExpanded( Context context, long groupid,
+ public static void setGroupExpanded( Context context, long groupid,
boolean expanded )
{
ContentValues values = new ContentValues();
@@ -1756,29 +1790,27 @@ public class DBUtils {
private static String getChatHistoryStr( Context context, long rowid )
{
String result = null;
- if ( BuildConstants.CHAT_SUPPORTED ) {
- String[] columns = { DBHelper.CHAT_HISTORY };
- String selection = String.format( ROW_ID_FMT, rowid );
- initDB( context );
- synchronized( s_dbHelper ) {
- SQLiteDatabase db = s_dbHelper.getReadableDatabase();
+ String[] columns = { DBHelper.CHAT_HISTORY };
+ String selection = String.format( ROW_ID_FMT, rowid );
+ initDB( context );
+ synchronized( s_dbHelper ) {
+ SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
- selection, null, null, null, null );
- if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
- result =
- cursor.getString( cursor
- .getColumnIndex(DBHelper
- .CHAT_HISTORY));
- }
- cursor.close();
- db.close();
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
+ selection, null, null, null, null );
+ if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
+ result =
+ cursor.getString( cursor
+ .getColumnIndex(DBHelper
+ .CHAT_HISTORY));
}
+ cursor.close();
+ db.close();
}
return result;
}
- private static void appendChatHistory( Context context,
+ private static void appendChatHistory( Context context,
ArrayList valuess )
{
initDB( context );
@@ -1808,7 +1840,7 @@ public class DBUtils {
ArrayList valuess = new ArrayList();
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
appendChatHistory( context, valuess );
- DbgUtils.logf( "appendChatHistory: inserted \"%s\" from player %d",
+ DbgUtils.logf( "appendChatHistory: inserted \"%s\" from player %d",
msg, fromPlayer );
} // appendChatHistory
@@ -1892,13 +1924,13 @@ public class DBUtils {
String[] columns = { DBHelper.ITERPOS, DBHelper.ITERTOP,
DBHelper.ITERMIN, DBHelper.ITERMAX,
DBHelper.WORDCOUNTS, DBHelper.ITERPREFIX };
- String selection =
- String.format( NAMELOC_FMT, DBHelper.DICTNAME,
+ String selection =
+ String.format( NAMELOC_FMT, DBHelper.DICTNAME,
name, DBHelper.LOC, loc.ordinal() );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_DICTBROWSE, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_DICTBROWSE, columns,
selection, null, null, null, null );
if ( 1 >= cursor.getCount() && cursor.moveToFirst() ) {
result = new DictBrowseState();
@@ -1906,16 +1938,16 @@ public class DBUtils {
.getColumnIndex(DBHelper.ITERPOS));
result.m_top = cursor.getInt( cursor
.getColumnIndex(DBHelper.ITERTOP));
- result.m_minShown =
+ result.m_minShown =
cursor.getInt( cursor
.getColumnIndex(DBHelper.ITERMIN));
- result.m_maxShown =
+ result.m_maxShown =
cursor.getInt( cursor
.getColumnIndex(DBHelper.ITERMAX));
- result.m_prefix =
+ result.m_prefix =
cursor.getString( cursor
.getColumnIndex(DBHelper.ITERPREFIX));
- String counts =
+ String counts =
cursor.getString( cursor.getColumnIndex(DBHelper.WORDCOUNTS));
if ( null != counts ) {
String[] nums = TextUtils.split( counts, ":" );
@@ -1932,12 +1964,12 @@ public class DBUtils {
return result;
}
- public static void dictsSetOffset( Context context, String name,
+ public static void dictsSetOffset( Context context, String name,
DictLoc loc, DictBrowseState state )
{
Assert.assertTrue( DictLoc.UNKNOWN != loc );
- String selection =
- String.format( NAMELOC_FMT, DBHelper.DICTNAME,
+ String selection =
+ String.format( NAMELOC_FMT, DBHelper.DICTNAME,
name, DBHelper.LOC, loc.ordinal() );
ContentValues values = new ContentValues();
values.put( DBHelper.ITERPOS, state.m_pos );
@@ -2005,14 +2037,14 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_DICTINFO, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_DICTINFO, columns,
selection, null, null, null, null );
if ( 1 == cursor.getCount() && cursor.moveToFirst() ) {
result = new DictInfo();
result.name = name;
- result.langCode =
+ result.langCode =
cursor.getInt( cursor.getColumnIndex(DBHelper.LANGCODE));
- result.wordCount =
+ result.wordCount =
cursor.getInt( cursor.getColumnIndex(DBHelper.WORDCOUNT));
result.md5Sum =
cursor.getString( cursor.getColumnIndex(DBHelper.MD5SUM));
@@ -2026,7 +2058,7 @@ public class DBUtils {
public static void dictsSetInfo( Context context, DictUtils.DictAndLoc dal,
DictInfo info )
{
- String selection =
+ String selection =
String.format( NAME_FMT, DBHelper.DICTNAME, dal.name );
ContentValues values = new ContentValues();
@@ -2051,8 +2083,8 @@ public class DBUtils {
public static void dictsMoveInfo( Context context, String name,
DictLoc fromLoc, DictLoc toLoc )
{
- String selection =
- String.format( NAMELOC_FMT, DBHelper.DICTNAME,
+ String selection =
+ String.format( NAMELOC_FMT, DBHelper.DICTNAME,
name, DBHelper.LOC, fromLoc.ordinal() );
ContentValues values = new ContentValues();
values.put( DBHelper.LOC, toLoc.ordinal() );
@@ -2066,11 +2098,11 @@ public class DBUtils {
}
}
- public static void dictsRemoveInfo( Context context,
+ public static void dictsRemoveInfo( Context context,
DictUtils.DictAndLoc dal )
{
- String selection =
- String.format( NAMELOC_FMT, DBHelper.DICTNAME,
+ String selection =
+ String.format( NAMELOC_FMT, DBHelper.DICTNAME,
dal.name, DBHelper.LOC, dal.loc.ordinal() );
initDB( context );
@@ -2120,7 +2152,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_STUDYLIST, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_STUDYLIST, columns,
null, null, groupBy, null, null );
int count = cursor.getCount();
result = new int[count];
@@ -2147,7 +2179,7 @@ public class DBUtils {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_STUDYLIST, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_STUDYLIST, columns,
selection, null, null, null, orderBy );
int count = cursor.getCount();
result = new String[count];
@@ -2197,11 +2229,11 @@ public class DBUtils {
insertQuery = String.format( insertQuery, DBHelper.TABLE_NAME_LOC,
DBHelper.KEY, DBHelper.LOCALE,
DBHelper.BLESSED, DBHelper.XLATION );
-
+
String updateQuery = "update %s set %s = ? "
+ " WHERE %s = ? and %s = ? and %s = ?";
updateQuery = String.format( updateQuery, DBHelper.TABLE_NAME_LOC,
- DBHelper.XLATION, DBHelper.KEY,
+ DBHelper.XLATION, DBHelper.KEY,
DBHelper.LOCALE, DBHelper.BLESSED );
initDB( context );
@@ -2220,7 +2252,7 @@ public class DBUtils {
insertStmt.bindString( 2, locale );
insertStmt.bindLong( 3, blessedLong );
insertStmt.bindString( 4, xlation );
-
+
try {
insertStmt.execute();
} catch ( SQLiteConstraintException sce ) {
@@ -2250,14 +2282,14 @@ public class DBUtils {
HashMap local = new HashMap();
HashMap blessed = new HashMap();
- String selection = String.format( "%s = '%s'", DBHelper.LOCALE,
+ String selection = String.format( "%s = '%s'", DBHelper.LOCALE,
locale );
String[] columns = { DBHelper.KEY, DBHelper.XLATION, DBHelper.BLESSED };
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
- Cursor cursor = db.query( DBHelper.TABLE_NAME_LOC, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_LOC, columns,
selection, null, null, null, null );
int keyIndex = cursor.getColumnIndex( DBHelper.KEY );
int valueIndex = cursor.getColumnIndex( DBHelper.XLATION );
@@ -2279,7 +2311,7 @@ public class DBUtils {
public static void dropXLations( Context context, String locale )
{
- String selection = String.format( "%s = '%s'", DBHelper.LOCALE,
+ String selection = String.format( "%s = '%s'", DBHelper.LOCALE,
locale );
initDB( context );
@@ -2304,12 +2336,18 @@ public class DBUtils {
}
}
+ private static void delStringsLikeSync( SQLiteDatabase db, String like )
+ {
+ String selection = String.format( "%s LIKE '%s'", DBHelper.KEY, like );
+ db.delete( DBHelper.TABLE_NAME_PAIRS, selection, null );
+ }
+
private static String getStringForSync( SQLiteDatabase db, String key, String dflt )
{
String selection = String.format( "%s = '%s'", DBHelper.KEY, key );
String[] columns = { DBHelper.VALUE };
- Cursor cursor = db.query( DBHelper.TABLE_NAME_PAIRS, columns,
+ Cursor cursor = db.query( DBHelper.TABLE_NAME_PAIRS, columns,
selection, null, null, null, null );
Assert.assertTrue( 1 >= cursor.getCount() );
int indx = cursor.getColumnIndex( DBHelper.VALUE );
@@ -2450,7 +2488,7 @@ public class DBUtils {
long rowid = db.insert( DBHelper.TABLE_NAME_LOGS, null, values );
if ( 0 == (rowid % (LOGLIMIT / 10)) ) {
- String where =
+ String where =
String.format( "not rowid in (select rowid from %s order by TIMESTAMP desc limit %d)",
DBHelper.TABLE_NAME_LOGS, LOGLIMIT );
int nGone = db.delete( DBHelper.TABLE_NAME_LOGS, where, null );
@@ -2474,12 +2512,12 @@ public class DBUtils {
sdcardDB = new File( Environment.getExternalStorageDirectory(),
name );
}
-
+
try {
File srcDB = toSDCard? gamesDB : sdcardDB;
if ( srcDB.exists() ) {
FileInputStream src = new FileInputStream( srcDB );
- FileOutputStream dest =
+ FileOutputStream dest =
new FileOutputStream( toSDCard? sdcardDB : gamesDB );
copyFileStream( dest, src );
invalGroupsCache();
@@ -2494,7 +2532,7 @@ public class DBUtils {
return String.format( "%s_%s", DBHelper.getDBName(),
BuildConstants.VARIANT );
}
-
+
// private static void clearChatHistoryString( Context context, long rowid )
// {
// ContentValues values = new ContentValues();
@@ -2552,7 +2590,7 @@ public class DBUtils {
}
return result;
}
-
+
private static void notifyListeners( long rowid, GameChangeType change )
{
synchronized( s_listeners ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java
index 7d3cf337b..516d4d35a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DbgUtils.java
@@ -66,7 +66,7 @@ public class DbgUtils {
logf( true, msg );
}
- public static void logf( boolean persist, String msg )
+ public static void logf( boolean persist, String msg )
{
if ( s_doLog ) {
String time = "";
@@ -162,7 +162,7 @@ public class DbgUtils {
// }
// }
- public static void dumpCursor( Cursor cursor )
+ public static void dumpCursor( Cursor cursor )
{
if ( s_doLog ) {
String dump = DatabaseUtils.dumpCursorToString( cursor );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java
index a59f143fb..426cdcdda 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DelegateBase.java
@@ -19,13 +19,14 @@
package org.eehouse.android.xw4;
-import android.graphics.Rect;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
+import android.graphics.Rect;
import android.os.Bundle;
+import android.graphics.Point;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@@ -38,6 +39,11 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eehouse.android.xw4.DlgDelegate.Action;
import org.eehouse.android.xw4.DlgDelegate.ActionPair;
import org.eehouse.android.xw4.loc.LocUtils;
@@ -57,13 +63,16 @@ public class DelegateBase implements DlgClickNotify,
private int m_layoutID;
private View m_rootView;
private boolean m_isVisible;
+ private ArrayList m_visibleProcs = new ArrayList();
+ private static Map> s_instances
+ = new HashMap>();
public DelegateBase( Delegator delegator, Bundle bundle, int layoutID )
{
this( delegator, bundle, layoutID, R.menu.empty );
}
- public DelegateBase( Delegator delegator, Bundle bundle,
+ public DelegateBase( Delegator delegator, Bundle bundle,
int layoutID, int menuID )
{
Assert.assertTrue( 0 < menuID );
@@ -80,16 +89,15 @@ public class DelegateBase implements DlgClickNotify,
protected void onSaveInstanceState( Bundle outState ) {}
public boolean onPrepareOptionsMenu( Menu menu ) { return false; }
public boolean onOptionsItemSelected( MenuItem item ) { return false; }
- public void onCreateContextMenu( ContextMenu menu, View view,
- ContextMenuInfo menuInfo ) {}
- public boolean onContextItemSelected( MenuItem item ) { return false; }
- protected void onStart() {}
+ protected void onCreateContextMenu( ContextMenu menu, View view,
+ ContextMenuInfo menuInfo ) {}
+ protected boolean onContextItemSelected( MenuItem item ) { return false; }
protected void onStop() {}
protected void onDestroy() {}
protected void onWindowFocusChanged( boolean hasFocus ) {}
- protected boolean onBackPressed() { return false; }
+ protected boolean handleBackPressed() { return false; }
public void orientationChanged() {}
-
+
protected void requestWindowFeature( int feature ) {}
// Fragments only
@@ -105,16 +113,27 @@ public class DelegateBase implements DlgClickNotify,
return view;
}
- protected void onActivityResult( RequestCode requestCode, int resultCode,
- Intent data )
+ protected void onActivityResult( RequestCode requestCode, int resultCode,
+ Intent data )
{
- DbgUtils.logf( "DelegateBase.onActivityResult(): subclass responsibility!!!" );
+ DbgUtils.logf( "%s.onActivityResult(): subclass responsibility!!!",
+ getClass().getSimpleName() );
}
- protected void onResume()
+ protected void onStart()
+ {
+ if ( s_instances.containsKey(getClass()) ) {
+ DbgUtils.logdf( "%s.onStart(): replacing curThis",
+ getClass().getSimpleName() );
+ }
+ s_instances.put( getClass(), new WeakReference(this) );
+ }
+
+ protected void onResume()
{
m_isVisible = true;
XWService.setListener( this );
+ runIfVisible();
}
protected void onPause()
@@ -123,6 +142,17 @@ public class DelegateBase implements DlgClickNotify,
XWService.setListener( null );
}
+ protected DelegateBase curThis()
+ {
+ DelegateBase result = null;
+ WeakReference ref = s_instances.get( getClass() );
+ if ( null != ref ) {
+ result = ref.get();
+ }
+ // DbgUtils.logdf( "%s.curThis() => " + result, this.toString() );
+ return result;
+ }
+
public boolean onCreateOptionsMenu( Menu menu, MenuInflater inflater )
{
boolean handled = 0 < m_optionsMenuID;
@@ -144,7 +174,9 @@ public class DelegateBase implements DlgClickNotify,
protected boolean isFinishing()
{
- return m_activity.isFinishing();
+ boolean result = m_activity.isFinishing();
+ // DbgUtils.logf( "%s.isFinishing() => %b", getClass().getSimpleName(), result );
+ return result;
}
protected Intent getIntent()
@@ -202,7 +234,7 @@ public class DelegateBase implements DlgClickNotify,
return m_activity.getTitle().toString();
}
- protected void startActivityForResult( Intent intent,
+ protected void startActivityForResult( Intent intent,
RequestCode requestCode )
{
m_activity.startActivityForResult( intent, requestCode.ordinal() );
@@ -210,8 +242,10 @@ public class DelegateBase implements DlgClickNotify,
protected void setResult( int result, Intent intent )
{
- if ( m_activity instanceof FragActivity ) {
- Assert.fail();
+ if ( m_activity instanceof MainActivity ) {
+ MainActivity main = (MainActivity)m_activity;
+ XWFragment fragment = (XWFragment)m_delegator;
+ main.setFragmentResult( fragment, result, intent );
} else {
m_activity.setResult( result, intent );
}
@@ -234,34 +268,52 @@ public class DelegateBase implements DlgClickNotify,
protected void finish()
{
- if ( m_activity instanceof FragActivity ) {
- ((FragActivity)m_activity).finishFragment();
- } else {
+ boolean handled = false;
+ if ( m_activity instanceof MainActivity ) {
+ MainActivity main = (MainActivity)m_activity;
+ if ( main.inDPMode() ) {
+ main.finishFragment();
+ handled = true;
+ }
+ }
+
+ if ( !handled ) {
m_activity.finish();
}
}
protected boolean isPortrait()
{
- int[] containerDims = getContainerDims( new int[2] );
- boolean result = containerDims[0] < containerDims[1];
- DbgUtils.logdf( "%s.isPortrait() => %b", getClass().getName(), result );
+ Point size = getContainerSize();
+ boolean result = size.x < size.y;
+ DbgUtils.logdf( "%s.isPortrait() => %b",
+ getClass().getSimpleName(), result );
return result;
}
- protected int[] getContainerDims( int[] outDims )
+ private Point getContainerSize()
{
- if ( m_activity instanceof FragActivity ) {
- ((FragActivity)m_activity).getFragmentDims( outDims );
+ Point result = null;
+ if ( m_activity instanceof MainActivity ) {
+ result = ((MainActivity)m_activity).getFragmentSize();
} else {
Rect rect = new Rect();
m_rootView.getWindowVisibleDisplayFrame( rect );
- outDims[0] = rect.width();
- outDims[1] = rect.height();
+ result = new Point( rect.width(), rect.height() );
+ }
+ DbgUtils.logdf( "%s.getContainerSize(): width => %d, height => %d",
+ getClass().getSimpleName(), result.x, result.y );
+ return result;
+ }
+
+ private void runIfVisible()
+ {
+ if ( isVisible() ) {
+ for ( Runnable proc : m_visibleProcs ) {
+ post( proc );
+ }
+ m_visibleProcs.clear();
}
- DbgUtils.logdf( "%s.getContainerDims(): width => %d, height => %d",
- getClass().getName(), outDims[0], outDims[1] );
- return outDims;
}
protected String getString( int resID, Object... params )
@@ -279,10 +331,10 @@ public class DelegateBase implements DlgClickNotify,
return LocUtils.xlateLang( m_activity, langCode, caps );
}
- protected String getQuantityString( int resID, int quantity,
+ protected String getQuantityString( int resID, int quantity,
Object... params )
{
- return LocUtils.getQuantityString( m_activity, resID, quantity,
+ return LocUtils.getQuantityString( m_activity, resID, quantity,
params );
}
@@ -463,7 +515,7 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.showConfirmThen( null, msg, action, params );
}
- protected void showConfirmThen( Runnable onNA, String msg, int posButton,
+ protected void showConfirmThen( Runnable onNA, String msg, int posButton,
Action action, Object... params )
{
m_dlgDelegate.showConfirmThen( onNA, msg, posButton, action, params );
@@ -491,7 +543,7 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.showConfirmThen( msg, posButton, negButton, action, params );
}
- protected void showConfirmThen( int msg, int posButton, Action action,
+ protected void showConfirmThen( int msg, int posButton, Action action,
Object... params )
{
m_dlgDelegate.showConfirmThen( msg, posButton, action, params );
@@ -502,10 +554,10 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.showConfirmThen( msgID, action );
}
- public void showConfirmThen( Runnable onNA, String msg, int posButton,
+ public void showConfirmThen( Runnable onNA, String msg, int posButton,
int negButton, Action action, Object... params )
{
- m_dlgDelegate.showConfirmThen( onNA, msg, posButton, negButton, action,
+ m_dlgDelegate.showConfirmThen( onNA, msg, posButton, negButton, action,
params );
}
@@ -551,13 +603,13 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.startProgress( titleID, msg, null );
}
- protected void startProgress( int titleID, int msgID,
+ protected void startProgress( int titleID, int msgID,
OnCancelListener lstnr )
{
m_dlgDelegate.startProgress( titleID, msgID, lstnr );
}
- protected void startProgress( int titleID, String msg,
+ protected void startProgress( int titleID, String msg,
OnCancelListener lstnr )
{
m_dlgDelegate.startProgress( titleID, msg, lstnr );
@@ -584,7 +636,19 @@ public class DelegateBase implements DlgClickNotify,
}
protected boolean isVisible() { return m_isVisible; }
-
+
+ protected boolean handleNewIntent( Intent intent ) {
+ DbgUtils.logf( "%s.handleNewIntent(%s): not handling",
+ getClass().getSimpleName(), intent.toString() );
+ return false; // not handled
+ }
+
+ protected void runWhenActive( Runnable proc )
+ {
+ m_visibleProcs.add( proc );
+ runIfVisible();
+ }
+
//////////////////////////////////////////////////
// MultiService.MultiEventListener interface
//////////////////////////////////////////////////
@@ -609,7 +673,7 @@ public class DelegateBase implements DlgClickNotify,
m_dlgDelegate.eventOccurred( event, args );
break;
default:
- DbgUtils.logdf( "DelegateBase.eventOccurred(event=%s) (DROPPED)",
+ DbgUtils.logdf( "DelegateBase.eventOccurred(event=%s) (DROPPED)",
event.toString() );
break;
}
@@ -680,5 +744,4 @@ public class DelegateBase implements DlgClickNotify,
{
Assert.fail();
}
-
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Delegator.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Delegator.java
index c9b506175..108eeba4f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Delegator.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Delegator.java
@@ -28,7 +28,10 @@ public interface Delegator {
Activity getActivity();
Bundle getArguments();
void finish();
-
+ boolean inDPMode();
+ void addFragment( XWFragment fragment, Bundle extras );
+ void addFragmentForResult( XWFragment fragment, Bundle extras,
+ RequestCode requestCode );
// For activities with lists
void setListAdapter( ListAdapter adapter );
ListAdapter getListAdapter();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DevID.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DevID.java
index e04ff2ec1..c30d01a62 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DevID.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DevID.java
@@ -126,7 +126,7 @@ public class DevID {
int storedVers = DBUtils.getIntFor( context, GCM_REGVERS_KEY, 0 );
// TRANSITIONAL
if ( 0 == storedVers ) {
- storedVers = XWPrefs.getPrefsInt( context,
+ storedVers = XWPrefs.getPrefsInt( context,
R.string.key_gcmvers_regid, 0 );
if ( 0 != storedVers ) {
DBUtils.setIntFor( context, GCM_REGVERS_KEY, storedVers );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseActivity.java
index 7019977d1..acf7ceecc 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseActivity.java
@@ -27,7 +27,7 @@ public class DictBrowseActivity extends XWActivity {
private DictBrowseDelegate m_dlgt;
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new DictBrowseDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java
index 6565bc9c8..b39ad0ec4 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseDelegate.java
@@ -87,11 +87,11 @@ public class DictBrowseDelegate extends ListDelegateBase
XwJNI.dict_iter_setMinMax( m_dictClosure, m_browseState.m_minShown,
m_browseState.m_maxShown );
m_nWords = XwJNI.dict_iter_wordCount( m_dictClosure );
-
+
int format = m_browseState.m_minShown == m_browseState.m_maxShown ?
R.string.dict_browse_title1_fmt : R.string.dict_browse_title_fmt;
- setTitle( getString( format, m_name, m_nWords,
- m_browseState.m_minShown,
+ setTitle( getString( format, m_name, m_nWords,
+ m_browseState.m_minShown,
m_browseState.m_maxShown ));
String desc = XwJNI.dict_iter_getDesc( m_dictClosure );
@@ -103,7 +103,7 @@ public class DictBrowseDelegate extends ListDelegateBase
}
}
- public Object getItem( int position )
+ public Object getItem( int position )
{
TextView text = (TextView)
inflate( android.R.layout.simple_list_item_1 );
@@ -121,7 +121,7 @@ public class DictBrowseDelegate extends ListDelegateBase
public long getItemId( int position ) { return position; }
- public int getCount() {
+ public int getCount() {
Assert.assertTrue( 0 != m_dictClosure );
return m_nWords;
}
@@ -134,7 +134,7 @@ public class DictBrowseDelegate extends ListDelegateBase
}
return m_indices[section];
}
-
+
public int getSectionForPosition( int position )
{
int section = Arrays.binarySearch( m_indices, position );
@@ -146,8 +146,8 @@ public class DictBrowseDelegate extends ListDelegateBase
}
return section;
}
-
- public Object[] getSections()
+
+ public Object[] getSections()
{
m_prefixes = XwJNI.dict_iter_getPrefixes( m_dictClosure );
m_indices = XwJNI.dict_iter_getIndices( m_dictClosure );
@@ -161,7 +161,7 @@ public class DictBrowseDelegate extends ListDelegateBase
m_activity = delegator.getActivity();
}
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
Bundle args = getArguments();
String name = null == args? null : args.getString( DICT_NAME );
@@ -170,7 +170,7 @@ public class DictBrowseDelegate extends ListDelegateBase
finish();
} else {
m_name = name;
- m_loc =
+ m_loc =
DictUtils.DictLoc.values()[args.getInt( DICT_LOC, 0 )];
m_lang = DictLangCache.getDictLangCode( m_activity, name );
@@ -188,7 +188,7 @@ public class DictBrowseDelegate extends ListDelegateBase
m_browseState.m_top = 0;
}
if ( null == m_browseState.m_counts ) {
- m_browseState.m_counts =
+ m_browseState.m_counts =
XwJNI.dict_iter_getCounts( m_dictClosure );
}
@@ -278,11 +278,10 @@ public class DictBrowseDelegate extends ListDelegateBase
launchLookup( words, m_lang, true );
}
-
//////////////////////////////////////////////////
// AdapterView.OnItemSelectedListener interface
//////////////////////////////////////////////////
- public void onItemSelected( AdapterView> parent, View view,
+ public void onItemSelected( AdapterView> parent, View view,
int position, long id )
{
TextView text = (TextView)view;
@@ -307,7 +306,7 @@ public class DictBrowseDelegate extends ListDelegateBase
@Override
public void dlgButtonClicked( Action action, int which, Object[] params )
{
- Assert.assertTrue( Action.FINISH_ACTION == action );
+ Assert.assertTrue( Action.FINISH_ACTION == action );
finish();
}
@@ -332,7 +331,7 @@ public class DictBrowseDelegate extends ListDelegateBase
edit.setText( text );
}
- private void showPrefix()
+ private void showPrefix()
{
String text = m_browseState.m_prefix;
if ( null != text && 0 < text.length() ) {
@@ -340,7 +339,7 @@ public class DictBrowseDelegate extends ListDelegateBase
if ( 0 <= pos ) {
getListView().setSelection( pos );
} else {
- DbgUtils.showf( m_activity, R.string.dict_browse_nowords_fmt,
+ DbgUtils.showf( m_activity, R.string.dict_browse_nowords_fmt,
m_name, text );
}
}
@@ -353,7 +352,7 @@ public class DictBrowseDelegate extends ListDelegateBase
// adapter/making it recognized a changed dataset. So, as a
// workaround, relaunch the activity with different
// parameters.
- if ( m_browseState.m_minShown != min ||
+ if ( m_browseState.m_minShown != min ||
m_browseState.m_maxShown != max ) {
m_browseState.m_pos = 0;
@@ -378,7 +377,7 @@ public class DictBrowseDelegate extends ListDelegateBase
++m_minAvail;
}
m_maxAvail = XwJNI.MAX_COLS_DICT;
- while ( 0 == counts[m_maxAvail] ) { //
+ while ( 0 == counts[m_maxAvail] ) { //
--m_maxAvail;
}
}
@@ -395,7 +394,7 @@ public class DictBrowseDelegate extends ListDelegateBase
nums[ii] = String.format( "%d", min + ii );
}
ArrayAdapter adapter = new
- ArrayAdapter( m_activity,
+ ArrayAdapter( m_activity,
//android.R.layout.simple_spinner_dropdown_item,
android.R.layout.simple_spinner_item,
nums );
@@ -412,29 +411,29 @@ public class DictBrowseDelegate extends ListDelegateBase
// current max the largest min allowed, and the current
// min the smallest max allowed.
m_minSpinner = (Spinner)findViewById( R.id.wordlen_min );
- makeAdapter( m_minSpinner, m_minAvail, m_browseState.m_maxShown,
+ makeAdapter( m_minSpinner, m_minAvail, m_browseState.m_maxShown,
m_browseState.m_minShown );
m_minSpinner.setOnItemSelectedListener( this );
m_maxSpinner = (Spinner)findViewById( R.id.wordlen_max );
- makeAdapter( m_maxSpinner, m_browseState.m_minShown,
+ makeAdapter( m_maxSpinner, m_browseState.m_minShown,
m_maxAvail, m_browseState.m_maxShown );
m_maxSpinner.setOnItemSelectedListener( this );
}
private static void launch( Delegator delegator, Bundle bundle )
{
- Activity activity = delegator.getActivity();
- if ( activity instanceof FragActivity ) {
- FragActivity.addFragment( new DictBrowseFrag(), bundle, delegator );
+ if ( delegator.inDPMode() ) {
+ delegator.addFragment( new DictBrowseFrag( delegator ), bundle );
} else {
+ Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, DictBrowseActivity.class );
intent.putExtras( bundle );
activity.startActivity( intent );
}
}
- public static void launch( Delegator delegator, String name,
+ public static void launch( Delegator delegator, String name,
DictUtils.DictLoc loc )
{
Bundle bundle = new Bundle();
@@ -447,6 +446,10 @@ public class DictBrowseDelegate extends ListDelegateBase
{
DictUtils.DictLoc loc
= DictUtils.getDictLoc( delegator.getActivity(), name );
- launch( delegator, name, loc );
+ if ( null == loc ) {
+ DbgUtils.logf( "DictBrowseDelegate.launch(): DictLoc null; try again?" );
+ } else {
+ launch( delegator, name, loc );
+ }
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseFrag.java
index 8fd890dbf..22b10d1cf 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictBrowseFrag.java
@@ -23,6 +23,8 @@ import android.os.Bundle;
public class DictBrowseFrag extends XWFragment {
+ public DictBrowseFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictLangCache.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictLangCache.java
index 6feebd82f..5c04fb91e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictLangCache.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictLangCache.java
@@ -72,7 +72,7 @@ public class DictLangCache {
String lang = getLangName( m_context, dal.name );
if ( null != lang && 0 != lang.length() ) {
if ( ! m_map.containsValue( lang ) ) {
- String locName = LocUtils.xlateLang( m_context, lang,
+ String locName = LocUtils.xlateLang( m_context, lang,
true );
m_map.put( locName, lang );
}
@@ -81,7 +81,7 @@ public class DictLangCache {
// Now build the array data
clear();
- for ( Iterator iter = m_map.keySet().iterator();
+ for ( Iterator iter = m_map.keySet().iterator();
iter.hasNext(); ) {
String locName = iter.next();
add( locName );
@@ -113,7 +113,7 @@ public class DictLangCache {
}
}
- private static Comparator KeepLast =
+ private static Comparator KeepLast =
new Comparator() {
public int compare( String str1, String str2 )
{
@@ -133,10 +133,10 @@ public class DictLangCache {
DictInfo info = getInfo( context, dal );
if ( null != info ) {
int wordCount = info.wordCount;
-
+
String langName = getLangName( context, dal.name );
String locName = LocUtils.xlateLang( context, langName );
- result = LocUtils.getString( context, R.string.dict_desc_fmt,
+ result = LocUtils.getString( context, R.string.dict_desc_fmt,
dal.name, locName,
wordCount );
}
@@ -259,7 +259,7 @@ public class DictLangCache {
return result;
}
- private static Comparator s_ByCount =
+ private static Comparator s_ByCount =
new Comparator() {
public int compare( DictInfo di1, DictInfo di2 )
{
@@ -337,9 +337,9 @@ public class DictLangCache {
s_handler.post( new Runnable() {
public void run() {
if ( null != s_dictsAdapter ) {
- rebuildAdapter( s_dictsAdapter,
+ rebuildAdapter( s_dictsAdapter,
DictLangCache.
- getHaveLang( context,
+ getHaveLang( context,
s_adaptedLang ) );
}
if ( null != s_langsAdapter ) {
@@ -370,7 +370,7 @@ public class DictLangCache {
return langs.toArray( result );
}
- public static String getBestDefault( Context context, int lang,
+ public static String getBestDefault( Context context, int lang,
boolean human )
{
String dict = human? CommonPrefs.getDefaultHumanDict( context )
@@ -410,19 +410,19 @@ public class DictLangCache {
public static LangsArrayAdapter getLangsAdapter( Context context )
{
if ( null == s_langsAdapter ) {
- s_langsAdapter =
- new LangsArrayAdapter( context,
+ s_langsAdapter =
+ new LangsArrayAdapter( context,
android.R.layout.simple_spinner_item );
s_langsAdapter.rebuild();
}
return s_langsAdapter;
}
- public static ArrayAdapter getDictsAdapter( Context context,
+ public static ArrayAdapter getDictsAdapter( Context context,
int lang )
{
if ( lang != s_adaptedLang ) {
- s_dictsAdapter =
+ s_dictsAdapter =
new ArrayAdapter( context,
android.R.layout.simple_spinner_item );
rebuildAdapter( s_dictsAdapter, getHaveLang( context, lang ) );
@@ -473,7 +473,7 @@ public class DictLangCache {
// Tmp test that recovers from problem with new background download code
if ( null != info && 0 == info.langCode ) {
- DbgUtils.logf( "getInfo: dropping info for %s b/c lang code wrong",
+ DbgUtils.logf( "getInfo: dropping info for %s b/c lang code wrong",
dal.name );
info = null;
}
@@ -483,9 +483,9 @@ public class DictLangCache {
DictUtils.DictPairs pairs = DictUtils.openDicts( context, names );
info = new DictInfo();
- if ( XwJNI.dict_getInfo( pairs.m_bytes[0], dal.name,
- pairs.m_paths[0],
- JNIUtilsImpl.get( context ),
+ if ( XwJNI.dict_getInfo( pairs.m_bytes[0], dal.name,
+ pairs.m_paths[0],
+ JNIUtilsImpl.get( context ),
DictLoc.DOWNLOAD == dal.loc,
info ) ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
index d1d64c58c..279b47f25 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictListPreference.java
@@ -56,7 +56,7 @@ public class DictListPreference extends XWListPreference {
String name = dals[ii].name;
if ( langCode == DictLangCache.getDictLangCode( context, name ) ) {
values.add( name );
- dictEntries.add( DictLangCache.annotatedDictName( context,
+ dictEntries.add( DictLangCache.annotatedDictName( context,
dals[ii] ) );
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java
index bc001a44a..ffbdfc27c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictUtils.java
@@ -81,7 +81,7 @@ public class DictUtils {
}
} );
}
-
+
public static class DictPairs {
public byte[][] m_bytes;
public String[] m_paths;
@@ -113,13 +113,13 @@ public class DictUtils {
public String name;
public DictLoc loc;
- @Override
- public boolean equals( Object obj )
+ @Override
+ public boolean equals( Object obj )
{
boolean result = false;
if ( obj instanceof DictAndLoc ) {
DictAndLoc other = (DictAndLoc)obj;
-
+
result = name.equals( other.name )
&& loc.equals( other.loc );
}
@@ -131,7 +131,7 @@ public class DictUtils {
return name.compareTo( other.name );
}
}
-
+
public static void invalDictList()
{
s_dictListCache = null;
@@ -139,7 +139,7 @@ public class DictUtils {
// changes?
}
- private static void tryDir( Context context, File dir, boolean strict,
+ private static void tryDir( Context context, File dir, boolean strict,
DictLoc loc, ArrayList al )
{
if ( null != dir ) {
@@ -161,7 +161,7 @@ public class DictUtils {
for ( String file : getAssets( context ) ) {
if ( isDict( context, file, null ) ) {
- al.add( new DictAndLoc( removeDictExtn( file ),
+ al.add( new DictAndLoc( removeDictExtn( file ),
DictLoc.BUILT_IN ) );
}
}
@@ -174,10 +174,10 @@ public class DictUtils {
}
tryDir( context, getSDDir( context ), false, DictLoc.EXTERNAL, al );
- tryDir( context, getDownloadDir( context ), true,
+ tryDir( context, getDownloadDir( context ), true,
DictLoc.DOWNLOAD, al );
- s_dictListCache =
+ s_dictListCache =
al.toArray( new DictUtils.DictAndLoc[al.size()] );
}
return s_dictListCache;
@@ -221,7 +221,7 @@ public class DictUtils {
}
}
- // DbgUtils.logf( "getDictLoc(%s)=>%h(%s)", name, loc,
+ // DbgUtils.logf( "getDictLoc(%s)=>%h(%s)", name, loc,
// ((null != loc)?loc.toString():"UNKNOWN") );
return loc;
}
@@ -262,12 +262,12 @@ public class DictUtils {
boolean success = false;
try {
- FileInputStream fis = DictLoc.INTERNAL == from
+ FileInputStream fis = DictLoc.INTERNAL == from
? context.openFileInput( name )
: new FileInputStream( getDictFile( context, name, from ) );
- FileOutputStream fos = DictLoc.INTERNAL == to
- ? context.openFileOutput( name, Context.MODE_PRIVATE )
+ FileOutputStream fos = DictLoc.INTERNAL == to
+ ? context.openFileOutput( name, Context.MODE_PRIVATE )
: new FileOutputStream( getDictFile( context, name, to ) );
success = DBUtils.copyFileStream( fos, fis );
@@ -376,7 +376,7 @@ public class DictUtils {
DbgUtils.loge( ioe );
}
}
-
+
return bytes;
} // openDict
@@ -447,7 +447,7 @@ public class DictUtils {
}
public static boolean saveDict( Context context, InputStream in,
- String name, DictLoc loc,
+ String name, DictLoc loc,
DownProgListener dpl )
{
boolean success = false;
@@ -524,13 +524,13 @@ public class DictUtils {
DbgUtils.logf( "uri: %s", uri.toString() );
intent.putExtra( Intent.EXTRA_STREAM, uri );
- intent.putExtra( Intent.EXTRA_SUBJECT,
+ intent.putExtra( Intent.EXTRA_SUBJECT,
context.getString( R.string.share_subject ) );
- intent.putExtra( Intent.EXTRA_TEXT,
+ intent.putExtra( Intent.EXTRA_TEXT,
Utils.format( context, R.string.share_bodyf, name ) );
String title = context.getString( R.string.share_chooser );
- context.startActivity( Intent.createChooser( intent, title ) );
+ context.startActivity( Intent.createChooser( intent, title ) );
}
*/
@@ -538,7 +538,7 @@ public class DictUtils {
{
return file.endsWith( XWConstants.GAME_EXTN );
}
-
+
private static boolean isDict( Context context, String file, File dir )
{
boolean ok = file.endsWith( XWConstants.DICT_EXTN );
@@ -559,7 +559,7 @@ public class DictUtils {
return str;
}
- public static String addDictExtn( String str )
+ public static String addDictExtn( String str )
{
if ( ! str.endsWith( XWConstants.DICT_EXTN ) ) {
str += XWConstants.DICT_EXTN;
@@ -577,7 +577,7 @@ public class DictUtils {
return new String[0];
}
}
-
+
public static boolean haveWriteableSD()
{
String state = Environment.getExternalStorageState();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
index d5e90814f..3c637c666 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsActivity.java
@@ -39,16 +39,9 @@ public class DictsActivity extends XWActivity {
private DictsDelegate m_dlgt;
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new DictsDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
} // onCreate
-
- public static void start( Context context )
- {
- Intent intent = new Intent( context, DictsActivity.class );
- context.startActivity( intent );
- }
-
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java
index c441a3f19..542026c0e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsDelegate.java
@@ -74,7 +74,7 @@ import org.eehouse.android.xw4.DwnldDelegate.OnGotLcDictListener;
public class DictsDelegate extends ListDelegateBase
implements View.OnClickListener, AdapterView.OnItemLongClickListener,
- SelectableItem, MountEventReceiver.SDCardNotifiee,
+ SelectableItem, MountEventReceiver.SDCardNotifiee,
DlgDelegate.DlgClickNotify, GroupStateListener,
DownloadFinishedListener, XWListItem.ExpandedListener {
@@ -109,25 +109,25 @@ public class DictsDelegate extends ListDelegateBase
private String m_noteNone;
private static interface SafePopup {
- public void doPopup( Delegator dlgtor, View button,
+ public void doPopup( Delegator dlgtor, View button,
String curDict, int lang );
}
private static SafePopup s_safePopup = null;
private static class SafePopupImpl implements SafePopup {
- public void doPopup( final Delegator dlgtor, View button,
+ public void doPopup( final Delegator dlgtor, View button,
String curDict, int lang ) {
final HashMap itemData
= new HashMap();
- MenuItem.OnMenuItemClickListener listener =
+ MenuItem.OnMenuItemClickListener listener =
new MenuItem.OnMenuItemClickListener() {
public boolean onMenuItemClick( MenuItem item )
{
DictAndLoc dal = itemData.get( item );
- DictBrowseDelegate.launch( dlgtor, dal.name,
+ DictBrowseDelegate.launch( dlgtor, dal.name,
dal.loc );
return true;
}
@@ -140,7 +140,7 @@ public class DictsDelegate extends ListDelegateBase
// Add at top but save until have dal info
MenuItem curItem =
menu.add( LocUtils.getString( context,
- R.string.cur_menu_marker_fmt,
+ R.string.cur_menu_marker_fmt,
curDict ) );
DictAndLoc[] dals = DictLangCache.getDALsHaveLang( context, lang );
@@ -161,7 +161,7 @@ public class DictsDelegate extends ListDelegateBase
public int m_nWords;
public long m_nBytes;
public String m_note;
- public DictInfo( String name, String lang, int nWords,
+ public DictInfo( String name, String lang, int nWords,
long nBytes, String note )
{
m_name = name;
@@ -178,7 +178,7 @@ public class DictsDelegate extends ListDelegateBase
private static class LangInfo {
int m_numDicts;
int m_posn;
- public LangInfo( int posn, int numDicts )
+ public LangInfo( int posn, int numDicts )
{
m_posn = posn;
m_numDicts = numDicts;
@@ -191,7 +191,7 @@ public class DictsDelegate extends ListDelegateBase
private class DictListAdapter extends XWExpListAdapter {
private Context m_context;
- public DictListAdapter( Context context )
+ public DictListAdapter( Context context )
{
super( new Class[] { LangInfo.class,
DictAndLoc.class,
@@ -207,7 +207,7 @@ public class DictsDelegate extends ListDelegateBase
int nLangs = m_langs.length;
for ( int ii = 0; ii < nLangs; ++ii ) {
String langName = m_langs[ii];
- if ( null != m_filterLang &&
+ if ( null != m_filterLang &&
! m_filterLang.equals(langName) ) {
continue;
}
@@ -235,12 +235,12 @@ public class DictsDelegate extends ListDelegateBase
langName );
boolean expanded = ! m_closedLangs.contains( langName );
String locLangName = xlateLang( langName );
- String name = getQuantityString( R.plurals.lang_name_fmt,
+ String name = getQuantityString( R.plurals.lang_name_fmt,
info.m_numDicts,
locLangName, info.m_numDicts );
name = Utils.capitalize( name );
- result = ListGroup.make( m_context, convertView,
- DictsDelegate.this, groupPos, name,
+ result = ListGroup.make( m_context, convertView,
+ DictsDelegate.this, groupPos, name,
expanded );
} else {
XWListItem item;
@@ -286,7 +286,7 @@ public class DictsDelegate extends ListDelegateBase
} else {
Assert.fail();
}
- }
+ }
return result;
}
@@ -349,7 +349,7 @@ public class DictsDelegate extends ListDelegateBase
protected DictsDelegate( Delegator delegator, Bundle savedInstanceState )
{
- super( delegator, savedInstanceState, R.layout.dict_browse,
+ super( delegator, savedInstanceState, R.layout.dict_browse,
R.menu.dicts_menu );
m_activity = delegator.getActivity();
}
@@ -374,27 +374,28 @@ public class DictsDelegate extends ListDelegateBase
public void onClick( DialogInterface dlgi, int item ) {
moveTo[0] = item;
AlertDialog dlg = (AlertDialog)dlgi;
- Button btn =
- dlg.getButton( AlertDialog.BUTTON_POSITIVE );
+ Button btn =
+ dlg.getButton( AlertDialog.BUTTON_POSITIVE );
btn.setEnabled( true );
}
};
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- DictLoc toLoc = itemToRealLoc( moveTo[0] );
+ DictsDelegate self = curThis();
+ DictLoc toLoc = self.itemToRealLoc( moveTo[0] );
for ( XWListItem selItem : selItems ) {
DictLoc fromLoc = (DictLoc)selItem.getCached();
String name = selItem.getText();
if ( fromLoc == toLoc ) {
DbgUtils.logf( "not moving %s: same loc", name );
- } else if ( DictUtils.moveDict( m_activity,
+ } else if ( DictUtils.moveDict( self.m_activity,
name, fromLoc,
toLoc ) ) {
- selItem.setComment( m_locNames[toLoc.ordinal()] );
+ selItem.setComment( self.m_locNames[toLoc.ordinal()] );
selItem.setCached( toLoc );
selItem.invalidate();
- DBUtils.dictsMoveInfo( m_activity, name,
+ DBUtils.dictsMoveInfo( self.m_activity, name,
fromLoc, toLoc );
} else {
DbgUtils.logf( "moveDict(%s) failed", name );
@@ -416,15 +417,16 @@ public class DictsDelegate extends ListDelegateBase
final XWListItem row = m_selDicts.values().iterator().next();
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
+ DictsDelegate self = curThis();
if ( DialogInterface.BUTTON_NEGATIVE == item
|| DialogInterface.BUTTON_POSITIVE == item ) {
- setDefault( row, R.string.key_default_dict,
- R.string.key_default_robodict );
+ self.setDefault( row, R.string.key_default_dict,
+ R.string.key_default_robodict );
}
- if ( DialogInterface.BUTTON_NEGATIVE == item
+ if ( DialogInterface.BUTTON_NEGATIVE == item
|| DialogInterface.BUTTON_NEUTRAL == item ) {
- setDefault( row, R.string.key_default_robodict,
- R.string.key_default_dict );
+ self.setDefault( row, R.string.key_default_robodict,
+ R.string.key_default_dict );
}
}
};
@@ -444,22 +446,22 @@ public class DictsDelegate extends ListDelegateBase
case DICT_OR_DECLINE:
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- Intent intent = getIntent();
+ DictsDelegate self = curThis();
+ Intent intent = self.getIntent();
int lang = intent.getIntExtra( MultiService.LANG, -1 );
String name = intent.getStringExtra( MultiService.DICT );
- m_launchedForMissing = true;
+ self.m_launchedForMissing = true;
DwnldDelegate
- .downloadDictInBack( m_activity, lang,
- name, DictsDelegate.this );
+ .downloadDictInBack( self.m_activity, lang, name, self );
}
};
lstnr2 = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- finish();
+ curThis().finish();
}
};
- dialog = MultiService.missingDictDialog( m_activity, getIntent(),
+ dialog = MultiService.missingDictDialog( m_activity, getIntent(),
lstnr, lstnr2 );
break;
@@ -488,7 +490,7 @@ public class DictsDelegate extends ListDelegateBase
}
}
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
m_onServerStr = getString( R.string.dict_on_server );
m_closedLangs = new HashSet();
@@ -504,7 +506,7 @@ public class DictsDelegate extends ListDelegateBase
m_listView = getListView();
m_listView.setOnItemLongClickListener( this );
-
+
m_checkbox = (CheckBox)findViewById( R.id.show_remote );
m_checkbox.setOnClickListener( this );
@@ -515,7 +517,7 @@ public class DictsDelegate extends ListDelegateBase
if ( MultiService.isMissingDictIntent( intent ) ) {
showDialog( DlgID.DICT_OR_DECLINE );
} else {
- boolean showRemote = intent.getBooleanExtra( DICT_SHOWREMOTE,
+ boolean showRemote = intent.getBooleanExtra( DICT_SHOWREMOTE,
false );
if ( showRemote ) {
m_quickFetchMode = true;
@@ -555,23 +557,24 @@ public class DictsDelegate extends ListDelegateBase
setTitleBar();
}
- protected void onStop()
+ protected void onStop()
{
MountEventReceiver.unregister( this );
}
- public void onClick( View view )
+ public void onClick( View view )
{
if ( view == m_checkbox ) {
switchShowingRemote( m_checkbox.isChecked() );
} else {
XWListItem item = (XWListItem)view;
- DictBrowseDelegate.launch( getDelegator(), item.getText(),
+ DictBrowseDelegate.launch( getDelegator(), item.getText(),
(DictLoc)item.getCached() );
}
}
- protected boolean onBackPressed()
+ @Override
+ protected boolean handleBackPressed()
{
boolean handled = 0 < m_selDicts.size();
if ( handled ) {
@@ -590,22 +593,22 @@ public class DictsDelegate extends ListDelegateBase
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
// int nSel = m_selDicts.size();
int[] nSels = countSelDicts();
- Utils.setItemVisible( menu, R.id.dicts_select,
+ Utils.setItemVisible( menu, R.id.dicts_select,
1 == nSels[SEL_LOCAL] && 0 == nSels[SEL_REMOTE] );
// NO -- test if any downloadable selected
- Utils.setItemVisible( menu, R.id.dicts_download,
+ Utils.setItemVisible( menu, R.id.dicts_download,
0 == nSels[SEL_LOCAL] && 0 < nSels[SEL_REMOTE] );
- Utils.setItemVisible( menu, R.id.dicts_deselect_all,
+ Utils.setItemVisible( menu, R.id.dicts_deselect_all,
0 < nSels[SEL_LOCAL] || 0 < nSels[SEL_REMOTE] );
boolean allVolatile = 0 == nSels[SEL_REMOTE] && selItemsVolatile();
- Utils.setItemVisible( menu, R.id.dicts_move,
+ Utils.setItemVisible( menu, R.id.dicts_move,
allVolatile && DictUtils.haveWriteableSD() );
Utils.setItemVisible( menu, R.id.dicts_delete, allVolatile );
@@ -634,14 +637,14 @@ public class DictsDelegate extends ListDelegateBase
Uri[] uris = new Uri[countNeedDownload()];
String[] names = new String[uris.length];
int count = 0;
- for ( Iterator iter = m_selDicts.values().iterator();
+ for ( Iterator iter = m_selDicts.values().iterator();
iter.hasNext(); ) {
XWListItem litm = iter.next();
Object cached = litm.getCached();
if ( cached instanceof DictInfo ) {
DictInfo info = (DictInfo)cached;
String name = litm.getText();
- Uri uri = Utils.makeDictUri( m_activity, info.m_lang,
+ Uri uri = Utils.makeDictUri( m_activity, info.m_lang,
name );
uris[count] = uri;
names[count] = name;
@@ -675,7 +678,7 @@ public class DictsDelegate extends ListDelegateBase
private int countNeedDownload()
{
int result = 0;
- for ( Iterator iter = m_selDicts.values().iterator();
+ for ( Iterator iter = m_selDicts.values().iterator();
iter.hasNext(); ) {
XWListItem litm = iter.next();
Object obj = litm.getCached();
@@ -690,9 +693,9 @@ public class DictsDelegate extends ListDelegateBase
{
int loci = intent.getIntExtra( UpdateCheckReceiver.NEW_DICT_LOC, 0 );
if ( 0 < loci ) {
- String name =
+ String name =
intent.getStringExtra( UpdateCheckReceiver.NEW_DICT_NAME );
- String url =
+ String url =
intent.getStringExtra( UpdateCheckReceiver.NEW_DICT_URL );
Uri uri = Uri.parse( url );
DwnldDelegate.downloadDictInBack( m_activity, uri, name, null );
@@ -744,11 +747,11 @@ public class DictsDelegate extends ListDelegateBase
}
saveClosed();
}
-
+
//////////////////////////////////////////////////////////////////////
// OnItemLongClickListener interface
//////////////////////////////////////////////////////////////////////
- public boolean onItemLongClick( AdapterView> parent, View view,
+ public boolean onItemLongClick( AdapterView> parent, View view,
int position, long id ) {
boolean success = view instanceof SelectableItem.LongClickHandler;
if ( success ) {
@@ -757,10 +760,10 @@ public class DictsDelegate extends ListDelegateBase
return success;
}
- private boolean selItemsVolatile()
+ private boolean selItemsVolatile()
{
boolean result = 0 < m_selDicts.size();
- for ( Iterator iter = m_selDicts.values().iterator();
+ for ( Iterator iter = m_selDicts.values().iterator();
result && iter.hasNext(); ) {
Object obj = iter.next().getCached();
if ( obj instanceof DictLoc ) {
@@ -778,7 +781,7 @@ public class DictsDelegate extends ListDelegateBase
private void deleteSelected()
{
XWListItem[] items = getSelItems();
- String msg = getQuantityString( R.plurals.confirm_delete_dict_fmt,
+ String msg = getQuantityString( R.plurals.confirm_delete_dict_fmt,
items.length, getJoinedNames( items ) );
// Confirm. And for each dict, warn if (after ALL are deleted) any
@@ -795,7 +798,7 @@ public class DictsDelegate extends ListDelegateBase
public String dictsStr()
{
if ( null == m_asArray ) {
- String[] arr = delDicts.toArray(new String[delDicts.size()]);
+ String[] arr = delDicts.toArray(new String[delDicts.size()]);
m_asArray = TextUtils.join( ", ", arr );
}
return m_asArray;
@@ -961,7 +964,7 @@ public class DictsDelegate extends ListDelegateBase
{
XWListItem[] items = new XWListItem[m_selDicts.size()];
int indx = 0;
- for ( Iterator iter = m_selDicts.values().iterator();
+ for ( Iterator iter = m_selDicts.values().iterator();
iter.hasNext(); ) {
items[indx++] = iter.next();
}
@@ -973,7 +976,7 @@ public class DictsDelegate extends ListDelegateBase
{
int[] results = new int[2];
Assert.assertTrue( 0 == results[0] && 0 == results[1] );
- for ( Iterator iter = m_selDicts.values().iterator();
+ for ( Iterator iter = m_selDicts.values().iterator();
iter.hasNext(); ) {
Object obj = iter.next().getCached();
if ( obj instanceof DictLoc ) {
@@ -999,7 +1002,7 @@ public class DictsDelegate extends ListDelegateBase
}
}
- private String[] makeDictDirItems()
+ private String[] makeDictDirItems()
{
boolean showDownload = DictUtils.haveDownloadDir( m_activity );
int nItems = showDownload ? 3 : 2;
@@ -1032,7 +1035,7 @@ public class DictsDelegate extends ListDelegateBase
// return mkDownloadIntent( context, dict_url );
}
- public static void downloadForResult( Activity activity, RequestCode requestCode,
+ public static void downloadForResult( Activity activity, RequestCode requestCode,
int lang, String name )
{
Intent intent = new Intent( activity, DictsActivity.class );
@@ -1084,6 +1087,12 @@ public class DictsDelegate extends ListDelegateBase
return canHandle;
}
+ @Override
+ protected DictsDelegate curThis()
+ {
+ return (DictsDelegate)super.curThis();
+ }
+
//////////////////////////////////////////////////////////////////////
// XWListItem.ExpandedListener interface
//////////////////////////////////////////////////////////////////////
@@ -1092,25 +1101,25 @@ public class DictsDelegate extends ListDelegateBase
final DictInfo info = (DictInfo)me.getCached();
if ( expanded ) {
m_expandedItems.add( info ); // may already be there
- LinearLayout view =
+ LinearLayout view =
(LinearLayout)inflate( R.layout.remote_dict_details );
Button button = (Button)view.findViewById( R.id.download_button );
button.setOnClickListener( new View.OnClickListener() {
public void onClick( View view ) {
DwnldDelegate.
- downloadDictInBack( m_activity, info.m_lang,
- info.m_name,
+ downloadDictInBack( m_activity, info.m_lang,
+ info.m_name,
DictsDelegate.this );
}
} );
-
+
long kBytes = (info.m_nBytes + 999) / 1000;
String note = null == info.m_note ? m_noteNone : info.m_note;
- String msg = getString( R.string.dict_info_fmt, info.m_nWords,
+ String msg = getString( R.string.dict_info_fmt, info.m_nWords,
kBytes, note );
TextView summary = (TextView)view.findViewById( R.id.details );
summary.setText( msg );
-
+
me.addExpandedView( view );
} else {
me.removeExpandedView();
@@ -1121,7 +1130,7 @@ public class DictsDelegate extends ListDelegateBase
//////////////////////////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface
//////////////////////////////////////////////////////////////////////
- public void downloadFinished( String lang, final String name,
+ public void downloadFinished( String lang, final String name,
final boolean success )
{
if ( success && m_showRemote ) {
@@ -1160,7 +1169,7 @@ public class DictsDelegate extends ListDelegateBase
DbgUtils.logf( "itemClicked not implemented" );
}
- public void itemToggled( SelectableItem.LongClickHandler toggled,
+ public void itemToggled( SelectableItem.LongClickHandler toggled,
boolean selected )
{
XWListItem dictView = (XWListItem)toggled;
@@ -1187,14 +1196,14 @@ public class DictsDelegate extends ListDelegateBase
private String m_langName;
private OnGotLcDictListener m_lstnr;
- public GetDefaultDictTask( Context context, String lc,
+ public GetDefaultDictTask( Context context, String lc,
OnGotLcDictListener lnr ) {
m_context = context;
m_lc = lc;
m_lstnr = lnr;
}
- @Override
+ @Override
public String doInBackground( Void... unused )
{
// FIXME: this should pass up the language code to retrieve and
@@ -1230,7 +1239,7 @@ public class DictsDelegate extends ListDelegateBase
break;
} else {
int nWords = dict.getInt( "nWords" );
- if ( null == theOne
+ if ( null == theOne
|| nWords > theOneNWords ) {
theOne = dict;
theOneNWords = nWords;
@@ -1244,8 +1253,8 @@ public class DictsDelegate extends ListDelegateBase
// the flag so we don't try again, even though
// we've failed.
if ( null == theOne ) {
- XWPrefs.setPrefsBoolean( m_context,
- R.string.key_got_langdict,
+ XWPrefs.setPrefsBoolean( m_context,
+ R.string.key_got_langdict,
true );
}
@@ -1269,7 +1278,7 @@ public class DictsDelegate extends ListDelegateBase
}
}
- private class FetchListTask extends AsyncTask
+ private class FetchListTask extends AsyncTask
implements OnCancelListener {
private Context m_context;
@@ -1279,7 +1288,7 @@ public class DictsDelegate extends ListDelegateBase
startProgress( R.string.progress_title, R.string.remote_empty, this );
}
- @Override
+ @Override
public Boolean doInBackground( Void... unused )
{
boolean success = false;
@@ -1299,21 +1308,21 @@ public class DictsDelegate extends ListDelegateBase
}
return new Boolean( success );
}
-
- @Override
+
+ @Override
protected void onCancelled()
{
m_remoteInfo = null;
m_showRemote = false;
}
- @Override
+ @Override
protected void onCancelled( Boolean success )
{
onCancelled();
}
- @Override
+ @Override
protected void onPostExecute( Boolean success )
{
if ( success ) {
@@ -1325,7 +1334,7 @@ public class DictsDelegate extends ListDelegateBase
String joined = TextUtils.join( ", ", names );
showConfirmThen( getString( R.string.update_dicts_fmt,
joined ),
- R.string.button_download,
+ R.string.button_download,
Action.UPDATE_DICTS_ACTION );
}
} else {
@@ -1358,8 +1367,8 @@ public class DictsDelegate extends ListDelegateBase
for ( int ii = 0; !isCancelled() && ii < nLangs; ++ii ) {
JSONObject langObj = langs.getJSONObject( ii );
String langName = langObj.getString( "lang" );
-
- if ( null != m_filterLang &&
+
+ if ( null != m_filterLang &&
! m_filterLang.equals( langName ) ) {
continue;
}
@@ -1370,9 +1379,9 @@ public class DictsDelegate extends ListDelegateBase
JSONArray dicts = langObj.getJSONArray( "dicts" );
int nDicts = dicts.length();
- ArrayList dictNames =
+ ArrayList dictNames =
new ArrayList();
- for ( int jj = 0; !isCancelled() && jj < nDicts;
+ for ( int jj = 0; !isCancelled() && jj < nDicts;
++jj ) {
JSONObject dict = dicts.getJSONObject( jj );
String name = dict.getString( "xwd" );
@@ -1388,18 +1397,18 @@ public class DictsDelegate extends ListDelegateBase
if ( !m_quickFetchMode ) {
// Check if we have it and it needs an update
- if ( DictLangCache.haveDict( m_activity,
+ if ( DictLangCache.haveDict( m_activity,
langName, name )){
boolean matches = true;
String curSum = DictLangCache
.getDictMD5Sum( m_activity, name );
if ( null != curSum ) {
- JSONArray sums =
+ JSONArray sums =
dict.getJSONArray("md5sums");
if ( null != sums ) {
matches = false;
- for ( int kk = 0;
- !matches && kk < sums.length();
+ for ( int kk = 0;
+ !matches && kk < sums.length();
++kk ) {
String sum = sums.getString( kk );
matches = sum.equals( curSum );
@@ -1407,8 +1416,8 @@ public class DictsDelegate extends ListDelegateBase
}
}
if ( !matches ) {
- Uri uri =
- Utils.makeDictUri( m_activity,
+ Uri uri =
+ Utils.makeDictUri( m_activity,
langName, name );
m_needUpdates.put( name, uri );
}
@@ -1445,4 +1454,15 @@ public class DictsDelegate extends ListDelegateBase
cancel( true );
}
} // class FetchListTask
+
+ public static void start( Delegator delegator )
+ {
+ if ( delegator.inDPMode() ) {
+ delegator.addFragment( new DictsFrag( delegator ), null );
+ } else {
+ Activity activity = delegator.getActivity();
+ Intent intent = new Intent( activity, DictsActivity.class );
+ activity.startActivity( intent );
+ }
+ }
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsFrag.java
new file mode 100644
index 000000000..0aa712387
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DictsFrag.java
@@ -0,0 +1,33 @@
+/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
+/*
+ * Copyright 2016 by Eric House (xwords@eehouse.org). All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4;
+
+import android.os.Bundle;
+
+public class DictsFrag extends XWFragment {
+
+ public DictsFrag( Delegator parent ) { super( parent ); }
+
+ @Override
+ public void onCreate( Bundle sis )
+ {
+ super.onCreate( new DictsDelegate( this, sis ), sis, true );
+ }
+}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DispatchNotify.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DispatchNotify.java
index 5cee9c3dc..1c6e038a6 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DispatchNotify.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DispatchNotify.java
@@ -34,7 +34,7 @@ import org.eehouse.android.xw4.jni.GameSummary;
public class DispatchNotify extends Activity {
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
index 8bc0e61a4..6a91beb82 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgDelegate.java
@@ -122,11 +122,12 @@ public class DlgDelegate {
ENABLE_SMS_DO,
ENABLE_BT_DO,
ENABLE_RELAY_DO,
+ ENABLE_RELAY_DO_OR,
DISABLE_RELAY_DO,
}
public static class ActionPair {
- public ActionPair( Action act, int str ) {
+ public ActionPair( Action act, int str ) {
buttonStr = str; action = act;
}
public int buttonStr;
@@ -156,8 +157,8 @@ public class DlgDelegate {
void showNotAgainDlgThen( int msgID, int prefsKey, Action action );
}
- private static Map> s_pendings
- = new HashMap>();
+ private static Map> s_pendings
+ = new HashMap>();
private Activity m_activity;
private DelegateBase m_dlgt;
private DlgClickNotify m_clickCallback;
@@ -167,8 +168,8 @@ public class DlgDelegate {
private HashMap m_dlgStates;
- public DlgDelegate( Activity activity, DelegateBase dlgt,
- DlgClickNotify callback, Bundle bundle )
+ public DlgDelegate( Activity activity, DelegateBase dlgt,
+ DlgClickNotify callback, Bundle bundle )
{
m_activity = activity;
m_dlgt = dlgt;
@@ -187,7 +188,7 @@ public class DlgDelegate {
}
}
- public void onSaveInstanceState( Bundle outState )
+ public void onSaveInstanceState( Bundle outState )
{
int[] ids = new int[m_dlgStates.size()];
if ( 0 < ids.length ) {
@@ -206,15 +207,13 @@ public class DlgDelegate {
protected void showDialog( DlgID dlgID )
{
- int id = dlgID.ordinal();
- if ( m_activity instanceof FragActivity ) {
- s_pendings.put( id, new WeakReference(m_dlgt) );
- }
+ // DbgUtils.logf( "showDialog(%s)", dlgID.toString() );
if ( !m_activity.isFinishing() ) {
- m_activity.showDialog( id );
+ s_pendings.put( dlgID, new WeakReference(m_dlgt) );
+ m_activity.showDialog( dlgID.ordinal() );
}
}
-
+
public Dialog createDialog( int id )
{
Dialog dialog = null;
@@ -299,8 +298,8 @@ public class DlgDelegate {
showDialog( DlgID.DIALOG_ENABLESMS );
}
- public void showNotAgainDlgThen( String msg, int prefsKey,
- final Action action, ActionPair more,
+ public void showNotAgainDlgThen( String msg, int prefsKey,
+ final Action action, ActionPair more,
final Object[] params )
{
if ( XWPrefs.getPrefsBoolean( m_activity, prefsKey, false ) ) {
@@ -317,18 +316,18 @@ public class DlgDelegate {
});
}
} else {
- DlgState state =
- new DlgState( DlgID.DIALOG_NOTAGAIN, msg, prefsKey, action, more,
+ DlgState state =
+ new DlgState( DlgID.DIALOG_NOTAGAIN, msg, prefsKey, action, more,
params );
addState( state );
showDialog( DlgID.DIALOG_NOTAGAIN );
}
}
- public void showNotAgainDlgThen( int msgID, int prefsKey, Action action,
+ public void showNotAgainDlgThen( int msgID, int prefsKey, Action action,
ActionPair more, Object[] params )
{
- showNotAgainDlgThen( getString( msgID ), prefsKey, action, more,
+ showNotAgainDlgThen( getString( msgID ), prefsKey, action, more,
params );
}
@@ -337,7 +336,7 @@ public class DlgDelegate {
showNotAgainDlgThen( msgID, prefsKey, action, null, null );
}
- public void showNotAgainDlgThen( int msgID, int prefsKey, Action action,
+ public void showNotAgainDlgThen( int msgID, int prefsKey, Action action,
ActionPair more )
{
showNotAgainDlgThen( msgID, prefsKey, action, more, null );
@@ -392,21 +391,21 @@ public class DlgDelegate {
public void showConfirmThen( int msg, int posButton, Action action,
Object[] params )
{
- showConfirmThen( null, getString(msg), posButton, android.R.string.cancel,
+ showConfirmThen( null, getString(msg), posButton, android.R.string.cancel,
action, params );
}
public void showConfirmThen( Runnable onNA, String msg, int posButton, Action action,
Object[] params )
{
- showConfirmThen( onNA, msg, posButton, android.R.string.cancel, action,
+ showConfirmThen( onNA, msg, posButton, android.R.string.cancel, action,
params );
}
- public void showConfirmThen( Runnable onNA, String msg, int posButton,
+ public void showConfirmThen( Runnable onNA, String msg, int posButton,
int negButton, Action action, Object[] params )
{
- DlgState state = new DlgState( DlgID.CONFIRM_THEN, onNA, msg, posButton,
+ DlgState state = new DlgState( DlgID.CONFIRM_THEN, onNA, msg, posButton,
negButton, action, 0, params );
addState( state );
showDialog( DlgID.CONFIRM_THEN );
@@ -428,7 +427,7 @@ public class DlgDelegate {
DlgClickNotify.InviteMeans means
= DlgClickNotify.InviteMeans.EMAIL;
m_clickCallback.inviteChoiceMade( action, means, null );
- }
+ }
});
}
}
@@ -463,7 +462,7 @@ public class DlgDelegate {
{
String title = getString( titleID );
m_progress = ProgressDialog.show( m_activity, title, msg, true, true );
-
+
if ( null != lstnr ) {
m_progress.setCancelable( true );
m_progress.setOnCancelListener( lstnr );
@@ -489,14 +488,14 @@ public class DlgDelegate {
return true;
}
- public void eventOccurred( MultiService.MultiEvent event,
+ public void eventOccurred( MultiService.MultiEvent event,
final Object ... args )
{
String msg = null;
boolean asToast = true;
switch( event ) {
case MESSAGE_RESEND:
- msg = getString( R.string.bt_resend_fmt, (String)args[0],
+ msg = getString( R.string.bt_resend_fmt, (String)args[0],
(Long)args[1], (Integer)args[2] );
break;
case MESSAGE_FAILOUT:
@@ -532,7 +531,7 @@ public class DlgDelegate {
final View view = LocUtils.inflate( m_activity, R.layout.about_dlg );
TextView vers = (TextView)view.findViewById( R.id.version_string );
- DateFormat df = DateFormat.getDateTimeInstance( DateFormat.FULL,
+ DateFormat df = DateFormat.getDateTimeInstance( DateFormat.FULL,
DateFormat.FULL );
String dateString
= df.format( new Date( BuildConstants.BUILD_STAMP * 1000 ) );
@@ -555,7 +554,7 @@ public class DlgDelegate {
builder.setNegativeButton( R.string.changes_button,
new OnClickListener() {
@Override
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int which )
{
FirstRunDialog.show( m_activity );
@@ -602,7 +601,7 @@ public class DlgDelegate {
public void onClick( DialogInterface dlg, int item ) {
checkNotAgainCheck( state, naView );
m_clickCallback.
- dlgButtonClicked( more.action,
+ dlgButtonClicked( more.action,
AlertDialog.BUTTON_POSITIVE,
more.params );
}
@@ -629,13 +628,13 @@ public class DlgDelegate {
.setPositiveButton( state.m_posButton, lstnr )
.setNegativeButton( state.m_negButton, lstnr );
Dialog dialog = builder.create();
-
+
return setCallbackDismissListener( dialog, state, dlgID );
}
private Dialog createInviteChoicesDialog( final DlgState state, DlgID dlgID )
{
- final ArrayList means =
+ final ArrayList means =
new ArrayList();
ArrayList items = new ArrayList();
DlgClickNotify.InviteMeans lastMeans = null;
@@ -643,7 +642,7 @@ public class DlgDelegate {
&& state.m_params[0] instanceof SentInvitesInfo ) {
lastMeans =((SentInvitesInfo)state.m_params[0]).getLastMeans();
}
-
+
if ( XWApp.SMS_INVITE_ENABLED && Utils.deviceSupportsSMS(m_activity) ) {
items.add( getString( R.string.invite_choice_sms ) );
means.add( DlgClickNotify.InviteMeans.SMS );
@@ -654,7 +653,7 @@ public class DlgDelegate {
items.add( getString( R.string.invite_choice_bt ) );
means.add( DlgClickNotify.InviteMeans.BLUETOOTH );
}
- if ( XWPrefs.getNFCToSelfEnabled( m_activity )
+ if ( XWPrefs.getNFCToSelfEnabled( m_activity )
|| NFCUtils.nfcAvail( m_activity )[0] ) {
items.add( getString( R.string.invite_choice_nfc ) );
means.add( DlgClickNotify.InviteMeans.NFC );
@@ -681,7 +680,7 @@ public class DlgDelegate {
sel[0] = view;
switch ( means.get(view) ) {
case CLIPBOARD:
- String msg =
+ String msg =
getString( R.string.not_again_clip_expl_fmt,
getString(R.string.slmenu_copy_sel) );
showNotAgainDlgThen( msg, R.string.key_na_clip_expl );
@@ -705,8 +704,8 @@ public class DlgDelegate {
Assert.assertTrue( Action.SKIP_CALLBACK != state.m_action );
int indx = sel[0];
if ( 0 <= indx ) {
- m_clickCallback.inviteChoiceMade( state.m_action,
- means.get(indx),
+ m_clickCallback.inviteChoiceMade( state.m_action,
+ means.get(indx),
state.m_params );
}
}
@@ -753,14 +752,14 @@ public class DlgDelegate {
{
final View layout = LocUtils.inflate( m_activity, R.layout.confirm_sms );
- DialogInterface.OnClickListener lstnr =
+ DialogInterface.OnClickListener lstnr =
new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
Spinner reasons = (Spinner)
layout.findViewById( R.id.confirm_sms_reasons );
boolean enabled = 0 < reasons.getSelectedItemPosition();
Assert.assertTrue( enabled );
- m_clickCallback.dlgButtonClicked( state.m_action,
+ m_clickCallback.dlgButtonClicked( state.m_action,
AlertDialog.BUTTON_POSITIVE,
state.m_params );
}
@@ -784,13 +783,13 @@ public class DlgDelegate {
button.setEnabled( enabled );
}
- private void prepareEnableSMSDialog( final Dialog dialog )
+ private void prepareEnableSMSDialog( final Dialog dialog )
{
final Spinner reasons = (Spinner)
dialog.findViewById( R.id.confirm_sms_reasons );
- OnItemSelectedListener onItemSel = new OnItemSelectedListener() {
- public void onItemSelected( AdapterView> parent, View view,
+ OnItemSelectedListener onItemSel = new OnItemSelectedListener() {
+ public void onItemSelected( AdapterView> parent, View view,
int position, long id )
{
checkEnableButton( dialog, reasons );
@@ -811,8 +810,8 @@ public class DlgDelegate {
checkNotAgainCheck( state, naView );
if ( Action.SKIP_CALLBACK != state.m_action ) {
- m_clickCallback.dlgButtonClicked( state.m_action,
- button,
+ m_clickCallback.dlgButtonClicked( state.m_action,
+ button,
state.m_params );
}
}
@@ -824,7 +823,7 @@ public class DlgDelegate {
{
if ( null != naView && naView.getChecked() ) {
if ( 0 != state.m_prefsKey ) {
- XWPrefs.setPrefsBoolean( m_activity, state.m_prefsKey,
+ XWPrefs.setPrefsBoolean( m_activity, state.m_prefsKey,
true );
} else if ( null != state.m_onNAChecked ) {
state.m_onNAChecked.run();
@@ -832,7 +831,7 @@ public class DlgDelegate {
}
}
- private Dialog setCallbackDismissListener( final Dialog dialog,
+ private Dialog setCallbackDismissListener( final Dialog dialog,
final DlgState state,
DlgID dlgID )
{
@@ -842,8 +841,8 @@ public class DlgDelegate {
public void onDismiss( DialogInterface di ) {
dropState( state );
if ( Action.SKIP_CALLBACK != state.m_action ) {
- m_clickCallback.dlgButtonClicked( state.m_action,
- DISMISS_BUTTON,
+ m_clickCallback.dlgButtonClicked( state.m_action,
+ DISMISS_BUTTON,
state.m_params );
}
m_activity.removeDialog( id );
@@ -867,7 +866,7 @@ public class DlgDelegate {
Assert.assertNotNull( state );
// Assert.assertTrue( state == m_dlgStates.get( state.m_id ) );
m_dlgStates.remove( state.m_id );
- // DbgUtils.logf( "dropState: active dialogs now %d from %d ",
+ // DbgUtils.logf( "dropState: active dialogs now %d from %d ",
// m_dlgStates.size(), nDlgs );
}
@@ -876,7 +875,7 @@ public class DlgDelegate {
// I'm getting serialization failures on devices pointing at
// DlgState but the code below says the object's fine (as it
// should be.) Just to have a record....
- //
+ //
// Bundle bundle = new Bundle();
// DbgUtils.logf( "addState: testing serializable" );
// bundle.putSerializable( "foo", state );
@@ -889,7 +888,8 @@ public class DlgDelegate {
public static Dialog onCreateDialog( int id )
{
Dialog result = null;
- WeakReference ref = s_pendings.get( id );
+ DlgID dlgID = DlgID.values()[id];
+ WeakReference ref = s_pendings.get( dlgID );
DelegateBase dlgt = ref.get();
if ( null != dlgt ) {
result = dlgt.onCreateDialog( id );
@@ -899,10 +899,11 @@ public class DlgDelegate {
public static void onPrepareDialog( int id, Dialog dialog )
{
- WeakReference ref = s_pendings.get( id );
+ DlgID dlgID = DlgID.values()[id];
+ WeakReference ref = s_pendings.get( dlgID );
DelegateBase dlgt = ref.get();
if ( null != dlgt ) {
- dlgt.prepareDialog( DlgID.values()[id], dialog );
+ dlgt.prepareDialog( dlgID, dialog );
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java
index 96e3e28c7..d6caea9e9 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DlgState.java
@@ -47,7 +47,7 @@ public class DlgState implements Parcelable {
this( dlgID, msg, android.R.string.ok, action, prefsKey );
}
- public DlgState( DlgID dlgID, String msg, int prefsKey, Action action,
+ public DlgState( DlgID dlgID, String msg, int prefsKey, Action action,
ActionPair more, Object[] params )
{
this( dlgID, msg, android.R.string.ok, action, prefsKey );
@@ -55,20 +55,20 @@ public class DlgState implements Parcelable {
m_pair = more;
}
- public DlgState( DlgID dlgID, String msg, int posButton,
+ public DlgState( DlgID dlgID, String msg, int posButton,
Action action, int prefsKey )
{
this( dlgID, msg, posButton, action, prefsKey, null );
}
- public DlgState( DlgID dlgID, String msg, int posButton,
+ public DlgState( DlgID dlgID, String msg, int posButton,
Action action, int prefsKey, Object[] params )
{
- this( dlgID, null, msg, posButton, android.R.string.cancel,
+ this( dlgID, null, msg, posButton, android.R.string.cancel,
action, prefsKey, params );
}
-
- public DlgState( DlgID dlgID, Runnable onNA, String msg, int posButton, int negButton,
+
+ public DlgState( DlgID dlgID, Runnable onNA, String msg, int posButton, int negButton,
Action action, int prefsKey, Object[] params )
{
m_id = dlgID;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DrawSelDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DrawSelDelegate.java
index 3eb0338a8..81c7454c2 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DrawSelDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DrawSelDelegate.java
@@ -27,7 +27,7 @@ import android.view.View;
public class DrawSelDelegate {
private View m_view;
private Drawable m_origDrawable;
- private static ColorDrawable s_selDrawable =
+ private static ColorDrawable s_selDrawable =
new ColorDrawable( XWApp.SEL_COLOR );
protected DrawSelDelegate( View view )
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DualpaneDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DualpaneDelegate.java
new file mode 100644
index 000000000..60437b206
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DualpaneDelegate.java
@@ -0,0 +1,98 @@
+/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
+/*
+ * Copyright 2009 - 2016 by Eric House (xwords@eehouse.org). All
+ * rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+
+public class DualpaneDelegate extends DelegateBase {
+ private Activity m_activity;
+
+ public DualpaneDelegate( Delegator delegator, Bundle sis )
+ {
+ super( delegator, sis, R.layout.dualcontainer );
+ m_activity = delegator.getActivity();
+ }
+
+ @Override
+ protected void init( Bundle savedInstanceState )
+ {
+ }
+
+ @Override
+ protected Dialog onCreateDialog( int id )
+ {
+ return DlgDelegate.onCreateDialog( id );
+ }
+
+ @Override
+ protected void prepareDialog( DlgID dlgId, Dialog dialog )
+ {
+ DlgDelegate.onPrepareDialog( dlgId.ordinal(), dialog );
+ }
+
+ @Override
+ protected boolean handleNewIntent( Intent intent )
+ {
+ MainActivity main = (MainActivity)m_activity;
+ boolean handled = main.dispatchNewIntent( intent );
+ DbgUtils.logf( "DualpaneDelegate.handleNewIntent() => %b", handled );
+ return handled;
+ }
+
+ @Override
+ protected boolean handleBackPressed()
+ {
+ MainActivity main = (MainActivity)m_activity;
+ boolean handled = main.dispatchBackPressed();
+ DbgUtils.logf( "DualpaneDelegate.handleBackPressed() => %b", handled );
+ return handled;
+ }
+
+ @Override
+ protected void onActivityResult( RequestCode requestCode, int resultCode, Intent data )
+ {
+ MainActivity main = (MainActivity)m_activity;
+ main.dispatchOnActivityResult( requestCode, resultCode, data );
+ }
+
+ @Override
+ protected void onCreateContextMenu( ContextMenu menu, View view,
+ ContextMenuInfo menuInfo )
+ {
+ MainActivity main = (MainActivity)m_activity;
+ main.dispatchOnCreateContextMenu( menu, view, menuInfo );
+ }
+
+ @Override
+ protected boolean onContextItemSelected( MenuItem item )
+ {
+ MainActivity main = (MainActivity)m_activity;
+ return main.dispatchOnContextItemSelected( item );
+ }
+
+}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldActivity.java
index 710d019e4..214a3cb30 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldActivity.java
@@ -27,14 +27,14 @@ import android.view.Window;
public class DwnldActivity extends XWActivity {
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
requestWindowFeature( Window.FEATURE_NO_TITLE );
requestWindowFeature( Window.FEATURE_LEFT_ICON );
getWindow().setFeatureDrawableResource( Window.FEATURE_LEFT_ICON,
R.drawable.icon48x48 );
-
- DwnldDelegate dlgt =
+
+ DwnldDelegate dlgt =
new DwnldDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java
index 7471ae145..e8b895d6a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DwnldDelegate.java
@@ -89,7 +89,7 @@ public class DwnldDelegate extends ListDelegateBase {
private static Map s_listeners =
new HashMap();
- private class DownloadFilesTask extends AsyncTask
+ private class DownloadFilesTask extends AsyncTask
implements DictUtils.DownProgListener {
private String m_savedDict = null;
private Uri m_uri = null;
@@ -122,8 +122,8 @@ public class DwnldDelegate extends ListDelegateBase {
m_appFile = null;
try {
- URI jUri = new URI( m_uri.getScheme(),
- m_uri.getSchemeSpecificPart(),
+ URI jUri = new URI( m_uri.getScheme(),
+ m_uri.getSchemeSpecificPart(),
m_uri.getFragment() );
URLConnection conn = jUri.toURL().openConnection();
final int fileLen = conn.getContentLength();
@@ -150,7 +150,7 @@ public class DwnldDelegate extends ListDelegateBase {
return null;
}
- @Override
+ @Override
protected void onCancelled()
{
callListener( m_uri, false );
@@ -160,9 +160,9 @@ public class DwnldDelegate extends ListDelegateBase {
protected void onPostExecute( Void unused )
{
if ( null != m_savedDict ) {
- DictUtils.DictLoc loc =
+ DictUtils.DictLoc loc =
XWPrefs.getDefaultLoc( m_activity );
- DictLangCache.inval( m_activity, m_savedDict,
+ DictLangCache.inval( m_activity, m_savedDict,
loc, true );
callListener( m_uri, true );
} else if ( null != m_appFile ) {
@@ -196,7 +196,7 @@ public class DwnldDelegate extends ListDelegateBase {
});
}
- private File saveToDownloads( InputStream is, String name,
+ private File saveToDownloads( InputStream is, String name,
DictUtils.DownProgListener dpl )
{
boolean success = false;
@@ -271,7 +271,7 @@ public class DwnldDelegate extends ListDelegateBase {
m_views.add( item );
}
}
- } else if ( (null != intent.getType()
+ } else if ( (null != intent.getType()
&& intent.getType().equals( "application/x-xwordsdict" ))
|| uri.toString().endsWith( XWConstants.DICT_EXTN ) ) {
item = (LinearLayout)inflate( R.layout.import_dict_item );
@@ -296,9 +296,9 @@ public class DwnldDelegate extends ListDelegateBase {
for ( int ii = 0; ii < uris.length; ++ii ) {
String showName = basename( uris[ii].getPath() );
showName = DictUtils.removeDictExtn( showName );
- String msg =
+ String msg =
getString( R.string.downloading_dict_fmt, showName );
-
+
dft = m_dfts.get( ii );
dft.setLabel( msg );
dft.execute();
@@ -307,15 +307,15 @@ public class DwnldDelegate extends ListDelegateBase {
} // init
@Override
- protected boolean onBackPressed()
- {
+ protected boolean handleBackPressed()
+ {
// cancel any tasks that remain
- for ( Iterator iter = m_dfts.iterator();
+ for ( Iterator iter = m_dfts.iterator();
iter.hasNext(); ) {
DownloadFilesTask dft = iter.next();
dft.cancel( true );
}
- return super.onBackPressed();
+ return super.handleBackPressed();
}
private void mkListAdapter()
@@ -323,7 +323,7 @@ public class DwnldDelegate extends ListDelegateBase {
setListAdapter( new ImportListAdapter() );
}
- private String saveDict( InputStream inputStream, String name,
+ private String saveDict( InputStream inputStream, String name,
DictUtils.DownProgListener dpl )
{
DictUtils.DictLoc loc = XWPrefs.getDefaultLoc( m_activity );
@@ -345,7 +345,7 @@ public class DwnldDelegate extends ListDelegateBase {
return result;
}
- private static void rememberListener( Uri uri, String name,
+ private static void rememberListener( Uri uri, String name,
DownloadFinishedListener lstnr )
{
ListenerData ld = new ListenerData( uri, name, lstnr );
@@ -354,7 +354,7 @@ public class DwnldDelegate extends ListDelegateBase {
}
}
- private static void callListener( Uri uri, boolean success )
+ private static void callListener( Uri uri, boolean success )
{
if ( null != uri ) {
ListenerData ld;
@@ -375,16 +375,16 @@ public class DwnldDelegate extends ListDelegateBase {
}
}
- public static void downloadDictInBack( Context context, String langName,
- String name,
+ public static void downloadDictInBack( Context context, String langName,
+ String name,
DownloadFinishedListener lstnr )
{
Uri uri = Utils.makeDictUri( context, langName, name );
downloadDictInBack( context, uri, name, lstnr );
}
- public static void downloadDictInBack( Context context, int lang,
- String name,
+ public static void downloadDictInBack( Context context, int lang,
+ String name,
DownloadFinishedListener lstnr )
{
Uri uri = Utils.makeDictUri( context, lang, name );
@@ -392,7 +392,7 @@ public class DwnldDelegate extends ListDelegateBase {
}
public static void downloadDictInBack( Context context, Uri uri,
- String name,
+ String name,
DownloadFinishedListener lstnr )
{
Uri[] uris = new Uri[] { uri };
@@ -401,7 +401,7 @@ public class DwnldDelegate extends ListDelegateBase {
}
public static void downloadDictsInBack( Context context, Uri[] uris,
- String[] names,
+ String[] names,
DownloadFinishedListener lstnr )
{
if ( null != lstnr ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/EditColorPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/EditColorPreference.java
index 80fe57e3c..bfa083d7f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/EditColorPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/EditColorPreference.java
@@ -43,9 +43,9 @@ public class EditColorPreference extends DialogPreference {
private int m_curColor;
// m_updateText: prevent loop that resets edittext cursor
private boolean m_updateText = true;
- private static final int m_seekbarIds[] = { R.id.seek_red, R.id.seek_green,
+ private static final int m_seekbarIds[] = { R.id.seek_red, R.id.seek_green,
R.id.seek_blue };
- private static final int m_editIds[] = { R.id.edit_red, R.id.edit_green,
+ private static final int m_editIds[] = { R.id.edit_red, R.id.edit_green,
R.id.edit_blue };
private class SBCL implements SeekBar.OnSeekBarChangeListener {
@@ -59,7 +59,7 @@ public class EditColorPreference extends DialogPreference {
m_editTxt = editTxt;
}
- public void onProgressChanged( SeekBar seekBar, int progress,
+ public void onProgressChanged( SeekBar seekBar, int progress,
boolean fromUser )
{
if ( m_updateText ) {
@@ -87,11 +87,11 @@ public class EditColorPreference extends DialogPreference {
{
}
- public void beforeTextChanged( CharSequence s, int st, int cnt, int a )
+ public void beforeTextChanged( CharSequence s, int st, int cnt, int a )
{
}
- public void onTextChanged( CharSequence s, int start,
+ public void onTextChanged( CharSequence s, int start,
int before, int count )
{
int val;
@@ -110,7 +110,7 @@ public class EditColorPreference extends DialogPreference {
{
super( context, attrs );
m_context = context;
-
+
setWidgetLayoutResource( R.layout.color_display );
setDialogLayoutResource( R.layout.color_edit );
@@ -134,9 +134,9 @@ public class EditColorPreference extends DialogPreference {
persistInt( (Integer)defaultValue );
}
}
-
+
@Override
- protected void onBindView( View parent )
+ protected void onBindView( View parent )
{
super.onBindView( parent );
View sample = parent.findViewById( R.id.color_display_sample );
@@ -156,11 +156,11 @@ public class EditColorPreference extends DialogPreference {
View sample = view.findViewById( R.id.color_edit_sample );
sample.setBackgroundColor( m_curColor );
}
-
+
@Override
protected void onPrepareDialogBuilder( AlertDialog.Builder builder )
{
- DialogInterface.OnClickListener lstnr =
+ DialogInterface.OnClickListener lstnr =
new DialogInterface.OnClickListener() {
@Override
public void onClick( DialogInterface dialog, int which )
@@ -179,7 +179,7 @@ public class EditColorPreference extends DialogPreference {
super.onPrepareDialogBuilder( builder );
}
- private void setOneByte( View parent, int indx )
+ private void setOneByte( View parent, int indx )
{
int shift = 16 - (indx*8);
int byt = (m_curColor >> shift) & 0xFF;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
index 5bd740b70..caae7b73b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringDelegate.java
@@ -42,7 +42,7 @@ public class ExpiringDelegate {
private static final long INTERVAL_SECS = 3 * 24 * 60 * 60;
// private static final long INTERVAL_SECS = 60 * 10; // for testing
- private static boolean s_kitkat =
+ private static boolean s_kitkat =
19 <= Integer.valueOf( android.os.Build.VERSION.SDK );
private Context m_context;
@@ -90,7 +90,7 @@ public class ExpiringDelegate {
}
}
- DbgUtils.logdf( "ExpUpdater: ref had %d refs, now has %d expiringdelegate views",
+ DbgUtils.logdf( "ExpUpdater: ref had %d refs, now has %d expiringdelegate views",
sizeBefore, dlgts.size() );
for ( ExpiringDelegate dlgt : dlgts ) {
@@ -100,7 +100,7 @@ public class ExpiringDelegate {
reschedule();
}
- private void reschedule()
+ private void reschedule()
{
m_handler.postDelayed( this, INTERVAL_SECS * 1000 / 100 );
}
@@ -130,8 +130,8 @@ public class ExpiringDelegate {
private static ExpUpdater s_updater;
static {
s_rect = new Rect();
- s_paint = new Paint();
- s_paint.setStyle(Paint.Style.STROKE);
+ s_paint = new Paint();
+ s_paint.setStyle(Paint.Style.STROKE);
s_paint.setStrokeWidth( 1 );
s_points = new float[4*6];
s_updater = new ExpUpdater();
@@ -149,7 +149,7 @@ public class ExpiringDelegate {
s_updater.setHandler( handler );
}
- public void configure( boolean haveTurn, boolean haveTurnLocal,
+ public void configure( boolean haveTurn, boolean haveTurnLocal,
long startSecs )
{
m_active = haveTurn;
@@ -173,7 +173,7 @@ public class ExpiringDelegate {
m_dsdel.showSelected( m_selected );
}
- public void onDraw( Canvas canvas )
+ public void onDraw( Canvas canvas )
{
if ( m_selected ) {
// do nothing; the drawable's set already
@@ -194,14 +194,14 @@ public class ExpiringDelegate {
s_rect.left, s_rect.bottom - 1 );
// left horizontals
- addPoints( 1, s_rect.left, s_rect.top,
+ addPoints( 1, s_rect.left, s_rect.top,
s_rect.left + redWidth, s_rect.top );
addPoints( 2, s_rect.left, s_rect.bottom - 1,
s_rect.left + redWidth,
s_rect.bottom - 1 );
// right horizontals
- addPoints( 3, s_rect.left + redWidth, s_rect.top,
+ addPoints( 3, s_rect.left + redWidth, s_rect.top,
s_rect.right - 1, s_rect.top );
addPoints( 4, s_rect.left + redWidth, s_rect.bottom - 1,
s_rect.right - 1, s_rect.bottom - 1 );
@@ -253,11 +253,11 @@ public class ExpiringDelegate {
Bitmap bm = Bitmap.createBitmap( 100, 1, Bitmap.Config.ARGB_8888 );
Canvas canvas = new Canvas(bm);
- Paint paint = new Paint();
- paint.setStyle(Paint.Style.FILL);
- paint.setColor( Color.RED );
+ Paint paint = new Paint();
+ paint.setStyle(Paint.Style.FILL);
+ paint.setColor( Color.RED );
canvas.drawRect( 0, 0, pct, 1, paint );
- paint.setColor( Utils.TURN_COLOR );
+ paint.setColor( Utils.TURN_COLOR );
canvas.drawRect( pct, 0, 100, 1, paint );
return new BitmapDrawable( m_context.getResources(), bm );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringLinearLayout.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringLinearLayout.java
index 4e3070e02..3c82fe77e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringLinearLayout.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringLinearLayout.java
@@ -32,7 +32,7 @@ public class ExpiringLinearLayout extends LinearLayout {
super( context, as );
}
- public void setPct( Handler handler, boolean haveTurn,
+ public void setPct( Handler handler, boolean haveTurn,
boolean haveTurnLocal, long startSecs )
{
if ( null == m_delegate ) {
@@ -49,7 +49,7 @@ public class ExpiringLinearLayout extends LinearLayout {
@Override
// not called unless setWillNotDraw( false ) called
- protected void onDraw( Canvas canvas )
+ protected void onDraw( Canvas canvas )
{
super.onDraw( canvas );
if ( null != m_delegate ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringTextView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringTextView.java
index 6c0ea2815..4aa8f25ae 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringTextView.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ExpiringTextView.java
@@ -35,7 +35,7 @@ class ExpiringTextView extends TextView {
m_context = context;
}
- public void setPct( Handler handler, boolean haveTurn,
+ public void setPct( Handler handler, boolean haveTurn,
boolean haveTurnLocal, long startSecs )
{
ExpiringDelegate delegate = getDelegate();
@@ -44,7 +44,7 @@ class ExpiringTextView extends TextView {
setPct( haveTurn, haveTurnLocal, startSecs );
}
- public void setPct( boolean haveTurn, boolean haveTurnLocal,
+ public void setPct( boolean haveTurn, boolean haveTurnLocal,
long startSecs )
{
if ( null != m_delegate ) {
@@ -53,7 +53,7 @@ class ExpiringTextView extends TextView {
}
@Override
- protected void onDraw( Canvas canvas )
+ protected void onDraw( Canvas canvas )
{
super.onDraw( canvas );
if ( null != m_delegate ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java
index 73abb192a..fe26f0d72 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FirstRunDialog.java
@@ -42,7 +42,7 @@ public class FirstRunDialog {
view.setWebViewClient( new WebViewClient() {
private boolean m_loaded = false;
@Override
- public boolean shouldOverrideUrlLoading( WebView view,
+ public boolean shouldOverrideUrlLoading( WebView view,
String url ) {
boolean result = false;
if ( url.startsWith("mailto:") ){
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FragActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FragActivity.java
index 8ec96693e..8b7edae98 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/FragActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/FragActivity.java
@@ -1,309 +1,309 @@
-/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
-/*
- * Copyright 2014-2016 by Eric House (xwords@eehouse.org). All rights
- * reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
+// /* -*- compile-command: "find-and-ant.sh debug install"; -*- */
+// /*
+// * Copyright 2014-2016 by Eric House (xwords@eehouse.org). All rights
+// * reserved.
+// *
+// * This program is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU General Public License as
+// * published by the Free Software Foundation; either version 2 of the
+// * License, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful, but
+// * WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+// */
-package org.eehouse.android.xw4;
+// package org.eehouse.android.xw4;
-import android.graphics.Rect;
-import android.app.Dialog;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentManager.BackStackEntry;
-import android.support.v4.app.FragmentTransaction;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout.LayoutParams;
-import android.widget.LinearLayout;
-import android.widget.LinearLayout;
+// import android.graphics.Rect;
+// import android.app.Dialog;
+// import android.content.res.Configuration;
+// import android.os.Bundle;
+// import android.support.v4.app.Fragment;
+// import android.support.v4.app.FragmentActivity;
+// import android.support.v4.app.FragmentManager;
+// import android.support.v4.app.FragmentManager.BackStackEntry;
+// import android.support.v4.app.FragmentTransaction;
+// import android.view.View;
+// import android.widget.FrameLayout;
+// import android.widget.LinearLayout.LayoutParams;
+// import android.widget.LinearLayout;
+// import android.widget.LinearLayout;
-import junit.framework.Assert;
+// import junit.framework.Assert;
-public class FragActivity extends FragmentActivity
- implements FragmentManager.OnBackStackChangedListener {
+// public class FragActivity extends FragmentActivity
+// implements FragmentManager.OnBackStackChangedListener {
- private static final int MAX_PANES_LANDSCAPE = 3;
+// private static final int MAX_PANES_LANDSCAPE = 3;
- public interface OrientChangeListener {
- void orientationChanged();
- }
+// // public interface OrientChangeListener {
+// // void orientationChanged();
+// // }
- private static FragActivity s_this;
+// private static FragActivity s_this;
- private LinearLayout m_root;
- private int m_nextID = 0x00FFFFFF;
- private int m_maxPanes;
- private Boolean m_isPortrait;
+// private LinearLayout m_root;
+// private int m_nextID = 0x00FFFFFF;
+// private int m_maxPanes;
+// private Boolean m_isPortrait;
- @Override
- public void onCreate( Bundle savedInstanceState )
- {
- s_this = this;
- super.onCreate( savedInstanceState );
- setContentView( R.layout.fragact );
+// @Override
+// public void onCreate( Bundle savedInstanceState )
+// {
+// s_this = this;
+// super.onCreate( savedInstanceState );
+// setContentView( R.layout.dualcontainer );
- m_root = (LinearLayout)findViewById( R.id.main_container );
- getSupportFragmentManager().addOnBackStackChangedListener( this );
+// m_root = (LinearLayout)findViewById( R.id.main_container );
+// getSupportFragmentManager().addOnBackStackChangedListener( this );
- m_maxPanes = maxPanes();
+// m_maxPanes = maxPanes();
- // Nothing to do if we're restarting
- if ( savedInstanceState == null ) {
- // In case this activity was started with special instructions from an Intent,
- // pass the Intent's extras to the fragment as arguments
- addFragmentImpl( new GamesListFrag(), getIntent().getExtras(), null );
- }
- }
+// // Nothing to do if we're restarting
+// if ( savedInstanceState == null ) {
+// // In case this activity was started with special instructions from an Intent,
+// // pass the Intent's extras to the fragment as arguments
+// addFragmentImpl( new GamesListFrag(), getIntent().getExtras(), null );
+// }
+// }
- @Override
- public void onBackPressed()
- {
- DbgUtils.logf( "FragActivity.onBackPressed()" );
- super.onBackPressed();
- }
+// @Override
+// public void onBackPressed()
+// {
+// DbgUtils.logf( "FragActivity.onBackPressed()" );
+// super.onBackPressed();
+// }
- @Override
- public void onConfigurationChanged( Configuration newConfig )
- {
- Rect rect = new Rect();
- m_root.getWindowVisibleDisplayFrame( rect );
+// @Override
+// public void onConfigurationChanged( Configuration newConfig )
+// {
+// Rect rect = new Rect();
+// m_root.getWindowVisibleDisplayFrame( rect );
- boolean isPortrait
- = Configuration.ORIENTATION_PORTRAIT == newConfig.orientation;
- DbgUtils.logf( "FragActivity.onConfigurationChanged(isPortrait=%b)",
- isPortrait );
- m_isPortrait = isPortrait;
- if ( isPortrait != (rect.width() <= rect.height()) ) {
- DbgUtils.logdf( "FragActivity.onConfigurationChanged(): isPortrait:"
- + " %b; width: %d; height: %d",
- isPortrait, rect.width(), rect.height() );
- }
- int maxPanes = isPortrait? 1 : MAX_PANES_LANDSCAPE;
- if ( m_maxPanes != maxPanes ) {
- m_maxPanes = maxPanes;
- setVisiblePanes();
- }
- tellOrientationChanged();
- super.onConfigurationChanged( newConfig );
- }
+// boolean isPortrait
+// = Configuration.ORIENTATION_PORTRAIT == newConfig.orientation;
+// DbgUtils.logf( "FragActivity.onConfigurationChanged(isPortrait=%b)",
+// isPortrait );
+// m_isPortrait = isPortrait;
+// if ( isPortrait != (rect.width() <= rect.height()) ) {
+// DbgUtils.logdf( "FragActivity.onConfigurationChanged(): isPortrait:"
+// + " %b; width: %d; height: %d",
+// isPortrait, rect.width(), rect.height() );
+// }
+// int maxPanes = isPortrait? 1 : MAX_PANES_LANDSCAPE;
+// if ( m_maxPanes != maxPanes ) {
+// m_maxPanes = maxPanes;
+// setVisiblePanes();
+// }
+// tellOrientationChanged();
+// super.onConfigurationChanged( newConfig );
+// }
- protected void getFragmentDims( int[] dims )
- {
- Rect rect = new Rect();
- m_root.getWindowVisibleDisplayFrame( rect );
- int width = rect.width();
- int height = rect.height();
- if ( null != m_isPortrait && m_isPortrait && height < width ) {
- int tmp = width;
- width = height;
- height = tmp;
- }
- dims[0] = width / Math.min( m_maxPanes, m_root.getChildCount() );
- dims[1] = height;
- }
+// protected void getFragmentDims( int[] dims )
+// {
+// Rect rect = new Rect();
+// m_root.getWindowVisibleDisplayFrame( rect );
+// int width = rect.width();
+// int height = rect.height();
+// if ( null != m_isPortrait && m_isPortrait && height < width ) {
+// int tmp = width;
+// width = height;
+// height = tmp;
+// }
+// dims[0] = width / Math.min( m_maxPanes, m_root.getChildCount() );
+// dims[1] = height;
+// }
- @Override
- protected Dialog onCreateDialog( int id )
- {
- return DlgDelegate.onCreateDialog( id );
- }
+// @Override
+// protected Dialog onCreateDialog( int id )
+// {
+// return DlgDelegate.onCreateDialog( id );
+// }
- @Override
- protected void onPrepareDialog( int id, Dialog dialog )
- {
- DlgDelegate.onPrepareDialog( id, dialog );
- }
+// @Override
+// protected void onPrepareDialog( int id, Dialog dialog )
+// {
+// DlgDelegate.onPrepareDialog( id, dialog );
+// }
- //////////////////////////////////////////////////////////////////////
- // FragmentManager.OnBackStackChangedListener
- //////////////////////////////////////////////////////////////////////
- public void onBackStackChanged()
- {
- DbgUtils.logf( "FragActivity.onBackStackChanged()" );
- // make sure the right-most are visible
- int fragCount = getSupportFragmentManager().getBackStackEntryCount();
- if ( 0 == fragCount ) {
- finish();
- } else if ( fragCount == m_root.getChildCount() - 1 ) {
- m_root.removeViewAt( fragCount );
- setVisiblePanes();
- }
- }
+// //////////////////////////////////////////////////////////////////////
+// // FragmentManager.OnBackStackChangedListener
+// //////////////////////////////////////////////////////////////////////
+// public void onBackStackChanged()
+// {
+// DbgUtils.logf( "FragActivity.onBackStackChanged()" );
+// // make sure the right-most are visible
+// int fragCount = getSupportFragmentManager().getBackStackEntryCount();
+// if ( 0 == fragCount ) {
+// finish();
+// } else if ( fragCount == m_root.getChildCount() - 1 ) {
+// m_root.removeViewAt( fragCount );
+// setVisiblePanes();
+// }
+// }
- // public void launchDictFrag( Bundle args )
- // {
- // // DictBrowseFrag dbf = new DictBrowseFrag();
- // // dbf.setArguments( args );
- // // addFragment( dbf );
- // }
+// // public void launchDictFrag( Bundle args )
+// // {
+// // // DictBrowseFrag dbf = new DictBrowseFrag();
+// // // dbf.setArguments( args );
+// // // addFragment( dbf );
+// // }
- protected void finishFragment()
- {
- popFragment( null );
- }
+// protected void finishFragment()
+// {
+// popFragment( null );
+// }
- protected void popFragment( Fragment frag )
- {
- getSupportFragmentManager().popBackStack();
- }
+// protected void popFragment( Fragment frag )
+// {
+// getSupportFragmentManager().popBackStack();
+// }
- private void addFragmentImpl( Fragment fragment, Bundle bundle,
- Delegator parent )
- {
- fragment.setArguments( bundle );
- addFragmentImpl( fragment, parent );
- }
+// private void addFragmentImpl( Fragment fragment, Bundle bundle,
+// Delegator parent )
+// {
+// fragment.setArguments( bundle );
+// addFragmentImpl( fragment, parent );
+// }
- private void addFragmentImpl( Fragment fragment, Delegator delegator )
- {
- String newName = fragment.getClass().getName();
- boolean replace = false;
- FragmentManager fm = getSupportFragmentManager();
- int fragCount = fm.getBackStackEntryCount();
- int containerCount = m_root.getChildCount();
- DbgUtils.logf( "fragCount: %d; containerCount: %d", fragCount, containerCount );
- // Assert.assertTrue( fragCount == containerCount );
+// private void addFragmentImpl( Fragment fragment, Delegator delegator )
+// {
+// String newName = fragment.getClass().getName();
+// boolean replace = false;
+// FragmentManager fm = getSupportFragmentManager();
+// int fragCount = fm.getBackStackEntryCount();
+// int containerCount = m_root.getChildCount();
+// DbgUtils.logf( "fragCount: %d; containerCount: %d", fragCount, containerCount );
+// // Assert.assertTrue( fragCount == containerCount );
- // Replace IF we're adding something of the same class at right OR if
- // we're adding something with the existing left pane as its parent
- // (delegator)
- if ( 0 < fragCount ) {
- FragmentManager.BackStackEntry entry = fm.getBackStackEntryAt( fragCount - 1 );
- String curName = entry.getName();
- DbgUtils.logf( "name of last entry: %s", curName );
- replace = curName.equals( newName );
+// // Replace IF we're adding something of the same class at right OR if
+// // we're adding something with the existing left pane as its parent
+// // (delegator)
+// if ( 0 < fragCount ) {
+// FragmentManager.BackStackEntry entry = fm.getBackStackEntryAt( fragCount - 1 );
+// String curName = entry.getName();
+// DbgUtils.logf( "name of last entry: %s", curName );
+// replace = curName.equals( newName );
- if ( !replace && 1 < fragCount ) {
- entry = fm.getBackStackEntryAt( fragCount - 2 );
- curName = entry.getName();
- String delName = delegator.getClass().getName();
- DbgUtils.logf( "comparing %s, %s", curName, delName );
- replace = curName.equals( delName );
- }
+// if ( !replace && 1 < fragCount ) {
+// entry = fm.getBackStackEntryAt( fragCount - 2 );
+// curName = entry.getName();
+// String delName = delegator.getClass().getName();
+// DbgUtils.logf( "comparing %s, %s", curName, delName );
+// replace = curName.equals( delName );
+// }
- if ( replace ) {
- fm.popBackStack();
- }
- }
+// if ( replace ) {
+// fm.popBackStack();
+// }
+// }
- // Replace doesn't seem to work with generated IDs, so we'll create a
- // new FrameLayout each time. If we're replacing, we'll replace the
- // current rightmost FrameLayout. Otherwise we'll add a new one.
- FrameLayout cont = new FrameLayout( this );
- cont.setLayoutParams( new LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) );
- int id = --m_nextID;
- cont.setId( id );
- m_root.addView( cont, replace ? containerCount - 1 : containerCount );
+// // Replace doesn't seem to work with generated IDs, so we'll create a
+// // new FrameLayout each time. If we're replacing, we'll replace the
+// // current rightmost FrameLayout. Otherwise we'll add a new one.
+// FrameLayout cont = new FrameLayout( this );
+// cont.setLayoutParams( new LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) );
+// int id = --m_nextID;
+// cont.setId( id );
+// m_root.addView( cont, replace ? containerCount - 1 : containerCount );
- if ( !replace && containerCount >= m_maxPanes ) {
- int indx = containerCount - m_maxPanes;
- View child = m_root.getChildAt( indx );
- child.setVisibility( View.GONE );
+// if ( !replace && containerCount >= m_maxPanes ) {
+// int indx = containerCount - m_maxPanes;
+// View child = m_root.getChildAt( indx );
+// child.setVisibility( View.GONE );
- setMenuVisibility( child, false );
+// setMenuVisibility( child, false );
- DbgUtils.logf( "hiding %dth container", indx );
- }
+// DbgUtils.logf( "hiding %dth container", indx );
+// }
- fm.beginTransaction()
- .add( id, fragment )
- .addToBackStack( newName )
- .commit();
- // fm.executePendingTransactions();
- }
+// fm.beginTransaction()
+// .add( id, fragment )
+// .addToBackStack( newName )
+// .commit();
+// // fm.executePendingTransactions();
+// }
- private void setVisiblePanes()
- {
- // hide all but the right-most m_maxPanes children
- int nPanes = m_root.getChildCount();
- for ( int ii = 0; ii < nPanes; ++ii ) {
- View child = m_root.getChildAt( ii );
- boolean visible = ii >= nPanes - m_maxPanes;
- DbgUtils.logf( "pane %d: visible=%b", ii, visible );
- child.setVisibility( visible ? View.VISIBLE : View.GONE );
- setMenuVisibility( child, visible );
- }
- }
+// private void setVisiblePanes()
+// {
+// // hide all but the right-most m_maxPanes children
+// int nPanes = m_root.getChildCount();
+// for ( int ii = 0; ii < nPanes; ++ii ) {
+// View child = m_root.getChildAt( ii );
+// boolean visible = ii >= nPanes - m_maxPanes;
+// DbgUtils.logf( "pane %d: visible=%b", ii, visible );
+// child.setVisibility( visible ? View.VISIBLE : View.GONE );
+// setMenuVisibility( child, visible );
+// }
+// }
- private void setMenuVisibility( View cont, boolean visible )
- {
- FrameLayout layout = (FrameLayout)cont;
- FragmentManager fm = getSupportFragmentManager();
- int hidingId = layout.getId();
- Fragment frag = fm.findFragmentById( hidingId );
- if ( null != frag ) { // hasn't been popped?
- frag.setMenuVisibility( visible );
- }
- }
+// private void setMenuVisibility( View cont, boolean visible )
+// {
+// FrameLayout layout = (FrameLayout)cont;
+// FragmentManager fm = getSupportFragmentManager();
+// int hidingId = layout.getId();
+// Fragment frag = fm.findFragmentById( hidingId );
+// if ( null != frag ) { // hasn't been popped?
+// frag.setMenuVisibility( visible );
+// }
+// }
- // Walk all Fragment children and if they care notify of change.
- private void tellOrientationChanged()
- {
- FragmentManager fm = getSupportFragmentManager();
- int nPanes = m_root.getChildCount();
- for ( int ii = 0; ii < nPanes; ++ii ) {
- FrameLayout frame = (FrameLayout)m_root.getChildAt( ii );
- int id = frame.getId();
- Fragment frag = fm.findFragmentById( id );
- if ( null == frag ) {
- DbgUtils.logf( "tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
- } else if ( frag instanceof OrientChangeListener ) {
- ((OrientChangeListener)frag).orientationChanged();
- }
- }
- }
+// // Walk all Fragment children and if they care notify of change.
+// private void tellOrientationChanged()
+// {
+// FragmentManager fm = getSupportFragmentManager();
+// int nPanes = m_root.getChildCount();
+// for ( int ii = 0; ii < nPanes; ++ii ) {
+// FrameLayout frame = (FrameLayout)m_root.getChildAt( ii );
+// int id = frame.getId();
+// Fragment frag = fm.findFragmentById( id );
+// if ( null == frag ) {
+// DbgUtils.logf( "tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
+// } else if ( frag instanceof XWFragment ) {
+// ((XWFragment)frag).getDelegate().orientationChanged();
+// }
+// }
+// }
- private int maxPanes()
- {
- int result;
- int orientation = getResources().getConfiguration().orientation;
- if ( XWPrefs.getIsTablet( this )
- && Configuration.ORIENTATION_LANDSCAPE == orientation ) {
- result = 2;
- } else {
- result = 1;
- }
- return result;
- }
+// private int maxPanes()
+// {
+// int result;
+// int orientation = getResources().getConfiguration().orientation;
+// if ( XWPrefs.getIsTablet( this )
+// && Configuration.ORIENTATION_LANDSCAPE == orientation ) {
+// result = 2;
+// } else {
+// result = 1;
+// }
+// return result;
+// }
- private static FragActivity getThis()
- {
- Assert.assertNotNull( s_this );
- return s_this;
- }
+// private static FragActivity getThis()
+// {
+// Assert.assertNotNull( s_this );
+// return s_this;
+// }
- public static void addFragment( Fragment fragment, Bundle bundle )
- {
- addFragment( fragment, bundle, null );
- }
+// public static void addFragment( Fragment fragment, Bundle bundle )
+// {
+// addFragment( fragment, bundle, null );
+// }
- public static void addFragment( Fragment fragment, Bundle bundle,
- Delegator parent )
- {
- getThis().addFragmentImpl( fragment, bundle, parent );
- }
+// public static void addFragment( Fragment fragment, Bundle bundle,
+// Delegator parent )
+// {
+// getThis().addFragmentImpl( fragment, bundle, parent );
+// }
- public static void addFragmentForResult( Fragment fragment, Bundle bundle,
- RequestCode requestCode, Delegator parent )
- {
- getThis().addFragmentImpl( fragment, bundle, parent );
- }
-}
+// public static void addFragmentForResult( Fragment fragment, Bundle bundle,
+// RequestCode requestCode, Delegator parent )
+// {
+// getThis().addFragmentImpl( fragment, bundle, parent );
+// }
+// }
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java
index 1df8351d5..9f2c53531 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GCMIntentService.java
@@ -35,13 +35,13 @@ public class GCMIntentService extends GCMBaseIntentService {
}
@Override
- protected void onError( Context context, String error )
+ protected void onError( Context context, String error )
{
DbgUtils.logdf("GCMIntentService.onError(%s)", error );
}
@Override
- protected void onRegistered( Context context, String regId )
+ protected void onRegistered( Context context, String regId )
{
DbgUtils.logdf( "GCMIntentService.onRegistered(%s)", regId );
DevID.setGCMDevID( context, regId );
@@ -49,7 +49,7 @@ public class GCMIntentService extends GCMBaseIntentService {
}
@Override
- protected void onUnregistered( Context context, String regId )
+ protected void onUnregistered( Context context, String regId )
{
DbgUtils.logdf( "GCMIntentService.onUnregistered(%s)", regId );
DevID.clearGCMDevID( context );
@@ -58,7 +58,7 @@ public class GCMIntentService extends GCMBaseIntentService {
}
@Override
- protected void onMessage( Context context, Intent intent )
+ protected void onMessage( Context context, Intent intent )
{
DbgUtils.logdf( "GCMIntentService.onMessage()" );
notifyRelayService( context, true );
@@ -108,7 +108,7 @@ public class GCMIntentService extends GCMBaseIntentService {
Intent alertIntent = GamesListDelegate
.makeAlertIntent( this, value );
int code = value.hashCode() ^ title.hashCode();
- Utils.postNotification( context, alertIntent, title,
+ Utils.postNotification( context, alertIntent, title,
teaser, code );
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigActivity.java
index 1a722438c..ba5095dc0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigActivity.java
@@ -27,7 +27,7 @@ public class GameConfigActivity extends XWActivity {
@Override
public void onCreate( Bundle savedInstanceState )
{
- super.onCreate( savedInstanceState,
+ super.onCreate( savedInstanceState,
new GameConfigDelegate( this, savedInstanceState ) );
} // onCreate
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java
index 2562444fa..c086b697d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigDelegate.java
@@ -65,7 +65,7 @@ public class GameConfigDelegate extends DelegateBase
,XWListItem.DeleteCallback
,RefreshNamesTask.NoNameFound {
- private static final String INTENT_FORRESULT_ROWID = "forresult";
+ private static final String INTENT_FORRESULT_NEWGAME = "newgame";
private static final String WHICH_PLAYER = "WHICH_PLAYER";
@@ -73,6 +73,7 @@ public class GameConfigDelegate extends DelegateBase
private CheckBox m_joinPublicCheck;
private CheckBox m_gameLockedCheck;
private boolean m_isLocked;
+ private boolean m_haveClosed;
private LinearLayout m_publicRoomsSet;
private LinearLayout m_privateRoomsSet;
@@ -88,9 +89,10 @@ public class GameConfigDelegate extends DelegateBase
private Spinner m_roomChoose;
// private Button m_configureButton;
private long m_rowid;
- private boolean m_forResult;
+ private boolean m_isNewGame;
private CurGameInfo m_gi;
private CurGameInfo m_giOrig;
+ private JNIThread m_jniThread;
private int m_whichPlayer;
// private Spinner m_roleSpinner;
// private Spinner m_connectSpinner;
@@ -140,12 +142,12 @@ public class GameConfigDelegate extends DelegateBase
public RemoteChoices() { super( m_gi.nPlayers ); }
public Object getItem( int position) { return m_gi.players[position]; }
- public View getView( final int position, View convertView,
+ public View getView( final int position, View convertView,
ViewGroup parent ) {
OnCheckedChangeListener lstnr;
lstnr = new OnCheckedChangeListener() {
@Override
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean isChecked )
{
m_gi.players[position].isLocal = !isChecked;
@@ -178,11 +180,12 @@ public class GameConfigDelegate extends DelegateBase
.setView(playerEditView)
.setPositiveButton( android.R.string.ok,
new DialogInterface.OnClickListener() {
- public void
- onClick( DialogInterface dlg,
+ public void
+ onClick( DialogInterface dlg,
int button ) {
- getPlayerSettings( dlg );
- loadPlayersList();
+ GameConfigDelegate self = curThis();
+ self.getPlayerSettings( dlg );
+ self.loadPlayersList();
}
})
.setNegativeButton( android.R.string.cancel, null )
@@ -197,7 +200,7 @@ public class GameConfigDelegate extends DelegateBase
// .inflate( layoutForDlg(id), null ))
// .setPositiveButton( android.R.string.ok,
// new DialogInterface.OnClickListener() {
- // public void onClick( DialogInterface dlg,
+ // public void onClick( DialogInterface dlg,
// int whichButton ) {
// getRoleSettings();
// }
@@ -208,9 +211,9 @@ public class GameConfigDelegate extends DelegateBase
case FORCE_REMOTE:
dlpos = new DialogInterface.OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- loadPlayersList();
+ curThis().loadPlayersList();
}
};
dialog = makeAlertBuilder()
@@ -218,14 +221,19 @@ public class GameConfigDelegate extends DelegateBase
.setView( inflate( layoutForDlg(dlgID) ) )
.setPositiveButton( android.R.string.ok, dlpos )
.create();
- DialogInterface.OnDismissListener dismiss =
+ DialogInterface.OnDismissListener dismiss =
new DialogInterface.OnDismissListener() {
@Override
- public void onDismiss( DialogInterface di )
+ public void onDismiss( DialogInterface di )
{
- if ( m_gi.forceRemoteConsistent() ) {
- showToast( R.string.forced_consistent );
- loadPlayersList();
+ GameConfigDelegate self = curThis();
+ if ( null != self
+ && self.m_gi.forceRemoteConsistent() ) {
+ self.showToast( R.string.forced_consistent );
+ self.loadPlayersList();
+ } else {
+ DbgUtils.logf( "GameConfigDelegate.onDismiss(): "
+ + "no visible self" );
}
}
};
@@ -234,11 +242,12 @@ public class GameConfigDelegate extends DelegateBase
case CONFIRM_CHANGE_PLAY:
case CONFIRM_CHANGE:
dlpos = new DialogInterface.OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- applyChanges( true );
+ GameConfigDelegate self = curThis();
+ self.applyChanges( true );
if ( DlgID.CONFIRM_CHANGE_PLAY == dlgID ) {
- launchGame();
+ self.launchGame( true );
}
}
};
@@ -248,9 +257,9 @@ public class GameConfigDelegate extends DelegateBase
.setPositiveButton( R.string.button_save, dlpos );
if ( DlgID.CONFIRM_CHANGE_PLAY == dlgID ) {
dlpos = new DialogInterface.OnClickListener() {
- public void onClick( DialogInterface dlg,
+ public void onClick( DialogInterface dlg,
int whichButton ) {
- launchGame();
+ curThis().finishAndLaunch();
}
};
} else {
@@ -262,12 +271,12 @@ public class GameConfigDelegate extends DelegateBase
dialog.setOnDismissListener( new DialogInterface.
OnDismissListener() {
public void onDismiss( DialogInterface di ) {
- finish();
+ curThis().closeNoSave();
}
});
break;
case NO_NAME_FOUND:
- String langName = DictLangCache.getLangName( m_activity,
+ String langName = DictLangCache.getLangName( m_activity,
m_gi.dictLang );
String msg = getString( R.string.no_name_found_fmt,
m_gi.nPlayers, xlateLang( langName ) );
@@ -285,22 +294,23 @@ public class GameConfigDelegate extends DelegateBase
.findViewById(R.id.default_check);
cb.setVisibility( View.VISIBLE );
- final DialogInterface.OnClickListener lstnr =
+ final DialogInterface.OnClickListener lstnr =
new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int button ) {
- m_conTypes = items.getTypes();
+ GameConfigDelegate self = curThis();
+ self.m_conTypes = items.getTypes();
if ( cb.isChecked()) {
- XWPrefs.setAddrTypes( m_activity, m_conTypes );
+ XWPrefs.setAddrTypes( self.m_activity, self.m_conTypes );
}
- m_car.populate( m_activity, m_conTypes );
+ self.m_car.populate( self.m_activity, self.m_conTypes );
- setConnLabel();
- setupRelayStuffIf( false );
- showHideRelayStuff();
+ self.setConnLabel();
+ self.setupRelayStuffIf( false );
+ self.showHideRelayStuff();
}
};
-
+
dialog = makeAlertBuilder()
.setTitle( R.string.title_addrs_pref )
.setView( layout )
@@ -315,7 +325,7 @@ public class GameConfigDelegate extends DelegateBase
@Override
protected void prepareDialog( DlgID dlgID, Dialog dialog )
- {
+ {
switch ( dlgID ) {
case PLAYER_EDIT:
setPlayerSettings( dialog );
@@ -339,13 +349,13 @@ public class GameConfigDelegate extends DelegateBase
public void warnDisabled( CommsConnType typ ) {
switch( typ ) {
case COMMS_CONN_SMS:
- showConfirmThen( R.string.warn_sms_disabled,
+ showConfirmThen( R.string.warn_sms_disabled,
R.string.button_enable_sms,
R.string.button_later,
Action.ENABLE_SMS_ASK );
break;
case COMMS_CONN_BT:
- showConfirmThen( R.string.warn_bt_disabled,
+ showConfirmThen( R.string.warn_bt_disabled,
R.string.button_enable_bt,
R.string.button_later,
Action.ENABLE_BT_DO );
@@ -406,9 +416,9 @@ public class GameConfigDelegate extends DelegateBase
if ( isServer ) {
OnCheckedChangeListener lstnr =
new OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean checked ) {
- localSet.setVisibility( checked ?
+ localSet.setVisibility( checked ?
View.GONE : View.VISIBLE );
}
};
@@ -422,7 +432,7 @@ public class GameConfigDelegate extends DelegateBase
check = (CheckBox)dialog.findViewById( R.id.robot_check );
OnCheckedChangeListener lstnr =
new OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean checked ) {
View view = dialog.findViewById( R.id.password_set );
view.setVisibility( checked ? View.GONE : View.VISIBLE );
@@ -474,7 +484,7 @@ public class GameConfigDelegate extends DelegateBase
Bundle args = getArguments();
m_rowid = args.getLong( GameUtils.INTENT_KEY_ROWID, DBUtils.ROWID_NOTFOUND );
Assert.assertTrue( DBUtils.ROWID_NOTFOUND != m_rowid );
- m_forResult = args.getBoolean( INTENT_FORRESULT_ROWID, false );
+ m_isNewGame = args.getBoolean( INTENT_FORRESULT_NEWGAME, false );
m_connectSetRelay = findViewById( R.id.connect_set_relay );
@@ -496,9 +506,9 @@ public class GameConfigDelegate extends DelegateBase
// This should only be in for one ship! Remove it and all associated
// strings immediately after shipping it.
- if ( !Utils.onFirstVersion( m_activity )
+ if ( !Utils.onFirstVersion( m_activity )
&& !XWPrefs.getPublicRoomsEnabled( m_activity ) ) {
- ActionPair pair = new ActionPair( Action.SET_ENABLE_PUBLIC,
+ ActionPair pair = new ActionPair( Action.SET_ENABLE_PUBLIC,
R.string.enable_pubroom_title );
showNotAgainDlgThen( R.string.not_again_enablepublic,
R.string.key_notagain_enablepublic,
@@ -509,6 +519,7 @@ public class GameConfigDelegate extends DelegateBase
@Override
protected void onResume()
{
+ m_jniThread = JNIThread.getRetained( m_rowid );
super.onResume();
loadGame();
}
@@ -517,9 +528,13 @@ public class GameConfigDelegate extends DelegateBase
{
m_giOrig = null; // flag for onStart and onResume
super.onPause();
+ if ( null != m_jniThread ) {
+ m_jniThread.release();
+ m_jniThread = null;
+ }
}
- protected void onSaveInstanceState( Bundle outState )
+ protected void onSaveInstanceState( Bundle outState )
{
outState.putInt( WHICH_PLAYER, m_whichPlayer );
}
@@ -551,8 +566,16 @@ public class GameConfigDelegate extends DelegateBase
if ( null == m_giOrig ) {
m_giOrig = new CurGameInfo( m_activity );
- GameLock gameLock = new GameLock( m_rowid, false ).lock();
- XwJNI.GamePtr gamePtr = GameUtils.loadMakeGame( m_activity, m_giOrig, gameLock );
+ GameLock gameLock;
+ XwJNI.GamePtr gamePtr;
+ if ( null == m_jniThread ) {
+ gameLock = new GameLock( m_rowid, false ).lock();
+ gamePtr = GameUtils.loadMakeGame( m_activity, m_giOrig, gameLock );
+ } else {
+ gameLock = m_jniThread.getLock();
+ gamePtr = m_jniThread.getGamePtr();
+ }
+
if ( null == gamePtr ) {
showDictGoneFinish();
} else {
@@ -561,7 +584,7 @@ public class GameConfigDelegate extends DelegateBase
if ( m_gameStarted ) {
if ( null == m_gameLockedCheck ) {
- m_gameLockedCheck =
+ m_gameLockedCheck =
(CheckBox)findViewById( R.id.game_locked_check );
m_gameLockedCheck.setVisibility( View.VISIBLE );
m_gameLockedCheck.setOnClickListener( this );
@@ -580,13 +603,15 @@ public class GameConfigDelegate extends DelegateBase
} else if ( !localOnlyGame() ) {
String relayName = XWPrefs.getDefaultRelayHost( m_activity );
int relayPort = XWPrefs.getDefaultRelayPort( m_activity );
- XwJNI.comms_getInitialAddr( m_carOrig, relayName,
+ XwJNI.comms_getInitialAddr( m_carOrig, relayName,
relayPort );
}
m_conTypes = (CommsConnTypeSet)m_carOrig.conTypes.clone();
- gamePtr.release();
- gameLock.unlock();
+ if ( null == m_jniThread ) {
+ gamePtr.release();
+ gameLock.unlock();
+ }
m_car = new CommsAddrRec( m_carOrig );
@@ -613,13 +638,13 @@ public class GameConfigDelegate extends DelegateBase
setChecked( R.id.hints_allowed, !m_gi.hintsNotAllowed );
setChecked( R.id.pick_faceup, m_gi.allowPickTiles );
- setInt( R.id.timer_minutes_edit,
+ setInt( R.id.timer_minutes_edit,
m_gi.gameSeconds/60/m_gi.nPlayers );
CheckBox check = (CheckBox)findViewById( R.id.use_timer );
OnCheckedChangeListener lstnr =
new OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton buttonView,
+ public void onCheckedChanged( CompoundButton buttonView,
boolean checked ) {
View view = findViewById( R.id.timer_set );
view.setVisibility( checked ? View.VISIBLE : View.GONE );
@@ -658,6 +683,8 @@ public class GameConfigDelegate extends DelegateBase
public void dlgButtonClicked( Action action, int button, Object[] params )
{
boolean callSuper = false;
+ Assert.assertTrue( curThis() == this );
+
if ( AlertDialog.BUTTON_POSITIVE == button ) {
switch( action ) {
case LOCKED_CHANGE_ACTION:
@@ -667,10 +694,10 @@ public class GameConfigDelegate extends DelegateBase
Utils.launchSettings( m_activity );
break;
case DELETE_AND_EXIT:
- if ( m_forResult ) {
+ if ( m_isNewGame ) {
deleteGame();
}
- finish();
+ closeNoSave();
break;
case SET_ENABLE_PUBLIC:
XWPrefs.setPrefsBoolean( m_activity, R.string.key_enable_pubroom,
@@ -689,7 +716,7 @@ public class GameConfigDelegate extends DelegateBase
callSuper = true;
break;
}
- } else {
+ } else {
callSuper = true;
}
@@ -698,7 +725,7 @@ public class GameConfigDelegate extends DelegateBase
}
}
- public void onClick( View view )
+ public void onClick( View view )
{
if ( isFinishing() ) {
// do nothing; we're on the way out
@@ -714,7 +741,7 @@ public class GameConfigDelegate extends DelegateBase
} else if ( m_joinPublicCheck == view ) {
adjustConnectStuff();
} else if ( m_gameLockedCheck == view ) {
- showNotAgainDlgThen( R.string.not_again_unlock,
+ showNotAgainDlgThen( R.string.not_again_unlock,
R.string.key_notagain_unlock,
Action.LOCKED_CHANGE_ACTION );
} else if ( m_refreshRoomsButton == view ) {
@@ -727,26 +754,19 @@ public class GameConfigDelegate extends DelegateBase
// from here if there's no confirmation needed, or launch
// a new dialog whose OK button does the same thing.
saveChanges();
+
if ( !localOnlyGame() && 0 == m_conTypes.size() ) {
showConfirmThen( R.string.config_no_connvia,
- R.string.button_discard,
+ R.string.button_discard,
R.string.button_edit,
Action.DELETE_AND_EXIT );
- } else if ( m_forResult ) {
- applyChanges( true );
- Intent intent = new Intent();
- intent.putExtra( GameUtils.INTENT_KEY_ROWID, m_rowid );
- setResult( Activity.RESULT_OK, intent );
- finish();
- } else if ( !m_gameStarted ) { // no confirm needed
- applyChanges( true );
- launchGame();
- } else if ( m_giOrig.changesMatter(m_gi)
+ } else if ( m_isNewGame || !m_gameStarted ) {
+ saveAndClose( true );
+ } else if ( m_giOrig.changesMatter(m_gi)
|| m_carOrig.changesMatter(m_car) ) {
showDialog( DlgID.CONFIRM_CHANGE_PLAY );
} else {
- applyChanges( false );
- launchGame();
+ finishAndLaunch();
}
} else {
@@ -754,18 +774,48 @@ public class GameConfigDelegate extends DelegateBase
}
} // onClick
+ private void saveAndClose( boolean forceNew )
+ {
+ DbgUtils.logf( "GameConfigDelegate.saveAndClose(forceNew=%b)",
+ forceNew );
+ applyChanges( forceNew );
+
+ finishAndLaunch();
+ }
+
+ private void finishAndLaunch()
+ {
+ if ( !m_haveClosed ) {
+ m_haveClosed = true;
+ DbgUtils.logf( "GameConfigDelegate.finishAndLaunch()" );
+ Intent intent = new Intent();
+ intent.putExtra( GameUtils.INTENT_KEY_ROWID, m_rowid );
+ setResult( Activity.RESULT_OK, intent );
+ finish();
+ }
+ }
+
+ private void closeNoSave()
+ {
+ if ( !m_haveClosed ) {
+ m_haveClosed = true;
+ setResult( Activity.RESULT_CANCELED, null );
+ finish();
+ }
+ }
+
@Override
- protected boolean onBackPressed()
+ protected boolean handleBackPressed()
{
boolean consumed = false;
if ( ! isFinishing() ) {
- if ( m_forResult ) {
+ if ( m_isNewGame ) {
deleteGame();
} else {
saveChanges();
- if ( !m_gameStarted ) { // no confirm needed
+ if ( !m_gameStarted ) { // no confirm needed
applyChanges( true );
- } else if ( m_giOrig.changesMatter(m_gi)
+ } else if ( m_giOrig.changesMatter(m_gi)
|| m_carOrig.changesMatter(m_car) ) {
showDialog( DlgID.CONFIRM_CHANGE );
consumed = true; // don't dismiss activity yet!
@@ -778,6 +828,12 @@ public class GameConfigDelegate extends DelegateBase
return consumed;
}
+ @Override
+ protected GameConfigDelegate curThis()
+ {
+ return (GameConfigDelegate)super.curThis();
+ }
+
private void deleteGame()
{
GameUtils.deleteGame( m_activity, m_rowid, false );
@@ -799,7 +855,7 @@ public class GameConfigDelegate extends DelegateBase
showDialog( DlgID.PLAYER_EDIT );
}
};
-
+
boolean localGame = localOnlyGame();
boolean unlocked = null == m_gameLockedCheck
|| !m_gameLockedCheck.isChecked();
@@ -845,20 +901,20 @@ public class GameConfigDelegate extends DelegateBase
{
if ( null != dictsSpinner ) {
String langName = DictLangCache.getLangName( m_activity, lang );
- dictsSpinner.setPrompt( getString( R.string.dicts_list_prompt_fmt,
+ dictsSpinner.setPrompt( getString( R.string.dicts_list_prompt_fmt,
langName ) );
- OnItemSelectedListener onSel =
+ OnItemSelectedListener onSel =
new OnItemSelectedListener() {
@Override
- public void onItemSelected( AdapterView> parentView,
- View selectedItemView,
+ public void onItemSelected( AdapterView> parentView,
+ View selectedItemView,
int position, long id ) {
- String chosen =
+ String chosen =
(String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) {
- DictsDelegate.downloadForResult( m_activity,
+ DictsDelegate.downloadForResult( m_activity,
RequestCode.REQUEST_DICT,
m_gi.dictLang );
}
@@ -868,7 +924,7 @@ public class GameConfigDelegate extends DelegateBase
public void onNothingSelected(AdapterView> parentView) {}
};
- ArrayAdapter adapter =
+ ArrayAdapter adapter =
DictLangCache.getDictsAdapter( m_activity, lang );
configSpinnerWDownload( dictsSpinner, adapter, onSel, curDict );
@@ -882,17 +938,17 @@ public class GameConfigDelegate extends DelegateBase
final LangsArrayAdapter adapter = DictLangCache.getLangsAdapter( m_activity );
- OnItemSelectedListener onSel =
+ OnItemSelectedListener onSel =
new OnItemSelectedListener() {
@Override
- public void onItemSelected(AdapterView> parentView,
- View selectedItemView,
+ public void onItemSelected(AdapterView> parentView,
+ View selectedItemView,
int position, long id ) {
if ( ! isFinishing() ) { // not on the way out?
- String chosen =
+ String chosen =
(String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) {
- DictsDelegate.downloadForResult( m_activity,
+ DictsDelegate.downloadForResult( m_activity,
RequestCode
.REQUEST_LANG_GC );
} else {
@@ -918,7 +974,7 @@ public class GameConfigDelegate extends DelegateBase
configDictSpinner( m_dictSpinner, m_gi.dictLang, m_gi.dictName );
}
- private void configSpinnerWDownload( Spinner spinner,
+ private void configSpinnerWDownload( Spinner spinner,
ArrayAdapter adapter,
OnItemSelectedListener onSel,
String curSel )
@@ -972,7 +1028,7 @@ public class GameConfigDelegate extends DelegateBase
setting = 2;
break;
default:
- DbgUtils.logf( "setSmartnessSpinner got %d from getRobotSmartness()",
+ DbgUtils.logf( "setSmartnessSpinner got %d from getRobotSmartness()",
m_gi.getRobotSmartness() );
Assert.fail();
}
@@ -1021,7 +1077,7 @@ public class GameConfigDelegate extends DelegateBase
} else {
int remoteCount = m_gi.remoteCount();
label = getString( R.string.players_label_host_fmt,
- m_gi.nPlayers - remoteCount,
+ m_gi.nPlayers - remoteCount,
remoteCount );
}
((TextView)findViewById( R.id.players_label )).setText( label );
@@ -1062,8 +1118,8 @@ public class GameConfigDelegate extends DelegateBase
}
}
}
-
- private int layoutForDlg( DlgID dlgID )
+
+ private int layoutForDlg( DlgID dlgID )
{
switch( dlgID ) {
// case ROLE_EDIT_RELAY:
@@ -1079,7 +1135,7 @@ public class GameConfigDelegate extends DelegateBase
return 0;
}
- // private int titleForDlg( int id )
+ // private int titleForDlg( int id )
// {
// switch( id ) {
// // case ROLE_EDIT_RELAY:
@@ -1127,7 +1183,7 @@ public class GameConfigDelegate extends DelegateBase
m_gi.hintsNotAllowed = !getChecked( R.id.hints_allowed );
m_gi.allowPickTiles = getChecked( R.id.pick_faceup );
m_gi.timerEnabled = getChecked( R.id.use_timer );
- m_gi.gameSeconds =
+ m_gi.gameSeconds =
60 * m_gi.nPlayers * getInt( R.id.timer_minutes_edit );
int position = m_phoniesSpinner.getSelectedItemPosition();
@@ -1141,7 +1197,7 @@ public class GameConfigDelegate extends DelegateBase
if ( m_conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
m_car.ip_relay_seeksPublicRoom = m_joinPublicCheck.isChecked();
- m_car.ip_relay_advertiseRoom =
+ m_car.ip_relay_advertiseRoom =
getChecked( R.id.advertise_new_room_check );
if ( m_car.ip_relay_seeksPublicRoom ) {
SpinnerAdapter adapter = m_roomChoose.getAdapter();
@@ -1162,28 +1218,32 @@ public class GameConfigDelegate extends DelegateBase
private void applyChanges( boolean forceNew )
{
if ( !isFinishing() ) {
- GameLock gameLock = new GameLock( m_rowid, true ).lock();
- GameUtils.applyChanges( m_activity, m_gi, m_car, gameLock,
+ GameLock gameLock = m_jniThread == null
+ ? new GameLock( m_rowid, true ).lock()
+ : m_jniThread.getLock();
+ GameUtils.applyChanges( m_activity, m_gi, m_car, gameLock,
forceNew );
DBUtils.saveThumbnail( m_activity, gameLock, null ); // clear it
- gameLock.unlock();
+ if ( null == m_jniThread ) {
+ gameLock.unlock();
+ }
}
}
- private void launchGame()
+ private void launchGame( boolean forceNew )
{
if ( m_conTypes.contains( CommsConnType.COMMS_CONN_RELAY )
&& 0 == m_car.ip_relay_invite.length() ) {
- showOKOnlyDialog( R.string.no_empty_rooms );
+ showOKOnlyDialog( R.string.no_empty_rooms );
} else {
- GameUtils.launchGameAndFinish( getDelegator(), m_rowid );
+ saveAndClose( forceNew );
}
}
private void refreshNames()
{
if ( !m_isLocked ) {
- new RefreshNamesTask( m_activity, this, m_gi.dictLang,
+ new RefreshNamesTask( m_activity, this, m_gi.dictLang,
m_gi.nPlayers, m_roomChoose ).execute();
}
}
@@ -1205,19 +1265,19 @@ public class GameConfigDelegate extends DelegateBase
return DeviceRole.SERVER_STANDALONE == m_giOrig.serverRole;
}
- public static void editForResult( Delegator delegator,
- RequestCode requestCode,
- long rowID )
+ public static void editForResult( Delegator delegator,
+ RequestCode requestCode,
+ long rowID, boolean newGame )
{
- Activity activity = delegator.getActivity();
Bundle bundle = new Bundle();
bundle.putLong( GameUtils.INTENT_KEY_ROWID, rowID );
- bundle.putBoolean( INTENT_FORRESULT_ROWID, true );
-
- if ( activity instanceof FragActivity ) {
- FragActivity.addFragmentForResult( new GameConfigFrag(), bundle,
- requestCode, delegator );
+ bundle.putBoolean( INTENT_FORRESULT_NEWGAME, newGame );
+
+ if ( delegator.inDPMode() ) {
+ delegator.addFragmentForResult( new GameConfigFrag( delegator ),
+ bundle, requestCode );
} else {
+ Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, GameConfigActivity.class );
intent.setAction( Intent.ACTION_EDIT );
intent.putExtras( bundle );
@@ -1242,7 +1302,7 @@ public class GameConfigDelegate extends DelegateBase
boolean publicEnabled = XWPrefs.getPublicRoomsEnabled( m_activity );
int vis = publicEnabled ? View.VISIBLE : View.GONE;
if ( reset || null == m_joinPublicCheck ) {
- m_joinPublicCheck =
+ m_joinPublicCheck =
(CheckBox)findViewById(R.id.join_public_room_check);
m_joinPublicCheck.setVisibility( vis );
@@ -1253,18 +1313,18 @@ public class GameConfigDelegate extends DelegateBase
m_joinPublicCheck.setOnClickListener( this );
m_joinPublicCheck.setChecked( m_car.ip_relay_seeksPublicRoom );
advertise.setChecked( m_car.ip_relay_advertiseRoom );
- m_publicRoomsSet =
+ m_publicRoomsSet =
(LinearLayout)findViewById(R.id.public_rooms_set );
- m_privateRoomsSet =
+ m_privateRoomsSet =
(LinearLayout)findViewById(R.id.private_rooms_set );
}
setText( R.id.room_edit, m_car.ip_relay_invite );
-
+
m_roomChoose = (Spinner)findViewById( R.id.room_spinner );
m_roomChoose.setVisibility( vis );
- m_refreshRoomsButton =
+ m_refreshRoomsButton =
(ImageButton)findViewById( R.id.refresh_button );
m_refreshRoomsButton.setVisibility( vis );
m_refreshRoomsButton.setOnClickListener( this );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigFrag.java
index e835da137..8cce822e9 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfigFrag.java
@@ -23,6 +23,8 @@ import android.os.Bundle;
public class GameConfigFrag extends XWFragment {
+ public GameConfigFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListGroup.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListGroup.java
index 3240c1d93..cf35dbdf1 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListGroup.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListGroup.java
@@ -31,7 +31,7 @@ import android.widget.TextView;
import org.eehouse.android.xw4.DBUtils.GameGroupInfo;
import org.eehouse.android.xw4.loc.LocUtils;
-public class GameListGroup extends ExpiringLinearLayout
+public class GameListGroup extends ExpiringLinearLayout
implements SelectableItem.LongClickHandler,
View.OnClickListener,
View.OnLongClickListener
@@ -81,7 +81,7 @@ public class GameListGroup extends ExpiringLinearLayout
return result;
}
- public GameListGroup( Context cx, AttributeSet as )
+ public GameListGroup( Context cx, AttributeSet as )
{
super( cx, as );
}
@@ -137,7 +137,7 @@ public class GameListGroup extends ExpiringLinearLayout
//////////////////////////////////////////////////
// View.OnLongClickListener interface
//////////////////////////////////////////////////
- public boolean onLongClick( View view )
+ public boolean onLongClick( View view )
{
boolean handled = ! XWApp.CONTEXT_MENUS_ENABLED;
if ( handled ) {
@@ -149,7 +149,7 @@ public class GameListGroup extends ExpiringLinearLayout
//////////////////////////////////////////////////
// View.OnClickListener interface
//////////////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
if ( 0 < m_nGames ) {
m_expanded = !m_expanded;
@@ -161,7 +161,7 @@ public class GameListGroup extends ExpiringLinearLayout
private void setButton()
{
if ( null != m_expandButton ) {
- m_expandButton.setVisibility( 0 == m_nGames ?
+ m_expandButton.setVisibility( 0 == m_nGames ?
View.GONE : View.VISIBLE );
m_expandButton.setImageResource( m_expanded ?
R.drawable.expander_ic_maximized :
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java
index f5ceb52d3..112c670a7 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListItem.java
@@ -48,11 +48,11 @@ import org.eehouse.android.xw4.jni.GameSummary;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
-public class GameListItem extends LinearLayout
+public class GameListItem extends LinearLayout
implements View.OnClickListener, SelectableItem.LongClickHandler {
private static final int SUMMARY_WAIT_MSECS = 1000;
-
+
private static HashSet s_invalRows = new HashSet();
private Activity m_activity;
@@ -81,7 +81,7 @@ public class GameListItem extends LinearLayout
private boolean m_selected = false;
private DrawSelDelegate m_dsdel;
- public GameListItem( Context cx, AttributeSet as )
+ public GameListItem( Context cx, AttributeSet as )
{
super( cx, as );
m_context = cx;
@@ -111,7 +111,7 @@ public class GameListItem extends LinearLayout
return m_summary;
}
- private void init( Handler handler, long rowid, int fieldID,
+ private void init( Handler handler, long rowid, int fieldID,
SelectableItem cb )
{
m_handler = handler;
@@ -149,7 +149,7 @@ public class GameListItem extends LinearLayout
}
@Override
- protected void onDraw( Canvas canvas )
+ protected void onDraw( Canvas canvas )
{
super.onDraw( canvas );
if ( DBUtils.ROWID_NOTFOUND != m_rowid ) {
@@ -198,9 +198,7 @@ public class GameListItem extends LinearLayout
m_state = (TextView)findViewById( R.id.state );
m_modTime = (TextView)findViewById( R.id.modtime );
m_marker = (ImageView)findViewById( R.id.msg_marker );
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- m_thumb = (ImageView)findViewById( R.id.thumbnail );
- }
+ m_thumb = (ImageView)findViewById( R.id.thumbnail );
m_role = (TextView)findViewById( R.id.role );
}
@@ -221,14 +219,13 @@ public class GameListItem extends LinearLayout
R.drawable.expander_ic_maximized :
R.drawable.expander_ic_minimized);
m_hideable.setVisibility( m_expanded? View.VISIBLE : View.GONE );
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- int vis = m_expanded && XWPrefs.getThumbEnabled( m_context )
- ? View.VISIBLE : View.GONE;
- m_thumb.setVisibility( vis );
- }
+
+ int vis = m_expanded && XWPrefs.getThumbEnabled( m_context )
+ ? View.VISIBLE : View.GONE;
+ m_thumb.setVisibility( vis );
m_name.setBackgroundColor( android.R.color.transparent );
- m_name.setPct( m_handler, m_haveTurn && !m_expanded,
+ m_name.setPct( m_handler, m_haveTurn && !m_expanded,
m_haveTurnLocal, m_lastMoveTime );
}
@@ -251,8 +248,8 @@ public class GameListItem extends LinearLayout
value = String.format( "%d", m_summary.nPacketsPending );
break;
case R.string.game_summary_field_language:
- value =
- DictLangCache.getLangName( m_context,
+ value =
+ DictLangCache.getLangName( m_context,
m_summary.dictLang );
value = LocUtils.xlateLang( m_context, value, true );
break;
@@ -266,12 +263,12 @@ public class GameListItem extends LinearLayout
String name = GameUtils.getName( m_context, m_rowid );
if ( null != value ) {
- value = LocUtils.getString( m_context, R.string.str_game_name_fmt,
+ value = LocUtils.getString( m_context, R.string.str_game_name_fmt,
name, value );
} else {
value = name;
}
-
+
m_name.setText( value );
}
return state;
@@ -300,7 +297,7 @@ public class GameListItem extends LinearLayout
haveALocalTurn = true;
}
}
- tmp.setPct( m_handler, thisHasTurn, isLocal[0],
+ tmp.setPct( m_handler, thisHasTurn, isLocal[0],
summary.lastMoveTime );
m_list.addView( tmp, ii );
}
@@ -309,7 +306,7 @@ public class GameListItem extends LinearLayout
long lastMoveTime = summary.lastMoveTime;
lastMoveTime *= 1000;
- DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
+ DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
DateFormat.SHORT );
m_modTime.setText( df.format( new Date( lastMoveTime ) ) );
@@ -330,7 +327,7 @@ public class GameListItem extends LinearLayout
m_role.setVisibility( View.GONE );
}
- update( expanded, summary.lastMoveTime, haveATurn,
+ update( expanded, summary.lastMoveTime, haveATurn,
haveALocalTurn );
}
}
@@ -352,35 +349,39 @@ public class GameListItem extends LinearLayout
private class LoadItemTask extends AsyncTask {
@Override
- protected GameSummary doInBackground( Void... unused )
+ protected GameSummary doInBackground( Void... unused )
{
- return DBUtils.getSummary( m_context, m_rowid, SUMMARY_WAIT_MSECS );
+ GameSummary result = null;
+
+ JNIThread thread = JNIThread.getRetained( m_rowid );
+ if ( null != thread ) {
+ GameLock lock = thread.getLock();
+ if ( null != lock ) {
+ result = DBUtils.getSummary( m_context, lock );
+ }
+ thread.release( false );
+ }
+
+ if ( null == result ) {
+ result = DBUtils.getSummary( m_context, m_rowid, SUMMARY_WAIT_MSECS );
+ }
+ return result;
} // doInBackground
@Override
protected void onPostExecute( GameSummary summary )
{
if ( 0 == --m_loadingCount ) {
- if ( null == summary ) {
- // Try again. Maybe it's open
- JNIThread thread = JNIThread.getRetained( m_rowid );
- if ( null != thread ) {
- summary = DBUtils.getSummary( m_context,
- thread.getLock() );
- thread.release();
- }
- }
-
m_summary = summary;
- boolean expanded = DBUtils.getExpanded( m_context, m_rowid );
+ boolean expanded = DBUtils.getExpanded( m_context, m_rowid );
makeThumbnailIf( expanded );
setData( summary, expanded );
setLoaded( null != m_summary );
if ( null == summary ) {
m_viewUnloaded
- .setText( LocUtils.getString( m_context,
+ .setText( LocUtils.getString( m_context,
R.string.summary_busy ) );
}
synchronized( s_invalRows ) {
@@ -391,14 +392,14 @@ public class GameListItem extends LinearLayout
} // class LoadItemTask
public static GameListItem makeForRow( Context context, View convertView,
- long rowid, Handler handler,
+ long rowid, Handler handler,
int fieldID, SelectableItem cb )
{
GameListItem result;
if ( null != convertView && convertView instanceof GameListItem ) {
result = (GameListItem)convertView;
} else {
- result = (GameListItem)LocUtils.inflate( context,
+ result = (GameListItem)LocUtils.inflate( context,
R.layout.game_list_item );
result.findViews();
}
@@ -406,7 +407,7 @@ public class GameListItem extends LinearLayout
return result;
}
- public static void inval( long rowid )
+ public static void inval( long rowid )
{
synchronized( s_invalRows ) {
s_invalRows.add( rowid );
@@ -448,14 +449,12 @@ public class GameListItem extends LinearLayout
private static void enqueueGetThumbnail( GameListItem item, long rowid )
{
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- s_queue.add( new ThumbQueueElem( item, rowid ) );
+ s_queue.add( new ThumbQueueElem( item, rowid ) );
- synchronized( GameListItem.class ) {
- if ( null == s_thumbThread ) {
- s_thumbThread = makeThumbThread();
- s_thumbThread.start();
- }
+ synchronized( GameListItem.class ) {
+ if ( null == s_thumbThread ) {
+ s_thumbThread = makeThumbThread();
+ s_thumbThread.start();
}
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java
index 5bb1b6add..dd5c42fc0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameLock.java
@@ -44,10 +44,10 @@ public class GameLock {
public static class GameLockedException extends RuntimeException {}
- private static HashMap
+ private static HashMap
s_locks = new HashMap();
- public GameLock( long rowid, boolean isForWrite )
+ public GameLock( long rowid, boolean isForWrite )
{
Assert.assertTrue( DBUtils.ROWID_NOTFOUND != rowid );
m_rowid = rowid;
@@ -78,7 +78,7 @@ public class GameLock {
s_locks.put( m_rowid, this );
++m_lockCount;
gotIt = true;
-
+
if ( DEBUG_LOCKS ) {
StackTraceElement[] trace
= Thread.currentThread().getStackTrace();
@@ -94,17 +94,17 @@ public class GameLock {
gotIt = true;
owner = null;
} else if ( DEBUG_LOCKS ) {
- DbgUtils.logf( "tryLock(): rowid %d already held by lock %H",
+ DbgUtils.logf( "tryLock(): rowid %d already held by lock %H",
m_rowid, owner );
}
}
if ( DEBUG_LOCKS ) {
- DbgUtils.logf( "GameLock.tryLock %H (rowid=%d) => %b",
+ DbgUtils.logf( "GameLock.tryLock %H (rowid=%d) => %b",
this, m_rowid, gotIt );
}
return owner;
}
-
+
// Wait forever (but may assert if too long)
public GameLock lock()
{
@@ -120,7 +120,7 @@ public class GameLock {
long sleptTime = 0;
if ( DEBUG_LOCKS ) {
- DbgUtils.logf( "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
+ DbgUtils.logf( "lock %H (rowid:%d, maxMillis=%d)", this, m_rowid,
maxMillis );
}
@@ -160,7 +160,7 @@ public class GameLock {
if ( DEBUG_LOCKS ) {
DbgUtils.logf( "lock %H overlocked", this );
}
- Assert.fail(); // firing
+ Assert.fail();
}
}
// DbgUtils.logf( "GameLock.lock(%s) done", m_path );
@@ -180,13 +180,13 @@ public class GameLock {
--m_lockCount;
if ( DEBUG_LOCKS ) {
- DbgUtils.logf( "GameLock.unlock: this: %H (rowid:%d) unlocked",
+ DbgUtils.logf( "GameLock.unlock: this: %H (rowid:%d) unlocked",
this, m_rowid );
}
}
}
- public long getRowid()
+ public long getRowid()
{
return m_rowid;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
index 16edf18ce..b580ac52a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
@@ -101,7 +101,7 @@ public class GameUtils {
* Open an existing game, and use its gi and comms addr as the
* basis for a new one.
*/
- public static GameLock resetGame( Context context, GameLock lockSrc,
+ public static GameLock resetGame( Context context, GameLock lockSrc,
GameLock lockDest, boolean juggle )
{
CurGameInfo gi = new CurGameInfo( context );
@@ -112,7 +112,7 @@ public class GameUtils {
GamePtr gamePtr = loadMakeGame( context, gi, lockSrc );
String[] dictNames = gi.dictNames();
DictUtils.DictPairs pairs = DictUtils.openDicts( context, dictNames );
-
+
if ( XwJNI.game_hasComms( gamePtr ) ) {
addr = new CommsAddrRec();
XwJNI.comms_getAddr( gamePtr, addr );
@@ -123,12 +123,12 @@ public class GameUtils {
}
}
gamePtr.release();
-
+
gamePtr = XwJNI.initJNI();
- XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get( context ),
+ XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get( context ),
CommonPrefs.get( context ), dictNames,
pairs.m_bytes, pairs.m_paths, gi.langName() );
-
+
if ( juggle ) {
gi.juggle();
}
@@ -150,8 +150,9 @@ public class GameUtils {
return lockDest;
} // resetGame
- public static void resetGame( Context context, long rowidIn )
+ public static boolean resetGame( Context context, long rowidIn )
{
+ boolean success = false;
GameLock lock = new GameLock( rowidIn, true ).lock( 500 );
if ( null != lock ) {
tellDied( context, lock, true );
@@ -159,9 +160,11 @@ public class GameUtils {
lock.unlock();
Utils.cancelNotification( context, (int)rowidIn );
+ success = true;
} else {
DbgUtils.logf( "resetGame: unable to open rowid %d", rowidIn );
}
+ return success;
}
private static int setFromFeedImpl( FeedUtilsImpl feedImpl )
@@ -169,7 +172,7 @@ public class GameUtils {
int result = GameSummary.MSG_FLAGS_NONE;
if ( feedImpl.m_gotChat ) {
result |= GameSummary.MSG_FLAGS_CHAT;
- }
+ }
if ( feedImpl.m_gotMsg ) {
result |= GameSummary.MSG_FLAGS_TURN;
}
@@ -179,9 +182,9 @@ public class GameUtils {
return result;
}
- private static GameSummary summarizeAndClose( Context context,
+ private static GameSummary summarizeAndClose( Context context,
GameLock lock,
- GamePtr gamePtr,
+ GamePtr gamePtr,
CurGameInfo gi )
{
GameSummary summary = new GameSummary( context, gi );
@@ -227,7 +230,7 @@ public class GameUtils {
DBUtils.deleteGame( context, lock );
}
- public static boolean deleteGame( Context context, long rowid,
+ public static boolean deleteGame( Context context, long rowid,
boolean informNow )
{
boolean success;
@@ -274,25 +277,32 @@ public class GameUtils {
return LocUtils.getString( context, R.string.game_fmt, count );
}
- public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
+ public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
TransportProcs tp, GameLock lock )
{
return loadMakeGame( context, gi, null, tp, lock );
}
- public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
+ public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
GameLock lock )
{
return loadMakeGame( context, gi, null, null, lock );
}
- public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
- UtilCtxt util, TransportProcs tp,
+ public static GamePtr loadMakeGame( Context context, CurGameInfo gi,
+ UtilCtxt util, TransportProcs tp,
GameLock lock )
+ {
+ byte[] stream = savedGame( context, lock );
+ return loadMakeGame( context, gi, util, tp, stream, lock.getRowid() );
+ }
+
+ private static GamePtr loadMakeGame( Context context, CurGameInfo gi,
+ UtilCtxt util, TransportProcs tp,
+ byte[] stream, long rowid )
{
GamePtr gamePtr = null;
- byte[] stream = savedGame( context, lock );
if ( null == stream ) {
DbgUtils.logf( "loadMakeGame: no saved game!");
} else {
@@ -300,23 +310,23 @@ public class GameUtils {
String[] dictNames = gi.dictNames();
DictUtils.DictPairs pairs = DictUtils.openDicts( context, dictNames );
if ( pairs.anyMissing( dictNames ) ) {
- DbgUtils.logf( "loadMakeGame() failing: dicts %s unavailable",
+ DbgUtils.logf( "loadMakeGame() failing: dicts %s unavailable",
TextUtils.join( ",", dictNames ) );
} else {
- gamePtr = XwJNI.initJNI( lock.getRowid() );
+ gamePtr = XwJNI.initJNI( rowid );
String langName = gi.langName();
- boolean madeGame =
- XwJNI.game_makeFromStream( gamePtr, stream, gi,
- dictNames, pairs.m_bytes,
+ boolean madeGame =
+ XwJNI.game_makeFromStream( gamePtr, stream, gi,
+ dictNames, pairs.m_bytes,
pairs.m_paths, langName,
- util, JNIUtilsImpl.get( context ),
+ util, JNIUtilsImpl.get( context ),
CommonPrefs.get(context),
tp);
if ( !madeGame ) {
- XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(context),
+ XwJNI.game_makeNewGame( gamePtr, gi, JNIUtilsImpl.get(context),
CommonPrefs.get(context), dictNames,
- pairs.m_bytes, pairs.m_paths,
+ pairs.m_bytes, pairs.m_paths,
langName );
}
}
@@ -324,59 +334,72 @@ public class GameUtils {
return gamePtr;
}
- public static Bitmap loadMakeBitmap( Activity activity, long rowid )
+ public static Bitmap loadMakeBitmap( Context context, long rowid )
{
Bitmap thumb = null;
GameLock lock = new GameLock( rowid, false );
if ( lock.tryLock() ) {
- CurGameInfo gi = new CurGameInfo( activity );
- GamePtr gamePtr = loadMakeGame( activity, gi, lock );
+ CurGameInfo gi = new CurGameInfo( context );
+ GamePtr gamePtr = loadMakeGame( context, gi, lock );
if ( null != gamePtr ) {
- thumb = takeSnapshot( activity, gamePtr, gi );
+ thumb = takeSnapshot( context, gamePtr, gi );
gamePtr.release();
- DBUtils.saveThumbnail( activity, lock, thumb );
+ DBUtils.saveThumbnail( context, lock, thumb );
}
lock.unlock();
}
return thumb;
}
- public static Bitmap takeSnapshot( Context context, GamePtr gamePtr,
+ public static Bitmap loadMakeBitmap( Context context, byte[] stream,
+ GameLock lock )
+ {
+ Bitmap thumb = null;
+ CurGameInfo gi = new CurGameInfo( context );
+ GamePtr gamePtr = loadMakeGame( context, gi, null, null, stream,
+ lock.getRowid() );
+ if ( null != gamePtr ) {
+ thumb = takeSnapshot( context, gamePtr, gi );
+ gamePtr.release();
+ DBUtils.saveThumbnail( context, lock, thumb );
+ }
+ return thumb;
+ }
+
+ public static Bitmap takeSnapshot( Context context, GamePtr gamePtr,
CurGameInfo gi )
{
Bitmap thumb = null;
- if ( BuildConstants.THUMBNAIL_SUPPORTED ) {
- if ( XWPrefs.getThumbEnabled( context ) ) {
- int nCols = gi.boardSize;
- int pct = XWPrefs.getThumbPct( context );
- Assert.assertTrue( 0 < pct );
+ if ( XWPrefs.getThumbEnabled( context ) ) {
+ int nCols = gi.boardSize;
+ int pct = XWPrefs.getThumbPct( context );
+ Assert.assertTrue( 0 < pct );
- if ( null == s_minScreen ) {
- if ( context instanceof Activity ) {
- Activity activity = (Activity)context;
- Display display =
- activity.getWindowManager().getDefaultDisplay();
- int width = display.getWidth();
- int height = display.getHeight();
- s_minScreen = new Integer( Math.min( width, height ) );
- }
+ if ( null == s_minScreen ) {
+ if ( context instanceof Activity ) {
+ Activity activity = (Activity)context;
+ Display display =
+ activity.getWindowManager().getDefaultDisplay();
+ int width = display.getWidth();
+ int height = display.getHeight();
+ s_minScreen = new Integer( Math.min( width, height ) );
}
- if ( null != s_minScreen ) {
- int dim = s_minScreen * pct / 100;
- int size = dim - (dim % nCols);
+ }
+ if ( null != s_minScreen ) {
+ int dim = s_minScreen * pct / 100;
+ int size = dim - (dim % nCols);
- thumb = Bitmap.createBitmap( size, size,
- Bitmap.Config.ARGB_8888 );
+ thumb = Bitmap.createBitmap( size, size,
+ Bitmap.Config.ARGB_8888 );
- XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
- 0, 0, 0, 20, 20, false, null );
+ XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
+ 0, 0, 0, 20, 20, false, null );
- ThumbCanvas canvas = new ThumbCanvas( context, thumb );
- XwJNI.board_setDraw( gamePtr, canvas );
- XwJNI.board_invalAll( gamePtr );
- Assert.assertNotNull( gamePtr );
- XwJNI.board_draw( gamePtr );
- }
+ ThumbCanvas canvas = new ThumbCanvas( context, thumb );
+ XwJNI.board_setDraw( gamePtr, canvas );
+ XwJNI.board_invalAll( gamePtr );
+ Assert.assertNotNull( gamePtr );
+ XwJNI.board_draw( gamePtr );
}
}
return thumb;
@@ -397,7 +420,7 @@ public class GameUtils {
}
if ( force ) {
- HashMap games =
+ HashMap games =
DBUtils.getGamesWithSendsPending( context );
if ( 0 < games.size() ) {
new ResendTask( context, games, filter, showUI ).execute();
@@ -410,7 +433,7 @@ public class GameUtils {
}
}
- public static long saveGame( Context context, GamePtr gamePtr,
+ public static long saveGame( Context context, GamePtr gamePtr,
CurGameInfo gi, GameLock lock,
boolean setCreate )
{
@@ -428,7 +451,7 @@ public class GameUtils {
return rowid;
}
- public static long saveGame( Context context, byte[] bytes,
+ public static long saveGame( Context context, byte[] bytes,
GameLock lock, boolean setCreate )
{
return DBUtils.saveGame( context, lock, bytes, setCreate );
@@ -455,7 +478,7 @@ public class GameUtils {
long rowid = DBUtils.ROWID_NOTFOUND;
byte[] bytes = XwJNI.gi_to_stream( gi );
if ( null != bytes ) {
- GameLock lock = DBUtils.saveNewGame( context, bytes, groupID,
+ GameLock lock = DBUtils.saveNewGame( context, bytes, groupID,
gameName );
rowid = lock.getRowid();
lock.unlock();
@@ -465,7 +488,7 @@ public class GameUtils {
public static long makeNewMultiGame( Context context, NetLaunchInfo nli )
{
- return makeNewMultiGame( context, nli, (MultiMsgSink)null,
+ return makeNewMultiGame( context, nli, (MultiMsgSink)null,
(UtilCtxt)null );
}
@@ -475,33 +498,33 @@ public class GameUtils {
DbgUtils.logdf( "makeNewMultiGame(nli=%s)", nli.toString() );
CommsAddrRec addr = nli.makeAddrRec( context );
- return makeNewMultiGame( context, sink, util, DBUtils.GROUPID_UNSPEC,
- addr, new int[] {nli.lang},
- new String[] { nli.dict }, null, nli.nPlayersT,
+ return makeNewMultiGame( context, sink, util, DBUtils.GROUPID_UNSPEC,
+ addr, new int[] {nli.lang},
+ new String[] { nli.dict }, null, nli.nPlayersT,
nli.nPlayersH, nli.forceChannel,
nli.inviteID(), nli.gameID(),
nli.gameName, false );
}
- public static long makeNewMultiGame( Context context, long groupID,
+ public static long makeNewMultiGame( Context context, long groupID,
String gameName )
{
return makeNewMultiGame( context, groupID, null, 0, null,
(CommsConnTypeSet)null, gameName );
}
- public static long makeNewMultiGame( Context context, long groupID,
+ public static long makeNewMultiGame( Context context, long groupID,
String dict, int lang, String jsonData,
- CommsConnTypeSet addrSet,
+ CommsConnTypeSet addrSet,
String gameName )
{
String inviteID = makeRandomID();
- return makeNewMultiGame( context, groupID, inviteID, dict, lang,
+ return makeNewMultiGame( context, groupID, inviteID, dict, lang,
jsonData, addrSet, gameName );
}
- private static long makeNewMultiGame( Context context, long groupID,
- String inviteID, String dict,
+ private static long makeNewMultiGame( Context context, long groupID,
+ String inviteID, String dict,
int lang, String jsonData,
CommsConnTypeSet addrSet,
String gameName )
@@ -520,14 +543,14 @@ public class GameUtils {
true );
}
- private static long makeNewMultiGame( Context context, MultiMsgSink sink,
- UtilCtxt util, long groupID,
+ private static long makeNewMultiGame( Context context, MultiMsgSink sink,
+ UtilCtxt util, long groupID,
CommsAddrRec addr,
int[] lang, String[] dict,
- String jsonData,
- int nPlayersT, int nPlayersH,
+ String jsonData,
+ int nPlayersT, int nPlayersH,
int forceChannel, String inviteID,
- int gameID, String gameName,
+ int gameID, String gameName,
boolean isHost )
{
long rowid = -1;
@@ -565,52 +588,52 @@ public class GameUtils {
}
public static long makeNewGame( Context context, MultiMsgSink sink,
- int gameID, CommsAddrRec addr, int lang,
- String dict, int nPlayersT,
- int nPlayersH, int forceChannel,
+ int gameID, CommsAddrRec addr, int lang,
+ String dict, int nPlayersT,
+ int nPlayersH, int forceChannel,
String gameName )
{
- return makeNewGame( context, sink, DBUtils.GROUPID_UNSPEC, gameID, addr,
- lang, dict, nPlayersT, nPlayersH, forceChannel,
+ return makeNewGame( context, sink, DBUtils.GROUPID_UNSPEC, gameID, addr,
+ lang, dict, nPlayersT, nPlayersH, forceChannel,
gameName );
}
- public static long makeNewGame( Context context, int gameID,
- CommsAddrRec addr, int lang,
- String dict, int nPlayersT,
- int nPlayersH, int forceChannel,
+ public static long makeNewGame( Context context, int gameID,
+ CommsAddrRec addr, int lang,
+ String dict, int nPlayersT,
+ int nPlayersH, int forceChannel,
String gameName )
{
- return makeNewGame( context, DBUtils.GROUPID_UNSPEC, gameID, addr,
- lang, dict, nPlayersT, nPlayersH, forceChannel,
+ return makeNewGame( context, DBUtils.GROUPID_UNSPEC, gameID, addr,
+ lang, dict, nPlayersT, nPlayersH, forceChannel,
gameName );
}
-
- public static long makeNewGame( Context context, long groupID, int gameID,
+
+ public static long makeNewGame( Context context, long groupID, int gameID,
CommsAddrRec addr, int lang, String dict,
- int nPlayersT, int nPlayersH,
+ int nPlayersT, int nPlayersH,
int forceChannel, String gameName )
{
return makeNewGame( context, null, groupID, gameID, addr, lang, dict,
nPlayersT, nPlayersH, forceChannel, gameName );
}
- public static long makeNewGame( Context context, MultiMsgSink sink,
+ public static long makeNewGame( Context context, MultiMsgSink sink,
long groupID, int gameID, CommsAddrRec addr,
- int lang, String dict,
- int nPlayersT, int nPlayersH,
+ int lang, String dict,
+ int nPlayersT, int nPlayersH,
int forceChannel, String gameName )
{
long rowid = -1;
int[] langa = { lang };
String[] dicta = { dict };
boolean isHost = null == addr;
- if ( isHost ) {
+ if ( isHost ) {
addr = new CommsAddrRec( null, null );
}
String inviteID = GameUtils.formatGameID( gameID );
- return makeNewMultiGame( context, sink, (UtilCtxt)null, groupID, addr,
- langa, dicta, null, nPlayersT, nPlayersH,
+ return makeNewMultiGame( context, sink, (UtilCtxt)null, groupID, addr,
+ langa, dicta, null, nPlayersT, nPlayersH,
forceChannel, inviteID, gameID, gameName,
isHost );
}
@@ -625,14 +648,14 @@ public class GameUtils {
int sdk = android.os.Build.VERSION.SDK_INT;
if ( sdk < android.os.Build.VERSION_CODES.HONEYCOMB ) {
- android.text.ClipboardManager clipboard =
- (android.text.ClipboardManager)
+ android.text.ClipboardManager clipboard =
+ (android.text.ClipboardManager)
context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText( asStr );
} else {
- android.content.ClipboardManager clipboard =
- (android.content.ClipboardManager)
- context.getSystemService(Context.CLIPBOARD_SERVICE);
+ android.content.ClipboardManager clipboard =
+ (android.content.ClipboardManager)
+ context.getSystemService(Context.CLIPBOARD_SERVICE);
String label = LocUtils.getString( context, R.string.clip_label );
android.content.ClipData clip = android.content.ClipData
.newPlainText( label, asStr );
@@ -656,13 +679,13 @@ public class GameUtils {
Intent intent = new Intent();
intent.setAction( Intent.ACTION_SEND );
String subject =
- LocUtils.getString( activity, R.string.invite_subject_fmt,
+ LocUtils.getString( activity, R.string.invite_subject_fmt,
nli.room );
intent.putExtra( Intent.EXTRA_SUBJECT, subject );
intent.putExtra( Intent.EXTRA_TEXT, Html.fromHtml(message) );
File attach = null;
- File tmpdir = XWApp.ATTACH_SUPPORTED ?
+ File tmpdir = XWApp.ATTACH_SUPPORTED ?
DictUtils.getDownloadDir( activity ) : null;
if ( null != tmpdir ) { // no attachment
attach = makeJsonFor( tmpdir, nli );
@@ -678,17 +701,17 @@ public class GameUtils {
}
String choiceType = LocUtils.getString( activity, R.string.invite_chooser_email );
- String chooserMsg =
- LocUtils.getString( activity, R.string.invite_chooser_fmt,
+ String chooserMsg =
+ LocUtils.getString( activity, R.string.invite_chooser_fmt,
choiceType );
activity.startActivity( Intent.createChooser( intent, chooserMsg ) );
}
}
- // public static void launchInviteActivity( Activity activity,
- // InviteMeans means,
+ // public static void launchInviteActivity( Activity activity,
+ // InviteMeans means,
// String room, String inviteID,
- // int lang, String dict,
+ // int lang, String dict,
// int nPlayers )
// {
// Assert.assertNotNull( inviteID );
@@ -713,16 +736,16 @@ public class GameUtils {
// if ( choseEmail ) {
// intent.setAction( Intent.ACTION_SEND );
// String subject =
- // LocUtils.getString( activity, R.string.invite_subject_fmt,
+ // LocUtils.getString( activity, R.string.invite_subject_fmt,
// room );
// intent.putExtra( Intent.EXTRA_SUBJECT, subject );
// intent.putExtra( Intent.EXTRA_TEXT, Html.fromHtml(message) );
// File attach = null;
- // File tmpdir = XWApp.ATTACH_SUPPORTED ?
+ // File tmpdir = XWApp.ATTACH_SUPPORTED ?
// DictUtils.getDownloadDir( activity ) : null;
// if ( null != tmpdir ) { // no attachment
- // attach = makeJsonFor( tmpdir, room, inviteID, lang,
+ // attach = makeJsonFor( tmpdir, room, inviteID, lang,
// dict, nPlayers );
// }
@@ -744,8 +767,8 @@ public class GameUtils {
// }
// String choiceType = LocUtils.getString( activity, choiceID );
- // String chooserMsg =
- // LocUtils.getString( activity, R.string.invite_chooser_fmt,
+ // String chooserMsg =
+ // LocUtils.getString( activity, R.string.invite_chooser_fmt,
// choiceType );
// activity.startActivity( Intent.createChooser( intent, chooserMsg ) );
// }
@@ -762,7 +785,7 @@ public class GameUtils {
}
public static String[] dictNames( Context context, long rowid,
- int[] missingLang )
+ int[] missingLang )
{
byte[] stream = savedGame( context, rowid );
CurGameInfo gi = new CurGameInfo( context );
@@ -773,11 +796,11 @@ public class GameUtils {
return gi.dictNames();
}
- public static String[] dictNames( Context context, long rowid )
+ public static String[] dictNames( Context context, long rowid )
{
return dictNames( context, rowid, null );
}
-
+
public static boolean gameDictsHere( Context context, long rowid )
{
return gameDictsHere( context, rowid, null, null );
@@ -786,7 +809,7 @@ public class GameUtils {
// Return true if all dicts present. Return list of those that
// are not.
public static boolean gameDictsHere( Context context, long rowid,
- String[][] missingNames,
+ String[][] missingNames,
int[] missingLang )
{
String[] gameDicts = dictNames( context, rowid, missingLang );
@@ -805,14 +828,14 @@ public class GameUtils {
DbgUtils.logf( "gameDictsHere: game has no dicts!" );
}
if ( null != missingNames ) {
- missingNames[0] =
+ missingNames[0] =
missingSet.toArray( new String[missingSet.size()] );
}
return allHere;
}
- public static String newName( Context context )
+ public static String newName( Context context )
{
return "untitled";
// String name = null;
@@ -851,11 +874,11 @@ public class GameUtils {
public static void launchGame( Delegator delegator, long rowid,
boolean invited )
{
- Activity activity = delegator.getActivity();
Bundle extras = makeLaunchExtras( rowid, invited );
- if ( activity instanceof FragActivity ) {
- FragActivity.addFragment( new BoardFrag(), extras, delegator );
+ if ( delegator.inDPMode() ) {
+ delegator.addFragment( new BoardFrag( delegator ), extras );
} else {
+ Activity activity = delegator.getActivity();
Intent intent = new Intent( activity, BoardActivity.class );
intent.putExtras( extras );
activity.startActivity( intent );
@@ -867,12 +890,6 @@ public class GameUtils {
launchGame( delegator, rowid, false );
}
- public static void launchGameAndFinish( Delegator delegator, long rowid )
- {
- launchGame( delegator, rowid );
- delegator.getActivity().finish();
- }
-
private static class FeedUtilsImpl extends UtilCtxtImpl {
private Context m_context;
private long m_rowid;
@@ -1004,14 +1021,14 @@ public class GameUtils {
gi.replaceDicts( newDict );
String[] dictNames = gi.dictNames();
- DictUtils.DictPairs pairs = DictUtils.openDicts( context,
+ DictUtils.DictPairs pairs = DictUtils.openDicts( context,
dictNames );
-
+
GamePtr gamePtr = XwJNI.initJNI( rowid );
- XwJNI.game_makeFromStream( gamePtr, stream, gi, dictNames,
+ XwJNI.game_makeFromStream( gamePtr, stream, gi, dictNames,
pairs.m_bytes, pairs.m_paths,
- gi.langName(),
- JNIUtilsImpl.get(context),
+ gi.langName(),
+ JNIUtilsImpl.get(context),
CommonPrefs.get( context ) );
// second time required as game_makeFromStream can overwrite
gi.replaceDicts( newDict );
@@ -1027,16 +1044,16 @@ public class GameUtils {
return success;
} // replaceDicts
- public static void applyChanges( Context context, CurGameInfo gi,
+ public static void applyChanges( Context context, CurGameInfo gi,
CommsAddrRec car, GameLock lock,
boolean forceNew )
{
- applyChanges( context, (MultiMsgSink)null, gi, (UtilCtxt)null, car,
+ applyChanges( context, (MultiMsgSink)null, gi, (UtilCtxt)null, car,
lock, forceNew );
}
public static void applyChanges( Context context, MultiMsgSink sink,
- CurGameInfo gi, UtilCtxt util,
+ CurGameInfo gi, UtilCtxt util,
CommsAddrRec car, GameLock lock,
boolean forceNew )
{
@@ -1056,8 +1073,8 @@ public class GameUtils {
} else {
byte[] stream = savedGame( context, lock );
// Will fail if there's nothing in the stream but a gi.
- madeGame = XwJNI.game_makeFromStream( gamePtr, stream,
- new CurGameInfo(context),
+ madeGame = XwJNI.game_makeFromStream( gamePtr, stream,
+ new CurGameInfo(context),
dictNames, pairs.m_bytes,
pairs.m_paths, langName,
JNIUtilsImpl.get(context),
@@ -1065,8 +1082,8 @@ public class GameUtils {
}
if ( forceNew || !madeGame ) {
- XwJNI.game_makeNewGame( gamePtr, gi, dictNames, pairs.m_bytes,
- pairs.m_paths, langName, util,
+ XwJNI.game_makeNewGame( gamePtr, gi, dictNames, pairs.m_bytes,
+ pairs.m_paths, langName, util,
JNIUtilsImpl.get(context), (DrawCtx)null,
cp, sink );
}
@@ -1087,22 +1104,6 @@ public class GameUtils {
DBUtils.saveSummary( context, lock, summary );
} // applyChanges
- public static void doConfig( Delegator delegator, long rowid )
- {
- Bundle extras = new Bundle();
- extras.putLong( INTENT_KEY_ROWID, rowid );
-
- Activity activity = delegator.getActivity();
- if ( activity instanceof FragActivity ) {
- FragActivity.addFragment( new GameConfigFrag(), extras, delegator );
- } else {
- Intent intent = new Intent( activity, GameConfigActivity.class );
- intent.setAction( Intent.ACTION_EDIT );
- intent.putExtras( extras );
- activity.startActivity( intent );
- }
- }
-
public static String formatGameID( int gameID )
{
Assert.assertTrue( 0 != gameID );
@@ -1126,15 +1127,7 @@ public class GameUtils {
return rint;
}
- // public static void postSelfNotification( Context context, long rowid )
- // {
- // Assert.assertTrue( BuildConfig.DEBUG );
- // Intent intent = GamesListDelegate.makeRowidIntent( context, rowid );
- // Utils.postNotification( context, intent, "launch",
- // String.format("%d", rowid), (int)rowid );
- // }
-
- public static void postMoveNotification( Context context, long rowid,
+ public static void postMoveNotification( Context context, long rowid,
BackMoveResult bmr,
boolean isTurnNow )
{
@@ -1178,8 +1171,8 @@ public class GameUtils {
Utils.postNotification( context, intent, R.string.invite_notice_title,
body, (int)rowid );
}
-
- private static void tellDied( Context context, GameLock lock,
+
+ private static void tellDied( Context context, GameLock lock,
boolean informNow )
{
GameSummary summary = DBUtils.getSummary( context, lock );
@@ -1281,7 +1274,7 @@ public class GameUtils {
}
lock.unlock();
} else {
- DbgUtils.logf( "ResendTask.doInBackground: unable to unlock %d",
+ DbgUtils.logf( "ResendTask.doInBackground: unable to unlock %d",
rowid );
}
}
@@ -1293,7 +1286,7 @@ public class GameUtils {
{
if ( m_showUI ) {
int nSent = null == m_sink ? 0 : m_sink.numSent();
- String msg =
+ String msg =
LocUtils.getQuantityString( m_context,
R.plurals.resend_finished_fmt,
nSent, nSent );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java
deleted file mode 100644
index dae8065ad..000000000
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
-/*
- * Copyright 2009 - 2014 by Eric House (xwords@eehouse.org). All
- * rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-package org.eehouse.android.xw4;
-
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-
-import org.eehouse.android.xw4.jni.CurGameInfo;
-
-import junit.framework.Assert;
-
-public class GamesListActivity extends XWActivity {
- private GamesListDelegate m_dlgt;
-
- @Override
- protected void onCreate( Bundle savedInstanceState )
- {
- m_dlgt = new GamesListDelegate( this, savedInstanceState );
- super.onCreate( savedInstanceState, m_dlgt );
-
- // Trying to debug situation where two of this activity are running at
- // once. finish()ing when Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT is
- // passed is not the fix, but perhaps there's another
- // int flags = getIntent().getFlags();
- // DbgUtils.logf( "GamesListActivity.onCreate(this=%H): flags=0x%x",
- // this, flags );
- } // onCreate
-
- // called when we're brought to the front (probably as a result of
- // notification)
- @Override
- protected void onNewIntent( Intent intent )
- {
- super.onNewIntent( intent );
- m_dlgt.onNewIntent( intent );
- }
-
- //////////////////////////////////////////////////////////////////////
- // GamesListDelegator interface
- //////////////////////////////////////////////////////////////////////
- public void launchGame( long rowID, boolean invited )
- {
- GameUtils.launchGame( this, rowID, invited );
- }
-}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java
index 3ffb58498..482d484d1 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java
@@ -72,10 +72,10 @@ import org.eehouse.android.xw4.loc.LocUtils;
public class GamesListDelegate extends ListDelegateBase
implements OnItemLongClickListener,
- DBUtils.DBChangeListener, SelectableItem,
- DownloadFinishedListener, DlgDelegate.HasDlgDelegate,
+ DBUtils.DBChangeListener, SelectableItem,
+ DownloadFinishedListener, DlgDelegate.HasDlgDelegate,
GroupStateListener {
-
+
private static final String SAVE_ROWID = "SAVE_ROWID";
private static final String SAVE_ROWIDS = "SAVE_ROWIDS";
@@ -145,7 +145,7 @@ public class GamesListDelegate extends ListDelegateBase
return alist.toArray( new Object[alist.size()] );
}
-
+
@Override
public View getView( Object dataObj, View convertView )
{
@@ -155,16 +155,16 @@ public class GamesListDelegate extends ListDelegateBase
GameGroupInfo ggi = DBUtils.getGroups( m_activity )
.get( rec.m_groupID );
GameListGroup group =
- GameListGroup.makeForPosition( m_activity, convertView,
- rec.m_groupID, ggi.m_count,
- ggi.m_expanded,
- GamesListDelegate.this,
+ GameListGroup.makeForPosition( m_activity, convertView,
+ rec.m_groupID, ggi.m_count,
+ ggi.m_expanded,
+ GamesListDelegate.this,
GamesListDelegate.this );
updateGroupPct( group, ggi );
- String name =
- LocUtils.getQuantityString( m_activity,
- R.plurals.group_name_fmt,
+ String name =
+ LocUtils.getQuantityString( m_activity,
+ R.plurals.group_name_fmt,
ggi.m_count, ggi.m_name,
ggi.m_count );
group.setText( name );
@@ -172,9 +172,9 @@ public class GamesListDelegate extends ListDelegateBase
result = group;
} else if ( dataObj instanceof GameRec ) {
GameRec rec = (GameRec)dataObj;
- GameListItem item =
- GameListItem.makeForRow( m_activity, convertView,
- rec.m_rowID, m_handler,
+ GameListItem item =
+ GameListItem.makeForRow( m_activity, convertView,
+ rec.m_rowID, m_handler,
m_fieldID, GamesListDelegate.this );
item.setSelected( m_selGames.contains( rec.m_rowID ) );
result = item;
@@ -211,7 +211,7 @@ public class GamesListDelegate extends ListDelegateBase
GroupRec rec = (GroupRec)
findParent( makeChildTestFor( rowID ) );
if ( null != rec ) {
- GameGroupInfo ggi =
+ GameGroupInfo ggi =
DBUtils.getGroups( m_activity ).get( rec.m_groupID );
expanded = ggi.m_expanded;
}
@@ -241,7 +241,7 @@ public class GamesListDelegate extends ListDelegateBase
String groupName( long groupID )
{
- final Map gameInfo =
+ final Map gameInfo =
DBUtils.getGroups( m_activity );
return gameInfo.get(groupID).m_name;
}
@@ -254,7 +254,7 @@ public class GamesListDelegate extends ListDelegateBase
String[] groupNames()
{
long[] positions = getGroupPositions();
- final Map gameInfo =
+ final Map gameInfo =
DBUtils.getGroups( m_activity );
Assert.assertTrue( positions.length == gameInfo.size() );
String[] names = new String[positions.length];
@@ -285,7 +285,7 @@ public class GamesListDelegate extends ListDelegateBase
// do not modify!!!!
final Set keys = DBUtils.getGroups( m_activity ).keySet();
- if ( null == m_groupPositions ||
+ if ( null == m_groupPositions ||
m_groupPositions.length != keys.size() ) {
HashSet unused = new HashSet( keys );
@@ -378,7 +378,7 @@ public class GamesListDelegate extends ListDelegateBase
private void updateGroupPct( GameListGroup group, GameGroupInfo ggi )
{
if ( !ggi.m_expanded ) {
- group.setPct( m_handler, ggi.m_hasTurn, ggi.m_turnLocal,
+ group.setPct( m_handler, ggi.m_hasTurn, ggi.m_turnLocal,
ggi.m_lastMoveTime );
}
}
@@ -404,6 +404,11 @@ public class GamesListDelegate extends ListDelegateBase
List alist = new ArrayList();
long[] rows = DBUtils.getGroupGames( m_activity, groupID );
for ( long row : rows ) {
+ if ( false && BuildConfig.DEBUG ) {
+ GameUtils.BackMoveResult bmr = new GameUtils.BackMoveResult();
+ bmr.m_lmi = new LastMoveInfo();
+ GameUtils.postMoveNotification( m_activity, row, bmr, false );
+ }
alist.add( new GameRec( row ) );
}
// DbgUtils.logf( "GamesListDelegate.makeChildren(%d) => %d kids", groupID, alist.size() );
@@ -430,7 +435,7 @@ public class GamesListDelegate extends ListDelegateBase
};
}
- private ArrayList removeRange( ArrayList list,
+ private ArrayList removeRange( ArrayList list,
int start, int len )
{
DbgUtils.logf( "removeRange(start=%d, len=%d)", start, len );
@@ -520,7 +525,7 @@ public class GamesListDelegate extends ListDelegateBase
long[] result = XWPrefs.getGroupPositions( m_activity );
if ( null != result ) {
- final Map gameInfo =
+ final Map gameInfo =
DBUtils.getGroups( m_activity );
Set posns = gameInfo.keySet();
if ( result.length != posns.size() ) {
@@ -538,11 +543,11 @@ public class GamesListDelegate extends ListDelegateBase
}
} // class GameListAdapter
- private static final int[] DEBUG_ITEMS = {
+ private static final int[] DEBUG_ITEMS = {
// R.id.games_menu_loaddb,
R.id.games_menu_storedb,
};
- private static final int[] NOSEL_ITEMS = {
+ private static final int[] NOSEL_ITEMS = {
R.id.games_menu_newgroup,
R.id.games_menu_prefs,
R.id.games_menu_dicts,
@@ -615,23 +620,25 @@ public class GamesListDelegate extends ListDelegateBase
case WARN_NODICT_SUBST:
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
+ GamesListDelegate self = curThis();
// no name, so user must pick
if ( null == m_missingDictName ) {
- DictsDelegate.downloadForResult( m_activity,
- RequestCode
- .REQUEST_LANG_GL,
- m_missingDictLang );
+ DictsDelegate
+ .downloadForResult( self.m_activity,
+ RequestCode
+ .REQUEST_LANG_GL,
+ self.m_missingDictLang );
} else {
DwnldDelegate
- .downloadDictInBack( m_activity,
- m_missingDictLang,
- m_missingDictName,
- GamesListDelegate.this );
+ .downloadDictInBack( self.m_activity,
+ self.m_missingDictLang,
+ self.m_missingDictName,
+ self );
}
}
};
String message;
- String langName =
+ String langName =
DictLangCache.getLangName( m_activity, m_missingDictLang );
String locLang = xlateLang( langName );
String gameName = GameUtils.getName( m_activity, m_missingDictRowId );
@@ -642,7 +649,7 @@ public class GamesListDelegate extends ListDelegateBase
null, m_missingDictName, locLang );
} else {
// WARN_NODICT_SUBST
- message = getString( R.string.no_dict_subst_fmt, gameName,
+ message = getString( R.string.no_dict_subst_fmt, gameName,
m_missingDictName, locLang );
}
@@ -655,7 +662,7 @@ public class GamesListDelegate extends ListDelegateBase
if ( DlgID.WARN_NODICT_SUBST == dlgID ) {
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- showDialog( DlgID.SHOW_SUBST );
+ curThis().showDialog( DlgID.SHOW_SUBST );
}
};
ab.setNeutralButton( R.string.button_substdict, lstnr );
@@ -664,20 +671,21 @@ public class GamesListDelegate extends ListDelegateBase
setRemoveOnDismiss( dialog, dlgID );
break;
case SHOW_SUBST:
- m_sameLangDicts =
+ m_sameLangDicts =
DictLangCache.getHaveLangCounts( m_activity, m_missingDictLang );
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg,
int which ) {
+ GamesListDelegate self = curThis();
int pos = ((AlertDialog)dlg).getListView().
getCheckedItemPosition();
- String dict = m_sameLangDicts[pos];
+ String dict = self.m_sameLangDicts[pos];
dict = DictLangCache.stripCount( dict );
- if ( GameUtils.replaceDicts( m_activity,
- m_missingDictRowId,
- m_missingDictName,
+ if ( GameUtils.replaceDicts( self.m_activity,
+ self.m_missingDictRowId,
+ self.m_missingDictName,
dict ) ) {
- launchGameIf();
+ self.launchGameIf();
}
}
};
@@ -697,10 +705,11 @@ public class GamesListDelegate extends ListDelegateBase
case RENAME_GAME:
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- String name = m_namer.getName();
- DBUtils.setName( m_activity, m_rowid,
+ GamesListDelegate self = curThis();
+ String name = self.m_namer.getName();
+ DBUtils.setName( self.m_activity, self.m_rowid,
name );
- m_adapter.invalName( m_rowid );
+ self.m_adapter.invalName( self.m_rowid );
}
};
GameSummary summary = DBUtils.getSummary( m_activity, m_rowid );
@@ -714,11 +723,12 @@ public class GamesListDelegate extends ListDelegateBase
case RENAME_GROUP:
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- String name = m_namer.getName();
- DBUtils.setGroupName( m_activity,
- m_groupid, name );
- reloadGame( m_rowid );
- mkListAdapter();
+ GamesListDelegate self = curThis();
+ String name = self.m_namer.getName();
+ DBUtils.setGroupName( self.m_activity,
+ self.m_groupid, name );
+ self.reloadGame( self.m_rowid );
+ self.mkListAdapter();
}
};
dialog = buildNamerDlg( m_adapter.groupName( m_groupid ),
@@ -730,15 +740,16 @@ public class GamesListDelegate extends ListDelegateBase
case NEW_GROUP:
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- String name = m_namer.getName();
- DBUtils.addGroup( m_activity, name );
- mkListAdapter();
- showNewGroupIf();
+ GamesListDelegate self = curThis();
+ String name = self.m_namer.getName();
+ DBUtils.addGroup( self.m_activity, name );
+ self.mkListAdapter();
+ self.showNewGroupIf();
}
};
lstnr2 = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- showNewGroupIf();
+ curThis().showNewGroupIf();
}
};
dialog = buildNamerDlg( "", R.string.newgroup_label,
@@ -753,13 +764,14 @@ public class GamesListDelegate extends ListDelegateBase
final int[] selItem = {-1}; // hack!!!!
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlgi, int item ) {
+ GamesListDelegate self = curThis();
selItem[0] = item;
AlertDialog dlg = (AlertDialog)dlgi;
- Button btn =
+ Button btn =
dlg.getButton( AlertDialog.BUTTON_POSITIVE );
boolean enabled = startGroup == -1;
if ( !enabled ) {
- long newGroup = m_adapter.getGroupIDFor( item );
+ long newGroup = self.m_adapter.getGroupIDFor( item );
enabled = newGroup != startGroup;
}
btn.setEnabled( enabled );
@@ -767,20 +779,22 @@ public class GamesListDelegate extends ListDelegateBase
};
lstnr2 = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
+ GamesListDelegate self = curThis();
Assert.assertTrue( -1 != selItem[0] );
- long gid = m_adapter.getGroupIDFor( selItem[0] );
- for ( long rowid : m_rowids ) {
- DBUtils.moveGame( m_activity, rowid, gid );
+ long gid = self.m_adapter.getGroupIDFor( selItem[0] );
+ for ( long rowid : self.m_rowids ) {
+ DBUtils.moveGame( self.m_activity, rowid, gid );
}
- DBUtils.setGroupExpanded( m_activity, gid, true );
- mkListAdapter();
+ DBUtils.setGroupExpanded( self.m_activity, gid, true );
+ self.mkListAdapter();
}
};
- OnClickListener lstnr3 =
+ OnClickListener lstnr3 =
new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- m_moveAfterNewGroup = true;
- showDialog( DlgID.NEW_GROUP );
+ GamesListDelegate self = curThis();
+ self.m_moveAfterNewGroup = true;
+ self.showDialog( DlgID.NEW_GROUP );
}
};
String[] groups = m_adapter.groupNames();
@@ -828,12 +842,12 @@ public class GamesListDelegate extends ListDelegateBase
final EditText edit = (EditText)view.findViewById( R.id.edit );
lstnr = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- makeThenLaunchOrConfigure( edit, true, false );
+ curThis().makeThenLaunchOrConfigure( edit, true, false );
}
};
lstnr2 = new OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- makeThenLaunchOrConfigure( edit, false, false );
+ curThis().makeThenLaunchOrConfigure( edit, false, false );
}
};
@@ -857,7 +871,7 @@ public class GamesListDelegate extends ListDelegateBase
public void onClick( DialogInterface dlg, int item ) {
EditText edit = (EditText)((Dialog)dlg)
.findViewById( R.id.edit );
- startRematchWithName( edit );
+ curThis().startRematchWithName( edit );
}
} )
.create();
@@ -879,7 +893,7 @@ public class GamesListDelegate extends ListDelegateBase
ad.getButton( AlertDialog.BUTTON_POSITIVE ).setEnabled( false );
break;
case GAMES_LIST_NEWGAME:
- boolean canDoDefaults = m_nextIsSolo
+ boolean canDoDefaults = m_nextIsSolo
|| 0 < XWPrefs.getAddrTypes( m_activity ).size();
ad.getButton( AlertDialog.BUTTON_NEGATIVE )
.setVisibility( canDoDefaults ? View.VISIBLE : View.GONE );
@@ -916,10 +930,9 @@ public class GamesListDelegate extends ListDelegateBase
}
@Override
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
m_origTitle = getTitle();
- Assert.assertTrue( m_origTitle.equals( getString(R.string.app_name) ) );
m_handler = new Handler();
// Next line useful if contents of DB are crashing app on start
@@ -951,33 +964,33 @@ public class GamesListDelegate extends ListDelegateBase
NetUtils.informOfDeaths( m_activity );
- tryStartsFromIntent( getIntent() );
+ post( new Runnable() {
+ @Override
+ public void run() {
+ tryStartsFromIntent( getIntent() );
+ getDictForLangIf();
+ }
+ } );
- getDictForLangIf();
} // init
- // protected View onCreateView( Bundle savedInstanceState )
- // {
- // View result = inflate( R.layout.game_list );
- // // init( savedInstanceState );
- // return result;
- // }
-
- // called when we're brought to the front (probably as a result of
- // notification)
- protected void onNewIntent( Intent intent )
+ @Override
+ protected boolean handleNewIntent( Intent intent )
{
- // super.onNewIntent( intent );
+ DbgUtils.logf( "GamesListDelegate.handleNewIntent(%s)",
+ intent.toString() );
+
m_launchedGames.clear();
Assert.assertNotNull( intent );
invalRelayIDs( intent.getStringArrayExtra( RELAYIDS_EXTRA ) );
reloadGame( intent.getLongExtra( ROWID_EXTRA, -1 ) );
tryStartsFromIntent( intent );
+ return true; // handled it
}
protected void onStop()
{
- // TelephonyManager mgr =
+ // TelephonyManager mgr =
// (TelephonyManager)getSystemService( Context.TELEPHONY_SERVICE );
// mgr.listen( m_phoneStateListener, PhoneStateListener.LISTEN_NONE );
// m_phoneStateListener = null;
@@ -994,7 +1007,7 @@ public class GamesListDelegate extends ListDelegateBase
}
}
- protected void onSaveInstanceState( Bundle outState )
+ protected void onSaveInstanceState( Bundle outState )
{
// super.onSaveInstanceState( outState );
outState.putLong( SAVE_ROWID, m_rowid );
@@ -1051,8 +1064,14 @@ public class GamesListDelegate extends ListDelegateBase
}
}
+ @Override
+ protected GamesListDelegate curThis()
+ {
+ return (GamesListDelegate)super.curThis();
+ }
+
// OnItemLongClickListener interface
- public boolean onItemLongClick( AdapterView> parent, View view,
+ public boolean onItemLongClick( AdapterView> parent, View view,
int position, long id ) {
boolean success = ! XWApp.CONTEXT_MENUS_ENABLED
&& view instanceof SelectableItem.LongClickHandler;
@@ -1101,22 +1120,20 @@ public class GamesListDelegate extends ListDelegateBase
public void itemClicked( SelectableItem.LongClickHandler clicked,
GameSummary summary )
{
- DbgUtils.logf( "GamesListDelegate.itemClicked()" );
// We need a way to let the user get back to the basic-config
// dialog in case it was dismissed. That way it to check for
// an empty room name.
if ( clicked instanceof GameListItem ) {
long rowid = ((GameListItem)clicked).getRowID();
- DbgUtils.logf( "GamesListDelegate.itemClicked(%d)", rowid );
if ( ! m_launchedGames.contains( rowid ) ) {
- showNotAgainDlgThen( R.string.not_again_newselect,
+ showNotAgainDlgThen( R.string.not_again_newselect,
R.string.key_notagain_newselect,
Action.OPEN_GAME, rowid, summary );
}
}
}
- public void itemToggled( SelectableItem.LongClickHandler toggled,
+ public void itemToggled( SelectableItem.LongClickHandler toggled,
boolean selected )
{
if ( toggled instanceof GameListItem ) {
@@ -1158,7 +1175,7 @@ public class GamesListDelegate extends ListDelegateBase
}
// BTService.MultiEventListener interface
- public void eventOccurred( MultiService.MultiEvent event,
+ public void eventOccurred( MultiService.MultiEvent event,
final Object ... args )
{
switch( event ) {
@@ -1167,7 +1184,7 @@ public class GamesListDelegate extends ListDelegateBase
public void run() {
DbgUtils.showf( m_activity,
"Pong from %s", args[0].toString() );
- }
+ }
});
break;
case BT_GAME_CREATED:
@@ -1177,7 +1194,7 @@ public class GamesListDelegate extends ListDelegateBase
if ( checkWarnNoDict( rowid ) ) {
launchGame( rowid, true );
}
- }
+ }
});
break;
default:
@@ -1199,10 +1216,13 @@ public class GamesListDelegate extends ListDelegateBase
break;
case RESET_GAMES:
long[] rowids = (long[])params[0];
+ boolean changed = false;
for ( long rowid : rowids ) {
- GameUtils.resetGame( m_activity, rowid );
+ changed = GameUtils.resetGame( m_activity, rowid ) || changed;
+ }
+ if ( changed ) {
+ mkListAdapter(); // required because position may change
}
- mkListAdapter(); // required because position may change
break;
case SYNC_MENU:
doSyncMenuitem();
@@ -1246,18 +1266,18 @@ public class GamesListDelegate extends ListDelegateBase
public void downloadFinished( String lang, String name, boolean success )
{
if ( success ) {
- XWPrefs.setPrefsString( m_activity,
- R.string.key_default_language,
+ XWPrefs.setPrefsString( m_activity,
+ R.string.key_default_language,
lang );
name = DictUtils.removeDictExtn( name );
- int[] ids = { R.string.key_default_dict,
+ int[] ids = { R.string.key_default_dict,
R.string.key_default_robodict };
for ( int id : ids ) {
XWPrefs.setPrefsString( m_activity, id, name );
}
- XWPrefs.setPrefsBoolean( m_activity,
- R.string.key_got_langdict,
+ XWPrefs.setPrefsBoolean( m_activity,
+ R.string.key_got_langdict,
true );
}
}
@@ -1280,7 +1300,7 @@ public class GamesListDelegate extends ListDelegateBase
}
@Override
- protected void onActivityResult( RequestCode requestCode, int resultCode,
+ protected void onActivityResult( RequestCode requestCode, int resultCode,
Intent data )
{
boolean cancelled = Activity.RESULT_CANCELED == resultCode;
@@ -1304,18 +1324,18 @@ public class GamesListDelegate extends ListDelegateBase
}
@Override
- protected void onResume()
+ protected void onResume()
{
super.onResume();
setupButtons();
}
@Override
- protected boolean onBackPressed()
+ protected boolean handleBackPressed()
{
boolean handled = 0 < m_selGames.size() || 0 < m_selGroupIDs.size();
if ( handled ) {
- showNotAgainDlgThen( R.string.not_again_backclears,
+ showNotAgainDlgThen( R.string.not_again_backclears,
R.string.key_notagain_backclears,
Action.CLEAR_SELS );
}
@@ -1323,20 +1343,20 @@ public class GamesListDelegate extends ListDelegateBase
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
- int nGamesSelected = m_selGames.size(); // NPE!
+ int nGamesSelected = m_selGames.size();
int nGroupsSelected = m_selGroupIDs.size();
int groupCount = m_adapter.getGroupCount();
m_menuPrepared = 0 == nGamesSelected || 0 == nGroupsSelected;
if ( m_menuPrepared ) {
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
-
+
final boolean showDbg = BuildConfig.DEBUG
|| XWPrefs.getDebugEnabled( m_activity );
showItemsIf( DEBUG_ITEMS, menu, nothingSelected && showDbg );
- Utils.setItemVisible( menu, R.id.games_menu_loaddb,
- showDbg && nothingSelected &&
+ Utils.setItemVisible( menu, R.id.games_menu_loaddb,
+ showDbg && nothingSelected &&
DBUtils.gameDBExists( m_activity ) );
showItemsIf( NOSEL_ITEMS, menu, nothingSelected );
@@ -1357,7 +1377,7 @@ public class GamesListDelegate extends ListDelegateBase
// You can't delete the default group, nor make it the default.
// But we enable delete so a warning message later can explain.
- Utils.setItemVisible( menu, R.id.games_group_delete,
+ Utils.setItemVisible( menu, R.id.games_group_delete,
1 <= nGroupsSelected );
enable = (1 == nGroupsSelected) && ! m_selGroupIDs
.contains( XWPrefs.getDefaultNewGameGroup( m_activity ) );
@@ -1366,7 +1386,7 @@ public class GamesListDelegate extends ListDelegateBase
// Rematch supported if there's one game selected
enable = 1 == nGamesSelected;
if ( enable ) {
- enable = BoardDelegate.rematchSupported( m_activity,
+ enable = BoardDelegate.rematchSupported( m_activity,
getSelRowIDs()[0] );
}
Utils.setItemVisible( menu, R.id.games_game_rematch, enable );
@@ -1374,7 +1394,7 @@ public class GamesListDelegate extends ListDelegateBase
// Move up/down enabled for groups if not the top-most or bottommost
// selected
enable = 1 == nGroupsSelected;
- Utils.setItemVisible( menu, R.id.games_group_moveup,
+ Utils.setItemVisible( menu, R.id.games_group_moveup,
enable && 0 < selGroupPos );
Utils.setItemVisible( menu, R.id.games_group_movedown, enable
&& (selGroupPos + 1) < groupCount );
@@ -1384,15 +1404,18 @@ public class GamesListDelegate extends ListDelegateBase
nothingSelected || 1 == nGroupsSelected );
Utils.setItemVisible( menu, R.id.games_menu_newgame_net,
nothingSelected || 1 == nGroupsSelected );
-
- // Multiples can be deleted
- Utils.setItemVisible( menu, R.id.games_game_delete,
- 0 < nGamesSelected );
+
+ // Multiples can be deleted, but disable if any selected game is
+ // currently open
+ enable = 0 < nGamesSelected;
+ for ( long row : m_selGames ) {
+ enable = enable && !m_launchedGames.contains( row );
+ }
+ Utils.setItemVisible( menu, R.id.games_game_delete, enable );
+ Utils.setItemVisible( menu, R.id.games_game_reset, enable );
// multiple games can be regrouped/reset.
- Utils.setItemVisible( menu, R.id.games_game_move,
- 0 < nGamesSelected );
- Utils.setItemVisible( menu, R.id.games_game_reset,
+ Utils.setItemVisible( menu, R.id.games_game_move,
0 < nGamesSelected );
// Hide rate-me if not a google play app
@@ -1402,10 +1425,10 @@ public class GamesListDelegate extends ListDelegateBase
enable = nothingSelected && XWPrefs.getStudyEnabled( m_activity );
Utils.setItemVisible( menu, R.id.games_menu_study, enable );
- enable = nothingSelected &&
+ enable = nothingSelected &&
0 < DBUtils.getGamesWithSendsPending( m_activity ).size();
Utils.setItemVisible( menu, R.id.games_menu_resend, enable );
-
+
Assert.assertTrue( m_menuPrepared );
} else {
DbgUtils.logf( "onPrepareOptionsMenu: incomplete so bailing" );
@@ -1454,7 +1477,7 @@ public class GamesListDelegate extends ListDelegateBase
break;
case R.id.games_menu_dicts:
- DictsActivity.start( m_activity );
+ DictsDelegate.start( getDelegator() );
break;
case R.id.games_menu_checkmoves:
@@ -1516,7 +1539,7 @@ public class GamesListDelegate extends ListDelegateBase
return handled;// || super.onOptionsItemSelected( item );
}
- public void onCreateContextMenu( ContextMenu menu, View view,
+ public void onCreateContextMenu( ContextMenu menu, View view,
ContextMenuInfo menuInfo )
{
boolean enable;
@@ -1528,8 +1551,8 @@ public class GamesListDelegate extends ListDelegateBase
AdapterView.AdapterContextMenuInfo info
= (AdapterView.AdapterContextMenuInfo)menuInfo;
View targetView = info.targetView;
- DbgUtils.logf( "onCreateContextMenu(t=%s)",
- targetView.getClass().getName() );
+ DbgUtils.logf( "onCreateContextMenu(t=%s)",
+ targetView.getClass().getSimpleName() );
if ( targetView instanceof GameListItem ) {
item = (GameListItem)targetView;
id = R.menu.games_list_game_menu;
@@ -1539,7 +1562,7 @@ public class GamesListDelegate extends ListDelegateBase
id = R.menu.games_list_group_menu;
long groupID = ((GameListGroup)targetView).getGroupID();
- selected = m_selGroupIDs.contains( groupID );
+ selected = m_selGroupIDs.contains( groupID );
} else {
Assert.fail();
}
@@ -1552,19 +1575,22 @@ public class GamesListDelegate extends ListDelegateBase
Utils.setItemVisible( menu, hideId, false );
if ( null != item ) {
- enable = BoardDelegate.rematchSupported( m_activity,
- item.getRowID() );
+ long rowID = item.getRowID();
+ enable = BoardDelegate.rematchSupported( m_activity, rowID );
Utils.setItemVisible( menu, R.id.games_game_rematch, enable );
enable = item.getSummary().isMultiGame()
&& (BuildConfig.DEBUG || XWPrefs.getDebugEnabled( m_activity ));
Utils.setItemVisible( menu, R.id.games_game_invites, enable );
+
+ enable = !m_launchedGames.contains( rowID );
+ Utils.setItemVisible( menu, R.id.games_game_delete, enable );
+ Utils.setItemVisible( menu, R.id.games_game_reset, enable );
}
}
-
}
- public boolean onContextItemSelected( MenuItem item )
+ public boolean onContextItemSelected( MenuItem item )
{
boolean handled = true;
AdapterView.AdapterContextMenuInfo info
@@ -1584,24 +1610,24 @@ public class GamesListDelegate extends ListDelegateBase
Assert.fail();
}
}
-
+
return handled || super.onContextItemSelected( item );
}
//////////////////////////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface
//////////////////////////////////////////////////////////////////////
- public void downloadFinished( String lang, String name,
+ public void downloadFinished( String lang, String name,
final boolean success )
{
- post( new Runnable() {
+ runWhenActive( new Runnable() {
public void run() {
boolean madeGame = false;
if ( success ) {
madeGame = makeNewNetGameIf() || launchGameIf();
}
if ( ! madeGame ) {
- int id = success ? R.string.download_done
+ int id = success ? R.string.download_done
: R.string.download_failed;
showToast( id );
}
@@ -1646,7 +1672,7 @@ public class GamesListDelegate extends ListDelegateBase
switch( itemID ) {
case R.id.games_game_select:
case R.id.games_game_deselect:
- SelectableItem.LongClickHandler toggled
+ SelectableItem.LongClickHandler toggled
= (SelectableItem.LongClickHandler)target;
toggled.longClicked();
handled = true;
@@ -1665,9 +1691,9 @@ public class GamesListDelegate extends ListDelegateBase
switch( itemID ) {
case R.id.games_game_delete:
- String msg = getQuantityString( R.plurals.confirm_seldeletes_fmt,
+ String msg = getQuantityString( R.plurals.confirm_seldeletes_fmt,
selRowIDs.length, selRowIDs.length );
- showConfirmThen( msg, R.string.button_delete,
+ showConfirmThen( msg, R.string.button_delete,
Action.DELETE_GAMES, selRowIDs );
break;
@@ -1677,7 +1703,9 @@ public class GamesListDelegate extends ListDelegateBase
break;
case R.id.games_game_config:
- GameUtils.doConfig( getDelegator(), selRowIDs[0] );
+ GameConfigDelegate.editForResult( getDelegator(),
+ RequestCode.CONFIG_GAME,
+ selRowIDs[0], false );
break;
case R.id.games_game_move:
@@ -1687,7 +1715,7 @@ public class GamesListDelegate extends ListDelegateBase
case R.id.games_game_new_from:
dropSels = true; // will select the new game instead
showNotAgainDlgThen( R.string.not_again_newfrom,
- R.string.key_notagain_newfrom,
+ R.string.key_notagain_newfrom,
Action.NEW_FROM, selRowIDs[0] );
break;
case R.id.games_game_copy:
@@ -1703,7 +1731,7 @@ public class GamesListDelegate extends ListDelegateBase
GameUtils.savedGame( self, selRowIDs[0] );
long groupID = XWPrefs
.getDefaultNewGameGroup( self );
- GameLock lock =
+ GameLock lock =
GameUtils.saveNewGame( self, stream, groupID );
DBUtils.saveSummary( self, lock, smry );
m_selGames.add( lock.getRowid() );
@@ -1728,7 +1756,7 @@ public class GamesListDelegate extends ListDelegateBase
msg = DBUtils.getSummary( m_activity, selRowIDs[0] )
.conTypes.toString( m_activity );
msg = getString( R.string.invites_net_fmt, msg );
-
+
SentInvitesInfo info = DBUtils.getInvitesFor( m_activity,
selRowIDs[0] );
if ( null != info ) {
@@ -1736,7 +1764,7 @@ public class GamesListDelegate extends ListDelegateBase
}
showOKOnlyDialog( msg );
break;
-
+
default:
handled = false;
}
@@ -1750,48 +1778,49 @@ public class GamesListDelegate extends ListDelegateBase
private boolean handleSelGroupsItem( int itemID, long[] groupIDs )
{
- boolean handled = true;
- String msg;
- Assert.assertTrue( 0 < groupIDs.length );
- long groupID = groupIDs[0];
- switch( itemID ) {
- case R.id.games_group_delete:
- long dftGroup = XWPrefs.getDefaultNewGameGroup( m_activity );
- if ( m_selGroupIDs.contains( dftGroup ) ) {
- msg = getString( R.string.cannot_delete_default_group_fmt,
- m_adapter.groupName( dftGroup ) );
- showOKOnlyDialog( msg );
- } else {
- Assert.assertTrue( 0 < groupIDs.length );
- msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
- groupIDs.length, groupIDs.length );
+ boolean handled = 0 < groupIDs.length;
+ if ( handled ) {
+ String msg;
+ long groupID = groupIDs[0];
+ switch( itemID ) {
+ case R.id.games_group_delete:
+ long dftGroup = XWPrefs.getDefaultNewGameGroup( m_activity );
+ if ( m_selGroupIDs.contains( dftGroup ) ) {
+ msg = getString( R.string.cannot_delete_default_group_fmt,
+ m_adapter.groupName( dftGroup ) );
+ showOKOnlyDialog( msg );
+ } else {
+ Assert.assertTrue( 0 < groupIDs.length );
+ msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
+ groupIDs.length, groupIDs.length );
- int nGames = 0;
- for ( long tmp : groupIDs ) {
- nGames += m_adapter.getChildrenCount( tmp );
+ int nGames = 0;
+ for ( long tmp : groupIDs ) {
+ nGames += m_adapter.getChildrenCount( tmp );
+ }
+ if ( 0 < nGames ) {
+ msg += getQuantityString( R.plurals.groups_confirm_del_games_fmt,
+ nGames, nGames );
+ }
+ showConfirmThen( msg, Action.DELETE_GROUPS, groupIDs );
}
- if ( 0 < nGames ) {
- msg += getQuantityString( R.plurals.groups_confirm_del_games_fmt,
- nGames, nGames );
- }
- showConfirmThen( msg, Action.DELETE_GROUPS, groupIDs );
+ break;
+ case R.id.games_group_default:
+ XWPrefs.setDefaultNewGameGroup( m_activity, groupID );
+ break;
+ case R.id.games_group_rename:
+ m_groupid = groupID;
+ showDialog( DlgID.RENAME_GROUP );
+ break;
+ case R.id.games_group_moveup:
+ moveGroup( groupID, true );
+ break;
+ case R.id.games_group_movedown:
+ moveGroup( groupID, false );
+ break;
+ default:
+ handled = false;
}
- break;
- case R.id.games_group_default:
- XWPrefs.setDefaultNewGameGroup( m_activity, groupID );
- break;
- case R.id.games_group_rename:
- m_groupid = groupID;
- showDialog( DlgID.RENAME_GROUP );
- break;
- case R.id.games_group_moveup:
- moveGroup( groupID, true );
- break;
- case R.id.games_group_movedown:
- moveGroup( groupID, false );
- break;
- default:
- handled = false;
}
return handled;
}
@@ -1808,8 +1837,8 @@ public class GamesListDelegate extends ListDelegateBase
button.setVisibility( View.VISIBLE );
final boolean solo = isSolos[ii];
button.setOnClickListener( new View.OnClickListener() {
- public void onClick( View view ) {
- handleNewGameButton( solo );
+ public void onClick( View view ) {
+ curThis().handleNewGameButton( solo );
}
} );
}
@@ -1831,7 +1860,7 @@ public class GamesListDelegate extends ListDelegateBase
if ( skipOffer ) {
handleNewGame( solo );
} else {
- ActionPair pair = new ActionPair( Action.SET_HIDE_NEWGAME_BUTTONS,
+ ActionPair pair = new ActionPair( Action.SET_HIDE_NEWGAME_BUTTONS,
R.string.set_pref );
showNotAgainDlgThen( R.string.not_again_hidenewgamebuttons,
R.string.key_notagain_hidenewgamebuttons,
@@ -1870,10 +1899,10 @@ public class GamesListDelegate extends ListDelegateBase
// Just pick one -- good enough for the period when
// users aren't using new clients that include the
// dict name.
- nli.dict = dicts[0];
+ nli.dict = dicts[0];
}
} else {
- haveDict =
+ haveDict =
DictLangCache.haveDict( m_activity, nli.lang, nli.dict );
}
if ( !haveDict ) {
@@ -1895,11 +1924,13 @@ public class GamesListDelegate extends ListDelegateBase
String[][] missingNames = new String[1][];
int[] missingLang = new int[1];
boolean hasDicts;
- try {
+ try {
hasDicts = GameUtils.gameDictsHere( m_activity, rowid, missingNames,
missingLang );
} catch ( GameUtils.NoSuchGameException nsge ) {
hasDicts = true; // irrelevant question
+ } catch ( GameLock.GameLockedException gle ) {
+ hasDicts = true; // irrelevant question
}
if ( !hasDicts ) {
@@ -1916,9 +1947,9 @@ public class GamesListDelegate extends ListDelegateBase
} else if ( null != m_missingDictName ) {
showDialog( DlgID.WARN_NODICT_SUBST );
} else {
- String dict =
+ String dict =
DictLangCache.getHaveLang( m_activity, m_missingDictLang)[0];
- if ( GameUtils.replaceDicts( m_activity, m_missingDictRowId,
+ if ( GameUtils.replaceDicts( m_activity, m_missingDictRowId,
null, dict ) ) {
launchGameIf();
}
@@ -1927,7 +1958,7 @@ public class GamesListDelegate extends ListDelegateBase
return hasDicts;
}
- private void invalRelayIDs( String[] relayIDs )
+ private void invalRelayIDs( String[] relayIDs )
{
if ( null != relayIDs ) {
for ( String relayID : relayIDs ) {
@@ -2002,7 +2033,7 @@ public class GamesListDelegate extends ListDelegateBase
makeNewNetGame( nli );
}
} else if ( XWPrefs.getSecondInviteAllowed( m_activity ) ) {
- String msg = getString( R.string.dup_game_query_fmt,
+ String msg = getString( R.string.dup_game_query_fmt,
create.toString() );
m_netLaunchInfo = nli;
showConfirmThen( msg, Action.NEW_NET_GAME, nli );
@@ -2047,7 +2078,7 @@ public class GamesListDelegate extends ListDelegateBase
// used to connect.
private void startRematch( Intent intent )
{
- if ( XWApp.REMATCH_SUPPORTED
+ if ( XWApp.REMATCH_SUPPORTED
&& ( -1 != intent.getLongExtra( REMATCH_ROWID_EXTRA, -1 ) ) ) {
m_rematchIntent = intent;
showDialog( DlgID.GAMES_LIST_NAME_REMATCH );
@@ -2077,7 +2108,7 @@ public class GamesListDelegate extends ListDelegateBase
long groupID = DBUtils.getGroupForGame( m_activity, srcRowID );
newid = GameUtils.makeNewMultiGame( m_activity, groupID, dict,
lang, json, addrs, gameName );
- DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,
+ DBUtils.addRematchInfo( m_activity, newid, btAddr, phone,
relayID );
}
launchGame( newid );
@@ -2112,9 +2143,9 @@ public class GamesListDelegate extends ListDelegateBase
}
private void getDictForLangIf()
- {
- if ( ! m_haveShownGetDict &&
- ! XWPrefs.getPrefsBoolean( m_activity, R.string.key_got_langdict,
+ {
+ if ( ! m_haveShownGetDict &&
+ ! XWPrefs.getPrefsBoolean( m_activity, R.string.key_got_langdict,
false ) ) {
m_haveShownGetDict = true;
@@ -2127,22 +2158,22 @@ public class GamesListDelegate extends ListDelegateBase
final Runnable onNA = new Runnable() {
public void run() {
XWPrefs.setPrefsBoolean( m_activity, R.string
- .key_got_langdict,
+ .key_got_langdict,
true );
}
};
OnGotLcDictListener lstnr = new OnGotLcDictListener() {
- public void gotDictInfo( boolean success, String lang,
+ public void gotDictInfo( boolean success, String lang,
String name ) {
stopProgress();
if ( success ) {
- String msg =
- getString( R.string.confirm_get_locdict_fmt,
+ String msg =
+ getString( R.string.confirm_get_locdict_fmt,
xlateLang( lang ) );
showConfirmThen( onNA, msg, R.string
- .button_download,
- Action.DWNLD_LOC_DICT,
+ .button_download,
+ Action.DWNLD_LOC_DICT,
lang, name );
}
}
@@ -2175,13 +2206,13 @@ public class GamesListDelegate extends ListDelegateBase
}
private Dialog buildNamerDlg( String curname, int labelID, int titleID,
- OnClickListener lstnr1, OnClickListener lstnr2,
+ OnClickListener lstnr1, OnClickListener lstnr2,
DlgID dlgID )
{
m_namer = (GameNamer)inflate( R.layout.rename_game );
m_namer.setName( curname );
m_namer.setLabel( labelID );
-
+
Dialog dialog = makeAlertBuilder()
.setTitle( titleID )
.setPositiveButton( android.R.string.ok, lstnr1 )
@@ -2276,12 +2307,6 @@ public class GamesListDelegate extends ListDelegateBase
{
boolean madeGame = DBUtils.ROWID_NOTFOUND != m_missingDictRowId;
if ( madeGame ) {
- // if ( R.id.games_game_reset == m_missingDictMenuId ) {
- // long[] rowIDs = { m_missingDictRowId };
- // doConfirmReset( rowIDs );
- // } else {
- // launchGame( m_missingDictRowId );
- // }
// save in case checkWarnNoDict needs to set them
long rowID = m_missingDictRowId;
int menuID = m_missingDictMenuId;
@@ -2300,10 +2325,6 @@ public class GamesListDelegate extends ListDelegateBase
private void launchGame( long rowid, boolean invited )
{
- // DbgUtils.logf( "launchGame(%d)", rowid );
- // if ( ! m_launchedGames.contains( rowid ) ) {
- // m_launchedGames.add( rowid );
- // m_delegator.launchGame( rowid, invited );
if ( ! m_launchedGames.contains( rowid ) ) {
m_launchedGames.add( rowid );
if ( m_adapter.inExpandedGroup( rowid ) ) {
@@ -2339,7 +2360,6 @@ public class GamesListDelegate extends ListDelegateBase
{
GameSummary summary = (GameSummary)params[1];
long rowid = (Long)params[0];
- DbgUtils.logf( "GamesListDelegate.doOpenGame(%d)", rowid );
if ( summary.conTypes.contains( CommsAddrRec.CommsConnType.COMMS_CONN_RELAY )
&& summary.roomName.length() == 0 ) {
@@ -2360,7 +2380,7 @@ public class GamesListDelegate extends ListDelegateBase
{
long[] result = new long[m_selGames.size()];
int ii = 0;
- for ( Iterator iter = m_selGames.iterator();
+ for ( Iterator iter = m_selGames.iterator();
iter.hasNext(); ) {
result[ii++] = iter.next();
}
@@ -2381,7 +2401,7 @@ public class GamesListDelegate extends ListDelegateBase
{
long[] result = new long[m_selGroupIDs.size()];
int ii = 0;
- for ( Iterator iter = m_selGroupIDs.iterator();
+ for ( Iterator iter = m_selGroupIDs.iterator();
iter.hasNext(); ) {
result[ii++] = iter.next();
}
@@ -2397,9 +2417,9 @@ public class GamesListDelegate extends ListDelegateBase
private void doConfirmReset( long[] rowIDs )
{
- String msg = getQuantityString( R.plurals.confirm_reset_fmt,
+ String msg = getQuantityString( R.plurals.confirm_reset_fmt,
rowIDs.length, rowIDs.length );
- showConfirmThen( msg, R.string.button_reset, Action.RESET_GAMES,
+ showConfirmThen( msg, R.string.button_reset, Action.RESET_GAMES,
rowIDs );
}
@@ -2414,8 +2434,8 @@ public class GamesListDelegate extends ListDelegateBase
// String field = CommonPrefs.getSummaryField( m_activity );
// long[] positions = XWPrefs.getGroupPositions( m_activity );
- // GameListAdapter adapter =
- // new GameListAdapter( m_activity, listview, new Handler(),
+ // GameListAdapter adapter =
+ // new GameListAdapter( m_activity, listview, new Handler(),
// this, positions, field );
// setListAdapter( adapter );
// adapter.expandGroups( listview );
@@ -2428,10 +2448,10 @@ public class GamesListDelegate extends ListDelegateBase
{
boolean asking = false;
boolean skipAsk = XWPrefs
- .getPrefsBoolean( m_activity, R.string.key_notagain_dfltname,
+ .getPrefsBoolean( m_activity, R.string.key_notagain_dfltname,
false );
if ( ! skipAsk ) {
- String name1 = CommonPrefs.getDefaultPlayerName( m_activity, 0,
+ String name1 = CommonPrefs.getDefaultPlayerName( m_activity, 0,
false );
String name2 = CommonPrefs.getDefaultOriginalPlayerName( m_activity, 0 );
if ( null == name1 || name1.equals( name2 ) ) {
@@ -2444,12 +2464,12 @@ public class GamesListDelegate extends ListDelegateBase
Runnable onChecked = new Runnable() {
public void run() {
XWPrefs
- .setPrefsBoolean( m_activity,
+ .setPrefsBoolean( m_activity,
R.string.key_notagain_dfltname,
true );
}
};
- showConfirmThen( onChecked, msg, android.R.string.ok,
+ showConfirmThen( onChecked, msg, android.R.string.ok,
R.string.button_later, Action.NEW_GAME_DFLT_NAME,
edit, doConfigure );
}
@@ -2469,7 +2489,7 @@ public class GamesListDelegate extends ListDelegateBase
return handled;
}
- private void makeThenLaunchOrConfigure( EditText edit, boolean doConfigure,
+ private void makeThenLaunchOrConfigure( EditText edit, boolean doConfigure,
boolean skipAsk )
{
if ( skipAsk || !askingChangeName( edit, doConfigure ) ) {
@@ -2481,8 +2501,8 @@ public class GamesListDelegate extends ListDelegateBase
// Ideally we'd check here whether user has set player name.
if ( m_nextIsSolo ) {
- rowID = GameUtils.saveNew( m_activity,
- new CurGameInfo( m_activity ),
+ rowID = GameUtils.saveNew( m_activity,
+ new CurGameInfo( m_activity ),
groupID, name );
} else {
rowID = GameUtils.makeNewMultiGame( m_activity, groupID, name );
@@ -2490,9 +2510,9 @@ public class GamesListDelegate extends ListDelegateBase
if ( doConfigure ) {
// configure it
- GameConfigDelegate.editForResult( getDelegator(),
- RequestCode.CONFIG_GAME,
- rowID );
+ GameConfigDelegate.editForResult( getDelegator(),
+ RequestCode.CONFIG_GAME,
+ rowID, true );
} else {
// launch it
GameUtils.launchGame( getDelegator(), rowID );
@@ -2509,15 +2529,15 @@ public class GamesListDelegate extends ListDelegateBase
public static void onGameDictDownload( Context context, Intent intent )
{
- intent.setClass( context, GamesListActivity.class );
+ intent.setClass( context, MainActivity.class );
context.startActivity( intent );
}
private static Intent makeSelfIntent( Context context )
{
- Intent intent = new Intent( context, GamesListActivity.class );
+ Intent intent = new Intent( context, MainActivity.class );
intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP
- | Intent.FLAG_ACTIVITY_NEW_TASK );
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP );
return intent;
}
@@ -2537,7 +2557,7 @@ public class GamesListDelegate extends ListDelegateBase
public static Intent makeRematchIntent( Context context, long rowid,
CurGameInfo gi,
- CommsConnTypeSet addrTypes,
+ CommsConnTypeSet addrTypes,
String btAddr, String phone,
String relayID, String newName )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListFrag.java
index f9828a693..9cfe6a83f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListFrag.java
@@ -24,6 +24,8 @@ import android.os.Bundle;
public class GamesListFrag extends XWFragment {
+ public GamesListFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/HeaderWithExpander.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/HeaderWithExpander.java
index 9160a43a1..93d4d5f24 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/HeaderWithExpander.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/HeaderWithExpander.java
@@ -31,7 +31,7 @@ import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
-public class HeaderWithExpander extends LinearLayout
+public class HeaderWithExpander extends LinearLayout
implements View.OnClickListener {
private boolean m_expanded;
@@ -43,7 +43,7 @@ public class HeaderWithExpander extends LinearLayout
public void expanded( boolean expanded );
}
- public HeaderWithExpander( Context cx, AttributeSet as )
+ public HeaderWithExpander( Context cx, AttributeSet as )
{
super( cx, as );
}
@@ -55,7 +55,7 @@ public class HeaderWithExpander extends LinearLayout
m_label = (TextView)findViewById( R.id.label );
}
- public void setExpanded( boolean expanded )
+ public void setExpanded( boolean expanded )
{
m_expanded = expanded;
if ( null != m_listener ) {
@@ -81,7 +81,7 @@ public class HeaderWithExpander extends LinearLayout
//////////////////////////////////////////////////
// View.OnClickListener interface
//////////////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
setExpanded( !m_expanded );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java
index f14125772..7b0dd1799 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/InviteDelegate.java
@@ -61,7 +61,7 @@ abstract class InviteDelegate extends ListDelegateBase
m_lastDev = intent.getStringExtra( INTENT_KEY_LASTDEV );
}
- protected void init( int button_invite, int button_rescan,
+ protected void init( int button_invite, int button_rescan,
int button_clear, int desc_id, String descTxt )
{
m_okButton = (Button)findViewById( button_invite );
@@ -87,7 +87,7 @@ abstract class InviteDelegate extends ListDelegateBase
////////////////////////////////////////
// View.OnClickListener
////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
if ( m_okButton == view ) {
Intent intent = new Intent();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListDelegateBase.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListDelegateBase.java
index a7621f13a..e5aba048e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListDelegateBase.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListDelegateBase.java
@@ -26,7 +26,7 @@ import android.widget.ListAdapter;
import android.widget.ListView;
public class ListDelegateBase extends DelegateBase {
-
+
private Activity m_activity;
private Delegator m_delegator;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListGroup.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListGroup.java
index e1407eeda..b1c66f162 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListGroup.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ListGroup.java
@@ -29,7 +29,7 @@ import android.widget.TextView;
import org.eehouse.android.xw4.loc.LocUtils;
-public class ListGroup extends LinearLayout
+public class ListGroup extends LinearLayout
implements View.OnClickListener {
private boolean m_expanded;
@@ -39,7 +39,7 @@ public class ListGroup extends LinearLayout
private GroupStateListener m_listener;
private int m_posn;
- public ListGroup( Context cx, AttributeSet as )
+ public ListGroup( Context cx, AttributeSet as )
{
super( cx, as );
}
@@ -50,7 +50,7 @@ public class ListGroup extends LinearLayout
super.onFinishInflate();
m_expandButton = (ImageButton)findViewById( R.id.expander );
m_text = (TextView)findViewById( R.id.game_name );
-
+
m_expandButton.setOnClickListener( this );
setOnClickListener( this );
@@ -66,7 +66,7 @@ public class ListGroup extends LinearLayout
//////////////////////////////////////////////////
// View.OnClickListener interface
//////////////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
m_expanded = !m_expanded;
m_listener.onGroupExpandedChanged( this, m_expanded );
@@ -89,8 +89,8 @@ public class ListGroup extends LinearLayout
}
}
- public static ListGroup make( Context context, View convertView,
- GroupStateListener lstnr, int posn,
+ public static ListGroup make( Context context, View convertView,
+ GroupStateListener lstnr, int posn,
String desc, boolean expanded )
{
ListGroup result;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java
index bfe62683a..a42cbb352 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/LookupAlert.java
@@ -72,7 +72,7 @@ public class LookupAlert extends LinearLayout
private static String[] s_lookupUrls;
private static ArrayAdapter s_urlsAdapter;
private static final int LIST_LAYOUT = android.R.layout.simple_list_item_1;
-
+
private static int s_lang = -1;
private static String s_langName;
@@ -115,7 +115,7 @@ public class LookupAlert extends LinearLayout
// m_state = STATE_DONE;
// adjustState( 1 );
- // m_wordsAdapter = new ArrayAdapter( this, LIST_LAYOUT,
+ // m_wordsAdapter = new ArrayAdapter( this, LIST_LAYOUT,
// m_words );
// getListView().setOnItemClickListener( this );
@@ -147,7 +147,7 @@ public class LookupAlert extends LinearLayout
m_state = STATE_DONE;
adjustState( 1 );
- m_wordsAdapter = new ArrayAdapter( m_context, LIST_LAYOUT,
+ m_wordsAdapter = new ArrayAdapter( m_context, LIST_LAYOUT,
m_words );
m_listView = (ListView)findViewById( android.R.id.list );
m_listView.setOnItemClickListener( this );
@@ -167,7 +167,7 @@ public class LookupAlert extends LinearLayout
}
// @Override
- // protected void onSaveInstanceState( Bundle outState )
+ // protected void onSaveInstanceState( Bundle outState )
// {
// super.onSaveInstanceState( outState );
// outState.putInt( STATE, m_state );
@@ -188,9 +188,9 @@ public class LookupAlert extends LinearLayout
// }
//////////////////////////////////////////////////////////////////////
- // View.OnClickListener
+ // View.OnClickListener
//////////////////////////////////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
if ( view == m_doneButton ) {
switchState( -1 );
@@ -198,16 +198,16 @@ public class LookupAlert extends LinearLayout
String word = m_words[m_wordIndex];
DBUtils.addToStudyList( m_context, word, s_lang );
- String msg = LocUtils.getString( m_context, R.string.add_done_fmt,
+ String msg = LocUtils.getString( m_context, R.string.add_done_fmt,
word, s_langName );
Utils.showToast( m_context, msg );
}
}
//////////////////////////////////////////////////////////////////////
- // AdapterView.OnItemClickListener
+ // AdapterView.OnItemClickListener
//////////////////////////////////////////////////////////////////////
- public void onItemClick( AdapterView> parentView, View view,
+ public void onItemClick( AdapterView> parentView, View view,
int position, long id )
{
if ( STATE_WORDS == m_state ) {
@@ -252,7 +252,7 @@ public class LookupAlert extends LinearLayout
break;
case STATE_WORDS:
m_listView.setAdapter( m_wordsAdapter );
- setSummary( m_studyOn ?
+ setSummary( m_studyOn ?
R.string.title_lookup_study : R.string.title_lookup );
m_doneButton.setText( R.string.button_done );
m_studyButton.setVisibility( View.GONE );
@@ -271,7 +271,7 @@ public class LookupAlert extends LinearLayout
}
break;
case STATE_LOOKUP:
- lookupWord( m_context, m_words[m_wordIndex],
+ lookupWord( m_context, m_words[m_wordIndex],
s_lookupUrls[m_urlIndex] );
switchState( -1 );
break;
@@ -291,7 +291,7 @@ public class LookupAlert extends LinearLayout
Uri uri = Uri.parse( dict_url );
Intent intent = new Intent( Intent.ACTION_VIEW, uri );
intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
-
+
try {
context.startActivity( intent );
} catch ( android.content.ActivityNotFoundException anfe ) {
@@ -323,7 +323,7 @@ public class LookupAlert extends LinearLayout
}
s_lookupNames = tmpNames.toArray( new String[tmpNames.size()] );
s_lookupUrls = tmpUrls.toArray( new String[tmpUrls.size()] );
- s_urlsAdapter = new ArrayAdapter( context, LIST_LAYOUT,
+ s_urlsAdapter = new ArrayAdapter( context, LIST_LAYOUT,
s_lookupNames );
s_lang = lang;
String langName = DictLangCache.getLangName( context, lang );
@@ -338,7 +338,7 @@ public class LookupAlert extends LinearLayout
private void setSummary( String word )
{
- String title =
+ String title =
LocUtils.getString( m_context, R.string.pick_url_title_fmt, word );
m_summary.setText( title );
}
@@ -356,7 +356,7 @@ public class LookupAlert extends LinearLayout
return handled;
}
- public static boolean needAlert( Context context, String[] words,
+ public static boolean needAlert( Context context, String[] words,
int langCode, boolean noStudy )
{
boolean result = !noStudy || 1 < words.length;
@@ -367,7 +367,7 @@ public class LookupAlert extends LinearLayout
return result;
}
- public static Bundle makeParams( String[] words, int lang,
+ public static Bundle makeParams( String[] words, int lang,
boolean noStudyOption )
{
Bundle bundle = new Bundle();
@@ -391,7 +391,7 @@ public class LookupAlert extends LinearLayout
return result;
}
- protected static void launchWordLookup( Context context, String word,
+ protected static void launchWordLookup( Context context, String word,
int langCode )
{
setLang( context, langCode );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java
new file mode 100644
index 000000000..7bbdb4dca
--- /dev/null
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MainActivity.java
@@ -0,0 +1,484 @@
+/* -*- compile-command: "find-and-ant.sh debug install"; -*- */
+/*
+ * Copyright 2009 - 2014 by Eric House (xwords@eehouse.org). All
+ * rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package org.eehouse.android.xw4;
+
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.graphics.Point;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager.BackStackEntry;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.view.ContextMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eehouse.android.xw4.jni.CurGameInfo;
+
+import junit.framework.Assert;
+
+public class MainActivity extends XWActivity
+ implements FragmentManager.OnBackStackChangedListener {
+ private static final int MAX_PANES_LANDSCAPE = 2;
+ private static final boolean LOG_IDS = true;
+
+ private DelegateBase m_dlgt;
+ private boolean m_dpEnabled;
+
+ // Used only if m_dpEnabled is true
+ private LinearLayout m_root;
+ private int m_maxPanes;
+ private int m_nextID = 0x00FFFFFF;
+ private Boolean m_isPortrait;
+
+ // for tracking launchForResult callback recipients
+ private Map> m_pendingCodes
+ = new HashMap>();
+
+ @Override
+ protected void onCreate( Bundle savedInstanceState )
+ {
+ m_dpEnabled = XWPrefs.dualpaneEnabled( this );
+ if ( BuildConfig.DEBUG ) {
+ Utils.showToast( this, "dualpane mode: " + m_dpEnabled );
+ }
+
+ m_dlgt = m_dpEnabled ? new DualpaneDelegate( this, savedInstanceState )
+ : new GamesListDelegate( this, savedInstanceState );
+ super.onCreate( savedInstanceState, m_dlgt );
+
+ if ( m_dpEnabled ) {
+ m_root = (LinearLayout)findViewById( R.id.main_container );
+ getSupportFragmentManager().addOnBackStackChangedListener( this );
+
+ m_maxPanes = maxPanes();
+
+ // Nothing to do if we're restarting
+ if ( savedInstanceState == null ) {
+ // In case this activity was started with special instructions from an Intent,
+ // pass the Intent's extras to the fragment as arguments
+ addFragmentImpl( new GamesListFrag(null),
+ getIntent().getExtras(), null );
+ }
+ }
+ } // onCreate
+
+ // called when we're brought to the front (probably as a result of
+ // notification)
+ @Override
+ protected void onNewIntent( Intent intent )
+ {
+ super.onNewIntent( intent );
+
+ m_dlgt.handleNewIntent( intent );
+ }
+
+ @Override
+ public void onConfigurationChanged( Configuration newConfig )
+ {
+ if ( m_dpEnabled ) {
+ Rect rect = new Rect();
+ m_root.getWindowVisibleDisplayFrame( rect );
+
+ boolean isPortrait
+ = Configuration.ORIENTATION_PORTRAIT == newConfig.orientation;
+ DbgUtils.logf( "MainActivity.onConfigurationChanged(isPortrait=%b)",
+ isPortrait );
+ m_isPortrait = isPortrait;
+ if ( isPortrait != (rect.width() <= rect.height()) ) {
+ DbgUtils.logdf( "FragActivity.onConfigurationChanged(): isPortrait:"
+ + " %b; width: %d; height: %d",
+ isPortrait, rect.width(), rect.height() );
+ }
+ int maxPanes = isPortrait? 1 : MAX_PANES_LANDSCAPE;
+ if ( m_maxPanes != maxPanes ) {
+ m_maxPanes = maxPanes;
+ setVisiblePanes();
+ }
+ tellOrientationChanged();
+ }
+ super.onConfigurationChanged( newConfig );
+ }
+
+ /**
+ * Run down the list of fragments until one handles the intent. If no
+ * visible one does, pop hidden ones into view until one of them
+ * does. Yes, this will take us back to GamesList being visible even if
+ * nothing handles the intent, but at least now all are handled by
+ * GamesList anyway.
+ */
+ protected boolean dispatchNewIntent( Intent intent )
+ {
+ boolean handled = false;
+ FragmentManager fm = getSupportFragmentManager();
+
+ // First try non-left-most fragments, if any. Once we've eliminated
+ // them we can just iterate on the leftmost fragment.
+ int nNonLeft = m_maxPanes - 1;
+ // include paged-to-left invisible views
+ int viewCount = m_root.getChildCount();
+ for ( int ii = nNonLeft; !handled && 0 < ii; --ii ) {
+ View child = m_root.getChildAt( viewCount - ii );
+ Fragment frag = fm.findFragmentById( child.getId() );
+ handled = ((XWFragment)frag).getDelegate().handleNewIntent( intent );
+ }
+
+ while ( !handled ) {
+ // Now iterate on the leftmost, popping if necessary to page new
+ // ones into place
+ int childCount = m_root.getChildCount();
+ int hiddenCount = Math.max( 0, childCount - m_maxPanes );
+ for ( int ii = hiddenCount; ii >= 0; --ii ) {
+ View child = m_root.getChildAt( ii );
+ Fragment frag = fm.findFragmentById( child.getId() );
+ // DbgUtils.logf( "left-most case (child %d): %s", hiddenCount,
+ // frag.getClass().getSimpleName() );
+ handled = ((XWFragment)frag).getDelegate()
+ .handleNewIntent( intent );
+
+ if ( handled ) {
+ break;
+ } else if ( ii > 0 ) {
+ DbgUtils.logf( "popping %s",
+ frag.getClass().getSimpleName() );
+ fm.popBackStackImmediate(); // callback removes view
+ }
+ }
+ }
+
+ return handled;
+ }
+
+ /**
+ * The right-most pane only gets a chance to handle on-back-pressed.
+ */
+ protected boolean dispatchBackPressed()
+ {
+ XWFragment frag = getTopFragment();
+ boolean handled = null != frag
+ && frag.getDelegate().handleBackPressed();
+ return handled;
+ }
+
+ protected void dispatchOnActivityResult( RequestCode requestCode,
+ int resultCode, Intent data )
+ {
+ XWFragment frag = getTopFragment();
+
+ if ( null != frag ) {
+ frag.onActivityResult( requestCode.ordinal(), resultCode, data );
+ } else {
+ DbgUtils.logdf( "dispatchOnActivityResult(): can't dispatch %s",
+ requestCode.toString() );
+ }
+ }
+
+ protected void dispatchOnCreateContextMenu( ContextMenu menu, View view,
+ ContextMenuInfo menuInfo )
+ {
+ XWFragment[] frags = getVisibleFragments();
+ for ( XWFragment frag : frags ) {
+ frag.getDelegate().onCreateContextMenu( menu, view, menuInfo );
+ }
+ }
+
+ protected boolean dispatchOnContextItemSelected( MenuItem item )
+ {
+ boolean handled = false;
+ XWFragment[] frags = getVisibleFragments();
+ for ( XWFragment frag : frags ) {
+ handled = frag.getDelegate().onContextItemSelected( item );
+ if ( handled ) {
+ break;
+ }
+ }
+ return handled;
+ }
+
+ protected Point getFragmentSize()
+ {
+ Rect rect = new Rect();
+ m_root.getWindowVisibleDisplayFrame( rect );
+ int width = rect.width();
+ int height = rect.height();
+ if ( null != m_isPortrait && m_isPortrait && height < width ) {
+ int tmp = width;
+ width = height;
+ height = tmp;
+ }
+ return new Point( width / Math.min( m_maxPanes, m_root.getChildCount() ),
+ height );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Delegator interface
+ //////////////////////////////////////////////////////////////////////
+ @Override
+ public boolean inDPMode() {
+ return m_dpEnabled;
+ }
+
+ @Override
+ public void addFragment( XWFragment fragment, Bundle extras )
+ {
+ addFragmentImpl( fragment, extras, fragment.getParent() );
+ }
+
+ private class PendingResultCache {
+ private WeakReference m_frag;
+ public int m_request;
+ public int m_result;
+ public Intent m_data;
+ public PendingResultCache( Fragment target, int request, int result, Intent data ) {
+ m_frag = new WeakReference(target);
+ m_request = request;
+ m_result = result;
+ m_data = data;
+ }
+
+ public Fragment getTarget() { return m_frag.get(); }
+ }
+ private PendingResultCache m_pendingResult;
+
+ public void addFragmentForResult( XWFragment fragment, Bundle extras,
+ RequestCode requestCode, XWFragment registrant )
+ {
+ DbgUtils.assertOnUIThread();
+
+ fragment.setTargetFragment( registrant, requestCode.ordinal() );
+
+ addFragmentImpl( fragment, extras, fragment.getParent() );
+ }
+
+ protected void setFragmentResult( XWFragment fragment, int resultCode,
+ Intent data )
+ {
+ Fragment target = fragment.getTargetFragment();
+ int requestCode = fragment.getTargetRequestCode();
+
+ Assert.assertNull( m_pendingResult );
+ m_pendingResult = new PendingResultCache( target, requestCode,
+ resultCode, data );
+ }
+
+ protected void finishFragment()
+ {
+ // Assert.assertTrue( fragment instanceof XWFragment );
+ // DbgUtils.logf( "MainActivity.finishFragment(%s)", fragment.toString() );
+ getSupportFragmentManager().popBackStack/*Immediate*/();
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // FragmentManager.OnBackStackChangedListener
+ //////////////////////////////////////////////////////////////////////
+ public void onBackStackChanged()
+ {
+ // make sure the right-most are visible
+ int fragCount = getSupportFragmentManager().getBackStackEntryCount();
+ DbgUtils.logf( "MainActivity.onBackStackChanged(); count now %d", fragCount );
+ if ( 0 == fragCount ) {
+ finish();
+ } else {
+ if ( fragCount == m_root.getChildCount() - 1 ) {
+ View child = m_root.getChildAt( fragCount );
+ if ( LOG_IDS ) {
+ DbgUtils.logf( "onBackStackChanged(): removing view with id %x",
+ child.getId() );
+ }
+ m_root.removeView( child );
+ setVisiblePanes();
+ }
+
+ // If there's a pending on-result call, make it.
+ if ( null != m_pendingResult ) {
+ Fragment target = m_pendingResult.getTarget();
+ if ( null != target ) {
+ DbgUtils.logf( "onBackStackChanged(): calling onActivityResult()" );
+ target.onActivityResult( m_pendingResult.m_request,
+ m_pendingResult.m_result,
+ m_pendingResult.m_data );
+ }
+ m_pendingResult = null;
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Dualpane mode stuff
+ ////////////////////////////////////////////////////////////////////////
+
+ private XWFragment getTopFragment()
+ {
+ View child = m_root.getChildAt( m_root.getChildCount() - 1 );
+ XWFragment frag = (XWFragment)getSupportFragmentManager()
+ .findFragmentById( child.getId() );
+ return frag;
+ }
+
+ private XWFragment[] getVisibleFragments()
+ {
+ int childCount = m_root.getChildCount();
+ int count = Math.min( m_maxPanes, childCount );
+ XWFragment[] result = new XWFragment[count];
+ for ( int ii = 0; ii < count; ++ii ) {
+ View child = m_root.getChildAt( childCount - 1 - ii );
+ result[ii] = (XWFragment)getSupportFragmentManager()
+ .findFragmentById( child.getId() );
+ }
+
+ return result;
+ }
+
+ // Walk all Fragment children and if they care notify of change.
+ private void tellOrientationChanged()
+ {
+ FragmentManager fm = getSupportFragmentManager();
+ int nPanes = m_root.getChildCount();
+ for ( int ii = 0; ii < nPanes; ++ii ) {
+ FrameLayout frame = (FrameLayout)m_root.getChildAt( ii );
+ int id = frame.getId();
+ Fragment frag = fm.findFragmentById( id );
+ if ( null == frag ) {
+ DbgUtils.logf( "tellOrienationChanged: NO FRAG at %d, id=%d", ii, id );
+ } else if ( frag instanceof XWFragment ) {
+ ((XWFragment)frag).getDelegate().orientationChanged();
+ }
+ }
+ }
+
+ private int maxPanes()
+ {
+ int result;
+ int orientation = getResources().getConfiguration().orientation;
+ if ( XWPrefs.getIsTablet( this )
+ && Configuration.ORIENTATION_LANDSCAPE == orientation ) {
+ result = MAX_PANES_LANDSCAPE;
+ } else {
+ result = 1;
+ }
+ // DbgUtils.logf( "maxPanes() => %d", result );
+ return result;
+ }
+
+ private void setVisiblePanes()
+ {
+ // hide all but the right-most m_maxPanes children
+ int nPanes = m_root.getChildCount();
+ for ( int ii = 0; ii < nPanes; ++ii ) {
+ View child = m_root.getChildAt( ii );
+ boolean visible = ii >= nPanes - m_maxPanes;
+ DbgUtils.logf( "pane %d: visible=%b", ii, visible );
+ child.setVisibility( visible ? View.VISIBLE : View.GONE );
+ setMenuVisibility( child, visible );
+ }
+ }
+
+ private void setMenuVisibility( View cont, boolean visible )
+ {
+ FrameLayout layout = (FrameLayout)cont;
+ FragmentManager fm = getSupportFragmentManager();
+ int hidingId = layout.getId();
+ Fragment frag = fm.findFragmentById( hidingId );
+ if ( null != frag ) { // hasn't been popped?
+ frag.setMenuVisibility( visible );
+ }
+ }
+
+ private void addFragmentImpl( Fragment fragment, Bundle bundle,
+ Delegator parent )
+ {
+ fragment.setArguments( bundle );
+ addFragmentImpl( fragment, parent );
+ }
+
+ private void addFragmentImpl( Fragment fragment, Delegator parent )
+ {
+ String newName = fragment.getClass().getSimpleName();
+ boolean replace = false;
+ FragmentManager fm = getSupportFragmentManager();
+ int fragCount = fm.getBackStackEntryCount();
+ int containerCount = m_root.getChildCount();
+ DbgUtils.logf( "fragCount: %d; containerCount: %d", fragCount, containerCount );
+ // Assert.assertTrue( fragCount == containerCount );
+
+ // Replace IF we're adding something of the same class at right OR if
+ // we're adding something with the existing left pane as its parent
+ // (delegator)
+ if ( 1 < fragCount ) {
+ Assert.assertTrue( MAX_PANES_LANDSCAPE == 2 ); // otherwise FIXME
+ FragmentManager.BackStackEntry entry
+ = fm.getBackStackEntryAt( fragCount - 2 );
+ String curName = entry.getName();
+ String delName = parent.getClass().getSimpleName();
+ // DbgUtils.logf( "comparing %s, %s", curName, delName );
+ replace = curName.equals( delName );
+ }
+
+ if ( replace ) {
+ fm.popBackStack();
+ }
+
+ // Replace doesn't seem to work with generated IDs, so we'll create a
+ // new FrameLayout each time. If we're replacing, we'll replace the
+ // current rightmost FrameLayout. Otherwise we'll add a new one.
+ LinearLayout.LayoutParams lp
+ = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams
+ .MATCH_PARENT, 1.0f);
+ FrameLayout cont = new FrameLayout( this );
+ cont.setLayoutParams( lp );
+ int id = --m_nextID;
+ cont.setId( id );
+ if ( LOG_IDS ) {
+ DbgUtils.logf( "assigning id %x to view with name %s", id, newName );
+ }
+ m_root.addView( cont, replace ? containerCount - 1 : containerCount );
+
+ if ( !replace && containerCount >= m_maxPanes ) {
+ int indx = containerCount - m_maxPanes;
+ View child = m_root.getChildAt( indx );
+ child.setVisibility( View.GONE );
+
+ setMenuVisibility( child, false );
+
+ DbgUtils.logf( "hiding %dth container", indx );
+ }
+
+ fm.beginTransaction()
+ .add( id, fragment )
+ .addToBackStack( newName )
+ .commit();
+ // Don't do this. It causes an exception if e.g. from fragment.start()
+ // I wind up launching another fragment and calling into this code
+ // again. If I need executePendingTransactions() I'm doing something
+ // else wrong.
+ // fm.executePendingTransactions();
+ }
+}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiMsgSink.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiMsgSink.java
index 45504cfd5..72c25da12 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiMsgSink.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiMsgSink.java
@@ -79,7 +79,7 @@ public class MultiMsgSink implements TransportProcs {
public int getFlags() { return COMMS_XPORT_FLAGS_HASNOCONN; }
- public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
+ public int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
CommsConnType typ, int gameID )
{
int nSent = -1;
@@ -97,7 +97,7 @@ public class MultiMsgSink implements TransportProcs {
Assert.fail();
break;
}
- DbgUtils.logf( "MultiMsgSink.transportSend(): sent %d via %s",
+ DbgUtils.logf( "MultiMsgSink.transportSend(): sent %d via %s",
nSent, typ.toString() );
if ( 0 < nSent ) {
DbgUtils.logdf( "MultiMsgSink.transportSend: adding %s", msgNo );
@@ -115,7 +115,7 @@ public class MultiMsgSink implements TransportProcs {
{
}
- public void relayConnd( String room, int devOrder, boolean allHere,
+ public void relayConnd( String room, int devOrder, boolean allHere,
int nMissing )
{
}
@@ -123,7 +123,7 @@ public class MultiMsgSink implements TransportProcs {
public boolean relayNoConnProc( byte[] buf, String msgNo, String relayID )
{
// Assert.fail();
- int nSent = RelayService.sendNoConnPacket( m_context, getRowID(),
+ int nSent = RelayService.sendNoConnPacket( m_context, getRowID(),
relayID, buf );
boolean success = buf.length == nSent;
if ( success ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java
index 7aaa75946..f64431cf0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/MultiService.java
@@ -149,7 +149,7 @@ public class MultiService {
String inviter = intent.getStringExtra( INVITER );
int msgID = (null == inviter) ? R.string.invite_dict_missing_body_noname_fmt
: R.string.invite_dict_missing_body_fmt;
- String msg = LocUtils.getString( context, msgID, inviter, dict,
+ String msg = LocUtils.getString( context, msgID, inviter, dict,
LocUtils.xlateLang( context, langStr));
return LocUtils.makeAlertBuilder( context )
@@ -160,10 +160,10 @@ public class MultiService {
.create();
}
- public static void postMissingDictNotification( Context content,
+ public static void postMissingDictNotification( Context content,
Intent intent, int id )
{
- Utils.postNotification( content, intent, R.string.missing_dict_title,
+ Utils.postNotification( content, intent, R.string.missing_dict_title,
R.string.missing_dict_detail, id );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java
index da3d1fe31..487b2a841 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NFCUtils.java
@@ -64,12 +64,12 @@ public class NFCUtils {
private static class SafeNFCImpl implements SafeNFC {
public void register( final Activity activity, final NFCActor actor )
{
- NfcManager manager =
+ NfcManager manager =
(NfcManager)activity.getSystemService( Context.NFC_SERVICE );
if ( null != manager ) {
NfcAdapter adapter = manager.getDefaultAdapter();
if ( null != adapter ) {
- NfcAdapter.CreateNdefMessageCallback cb =
+ NfcAdapter.CreateNdefMessageCallback cb =
new NfcAdapter.CreateNdefMessageCallback() {
public NdefMessage createNdefMessage( NfcEvent evt )
{
@@ -93,7 +93,7 @@ public class NFCUtils {
public static boolean[] nfcAvail( Context context )
{
if ( null == s_nfcAvail ) {
- s_nfcAvail = new boolean[] {
+ s_nfcAvail = new boolean[] {
s_inSDK && null != getNFCAdapter( context ),
false
};
@@ -110,7 +110,7 @@ public class NFCUtils {
String action = intent.getAction();
if ( NfcAdapter.ACTION_NDEF_DISCOVERED.equals( action ) ) {
- Parcelable[] rawMsgs =
+ Parcelable[] rawMsgs =
intent.getParcelableArrayExtra( NfcAdapter.EXTRA_NDEF_MESSAGES );
// only one message sent during the beam
NdefMessage msg = (NdefMessage)rawMsgs[0];
@@ -140,7 +140,7 @@ public class NFCUtils {
{
DialogInterface.OnClickListener lstnr
= new DialogInterface.OnClickListener() {
- public void onClick( DialogInterface dialog,
+ public void onClick( DialogInterface dialog,
int item ) {
activity.
startActivity( new Intent("android.settings"
@@ -159,8 +159,8 @@ public class NFCUtils {
{
String mimeType = LocUtils.getString( activity, R.string.xwords_nfc_mime );
NdefMessage msg = new NdefMessage( new NdefRecord[] {
- new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
- mimeType.getBytes(), new byte[0],
+ new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
+ mimeType.getBytes(), new byte[0],
data.getBytes())
,NdefRecord.
createApplicationRecord( activity.getPackageName() )
@@ -170,9 +170,9 @@ public class NFCUtils {
private static NfcAdapter getNFCAdapter( Context context )
{
- NfcManager manager =
+ NfcManager manager =
(NfcManager)context.getSystemService( Context.NFC_SERVICE );
return manager.getDefaultAdapter();
}
-
+
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java
index aecfc7641..f45ad2b94 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NagTurnReceiver.java
@@ -76,31 +76,31 @@ public class NagTurnReceiver extends BroadcastReceiver {
continue;
}
- info.m_nextNag = figureNextNag( context,
+ info.m_nextNag = figureNextNag( context,
info.m_lastMoveMillis );
boolean lastWarning = 0 == info.m_nextNag;
long rowid = info.m_rowid;
- GameSummary summary = DBUtils.getSummary( context, rowid,
+ GameSummary summary = DBUtils.getSummary( context, rowid,
10 );
- String prevPlayer = null == summary
+ String prevPlayer = null == summary
? LocUtils.getString(context, R.string.prev_player)
: summary.getPrevPlayer();
- Intent msgIntent =
+ Intent msgIntent =
GamesListDelegate.makeRowidIntent( context, rowid );
String millis = formatMillis( context,
now - info.m_lastMoveMillis);
String body =
- String.format( LocUtils.getString(context,
+ String.format( LocUtils.getString(context,
R.string.nag_body_fmt),
prevPlayer, millis );
if ( lastWarning ) {
body = LocUtils
.getString( context, R.string.nag_warn_last_fmt, body );
}
- Utils.postNotification( context, msgIntent,
- R.string.nag_title, body,
+ Utils.postNotification( context, msgIntent,
+ R.string.nag_title, body,
(int)rowid );
}
@@ -162,7 +162,7 @@ public class NagTurnReceiver extends BroadcastReceiver {
private static long[] getIntervals( Context context )
{
long[] result = null;
- String pref =
+ String pref =
XWPrefs.getPrefsString( context, R.string.key_nag_intervals );
if ( null != pref && 0 < pref.length() ) {
if ( pref.equals( s_lastStr ) ) {
@@ -205,7 +205,7 @@ public class NagTurnReceiver extends BroadcastReceiver {
for ( int[] datum : s_fmtData ) {
long val = seconds / datum[0];
if ( 1 <= val ) {
- results.add( LocUtils.getQuantityString( context, datum[1],
+ results.add( LocUtils.getQuantityString( context, datum[1],
(int)val, val ) );
seconds %= datum[0];
}
@@ -217,13 +217,13 @@ public class NagTurnReceiver extends BroadcastReceiver {
private static boolean getNagsDisabled( Context context )
{
if ( null == s_nagsDisabledNet ) {
- boolean nagsDisabled =
- XWPrefs.getPrefsBoolean( context, R.string.key_disable_nag,
+ boolean nagsDisabled =
+ XWPrefs.getPrefsBoolean( context, R.string.key_disable_nag,
false );
s_nagsDisabledNet = new Boolean( nagsDisabled );
}
if ( null == s_nagsDisabledSolo ) {
- boolean nagsDisabled =
+ boolean nagsDisabled =
XWPrefs.getPrefsBoolean( context, R.string.key_disable_nag_solo,
true );
s_nagsDisabledSolo = new Boolean( nagsDisabled );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java
index 17540d7b1..146e4068d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetLaunchInfo.java
@@ -204,7 +204,7 @@ public class NetLaunchInfo {
calcValid();
}
- private NetLaunchInfo( int gamID, String gamNam, int dictLang,
+ private NetLaunchInfo( int gamID, String gamNam, int dictLang,
String dictName, int nPlayers )
{
this();
@@ -262,7 +262,7 @@ public class NetLaunchInfo {
}
public String inviteID()
- {
+ {
String result = inviteID;
if ( null == result ) {
result = GameUtils.formatGameID( gameID );
@@ -272,7 +272,7 @@ public class NetLaunchInfo {
}
public int gameID()
- {
+ {
int result = gameID;
if ( 0 == result ) {
Assert.assertNotNull( inviteID );
@@ -369,12 +369,12 @@ public class NetLaunchInfo {
private void init( Context context, String data )
{
CommsConnTypeSet supported = CommsConnTypeSet.getSupported( context );
- try {
+ try {
JSONObject json = new JSONObject( data );
int flags = json.optInt(ADDRS_KEY, -1);
boolean hasAddrs = -1 != flags;
- m_addrs = hasAddrs ?
+ m_addrs = hasAddrs ?
new CommsConnTypeSet( flags ) : new CommsConnTypeSet();
lang = json.optInt( MultiService.LANG, -1 );
@@ -475,7 +475,7 @@ public class NetLaunchInfo {
return result;
}
-
+
public void addRelayInfo( String aRoom, String inviteID )
{
room = aRoom;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
index 2e7660cbd..e22aee087 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetStateCache.java
@@ -79,7 +79,7 @@ public class NetStateCache {
}
if ( now - s_lastNetCheck > (1000 * 20) ) { // 20 seconds
s_lastNetCheck = now;
-
+
boolean netAvail = getIsConnected( context );
if ( netAvail ) {
DbgUtils.logf( "netAvail(): second-guessing successful!!!" );
@@ -168,7 +168,7 @@ public class NetStateCache {
}
}
}
-
+
private static class PvtBroadcastReceiver extends BroadcastReceiver {
private Runnable mNotifyLater;
private Handler mHandler;
@@ -182,7 +182,7 @@ public class NetStateCache {
}
@Override
- public void onReceive( Context context, Intent intent )
+ public void onReceive( Context context, Intent intent )
{
DbgUtils.assertOnUIThread();
@@ -192,7 +192,7 @@ public class NetStateCache {
NetworkInfo ni = (NetworkInfo)intent.
getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
NetworkInfo.State state = ni.getState();
- DbgUtils.logdf( "NetStateCache.PvtBroadcastReceiver.onReceive(state=%s)",
+ DbgUtils.logdf( "NetStateCache.PvtBroadcastReceiver.onReceive(state=%s)",
state.toString() );
boolean netAvail;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java
index b0a59b823..76f9b92a8 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/NetUtils.java
@@ -57,7 +57,7 @@ public class NetUtils {
public static byte PRX_GET_MSGS = 4;
public static byte PRX_PUT_MSGS = 5;
- public static Socket makeProxySocket( Context context,
+ public static Socket makeProxySocket( Context context,
int timeoutMillis )
{
Socket socket = null;
@@ -101,7 +101,7 @@ public class NetUtils {
}
try {
- DataOutputStream outStream =
+ DataOutputStream outStream =
new DataOutputStream( socket.getOutputStream() );
outStream.writeShort( 2 + 2 + (2*nObits) + strLens );
outStream.writeByte( NetUtils.PROTOCOL_VERSION );
@@ -119,7 +119,7 @@ public class NetUtils {
outStream.flush();
- DataInputStream dis =
+ DataInputStream dis =
new DataInputStream( socket.getInputStream() );
short resLen = dis.readShort();
socket.close();
@@ -149,7 +149,7 @@ public class NetUtils {
try {
Socket socket = makeProxySocket( context, 8000 );
if ( null != socket ) {
- DataOutputStream outStream =
+ DataOutputStream outStream =
new DataOutputStream( socket.getOutputStream() );
// total packet size
@@ -168,7 +168,7 @@ public class NetUtils {
}
outStream.flush();
- DataInputStream dis =
+ DataInputStream dis =
new DataInputStream(socket.getInputStream());
short resLen = dis.readShort(); // total message length
short nameCount = dis.readShort();
@@ -213,12 +213,12 @@ public class NetUtils {
return host;
}
- protected static HttpURLConnection makeHttpConn( Context context,
+ protected static HttpURLConnection makeHttpConn( Context context,
String proc )
{
HttpURLConnection result = null;
try {
- String url = String.format( "%s/%s",
+ String url = String.format( "%s/%s",
XWPrefs.getDefaultUpdateUrl( context ),
proc );
result = (HttpURLConnection)new URL(url).openConnection();
@@ -239,7 +239,7 @@ public class NetUtils {
params.put( k_PARAMS, param.toString() );
String paramsString = getPostDataString( params );
- if ( null != paramsString ) {
+ if ( null != paramsString ) {
try {
conn.setReadTimeout( 15000 );
conn.setConnectTimeout( 15000 );
@@ -249,7 +249,7 @@ public class NetUtils {
conn.setFixedLengthStreamingMode( paramsString.length() );
OutputStream os = conn.getOutputStream();
- BufferedWriter writer
+ BufferedWriter writer
= new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
writer.write( paramsString );
writer.flush();
@@ -284,7 +284,7 @@ public class NetUtils {
return result;
}
- private static String getPostDataString( Map params )
+ private static String getPostDataString( Map params )
{
String result = null;
try {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/OnBootReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/OnBootReceiver.java
index 21ec664d8..d3c1c39d6 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/OnBootReceiver.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/OnBootReceiver.java
@@ -29,9 +29,9 @@ public class OnBootReceiver extends BroadcastReceiver {
@Override
public void onReceive( Context context, Intent intent )
{
- if ( null != intent && null != intent.getAction()
+ if ( null != intent && null != intent.getAction()
&& intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) {
- DbgUtils.logf( "OnBootReceiver: got ACTION_BOOT_COMPLETED" );
+ DbgUtils.logdf( "OnBootReceiver: got ACTION_BOOT_COMPLETED" );
startTimers( context );
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
index 7b35acfa1..672c3acd6 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsActivity.java
@@ -26,6 +26,8 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
+import junit.framework.Assert;
+
import org.eehouse.android.xw4.loc.LocUtils;
import org.eehouse.android.xw4.DlgDelegate.Action;
@@ -47,23 +49,24 @@ public class PrefsActivity extends PreferenceActivity
m_dlgt.init( savedInstanceState );
}
-
+
@Override
- protected void onStart()
+ protected void onStart()
{
LocUtils.xlatePreferences( this );
super.onStart();
+ m_dlgt.onStart();
}
@Override
- protected void onResume()
+ protected void onResume()
{
super.onResume();
m_dlgt.onResume();
}
@Override
- protected void onPause()
+ protected void onPause()
{
super.onPause();
m_dlgt.onPause();
@@ -141,4 +144,9 @@ public class PrefsActivity extends PreferenceActivity
{
return getIntent().getExtras();
}
+
+ public boolean inDPMode() { Assert.fail(); return false; }
+ public void addFragment( XWFragment fragment, Bundle extras ) { Assert.fail(); }
+ public void addFragmentForResult( XWFragment fragment, Bundle extras,
+ RequestCode code ) { Assert.fail(); }
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java
index 943abdacc..5c751d88e 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/PrefsDelegate.java
@@ -82,7 +82,8 @@ public class PrefsDelegate extends DelegateBase
confirmID = R.string.confirm_revert_colors;
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- SharedPreferences sp = getSharedPreferences();
+ PrefsDelegate self = (PrefsDelegate)curThis();
+ SharedPreferences sp = self.getSharedPreferences();
SharedPreferences.Editor editor = sp.edit();
int[] colorKeys = {
R.string.key_player0,
@@ -103,7 +104,7 @@ public class PrefsDelegate extends DelegateBase
editor.remove( getString(colorKey) );
}
editor.commit();
- relaunch();
+ self.relaunch();
}
};
break;
@@ -111,11 +112,12 @@ public class PrefsDelegate extends DelegateBase
confirmID = R.string.confirm_revert_all;
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
- SharedPreferences sp = getSharedPreferences();
+ PrefsDelegate self = (PrefsDelegate)curThis();
+ SharedPreferences sp = self.getSharedPreferences();
SharedPreferences.Editor editor = sp.edit();
editor.clear();
editor.commit();
- relaunch();
+ self.relaunch();
}
};
break;
@@ -149,13 +151,13 @@ public class PrefsDelegate extends DelegateBase
Button button = (Button)findViewById( R.id.revert_colors );
button.setOnClickListener( new View.OnClickListener() {
public void onClick( View v ) {
- showDialog( DlgID.REVERT_COLORS );
+ curThis().showDialog( DlgID.REVERT_COLORS );
}
} );
button = (Button)findViewById( R.id.revert_all );
button.setOnClickListener(new View.OnClickListener() {
public void onClick( View v ) {
- showDialog( DlgID.REVERT_ALL );
+ curThis().showDialog( DlgID.REVERT_ALL );
}
} );
@@ -163,22 +165,22 @@ public class PrefsDelegate extends DelegateBase
hideStuff();
}
-
+
@Override
- protected void onResume()
+ protected void onResume()
{
super.onResume();
- getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
+ getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
- protected void onPause()
+ protected void onPause()
{
getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
super.onPause();
}
@Override
- public void onSharedPreferenceChanged( SharedPreferences sp, String key )
+ public void onSharedPreferenceChanged( SharedPreferences sp, String key )
{
if ( s_keysHash.containsKey( key ) ) {
switch( s_keysHash.get( key ) ) {
@@ -240,7 +242,6 @@ public class PrefsDelegate extends DelegateBase
@Override
public void dlgButtonClicked( Action action, int button, Object[] params )
{
- DbgUtils.logf( "PrefsDelegate.dlgButtonClicked(%s)", action.toString() );
boolean handled = AlertDialog.BUTTON_POSITIVE == button;
if ( handled ) {
switch ( action ) {
@@ -306,17 +307,17 @@ public class PrefsDelegate extends DelegateBase
lp.setEntryValues( langs );
}
- private void forceDictsMatch( String newLang )
+ private void forceDictsMatch( String newLang )
{
int code = DictLangCache.getLangLangCode( m_activity, newLang );
- int[] keyIds = { R.string.key_default_dict,
+ int[] keyIds = { R.string.key_default_dict,
R.string.key_default_robodict };
for ( int id : keyIds ) {
String key = getString( id );
DictListPreference pref = (DictListPreference)m_activity.findPreference( key );
String curDict = pref.getValue().toString();
if ( ! DictUtils.dictExists( m_activity, curDict )
- || code != DictLangCache.getDictLangCode( m_activity,
+ || code != DictLangCache.getDictLangCode( m_activity,
curDict ) ) {
pref.invalidate();
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java
index 36f0b9df7..c50c1a00f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RefreshNamesTask.java
@@ -47,7 +47,7 @@ public class RefreshNamesTask extends AsyncTask {
private NoNameFound m_nnf;
public RefreshNamesTask( Context context, NoNameFound nnf,
- int lang, int nInGame,
+ int lang, int nInGame,
Spinner getsResults )
{
super();
@@ -65,7 +65,7 @@ public class RefreshNamesTask extends AsyncTask {
}
@Override
- protected String[] doInBackground( Void...unused )
+ protected String[] doInBackground( Void...unused )
{
ArrayList names = new ArrayList();
DbgUtils.logf( "doInBackground()" );
@@ -73,9 +73,9 @@ public class RefreshNamesTask extends AsyncTask {
try {
Socket socket = NetUtils.makeProxySocket( m_context, 15000 );
if ( null != socket ) {
- DataOutputStream outStream =
+ DataOutputStream outStream =
new DataOutputStream( socket.getOutputStream() );
-
+
outStream.writeShort( 4 ); // total packet length
outStream.writeByte( NetUtils.PROTOCOL_VERSION );
outStream.writeByte( NetUtils.PRX_PUB_ROOMS );
@@ -84,7 +84,7 @@ public class RefreshNamesTask extends AsyncTask {
outStream.flush();
// read result -- will block
- DataInputStream dis =
+ DataInputStream dis =
new DataInputStream(socket.getInputStream());
short len = dis.readShort();
short nRooms = dis.readShort();
@@ -112,7 +112,7 @@ public class RefreshNamesTask extends AsyncTask {
DbgUtils.loge( ioe );
}
DbgUtils.logf( "doInBackground() returning" );
- return names.toArray( new String[names.size()] );
+ return names.toArray( new String[names.size()] );
}
// protected void onProgressUpdate(Integer... progress) {
@@ -123,7 +123,7 @@ public class RefreshNamesTask extends AsyncTask {
protected void onPostExecute( String[] result )
{
DbgUtils.logf( "onPostExecute()" );
- ArrayAdapter adapter =
+ ArrayAdapter adapter =
new ArrayAdapter( m_context,
android.R.layout.simple_spinner_item,
result );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayCheckBoxPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayCheckBoxPreference.java
index 651a72e13..97b64e4b4 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayCheckBoxPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayCheckBoxPreference.java
@@ -43,9 +43,9 @@ public class RelayCheckBoxPreference extends ConfirmingCheckBoxPreference {
PrefsActivity activity = (PrefsActivity)getContext();
int count = DBUtils.getRelayGameCount( activity );
if ( 0 < count ) {
- String msg = LocUtils.getString( activity,
+ String msg = LocUtils.getString( activity,
R.string.warn_relay_havegames );
- msg += LocUtils.getQuantityString( activity, R.plurals.warn_relay_games_fmt,
+ msg += LocUtils.getQuantityString( activity, R.plurals.warn_relay_games_fmt,
count, count );
activity.showConfirmThen( msg, R.string.button_disable_relay,
android.R.string.cancel,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java
index f9ba55e6d..fbd8a1713 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayInviteDelegate.java
@@ -70,7 +70,7 @@ public class RelayInviteDelegate extends InviteDelegate {
private boolean m_immobileConfirmed;
private Activity m_activity;
- public static void launchForResult( Activity activity, int nMissing,
+ public static void launchForResult( Activity activity, int nMissing,
RequestCode requestCode )
{
Intent intent = new Intent( activity, RelayInviteActivity.class );
@@ -87,9 +87,9 @@ public class RelayInviteDelegate extends InviteDelegate {
protected void init( Bundle savedInstanceState )
{
String msg = getString( R.string.button_invite );
- msg = getQuantityString( R.plurals.invite_relay_desc_fmt, m_nMissing,
+ msg = getQuantityString( R.plurals.invite_relay_desc_fmt, m_nMissing,
m_nMissing, msg );
- super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
+ super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
R.id.invite_desc, msg );
// getBundledData( savedInstanceState );
@@ -120,7 +120,7 @@ public class RelayInviteDelegate extends InviteDelegate {
rebuildList( true );
}
- // protected void onSaveInstanceState( Bundle outState )
+ // protected void onSaveInstanceState( Bundle outState )
// {
// outState.putString( SAVE_NAME, m_pendingName );
// outState.putString( SAVE_NUMBER, m_pendingNumber );
@@ -133,8 +133,8 @@ public class RelayInviteDelegate extends InviteDelegate {
// m_pendingNumber = bundle.getString( SAVE_NUMBER );
// }
// }
-
- // protected void onActivityResult( int requestCode, int resultCode,
+
+ // protected void onActivityResult( int requestCode, int resultCode,
// Intent data )
// {
// // super.onActivityResult( requestCode, resultCode, data );
@@ -148,7 +148,7 @@ public class RelayInviteDelegate extends InviteDelegate {
// }
// protected Dialog onCreateDialog( int id )
- // {
+ // {
// Dialog dialog = super.onCreateDialog( id );
// if ( null == dialog ) {
// DialogInterface.OnClickListener lstnr;
@@ -196,7 +196,7 @@ public class RelayInviteDelegate extends InviteDelegate {
new ListOpponentsTask( m_activity, relayIDs, rowIDss[0] ).execute();
}
- // Intent intent = new Intent( Intent.ACTION_PICK,
+ // Intent intent = new Intent( Intent.ACTION_PICK,
// ContactsContract.Contacts.CONTENT_URI );
// intent.setType( Phone.CONTENT_TYPE );
// startActivityForResult( intent, GET_CONTACT );
@@ -230,7 +230,7 @@ public class RelayInviteDelegate extends InviteDelegate {
}
@Override
- protected void tryEnable()
+ protected void tryEnable()
{
if ( null != m_devIDRecs ) {
int nPlayers = 0;
@@ -265,8 +265,8 @@ public class RelayInviteDelegate extends InviteDelegate {
break;
case DlgDelegate.DISMISS_BUTTON:
if ( Action.USE_IMMOBILE_ACTION == action && m_immobileConfirmed ) {
- showConfirmThen( R.string.warn_unlimited,
- R.string.button_yes,
+ showConfirmThen( R.string.warn_unlimited,
+ R.string.button_yes,
Action.POST_WARNING_ACTION );
}
break;
@@ -291,9 +291,9 @@ public class RelayInviteDelegate extends InviteDelegate {
// {
// Uri data = intent.getData();
// Cursor cursor = m_activity
- // .managedQuery( data,
- // new String[] { Phone.DISPLAY_NAME,
- // Phone.NUMBER,
+ // .managedQuery( data,
+ // new String[] { Phone.DISPLAY_NAME,
+ // Phone.NUMBER,
// Phone.TYPE },
// null, null, null );
// // Have seen a crash reporting
@@ -302,10 +302,10 @@ public class RelayInviteDelegate extends InviteDelegate {
// // long time to return. Be safe.
// if ( null != cursor && !cursor.isClosed() ) {
// if ( cursor.moveToFirst() ) {
- // String name =
+ // String name =
// cursor.getString( cursor.
// getColumnIndex( Phone.DISPLAY_NAME));
- // String number =
+ // String number =
// cursor.getString( cursor.
// getColumnIndex( Phone.NUMBER ) );
@@ -314,14 +314,14 @@ public class RelayInviteDelegate extends InviteDelegate {
// // m_pendingName = name;
// // m_pendingNumber = number;
// if ( Phone.TYPE_MOBILE == type ) {
- // showConfirmThen( R.string.warn_unlimited,
- // R.string.button_yes,
+ // showConfirmThen( R.string.warn_unlimited,
+ // R.string.button_yes,
// Action.POST_WARNING_ACTION );
// } else {
// m_immobileConfirmed = false;
- // String msg = getString( R.string.warn_nomobile_fmt,
+ // String msg = getString( R.string.warn_nomobile_fmt,
// number, name );
- // showConfirmThen( msg, R.string.button_yes,
+ // showConfirmThen( msg, R.string.button_yes,
// Action.USE_IMMOBILE_ACTION );
// }
// }
@@ -426,7 +426,7 @@ public class RelayInviteDelegate extends InviteDelegate {
m_items = new SMSListItem[m_devIDRecs.size()];
}
- public Object getItem( final int position )
+ public Object getItem( final int position )
{
// For some reason I can't cache items to be returned.
// Checking/unchecking breaks for some but not all items,
@@ -434,13 +434,13 @@ public class RelayInviteDelegate extends InviteDelegate {
// view. So build them anew each time (but still cache
// for by-index access.)
- SMSListItem item =
+ SMSListItem item =
(SMSListItem)inflate( R.layout.smsinviter_item );
item.setChecked( m_devIDRecs.get(position).m_isChecked );
CompoundButton.OnCheckedChangeListener lstnr =
new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton bv,
+ public void onCheckedChanged( CompoundButton bv,
boolean isChecked ) {
m_devIDRecs.get(position).m_isChecked = isChecked;
tryEnable();
@@ -456,7 +456,7 @@ public class RelayInviteDelegate extends InviteDelegate {
if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
Spinner spinner = (Spinner)
item.findViewById(R.id.nperdev_spinner);
- ArrayAdapter adapter =
+ ArrayAdapter adapter =
new ArrayAdapter( m_activity, android.R.layout
.simple_spinner_item );
for ( int ii = 1; ii <= m_nMissing; ++ii ) {
@@ -466,8 +466,8 @@ public class RelayInviteDelegate extends InviteDelegate {
spinner.setAdapter( adapter );
spinner.setVisibility( View.VISIBLE );
spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
- public void onItemSelected( AdapterView> parent,
- View view, int pos,
+ public void onItemSelected( AdapterView> parent,
+ View view, int pos,
long id )
{
rec.m_nPlayers = 1 + pos;
@@ -481,7 +481,7 @@ public class RelayInviteDelegate extends InviteDelegate {
return item;
}
- public View getView( final int position, View convertView,
+ public View getView( final int position, View convertView,
ViewGroup parent ) {
return (View)getItem( position );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java
index 9fe565c04..0fbbe7bcd 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayService.java
@@ -57,7 +57,7 @@ import org.eehouse.android.xw4.jni.XwJNI;
import org.eehouse.android.xw4.jni.JNIThread;
import org.eehouse.android.xw4.loc.LocUtils;
-public class RelayService extends XWService
+public class RelayService extends XWService
implements NetStateCache.StateChangedIf {
private static final int MAX_SEND = 1024;
private static final int MAX_BUF = MAX_SEND - 2;
@@ -96,14 +96,14 @@ public class RelayService extends XWService
private static int s_nextPacketID = 1;
private static boolean s_gcmWorking = false;
private static boolean s_registered = false;
- private static CommsAddrRec s_addr =
+ private static CommsAddrRec s_addr =
new CommsAddrRec( CommsConnType.COMMS_CONN_RELAY );
private Thread m_fetchThread = null;
private Thread m_UDPReadThread = null;
private Thread m_UDPWriteThread = null;
private DatagramSocket m_UDPSocket;
- private LinkedBlockingQueue m_queue =
+ private LinkedBlockingQueue m_queue =
new LinkedBlockingQueue();
private Handler m_handler;
private Runnable m_onInactivity;
@@ -190,7 +190,7 @@ public class RelayService extends XWService
context.startService( intent );
}
- public static void inviteRemote( Context context, int destDevID,
+ public static void inviteRemote( Context context, int destDevID,
String relayID, NetLaunchInfo nli )
{
int myDevID = DevID.getRelayDevIDInt( context );
@@ -231,7 +231,7 @@ public class RelayService extends XWService
return result;
}
- public static int sendNoConnPacket( Context context, long rowid, String relayID,
+ public static int sendNoConnPacket( Context context, long rowid, String relayID,
byte[] msg )
{
int result = -1;
@@ -251,7 +251,7 @@ public class RelayService extends XWService
s_registered = false;
}
- private void receiveInvitation( int srcDevID, NetLaunchInfo nli )
+ private void receiveInvitation( int srcDevID, NetLaunchInfo nli )
{
DbgUtils.logdf( "receiveInvitation: got nli from %d: %s", srcDevID,
nli.toString() );
@@ -266,9 +266,9 @@ public class RelayService extends XWService
makeGame( nli );
} else {
Intent intent = MultiService
- .makeMissingDictIntent( this, nli,
+ .makeMissingDictIntent( this, nli,
DictFetchOwner.OWNER_RELAY );
- MultiService.postMissingDictNotification( this, intent,
+ MultiService.postMissingDictNotification( this, intent,
nli.gameID() );
}
}
@@ -280,23 +280,23 @@ public class RelayService extends XWService
|| XWPrefs.getRelayInviteToSelfEnabled( this )) {
if ( DictLangCache.haveDict( this, nli.lang, nli.dict ) ) {
- long rowid = GameUtils.makeNewMultiGame( this, nli,
+ long rowid = GameUtils.makeNewMultiGame( this, nli,
new RelayMsgSink(),
getUtilCtxt() );
if ( DBUtils.ROWID_NOTFOUND != rowid ) {
if ( null != nli.gameName && 0 < nli.gameName.length() ) {
DBUtils.setName( this, rowid, nli.gameName );
}
- String body = LocUtils.getString( this,
+ String body = LocUtils.getString( this,
R.string.new_relay_body );
- GameUtils.postInvitedNotification( this, nli.gameID(), body,
+ GameUtils.postInvitedNotification( this, nli.gameID(), body,
rowid );
}
} else {
Intent intent = MultiService
- .makeMissingDictIntent( this, nli,
+ .makeMissingDictIntent( this, nli,
DictFetchOwner.OWNER_RELAY );
- MultiService.postMissingDictNotification( this, intent,
+ MultiService.postMissingDictNotification( this, intent,
nli.gameID() );
}
}
@@ -305,7 +305,7 @@ public class RelayService extends XWService
// Exists to get incoming data onto the main thread
private static void postData( Context context, long rowid, byte[] msg )
{
- DbgUtils.logdf( "RelayService::postData: packet of length %d for token %d",
+ DbgUtils.logdf( "RelayService::postData: packet of length %d for token %d",
msg.length, rowid );
if ( DBUtils.haveGame( context, rowid ) ) {
Intent intent = getIntentTo( context, MsgCmds.RECEIVE )
@@ -323,7 +323,7 @@ public class RelayService extends XWService
startService( context );
}
- public static void processGameMsgs( Context context, String relayId,
+ public static void processGameMsgs( Context context, String relayId,
String[] msgs64 )
{
Intent intent = getIntentTo( context, MsgCmds.PROCESS_GAME_MSGS )
@@ -356,8 +356,8 @@ public class RelayService extends XWService
public void onCreate()
{
super.onCreate();
- m_lastGamePacketReceived =
- XWPrefs.getPrefsLong( this, R.string.key_last_packet,
+ m_lastGamePacketReceived =
+ XWPrefs.getPrefsLong( this, R.string.key_last_packet,
Utils.getCurSeconds() );
m_handler = new Handler();
@@ -365,7 +365,7 @@ public class RelayService extends XWService
public void run() {
DbgUtils.logdf( "RelayService: m_onInactivity fired" );
if ( !shouldMaintainConnection() ) {
- NetStateCache.unregister( RelayService.this,
+ NetStateCache.unregister( RelayService.this,
RelayService.this );
stopSelf();
} else {
@@ -387,7 +387,7 @@ public class RelayService extends XWService
cmd = null;
}
if ( null != cmd ) {
- DbgUtils.logdf( "RelayService::onStartCommand: cmd=%s",
+ DbgUtils.logdf( "RelayService::onStartCommand: cmd=%s",
cmd.toString() );
switch( cmd ) {
case PROCESS_GAME_MSGS:
@@ -419,7 +419,7 @@ public class RelayService extends XWService
break;
case GOT_INVITE:
int srcDevID = intent.getIntExtra( INVITE_FROM, 0 );
- NetLaunchInfo nli
+ NetLaunchInfo nli
= new NetLaunchInfo( this, intent.getStringExtra(NLI_DATA) );
receiveInvitation( srcDevID, nli );
break;
@@ -470,7 +470,7 @@ public class RelayService extends XWService
if ( null == result ) {
result = Service.START_STICKY_COMPATIBILITY;
- }
+ }
NetStateCache.register( this, this );
resetExitTimer();
@@ -552,10 +552,9 @@ public class RelayService extends XWService
DbgUtils.logf( "RelayService:read thread running" );
byte[] buf = new byte[1024];
for ( ; ; ) {
- DatagramPacket packet =
+ DatagramPacket packet =
new DatagramPacket( buf, buf.length );
try {
- Assert.assertTrue( relayEnabled( RelayService.this ) );
m_UDPSocket.receive( packet );
resetExitTimer();
gotPacket( packet );
@@ -583,8 +582,7 @@ public class RelayService extends XWService
if ( null == m_UDPSocket ) {
int port = XWPrefs.getDefaultRelayPort( this );
String host = XWPrefs.getDefaultRelayHost( this );
- try {
- Assert.assertTrue( relayEnabled( this ) );
+ try {
m_UDPSocket = new DatagramSocket();
m_UDPSocket.setSoTimeout(30 * 1000); // timeout so we can log
@@ -626,13 +624,12 @@ public class RelayService extends XWService
}
try {
- Assert.assertTrue( relayEnabled( RelayService.this ) );
DatagramPacket outPacket = outData.assemble();
m_UDPSocket.send( outPacket );
int pid = outData.m_packetID;
DbgUtils.logdf( "Sent udp packet, cmd=%s, id=%d,"
- + " of length %d",
- outData.m_cmd.toString(),
+ + " of length %d",
+ outData.m_cmd.toString(),
pid, outPacket.getLength());
synchronized( s_packetsSent ) {
s_packetsSent.add( pid );
@@ -703,10 +700,10 @@ public class RelayService extends XWService
sendAckIf( header );
}
DbgUtils.logdf( "RelayService.gotPacket: cmd=%s", header.m_cmd.toString() );
- switch ( header.m_cmd ) {
+ switch ( header.m_cmd ) {
case XWPDEV_UNAVAIL:
int unavail = dis.readInt();
- DbgUtils.logf( "relay unvailable for another %d seconds",
+ DbgUtils.logf( "relay unvailable for another %d seconds",
unavail );
String str = getVLIString( dis );
sendResult( MultiEvent.RELAY_ALERT, str );
@@ -714,7 +711,7 @@ public class RelayService extends XWService
case XWPDEV_ALERT:
str = getVLIString( dis );
Intent intent = GamesListDelegate.makeAlertIntent( this, str );
- Utils.postNotification( this, intent,
+ Utils.postNotification( this, intent,
R.string.relay_alert_title,
str, str.hashCode() );
break;
@@ -728,8 +725,8 @@ public class RelayService extends XWService
case XWPDEV_REGRSP:
str = getVLIString( dis );
short maxIntervalSeconds = dis.readShort();
- DbgUtils.logdf( "got relayid %s (%d), maxInterval %d", str,
- Integer.parseInt( str, 16 ),
+ DbgUtils.logdf( "got relayid %s (%d), maxInterval %d", str,
+ Integer.parseInt( str, 16 ),
maxIntervalSeconds );
setMaxIntervalSeconds( maxIntervalSeconds );
DevID.setRelayDevID( this, str );
@@ -814,7 +811,7 @@ public class RelayService extends XWService
// if none has been assigned yet) and the deviceID IFF it's
// changed since we last registered (Otherwise just ID_TYPE_NONE
// and no string)
- //
+ //
// How do we know if we need to register? We keep a timestamp
// indicating when we last got a reg-response. When the GCM id
// changes, that timestamp is cleared.
@@ -844,7 +841,7 @@ public class RelayService extends XWService
writeVLIString( out, devid );
}
- DbgUtils.logdf( "registering devID \"%s\" (type=%s)", devid,
+ DbgUtils.logdf( "registering devID \"%s\" (type=%s)", devid,
typ.toString() );
out.writeShort( BuildConstants.CLIENT_VERS_RELAY );
@@ -905,7 +902,7 @@ public class RelayService extends XWService
postPacket( bas, XWRelayReg.XWPDEV_MSG );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
- }
+ }
}
private void sendNoConnMessage( long rowid, String relayID, byte[] msg )
@@ -921,7 +918,7 @@ public class RelayService extends XWService
postPacket( bas, XWRelayReg.XWPDEV_MSGNOCONN );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
- }
+ }
}
private void sendInvitation( int srcDevID, int destDevID, String relayID,
@@ -934,7 +931,7 @@ public class RelayService extends XWService
byte[] nliData = XwJNI.nliToStream( nli );
if ( BuildConfig.DEBUG ) {
NetLaunchInfo tmp = XwJNI.nliFromStream( nliData );
- DbgUtils.logdf( "sendInvitation: compare these: %s vs %s",
+ DbgUtils.logdf( "sendInvitation: compare these: %s vs %s",
nli.toString(), tmp.toString() );
}
@@ -955,7 +952,7 @@ public class RelayService extends XWService
postPacket( bas, XWRelayReg.XWPDEV_INVITE );
} catch ( java.io.IOException ioe ) {
DbgUtils.loge( ioe );
- }
+ }
}
private void sendAckIf( PacketHeader header )
@@ -1049,7 +1046,7 @@ public class RelayService extends XWService
int nameCount = relayIDs.length;
ArrayList idsWMsgs = new ArrayList( nameCount );
ArrayList isLocals = new ArrayList( nameCount );
- ArrayList bmrs =
+ ArrayList bmrs =
new ArrayList( nameCount );
boolean[] isLocalP = new boolean[1];
@@ -1071,7 +1068,7 @@ public class RelayService extends XWService
private Context m_context;
private HashMap> m_msgHash;
- public AsyncSender( Context context,
+ public AsyncSender( Context context,
HashMap> msgHash )
{
m_context = context;
@@ -1091,12 +1088,12 @@ public class RelayService extends XWService
// Build up a buffer containing everything but the total
// message length and number of relayIDs in the message.
try {
- ByteArrayOutputStream store =
+ ByteArrayOutputStream store =
new ByteArrayOutputStream( MAX_BUF ); // mem
DataOutputStream outBuf = new DataOutputStream( store );
int msgLen = 4; // relayID count + protocol stuff
int nRelayIDs = 0;
-
+
Iterator iter = m_msgHash.keySet().iterator();
while ( iter.hasNext() ) {
String relayID = iter.next();
@@ -1130,7 +1127,7 @@ public class RelayService extends XWService
// copy in the formatted buffer
Socket socket = NetUtils.makeProxySocket( m_context, 8000 );
if ( null != socket ) {
- DataOutputStream outStream =
+ DataOutputStream outStream =
new DataOutputStream( socket.getOutputStream() );
outStream.writeShort( msgLen );
outStream.writeByte( NetUtils.PROTOCOL_VERSION );
@@ -1170,7 +1167,7 @@ public class RelayService extends XWService
Assert.assertNull( m_msgLists );
}
}
-
+
@Override
public int sendViaRelay( byte[] buf, int gameID )
{
@@ -1220,7 +1217,7 @@ public class RelayService extends XWService
DbgUtils.logf( "Weird: got ack %d but never sent", packetID );
}
DbgUtils.logdf( "RelayService.noteAck(): Got ack for %d; "
- + "there are %d unacked packets",
+ + "there are %d unacked packets",
packetID, s_packetsSent.size() );
}
}
@@ -1233,7 +1230,7 @@ public class RelayService extends XWService
// UDP socket's no good as a return address after several
// minutes of inactivity, so do something after that time.
- m_handler.postDelayed( m_onInactivity,
+ m_handler.postDelayed( m_onInactivity,
getMaxIntervalSeconds() * 1000 );
}
@@ -1259,7 +1256,7 @@ public class RelayService extends XWService
stopUDPThreadsIf();
}
- private static void un2vli( int nn, OutputStream os )
+ private static void un2vli( int nn, OutputStream os )
throws java.io.IOException
{
int indx = 0;
@@ -1292,7 +1289,7 @@ public class RelayService extends XWService
done = 0 != (byt & 0x80);
if ( done ) {
byt &= 0x7F;
- }
+ }
result |= byt << (7 * count);
}
@@ -1315,7 +1312,7 @@ public class RelayService extends XWService
{
if ( m_maxIntervalSeconds != maxIntervalSeconds ) {
m_maxIntervalSeconds = maxIntervalSeconds;
- XWPrefs.setPrefsInt( this, R.string.key_udp_interval,
+ XWPrefs.setPrefsInt( this, R.string.key_udp_interval,
maxIntervalSeconds );
}
}
@@ -1323,7 +1320,7 @@ public class RelayService extends XWService
private int getMaxIntervalSeconds()
{
if ( 0 == m_maxIntervalSeconds ) {
- m_maxIntervalSeconds =
+ m_maxIntervalSeconds =
XWPrefs.getPrefsInt( this, R.string.key_udp_interval, 60 );
}
return m_maxIntervalSeconds;
@@ -1415,7 +1412,7 @@ public class RelayService extends XWService
try {
m_packetID = nextPacketID( m_cmd );
DataOutputStream out = new DataOutputStream( bas );
- DbgUtils.logdf( "RelayService.makeHeader(): building packet with cmd %s",
+ DbgUtils.logdf( "RelayService.makeHeader(): building packet with cmd %s",
m_cmd.toString() );
out.writeByte( XWPDevProto.XWPDEV_PROTO_VERSION_1.ordinal() );
un2vli( m_packetID, out );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RequestCode.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RequestCode.java
index dfba107cc..788b7a70c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RequestCode.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RequestCode.java
@@ -25,7 +25,6 @@ public enum RequestCode {
__UNUSED,
// BoardDelegate
- CHAT_REQUEST,
BT_INVITE_RESULT,
SMS_INVITE_RESULT,
RELAY_INVITE_RESULT,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java
index 446a9d77d..5fcf28936 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteDelegate.java
@@ -85,13 +85,10 @@ public class SMSInviteDelegate extends InviteDelegate {
protected void init( Bundle savedInstanceState )
{
- // super.init( R.id.button_invite, R.id.button_add,
- // R.id.button_clear, R.id.invite_desc,
- // R.string.invite_sms_desc_fmt );
String msg = getString( R.string.button_invite );
- msg = getQuantityString( R.plurals.invite_sms_desc_fmt, m_nMissing,
+ msg = getQuantityString( R.plurals.invite_sms_desc_fmt, m_nMissing,
m_nMissing, msg );
- super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
+ super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
R.id.invite_desc, msg );
getBundledData( savedInstanceState );
@@ -108,7 +105,7 @@ public class SMSInviteDelegate extends InviteDelegate {
rebuildList( true );
}
- protected void onSaveInstanceState( Bundle outState )
+ protected void onSaveInstanceState( Bundle outState )
{
outState.putString( SAVE_NAME, m_pendingName );
outState.putString( SAVE_NUMBER, m_pendingNumber );
@@ -121,9 +118,9 @@ public class SMSInviteDelegate extends InviteDelegate {
m_pendingNumber = bundle.getString( SAVE_NUMBER );
}
}
-
+
@Override
- protected void onActivityResult( RequestCode requestCode, int resultCode,
+ protected void onActivityResult( RequestCode requestCode, int resultCode,
Intent data )
{
// super.onActivityResult( requestCode, resultCode, data );
@@ -137,7 +134,7 @@ public class SMSInviteDelegate extends InviteDelegate {
}
protected Dialog onCreateDialog( int id )
- {
+ {
Dialog dialog = super.onCreateDialog( id );
if ( null == dialog ) {
DialogInterface.OnClickListener lstnr;
@@ -150,13 +147,14 @@ public class SMSInviteDelegate extends InviteDelegate {
namerView.setKeyListener(DialerKeyListener.getInstance());
lstnr = new DialogInterface.OnClickListener() {
public void onClick( DialogInterface dlg, int item ) {
+ SMSInviteDelegate self = (SMSInviteDelegate)curThis();
String number = namerView.getName();
PhoneRec rec = new PhoneRec( number );
- m_pendingNumber = number;
- m_pendingName = null;
- showConfirmThen( R.string.warn_unlimited,
- R.string.button_yes,
- Action.POST_WARNING_ACTION );
+ self.m_pendingNumber = number;
+ self.m_pendingName = null;
+ self.showConfirmThen( R.string.warn_unlimited,
+ R.string.button_yes,
+ Action.POST_WARNING_ACTION );
}
};
dialog = makeAlertBuilder()
@@ -173,7 +171,7 @@ public class SMSInviteDelegate extends InviteDelegate {
protected void scan()
{
- Intent intent = new Intent( Intent.ACTION_PICK,
+ Intent intent = new Intent( Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI );
intent.setType( Phone.CONTENT_TYPE );
startActivityForResult( intent, RequestCode.GET_CONTACT );
@@ -182,7 +180,7 @@ public class SMSInviteDelegate extends InviteDelegate {
protected void clearSelected()
{
int count = countChecks();
- String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
+ String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
count, count );
showConfirmThen( msg, Action.CLEAR_ACTION );
}
@@ -210,7 +208,7 @@ public class SMSInviteDelegate extends InviteDelegate {
}
@Override
- protected void tryEnable()
+ protected void tryEnable()
{
if ( null != m_phoneRecs ) {
int nPlayers = 0;
@@ -249,8 +247,8 @@ public class SMSInviteDelegate extends InviteDelegate {
break;
case DlgDelegate.DISMISS_BUTTON:
if ( Action.USE_IMMOBILE_ACTION == action && m_immobileConfirmed ) {
- showConfirmThen( R.string.warn_unlimited,
- R.string.button_yes,
+ showConfirmThen( R.string.warn_unlimited,
+ R.string.button_yes,
Action.POST_WARNING_ACTION );
}
break;
@@ -275,9 +273,9 @@ public class SMSInviteDelegate extends InviteDelegate {
{
Uri data = intent.getData();
Cursor cursor = m_activity
- .managedQuery( data,
- new String[] { Phone.DISPLAY_NAME,
- Phone.NUMBER,
+ .managedQuery( data,
+ new String[] { Phone.DISPLAY_NAME,
+ Phone.NUMBER,
Phone.TYPE },
null, null, null );
// Have seen a crash reporting
@@ -286,10 +284,10 @@ public class SMSInviteDelegate extends InviteDelegate {
// long time to return. Be safe.
if ( null != cursor && !cursor.isClosed() ) {
if ( cursor.moveToFirst() ) {
- String name =
+ String name =
cursor.getString( cursor.
getColumnIndex( Phone.DISPLAY_NAME));
- String number =
+ String number =
cursor.getString( cursor.
getColumnIndex( Phone.NUMBER ) );
@@ -298,14 +296,14 @@ public class SMSInviteDelegate extends InviteDelegate {
m_pendingName = name;
m_pendingNumber = number;
if ( Phone.TYPE_MOBILE == type ) {
- showConfirmThen( R.string.warn_unlimited,
- R.string.button_yes,
+ showConfirmThen( R.string.warn_unlimited,
+ R.string.button_yes,
Action.POST_WARNING_ACTION );
} else {
m_immobileConfirmed = false;
- String msg = getString( R.string.warn_nomobile_fmt,
+ String msg = getString( R.string.warn_nomobile_fmt,
number, name );
- showConfirmThen( msg, R.string.button_yes,
+ showConfirmThen( msg, R.string.button_yes,
Action.USE_IMMOBILE_ACTION );
}
}
@@ -418,7 +416,7 @@ public class SMSInviteDelegate extends InviteDelegate {
m_items = new SMSListItem[m_phoneRecs.size()];
}
- public Object getItem( final int position )
+ public Object getItem( final int position )
{
// For some reason I can't cache items to be returned.
// Checking/unchecking breaks for some but not all items,
@@ -426,13 +424,13 @@ public class SMSInviteDelegate extends InviteDelegate {
// view. So build them anew each time (but still cache
// for by-index access.)
- SMSListItem item =
+ SMSListItem item =
(SMSListItem)inflate( R.layout.smsinviter_item );
item.setChecked( m_phoneRecs.get(position).m_isChecked );
CompoundButton.OnCheckedChangeListener lstnr =
new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged( CompoundButton bv,
+ public void onCheckedChanged( CompoundButton bv,
boolean isChecked ) {
m_phoneRecs.get(position).m_isChecked = isChecked;
tryEnable();
@@ -448,7 +446,7 @@ public class SMSInviteDelegate extends InviteDelegate {
if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
Spinner spinner = (Spinner)
item.findViewById(R.id.nperdev_spinner);
- ArrayAdapter adapter =
+ ArrayAdapter adapter =
new ArrayAdapter( m_activity, android.R.layout
.simple_spinner_item );
for ( int ii = 1; ii <= m_nMissing; ++ii ) {
@@ -458,8 +456,8 @@ public class SMSInviteDelegate extends InviteDelegate {
spinner.setAdapter( adapter );
spinner.setVisibility( View.VISIBLE );
spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
- public void onItemSelected( AdapterView> parent,
- View view, int pos,
+ public void onItemSelected( AdapterView> parent,
+ View view, int pos,
long id )
{
rec.m_nPlayers = 1 + pos;
@@ -473,7 +471,7 @@ public class SMSInviteDelegate extends InviteDelegate {
return item;
}
- public View getView( final int position, View convertView,
+ public View getView( final int position, View convertView,
ViewGroup parent ) {
return (View)getItem( position );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSListItem.java
index 8cd1d7c12..72d80bb58 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSListItem.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSListItem.java
@@ -28,8 +28,8 @@ import android.util.AttributeSet;
import android.widget.CompoundButton.OnCheckedChangeListener;
public class SMSListItem extends LinearLayout {
-
- public SMSListItem( Context cx, AttributeSet as )
+
+ public SMSListItem( Context cx, AttributeSet as )
{
super( cx, as );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
index a69d4c1d0..0fe054aab 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSService.java
@@ -96,11 +96,11 @@ public class SMSService extends XWService {
private static final String PHONE = "PHONE";
private static final String GAMEDATA_STR = "GD";
- private static final String PHONE_RECS_KEY =
+ private static final String PHONE_RECS_KEY =
SMSService.class.getName() + "_PHONES";
private static Boolean s_showToasts = null;
-
+
// All messages are base64-encoded byte arrays. The first byte is
// always one of these. What follows depends.
private enum SMS_CMD { NONE, INVITE, DATA, DEATH, ACK, };
@@ -184,7 +184,7 @@ public class SMSService extends XWService {
s_phoneInfo = null;
}
- public static void smsToastEnable( boolean newVal )
+ public static void smsToastEnable( boolean newVal )
{
s_showToasts = newVal;
}
@@ -196,7 +196,7 @@ public class SMSService extends XWService {
}
// NBS case
- public static void handleFrom( Context context, byte[] buffer,
+ public static void handleFrom( Context context, byte[] buffer,
String phone )
{
Intent intent = getIntentTo( context, SMSAction.HANDLEDATA );
@@ -216,7 +216,7 @@ public class SMSService extends XWService {
context.startService( intent );
}
- public static int sendPacket( Context context, String phone,
+ public static int sendPacket( Context context, String phone,
int gameID, byte[] binmsg )
{
int nSent = -1;
@@ -258,7 +258,7 @@ public class SMSService extends XWService {
String tmp = msg.substring( 1 + msg.lastIndexOf( " " ) );
int headerLen = XWApp.SMS_PUBLIC_HEADER.length();
- String hashString =
+ String hashString =
msg.substring( headerLen, headerLen + 4 );
int hashRead = Integer.parseInt( hashString, 16 );
int hashCode = 0xFFFF & tmp.hashCode();
@@ -283,13 +283,13 @@ public class SMSService extends XWService {
private static boolean showToasts( Context context )
{
if ( null == s_showToasts ) {
- s_showToasts =
+ s_showToasts =
XWPrefs.getPrefsBoolean( context, R.string.key_show_sms, false );
}
return s_showToasts;
}
- @Override // abstract
+ @Override
protected MultiMsgSink getSink( long rowid )
{
return new SMSMsgSink( this );
@@ -378,8 +378,8 @@ public class SMSService extends XWService {
result = Service.START_STICKY;
}
-
- if ( Service.START_NOT_STICKY == result
+
+ if ( Service.START_NOT_STICKY == result
|| !XWPrefs.getSMSEnabled( this ) ) {
stopSelf( startId );
}
@@ -469,7 +469,7 @@ public class SMSService extends XWService {
return result;
}
- private byte[][] breakAndEncode( byte msg[] ) throws java.io.IOException
+ private byte[][] breakAndEncode( byte msg[] ) throws java.io.IOException
{
byte[][] result = null;
int count = (msg.length + (MAX_LEN_BINARY-1)) / MAX_LEN_BINARY;
@@ -485,7 +485,7 @@ public class SMSService extends XWService {
len = MAX_LEN_BINARY;
}
end += len;
- byte[] part = new byte[4 + len];
+ byte[] part = new byte[4 + len];
part[0] = (byte)SMS_PROTO_VERSION;
part[1] = (byte)msgID;
part[2] = (byte)ii;
@@ -505,7 +505,7 @@ public class SMSService extends XWService {
private void receive( SMS_CMD cmd, byte[] data, String phone )
{
DbgUtils.logf( "SMSService.receive(cmd=%s)", cmd.toString() );
- DataInputStream dis =
+ DataInputStream dis =
new DataInputStream( new ByteArrayInputStream(data) );
try {
switch( cmd ) {
@@ -517,9 +517,9 @@ public class SMSService extends XWService {
makeForInvite( phone, nli );
} else {
Intent intent = MultiService
- .makeMissingDictIntent( this, nli,
+ .makeMissingDictIntent( this, nli,
DictFetchOwner.OWNER_SMS );
- MultiService.postMissingDictNotification( this, intent,
+ MultiService.postMissingDictNotification( this, intent,
nli.gameID() );
}
} else {
@@ -538,7 +538,7 @@ public class SMSService extends XWService {
break;
case ACK:
gameID = dis.readInt();
- sendResult( MultiEvent.NEWGAME_SUCCESS,
+ sendResult( MultiEvent.NEWGAME_SUCCESS,
gameID );
break;
default:
@@ -566,7 +566,7 @@ public class SMSService extends XWService {
}
}
- private boolean tryAssemble( String senderPhone, int id, int index,
+ private boolean tryAssemble( String senderPhone, int id, int index,
int count, byte[] msg )
{
boolean success = true;
@@ -574,8 +574,8 @@ public class SMSService extends XWService {
success = disAssemble( senderPhone, msg );
} else if ( count > 0 && count < MAX_MSG_COUNT && index < count ) {
// required? Should always be in main thread.
- synchronized( s_partialMsgs ) {
- HashMap perPhone =
+ synchronized( s_partialMsgs ) {
+ HashMap perPhone =
s_partialMsgs.get( senderPhone );
if ( null == perPhone ) {
perPhone = new HashMap ();
@@ -601,7 +601,7 @@ public class SMSService extends XWService {
private boolean disAssemble( String senderPhone, byte[] fullMsg )
{
boolean success = false;
- DataInputStream dis =
+ DataInputStream dis =
new DataInputStream( new ByteArrayInputStream(fullMsg) );
try {
byte proto = dis.readByte();
@@ -638,7 +638,7 @@ public class SMSService extends XWService {
private void postNotification( String phone, int gameID, long rowid )
{
String owner = Utils.phoneToContact( this, phone, true );
- String body = LocUtils.getString( this, R.string.new_name_body_fmt,
+ String body = LocUtils.getString( this, R.string.new_name_body_fmt,
owner );
GameUtils.postInvitedNotification( this, gameID, body, rowid );
}
@@ -681,7 +681,7 @@ public class SMSService extends XWService {
PendingIntent sent = makeStatusIntent( MSG_SENT );
PendingIntent delivery = makeStatusIntent( MSG_DELIVERED );
for ( byte[] fragment : fragments ) {
- mgr.sendDataMessage( phone, null, nbsPort, fragment, sent,
+ mgr.sendDataMessage( phone, null, nbsPort, fragment, sent,
delivery );
DbgUtils.logf( "SMSService.sendBuffers(): sent %d byte fragment",
fragment.length );
@@ -703,8 +703,8 @@ public class SMSService extends XWService {
DbgUtils.showf( this, "Sent msg %d", s_nSent );
}
- ConnStatusHandler.updateStatusOut( this, null,
- CommsConnType.COMMS_CONN_SMS,
+ ConnStatusHandler.updateStatusOut( this, null,
+ CommsConnType.COMMS_CONN_SMS,
success );
return success;
}
@@ -721,7 +721,7 @@ public class SMSService extends XWService {
{
m_sentReceiver = new BroadcastReceiver() {
@Override
- public void onReceive(Context arg0, Intent arg1)
+ public void onReceive(Context arg0, Intent arg1)
{
switch ( getResultCode() ) {
case Activity.RESULT_OK:
@@ -830,7 +830,7 @@ public class SMSService extends XWService {
m_msgsData[index] = msg;
return this;
}
-
+
public boolean isComplete()
{
int count = null != m_msgsText ? m_msgsText.length : m_msgsData.length;
@@ -838,7 +838,7 @@ public class SMSService extends XWService {
return complete;
}
- public String messageText()
+ public String messageText()
{
StringBuffer sb = new StringBuffer(m_fullLength);
for ( String msg : m_msgsText ) {
@@ -847,7 +847,7 @@ public class SMSService extends XWService {
return sb.toString();
}
- public byte[] messageData()
+ public byte[] messageData()
{
byte[] result = new byte[m_fullLength];
int indx = 0;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListActivity.java
index bb2c46433..019e5190b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListActivity.java
@@ -24,9 +24,9 @@ import android.os.Bundle;
public class StudyListActivity extends XWActivity {
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
- StudyListDelegate dlgt =
+ StudyListDelegate dlgt =
new StudyListDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, dlgt );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListDelegate.java
index 8d594e65c..80755a2f0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListDelegate.java
@@ -55,7 +55,7 @@ public class StudyListDelegate extends ListDelegateBase
protected static final int NO_LANG = -1;
protected static final String START_LANG = "START_LANG";
-
+
private Activity m_activity;
private Spinner m_spinner;
private View m_pickView; // LinearLayout, actually
@@ -73,7 +73,7 @@ public class StudyListDelegate extends ListDelegateBase
m_activity = delegator.getActivity();
}
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
m_list = (ListView)findViewById( android.R.id.list );
@@ -86,7 +86,7 @@ public class StudyListDelegate extends ListDelegateBase
}
@Override
- protected boolean onBackPressed()
+ protected boolean handleBackPressed()
{
boolean handled = 0 < m_checkeds.size();
if ( handled ) {
@@ -96,17 +96,17 @@ public class StudyListDelegate extends ListDelegateBase
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
int nSel = m_checkeds.size();
Utils.setItemVisible( menu, R.id.slmenu_copy_sel, 0 < nSel );
Utils.setItemVisible( menu, R.id.slmenu_clear_sel, 0 < nSel );
- Utils.setItemVisible( menu, R.id.slmenu_select_all,
+ Utils.setItemVisible( menu, R.id.slmenu_select_all,
m_words.length > nSel );
Utils.setItemVisible( menu, R.id.slmenu_deselect_all, 0 < nSel );
boolean enable = 1 == nSel;
if ( enable ) {
- String title = getString( R.string.button_lookup_fmt,
+ String title = getString( R.string.button_lookup_fmt,
getSelWords()[0] );
menu.findItem( R.id.slmenu_lookup_sel ).setTitle( title );
}
@@ -121,11 +121,11 @@ public class StudyListDelegate extends ListDelegateBase
switch ( item.getItemId() ) {
case R.id.slmenu_copy_sel:
showNotAgainDlgThen( R.string.not_again_studycopy,
- R.string.key_na_studycopy,
+ R.string.key_na_studycopy,
Action.SL_COPY_ACTION );
break;
case R.id.slmenu_clear_sel:
- String msg = getQuantityString( R.plurals.confirm_studylist_clear_fmt,
+ String msg = getQuantityString( R.plurals.confirm_studylist_clear_fmt,
m_checkeds.size(), m_checkeds.size() );
showConfirmThen( msg, Action.SL_CLEAR_ACTION );
break;
@@ -163,7 +163,7 @@ public class StudyListDelegate extends ListDelegateBase
if ( selWords.length == m_words.length ) {
selWords = null; // all: easier on DB :-)
}
- DBUtils.studyListClear( m_activity, m_langCodes[m_langPosition],
+ DBUtils.studyListClear( m_activity, m_langCodes[m_langPosition],
selWords );
initOrFinish( null );
break;
@@ -173,7 +173,7 @@ public class StudyListDelegate extends ListDelegateBase
getSystemService( Context.CLIPBOARD_SERVICE );
clipboard.setText( TextUtils.join( "\n", selWords ) );
- String msg = getQuantityString( R.plurals.paste_done_fmt,
+ String msg = getQuantityString( R.plurals.paste_done_fmt,
selWords.length, selWords.length );
showToast( msg );
break;
@@ -187,7 +187,7 @@ public class StudyListDelegate extends ListDelegateBase
//////////////////////////////////////////////////
// AdapterView.OnItemSelectedListener interface
//////////////////////////////////////////////////
- public void onItemSelected( AdapterView> parent, View view,
+ public void onItemSelected( AdapterView> parent, View view,
int position, long id )
{
m_langPosition = position;
@@ -201,7 +201,7 @@ public class StudyListDelegate extends ListDelegateBase
//////////////////////////////////////////////////
// View.OnLongClickListener interface
//////////////////////////////////////////////////
- public boolean onLongClick( View view )
+ public boolean onLongClick( View view )
{
boolean success = view instanceof SelectableItem.LongClickHandler;
if ( success ) {
@@ -213,7 +213,7 @@ public class StudyListDelegate extends ListDelegateBase
//////////////////////////////////////////////////
// View.OnClickListener interface
//////////////////////////////////////////////////
- public void onClick( View view )
+ public void onClick( View view )
{
XWListItem item = (XWListItem)view;
String[] words = { m_words[item.getPosition()] };
@@ -229,7 +229,7 @@ public class StudyListDelegate extends ListDelegateBase
m_checkeds.add( ((XWListItem)clicked).getPosition() );
}
- public void itemToggled( SelectableItem.LongClickHandler toggled,
+ public void itemToggled( SelectableItem.LongClickHandler toggled,
boolean selected )
{
int position = ((XWListItem)toggled).getPosition();
@@ -256,7 +256,7 @@ public class StudyListDelegate extends ListDelegateBase
makeAdapter();
String langName = DictLangCache.getLangName( m_activity, lang );
- m_origTitle = getString( R.string.studylist_title_fmt,
+ m_origTitle = getString( R.string.studylist_title_fmt,
xlateLang( langName ) );
setTitleBar();
}
@@ -293,9 +293,8 @@ public class StudyListDelegate extends ListDelegateBase
}
}
- DbgUtils.logf( "creating studylist adapter" );
ArrayAdapter adapter = new
- ArrayAdapter( m_activity,
+ ArrayAdapter( m_activity,
android.R.layout.simple_spinner_item,
myNames );
adapter.setDropDownViewResource( android.R.layout.
@@ -345,17 +344,17 @@ public class StudyListDelegate extends ListDelegateBase
setTitleBar();
}
- public static void launchOrAlert( Delegator delegator, int lang,
+ public static void launchOrAlert( Delegator delegator, int lang,
DlgDelegate.HasDlgDelegate dlg )
{
String msg = null;
Activity activity = delegator.getActivity();
if ( 0 == DBUtils.studyListLangs( activity ).length ) {
msg = LocUtils.getString( activity, R.string.study_no_lists );
- } else if ( NO_LANG != lang &&
+ } else if ( NO_LANG != lang &&
0 == DBUtils.studyListWords( activity, lang ).length ) {
String langname = DictLangCache.getLangName( activity, lang );
- msg = LocUtils.getString( activity, R.string.study_no_lang_fmt,
+ msg = LocUtils.getString( activity, R.string.study_no_lang_fmt,
langname );
} else {
Bundle bundle = new Bundle();
@@ -363,9 +362,8 @@ public class StudyListDelegate extends ListDelegateBase
bundle.putInt( START_LANG, lang );
}
- if ( activity instanceof FragActivity ) {
- StudyListFrag frag = new StudyListFrag();
- ((FragActivity)activity).addFragment( frag, bundle, delegator );
+ if ( delegator.inDPMode() ) {
+ delegator.addFragment( new StudyListFrag( delegator ), bundle );
} else {
Intent intent = new Intent( activity, StudyListActivity.class );
intent.putExtras( bundle );
@@ -386,7 +384,7 @@ public class StudyListDelegate extends ListDelegateBase
}
public View getView( int position, View convertView, ViewGroup parent ){
- XWListItem item =
+ XWListItem item =
XWListItem.inflate( m_activity, StudyListDelegate.this );
item.setPosition( position );
item.setText( m_words[position] );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListFrag.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListFrag.java
index 0fcae720d..91dcb6259 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListFrag.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/StudyListFrag.java
@@ -24,6 +24,8 @@ import android.os.Bundle;
public class StudyListFrag extends XWFragment {
+ public StudyListFrag( Delegator parent ) { super( parent ); }
+
@Override
public void onCreate( Bundle sis )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ThumbCanvas.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ThumbCanvas.java
index 0faaccfa0..837c762bc 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ThumbCanvas.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ThumbCanvas.java
@@ -36,14 +36,14 @@ public class ThumbCanvas extends BoardCanvas {
// These should not be needed if common code gets fixed! So the
// whole class should go away. PENDING
@Override
- public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
+ public boolean scoreBegin( Rect rect, int numPlayers, int[] scores,
int remCount )
{
return false;
}
@Override
- public boolean trayBegin( Rect rect, int owner, int score )
+ public boolean trayBegin( Rect rect, int owner, int score )
{
return false;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java
index 4df19579a..9ea4072ba 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Toolbar.java
@@ -95,7 +95,7 @@ public class Toolbar {
return button;
}
- public void setListener( int index, final int msgID, final int prefsKey,
+ public void setListener( int index, final int msgID, final int prefsKey,
final Action action )
{
View.OnClickListener listener = new View.OnClickListener() {
@@ -106,7 +106,7 @@ public class Toolbar {
setListener( index, listener );
}
- public void setLongClickListener( int index, final int msgID,
+ public void setLongClickListener( int index, final int msgID,
final int prefsKey, final Action action )
{
View.OnLongClickListener listener = new View.OnLongClickListener() {
@@ -166,7 +166,7 @@ public class Toolbar {
}
}
- private void setLongClickListener( int index,
+ private void setLongClickListener( int index,
View.OnLongClickListener listener )
{
ImageButton button = getViewFor( index );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java
index 069e81da5..64c29ad81 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/UpdateCheckReceiver.java
@@ -66,14 +66,14 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
private static final String k_INDEX = "index";
private static final String k_URL = "url";
private static final String k_DEVID = "did";
- private static final String k_DEBUG = "dbg";
+ private static final String k_DEBUG = "dbg";
private static final String k_XLATEINFO = "xlatinfo";
private static final String k_STRINGSHASH = "strings";
@Override
public void onReceive( Context context, Intent intent )
{
- if ( null != intent && null != intent.getAction()
+ if ( null != intent && null != intent.getAction()
&& intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) {
restartTimer( context );
} else {
@@ -97,7 +97,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
}
interval_millis = (interval_millis / 2)
+ Math.abs(Utils.nextRandomInt() % interval_millis);
- am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
+ am.setInexactRepeating( AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + interval_millis,
interval_millis, pi );
}
@@ -112,13 +112,13 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
return result;
}
- public static void checkVersions( Context context, boolean fromUI )
+ public static void checkVersions( Context context, boolean fromUI )
{
JSONObject params = new JSONObject();
PackageManager pm = context.getPackageManager();
String packageName = context.getPackageName();
int versionCode;
- try {
+ try {
versionCode = pm.getPackageInfo( packageName, 0 ).versionCode;
} catch ( PackageManager.NameNotFoundException nnfe ) {
DbgUtils.loge( nnfe );
@@ -131,7 +131,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
} else {
String installer = pm.getInstallerPackageName( packageName );
- try {
+ try {
JSONObject appParams = new JSONObject();
appParams.put( k_AVERS, versionCode );
@@ -180,7 +180,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
params.put( k_NAME, packageName );
params.put( k_AVERS, versionCode );
DbgUtils.logdf( "current update: %s", params.toString() );
- new UpdateQueryTask( context, params, fromUI, pm,
+ new UpdateQueryTask( context, params, fromUI, pm,
packageName, dals ).execute();
} catch ( org.json.JSONException jse ) {
DbgUtils.loge( jse );
@@ -212,8 +212,8 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
return result;
}
- private static JSONObject makeDictParams( Context context,
- DictUtils.DictAndLoc dal,
+ private static JSONObject makeDictParams( Context context,
+ DictUtils.DictAndLoc dal,
int index )
{
JSONObject params = new JSONObject();
@@ -245,9 +245,9 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
private String m_packageName;
private DictUtils.DictAndLoc[] m_dals;
- public UpdateQueryTask( Context context, JSONObject params,
- boolean fromUI, PackageManager pm,
- String packageName,
+ public UpdateQueryTask( Context context, JSONObject params,
+ boolean fromUI, PackageManager pm,
+ String packageName,
DictUtils.DictAndLoc[] dals )
{
m_context = context;
@@ -287,7 +287,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
if ( jobj.has( k_APP ) ) {
JSONObject app = jobj.getJSONObject( k_APP );
if ( app.has( k_URL ) ) {
- ApplicationInfo ai =
+ ApplicationInfo ai =
m_pm.getApplicationInfo( m_packageName, 0);
String label = m_pm.getApplicationLabel( ai ).toString();
@@ -299,7 +299,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
if ( null == downloads ) {
useBrowser = true;
} else {
- File tmp = new File( downloads,
+ File tmp = new File( downloads,
"xx" + XWConstants.APK_EXTN );
useBrowser = !Utils.canInstall( m_context, tmp );
}
@@ -307,25 +307,25 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
Intent intent;
String url = app.getString( k_URL );
if ( useBrowser ) {
- intent = new Intent( Intent.ACTION_VIEW,
+ intent = new Intent( Intent.ACTION_VIEW,
Uri.parse(url) );
} else {
intent = DwnldDelegate
.makeAppDownloadIntent( m_context, url );
}
- String title =
+ String title =
LocUtils.getString( m_context, R.string.new_app_avail_fmt,
label );
- String body =
- LocUtils.getString( m_context,
+ String body =
+ LocUtils.getString( m_context,
R.string.new_app_avail );
- Utils.postNotification( m_context, intent, title,
+ Utils.postNotification( m_context, intent, title,
body, url.hashCode() );
gotOne = true;
}
}
-
+
// dictionaries upgrade
if ( jobj.has( k_DICTS ) ) {
JSONArray dicts = jobj.getJSONArray( k_DICTS );
@@ -335,17 +335,17 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
String url = dict.getString( k_URL );
int index = dict.getInt( k_INDEX );
DictUtils.DictAndLoc dal = m_dals[index];
- Intent intent =
+ Intent intent =
new Intent( m_context, DictsActivity.class );
intent.putExtra( NEW_DICT_URL, url );
intent.putExtra( NEW_DICT_NAME, dal.name );
intent.putExtra( NEW_DICT_LOC, dal.loc.ordinal() );
- String body =
- LocUtils.getString( m_context,
+ String body =
+ LocUtils.getString( m_context,
R.string.new_dict_avail_fmt,
dal.name );
- Utils.postNotification( m_context, intent,
- R.string.new_dict_avail,
+ Utils.postNotification( m_context, intent,
+ R.string.new_dict_avail,
body, url.hashCode() );
gotOne = true;
}
@@ -359,7 +359,7 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
if ( 0 < nAdded ) {
gotOne = true;
String msg = LocUtils
- .getQuantityString( m_context, R.plurals.new_xlations_fmt,
+ .getQuantityString( m_context, R.plurals.new_xlations_fmt,
nAdded, nAdded );
Utils.showToast( m_context, msg );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java
index 24a349e12..ee10e28ac 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java
@@ -35,6 +35,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.database.Cursor;
+import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.provider.ContactsContract.PhoneLookup;
@@ -70,7 +71,7 @@ public class Utils {
private static Boolean s_deviceSupportSMS = null;
private static Boolean s_isFirstBootEver = null;
private static Integer s_appVersion = null;
- private static HashMap s_phonesHash =
+ private static HashMap s_phonesHash =
new HashMap();
private static Boolean s_hasSmallScreen = null;
private static Random s_random = new Random();
@@ -127,7 +128,7 @@ public class Utils {
s_deviceSupportSMS = null; // force to check again
}
- public static void notImpl( Context context )
+ public static void notImpl( Context context )
{
String text = "Feature coming soon";
showToast( context, text );
@@ -149,7 +150,7 @@ public class Utils {
showToast( context, msg );
}
- public static void setRemoveOnDismiss( final Activity activity,
+ public static void setRemoveOnDismiss( final Activity activity,
Dialog dialog, DlgID dlgID )
{
final int id = dlgID.ordinal();
@@ -171,9 +172,9 @@ public class Utils {
Intent intent = new Intent( Intent.ACTION_SEND );
intent.setType( "message/rfc822" ); // force email
intent.putExtra( Intent.EXTRA_SUBJECT,
- LocUtils.getString( context,
+ LocUtils.getString( context,
R.string.email_author_subject ) );
- String[] addrs = { LocUtils.getString( context,
+ String[] addrs = { LocUtils.getString( context,
R.string.email_author_email ) };
intent.putExtra( Intent.EXTRA_EMAIL, addrs );
String body = LocUtils.getString( context, R.string.email_body_rev_fmt,
@@ -184,22 +185,22 @@ public class Utils {
context.startActivity( Intent.createChooser( intent, chooserMsg ) );
}
- public static void postNotification( Context context, Intent intent,
+ public static void postNotification( Context context, Intent intent,
int titleID, int bodyID, int id )
{
- postNotification( context, intent, titleID,
+ postNotification( context, intent, titleID,
LocUtils.getString( context, bodyID ), id );
}
- public static void postNotification( Context context, Intent intent,
+ public static void postNotification( Context context, Intent intent,
int titleID, String body, int id )
{
String title = LocUtils.getString( context, titleID );
postNotification( context, intent, title, body, id );
}
- public static void postNotification( Context context, Intent intent,
- String title, String body,
+ public static void postNotification( Context context, Intent intent,
+ String title, String body,
int id )
{
/* nextRandomInt: per this link
@@ -209,10 +210,10 @@ public class Utils {
though the docs say that param's ignored.
*/
PendingIntent pi = null == intent ? null
- : PendingIntent.getActivity( context, Utils.nextRandomInt(), intent,
+ : PendingIntent.getActivity( context, Utils.nextRandomInt(), intent,
PendingIntent.FLAG_ONE_SHOT );
- Notification notification =
+ Notification notification =
new Notification( R.drawable.icon48x48, title,
System.currentTimeMillis() );
@@ -243,13 +244,16 @@ public class Utils {
if ( CommonPrefs.getSoundNotify( context ) ) {
Uri uri = RingtoneManager
.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION );
- RingtoneManager.getRingtone( context, uri ).play();
+ Ringtone ringtone = RingtoneManager.getRingtone( context, uri );
+ if ( null != ringtone ) {
+ ringtone.play();
+ }
}
}
// adapted from
// http://stackoverflow.com/questions/2174048/how-to-look-up-a-contacts-name-from-their-phone-number-on-android
- public static String phoneToContact( Context context, String phone,
+ public static String phoneToContact( Context context, String phone,
boolean phoneStandsIn )
{
// I'm assuming that since context is passed this needn't
@@ -265,9 +269,9 @@ public class Utils {
ContentResolver contentResolver = context.getContentResolver();
Cursor cursor =
contentResolver
- .query( Uri.withAppendedPath( PhoneLookup.CONTENT_FILTER_URI,
- Uri.encode( phone )),
- new String[] { PhoneLookup.DISPLAY_NAME },
+ .query( Uri.withAppendedPath( PhoneLookup.CONTENT_FILTER_URI,
+ Uri.encode( phone )),
+ new String[] { PhoneLookup.DISPLAY_NAME },
null, null, null );
if ( cursor.moveToNext() ) {
int indx = cursor.getColumnIndex( PhoneLookup.DISPLAY_NAME );
@@ -361,7 +365,7 @@ public class Utils {
if ( null == s_hasSmallScreen ) {
int screenLayout = context.getResources().
getConfiguration().screenLayout;
- boolean hasSmallScreen =
+ boolean hasSmallScreen =
(screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_SMALL;
s_hasSmallScreen = new Boolean( hasSmallScreen );
@@ -450,7 +454,7 @@ public class Utils {
PackageManager pm = context.getPackageManager();
Intent intent = makeInstallIntent( path );
List doers =
- pm.queryIntentActivities( intent,
+ pm.queryIntentActivities( intent,
PackageManager.MATCH_DEFAULT_ONLY );
result = 0 < doers.size();
return result;
@@ -466,7 +470,7 @@ public class Utils {
PackageManager pm = context.getPackageManager();
String packageName = context.getPackageName();
String installer = pm.getInstallerPackageName( packageName );
- boolean result = "com.google.android.feedback".equals( installer )
+ boolean result = "com.google.android.feedback".equals( installer )
|| "com.android.vending".equals( installer );
return result;
}
@@ -476,18 +480,18 @@ public class Utils {
if ( null == s_isFirstBootThisVersion ) {
final int thisVersion = getAppVersion( context );
int prevVersion = 0;
- SharedPreferences prefs =
- context.getSharedPreferences( HIDDEN_PREFS,
+ SharedPreferences prefs =
+ context.getSharedPreferences( HIDDEN_PREFS,
Context.MODE_PRIVATE );
if ( 0 < thisVersion ) {
- prefs = context.getSharedPreferences( HIDDEN_PREFS,
+ prefs = context.getSharedPreferences( HIDDEN_PREFS,
Context.MODE_PRIVATE );
prevVersion = prefs.getInt( SHOWN_VERSION_KEY, -1 );
}
boolean newVersion = prevVersion != thisVersion;
-
+
s_isFirstBootThisVersion = new Boolean( newVersion );
s_isFirstBootEver = new Boolean( -1 == prevVersion );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java
index 0702880b6..b96c63e52 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWActivity.java
@@ -24,6 +24,7 @@ import android.app.Dialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.ContextMenu;
import android.view.Menu;
@@ -35,16 +36,15 @@ import android.widget.ListView;
import junit.framework.Assert;
-import junit.framework.Assert;
-
-public class XWActivity extends Activity implements Delegator {
+public class XWActivity extends FragmentActivity implements Delegator {
private DelegateBase m_dlgt;
protected void onCreate( Bundle savedInstanceState, DelegateBase dlgt )
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onCreate(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onCreate(this=%H)",
+ getClass().getSimpleName(), this );
}
super.onCreate( savedInstanceState );
m_dlgt = dlgt;
@@ -58,7 +58,7 @@ public class XWActivity extends Activity implements Delegator {
}
@Override
- protected void onSaveInstanceState( Bundle outState )
+ protected void onSaveInstanceState( Bundle outState )
{
super.onSaveInstanceState( outState );
m_dlgt.onSaveInstanceState( outState );
@@ -68,7 +68,8 @@ public class XWActivity extends Activity implements Delegator {
protected void onPause()
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onPause(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onPause(this=%H)",
+ getClass().getSimpleName(), this );
}
m_dlgt.onPause();
super.onPause();
@@ -78,7 +79,8 @@ public class XWActivity extends Activity implements Delegator {
protected void onResume()
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onResume(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onResume(this=%H)",
+ getClass().getSimpleName(), this );
}
super.onResume();
m_dlgt.onResume();
@@ -88,7 +90,8 @@ public class XWActivity extends Activity implements Delegator {
protected void onStart()
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onStart(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onStart(this=%H)",
+ getClass().getSimpleName(), this );
}
super.onStart();
m_dlgt.onStart();
@@ -98,7 +101,8 @@ public class XWActivity extends Activity implements Delegator {
protected void onStop()
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onStop(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onStop(this=%H)",
+ getClass().getSimpleName(), this );
}
m_dlgt.onStop();
super.onStop();
@@ -108,7 +112,8 @@ public class XWActivity extends Activity implements Delegator {
protected void onDestroy()
{
if ( XWApp.LOG_LIFECYLE ) {
- DbgUtils.logf( "%s.onDestroy(this=%H)", getClass().getName(), this );
+ DbgUtils.logf( "%s.onDestroy(this=%H)",
+ getClass().getSimpleName(), this );
}
m_dlgt.onDestroy();
super.onDestroy();
@@ -123,26 +128,26 @@ public class XWActivity extends Activity implements Delegator {
@Override
public void onBackPressed() {
- if ( !m_dlgt.onBackPressed() ) {
+ if ( !m_dlgt.handleBackPressed() ) {
super.onBackPressed();
}
}
@Override
- public boolean onCreateOptionsMenu( Menu menu )
+ public boolean onCreateOptionsMenu( Menu menu )
{
return m_dlgt.onCreateOptionsMenu( menu );
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
return m_dlgt.onPrepareOptionsMenu( menu )
|| super.onPrepareOptionsMenu( menu );
} // onPrepareOptionsMenu
@Override
- public boolean onOptionsItemSelected( MenuItem item )
+ public boolean onOptionsItemSelected( MenuItem item )
{
return m_dlgt.onOptionsItemSelected( item )
|| super.onOptionsItemSelected( item );
@@ -187,10 +192,10 @@ public class XWActivity extends Activity implements Delegator {
}
@Override
- protected void onActivityResult( int requestCode, int resultCode,
+ protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
- RequestCode rc = RequestCode.values()[requestCode];
+ RequestCode rc = RequestCode.values()[requestCode];
m_dlgt.onActivityResult( rc, resultCode, data );
}
@@ -214,7 +219,7 @@ public class XWActivity extends Activity implements Delegator {
}
public void setListAdapter( ListAdapter adapter )
- {
+ {
getListView().setAdapter( adapter );
}
@@ -222,4 +227,19 @@ public class XWActivity extends Activity implements Delegator {
{
return getListView().getAdapter();
}
+
+ public boolean inDPMode() {
+ return false;
+ }
+
+ public void addFragment( XWFragment fragment, Bundle extras )
+ {
+ Assert.fail();
+ }
+
+ public void addFragmentForResult( XWFragment fragment, Bundle extras,
+ RequestCode request )
+ {
+ Assert.fail();
+ }
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
index 730167b0d..c999f978d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWApp.java
@@ -38,7 +38,7 @@ public class XWApp extends Application {
public static final boolean REMATCH_SUPPORTED = true;
public static final boolean RELAYINVITE_SUPPORTED = false;
public static final boolean ATTACH_SUPPORTED = false;
- public static final boolean LOG_LIFECYLE = true;
+ public static final boolean LOG_LIFECYLE = false;
public static final boolean DEBUG_EXP_TIMERS = false;
public static final boolean GCM_IGNORED = false;
public static final boolean UDP_ENABLED = true;
@@ -48,7 +48,7 @@ public class XWApp extends Application {
public static final boolean OFFER_DUALPANE = false;
// BT class "COMPUTERS" includes tablets like the Nexus 9
public static final boolean BT_SCAN_COMPUTERS = true;
-
+
public static final String SMS_PUBLIC_HEADER = "-XW4";
public static final int MAX_TRAY_TILES = 7; // comtypes.h
public static final int SEL_COLOR = Color.argb( 0xFF, 0x09, 0x70, 0x93 );
@@ -66,7 +66,7 @@ public class XWApp extends Application {
// This one line should always get logged even if logging is
// off -- because logging is on by default until logEnable is
// called.
- DbgUtils.logf( "XWApp.onCreate(); git_rev=%s",
+ DbgUtils.logf( "XWApp.onCreate(); git_rev=%s",
getString( R.string.git_rev ) );
DbgUtils.logEnable( this );
@@ -108,7 +108,7 @@ public class XWApp extends Application {
return s_UUID;
}
- public static String getAppName( Context context )
+ public static String getAppName( Context context )
{
return context.getString( R.string.app_name );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java
index 53568ea01..aa56ab2bc 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWConnAddrPreference.java
@@ -61,25 +61,24 @@ public class XWConnAddrPreference extends DialogPreference {
m_view.configure( XWPrefs.getAddrTypes( m_context ),
new ConnViaViewLayout.CheckEnabledWarner() {
public void warnDisabled( CommsConnType typ ) {
- String msg;
switch( typ ) {
case COMMS_CONN_SMS:
- activity.showConfirmThen( R.string.warn_sms_disabled,
+ activity.showConfirmThen( R.string.warn_sms_disabled,
R.string.button_enable_sms,
R.string.button_later,
Action.ENABLE_SMS_ASK );
break;
case COMMS_CONN_BT:
- activity.showConfirmThen( R.string.warn_bt_disabled,
+ activity.showConfirmThen( R.string.warn_bt_disabled,
R.string.button_enable_bt,
R.string.button_later,
Action.ENABLE_BT_DO );
case COMMS_CONN_RELAY:
- msg = LocUtils
+ String msg = LocUtils
.getString( m_context, R.string
.warn_relay_disabled );
msg += "\n\n" + LocUtils
- .getString( m_context,
+ .getString( m_context,
R.string.warn_relay_later );
activity.showConfirmThen( msg, R.string.button_enable_relay,
R.string.button_later,
@@ -98,7 +97,7 @@ public class XWConnAddrPreference extends DialogPreference {
}
}, activity );
}
-
+
@Override
public void onClick( DialogInterface dialog, int which )
{
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpListAdapter.java
index 8f42786ce..2018d5535 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpListAdapter.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWExpListAdapter.java
@@ -58,7 +58,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
abstract View getView( Object dataObj, View convertView );
@Override
- public int getCount()
+ public int getCount()
{
if ( null == m_listObjs ) {
m_listObjs = makeListData();
@@ -74,7 +74,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
@Override
public int getItemViewType( int position )
- {
+ {
return m_types.get( m_listObjs[position].getClass() );
}
@@ -82,12 +82,12 @@ abstract class XWExpListAdapter extends XWListAdapter {
{
return m_types.size();
}
-
+
@Override
public View getView( int position, View convertView, ViewGroup parent )
{
View result = getView( m_listObjs[position], convertView );
- // DbgUtils.logf( "getView(position=%d) => %H (%s)", position, result,
+ // DbgUtils.logf( "getView(position=%d) => %H (%s)", position, result,
// result.getClass().getName() );
return result;
}
@@ -142,13 +142,13 @@ abstract class XWExpListAdapter extends XWListAdapter {
System.arraycopy( m_listObjs, 0, newArray, 0, groupIndex + 1 ); // 1: include parent
int nAbove = m_listObjs.length - (groupIndex + nChildren + 1);
if ( end < m_listObjs.length ) {
- System.arraycopy( m_listObjs, end, newArray, groupIndex + 1,
+ System.arraycopy( m_listObjs, end, newArray, groupIndex + 1,
m_listObjs.length - end );
}
m_listObjs = newArray;
notifyDataSetChanged();
}
-
+
protected void addChildrenOf( int groupIndex, List children )
{
int nToAdd = children.size();
@@ -161,7 +161,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
}
System.arraycopy( m_listObjs, groupIndex + 1,
newArray, groupIndex + 1 + nToAdd,
- m_listObjs.length - groupIndex - 1 );
+ m_listObjs.length - groupIndex - 1 );
m_listObjs = newArray;
notifyDataSetChanged();
}
@@ -181,7 +181,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
}
if ( 0 < nLost ) {
- m_listObjs = Arrays.copyOfRange( m_listObjs,
+ m_listObjs = Arrays.copyOfRange( m_listObjs,
0, m_listObjs.length - nLost );
notifyDataSetChanged();
}
@@ -207,7 +207,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
protected void swapGroups( int groupPosn1, int groupPosn2 )
{
- // switch if needed so we know the direction
+ // switch if needed so we know the direction
if ( groupPosn1 > groupPosn2 ) {
int tmp = groupPosn2;
groupPosn2 = groupPosn1;
@@ -216,7 +216,7 @@ abstract class XWExpListAdapter extends XWListAdapter {
int groupIndx1 = indexForPosition( groupPosn1 );
int groupIndx2 = indexForPosition( groupPosn2 );
-
+
// copy out the lower group subarray
int groupEnd1 = findGroupEnd( groupIndx1 );
Object[] tmp1 = Arrays.copyOfRange( m_listObjs, groupIndx1, groupEnd1 );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWFragment.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWFragment.java
index e181eac9c..8845130b9 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWFragment.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWFragment.java
@@ -20,6 +20,7 @@
package org.eehouse.android.xw4;
+import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -34,13 +35,16 @@ import android.widget.ListView;
import junit.framework.Assert;
-public class XWFragment extends Fragment
- implements Delegator,
- FragActivity.OrientChangeListener {
+public class XWFragment extends Fragment implements Delegator {
private DelegateBase m_dlgt;
+ private Delegator m_parent;
private boolean m_hasOptionsMenu = false;
+ public XWFragment( Delegator parent ) { m_parent = parent; }
+
+ public Delegator getParent() { return m_parent; }
+
protected void onCreate( DelegateBase dlgt, Bundle sis, boolean hasOptionsMenu )
{
m_hasOptionsMenu = hasOptionsMenu;
@@ -49,23 +53,24 @@ public class XWFragment extends Fragment
protected void onCreate( DelegateBase dlgt, Bundle sis )
{
- DbgUtils.logdf( "%s.onCreate() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onCreate() called", this.getClass().getSimpleName() );
super.onCreate( sis );
m_dlgt = dlgt;
}
@Override
- public View onCreateView( LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState )
+ public View onCreateView( LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState )
{
- DbgUtils.logdf( "%s.onCreateView() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onCreateView() called", this.getClass().getSimpleName() );
return m_dlgt.inflateView( inflater, container );
}
@Override
public void onActivityCreated( Bundle savedInstanceState )
{
- DbgUtils.logdf( "%s.onActivityCreated() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onActivityCreated() called",
+ this.getClass().getSimpleName() );
m_dlgt.init( savedInstanceState );
super.onActivityCreated( savedInstanceState );
if ( m_hasOptionsMenu ) {
@@ -76,7 +81,8 @@ public class XWFragment extends Fragment
@Override
public void onPause()
{
- DbgUtils.logdf( "%s.onPause() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onPause() called",
+ this.getClass().getSimpleName() );
m_dlgt.onPause();
super.onPause();
}
@@ -84,6 +90,8 @@ public class XWFragment extends Fragment
@Override
public void onResume()
{
+ DbgUtils.logdf( "%s.onResume() called",
+ this.getClass().getSimpleName() );
super.onResume();
m_dlgt.onResume();
}
@@ -91,7 +99,8 @@ public class XWFragment extends Fragment
@Override
public void onStart()
{
- DbgUtils.logdf( "%s.onStart() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onStart() called",
+ this.getClass().getSimpleName() );
super.onStart();
m_dlgt.onStart();
}
@@ -99,7 +108,8 @@ public class XWFragment extends Fragment
@Override
public void onStop()
{
- DbgUtils.logdf( "%s.onStop() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onStop() called",
+ this.getClass().getSimpleName() );
m_dlgt.onStop();
super.onStop();
}
@@ -107,11 +117,21 @@ public class XWFragment extends Fragment
@Override
public void onDestroy()
{
- DbgUtils.logdf( "%s.onDestroy() called", this.getClass().getName() );
+ DbgUtils.logdf( "%s.onDestroy() called",
+ this.getClass().getSimpleName() );
m_dlgt.onDestroy();
super.onDestroy();
}
+ @Override
+ public void onActivityResult( int requestCode, int resultCode, Intent data )
+ {
+ DbgUtils.logdf( "%s.onActivityResult() called",
+ this.getClass().getSimpleName() );
+ m_dlgt.onActivityResult( RequestCode.values()[requestCode],
+ resultCode, data );
+ }
+
@Override
public void onPrepareOptionsMenu( Menu menu )
{
@@ -125,7 +145,7 @@ public class XWFragment extends Fragment
}
@Override
- public boolean onOptionsItemSelected( MenuItem item )
+ public boolean onOptionsItemSelected( MenuItem item )
{
return m_dlgt.onOptionsItemSelected( item );
}
@@ -135,12 +155,30 @@ public class XWFragment extends Fragment
Assert.fail();
}
- // FragActivity.OrientChangeListener
- public void orientationChanged()
- {
- m_dlgt.orientationChanged();
+ @Override
+ public boolean inDPMode() {
+ MainActivity main = (MainActivity)getActivity();
+ Assert.assertTrue( main.inDPMode() ); // otherwise should be somewhere else
+ return true;
}
+ @Override
+ public void addFragment( XWFragment fragment, Bundle extras )
+ {
+ MainActivity main = (MainActivity)getActivity();
+ main.addFragment( fragment, extras );
+ }
+
+ @Override
+ public void addFragmentForResult( XWFragment fragment, Bundle extras,
+ RequestCode code )
+ {
+ MainActivity main = (MainActivity)getActivity();
+ main.addFragmentForResult( fragment, extras, code, this );
+ }
+
+ public DelegateBase getDelegate() { return m_dlgt; }
+
public ListView getListView()
{
ListView view = (ListView)m_dlgt.findViewById( android.R.id.list );
@@ -148,7 +186,7 @@ public class XWFragment extends Fragment
}
public void setListAdapter( ListAdapter adapter )
- {
+ {
getListView().setAdapter( adapter );
}
@@ -157,5 +195,3 @@ public class XWFragment extends Fragment
return getListView().getAdapter();
}
}
-
-
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java
index 6435b82fe..cc549c9cb 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListAdapter.java
@@ -44,8 +44,8 @@ public abstract class XWListAdapter extends BaseAdapter
public int getCount() { return m_count; }
public Object getItem( int position ) { return null; }
public long getItemId( int position ) { return position; }
- public int getItemViewType( int position ) {
- return ListAdapter.IGNORE_ITEM_VIEW_TYPE;
+ public int getItemViewType( int position ) {
+ return ListAdapter.IGNORE_ITEM_VIEW_TYPE;
}
public int getViewTypeCount() { return 1; }
public boolean hasStableIds() { return true; }
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListItem.java
index 6f5bb891b..037ab898f 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListItem.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWListItem.java
@@ -33,7 +33,7 @@ import junit.framework.Assert;
import org.eehouse.android.xw4.loc.LocUtils;
-public class XWListItem extends LinearLayout
+public class XWListItem extends LinearLayout
implements SelectableItem.LongClickHandler, View.OnClickListener {
private int m_position;
private Object m_cached;
@@ -123,7 +123,7 @@ public class XWListItem extends LinearLayout
}
}
- public void setDeleteCallback( DeleteCallback cb )
+ public void setDeleteCallback( DeleteCallback cb )
{
m_delCb = cb;
ImageButton button = (ImageButton)findViewById( R.id.del );
@@ -150,7 +150,7 @@ public class XWListItem extends LinearLayout
}
@Override
- public void setEnabled( boolean enabled )
+ public void setEnabled( boolean enabled )
{
ImageButton button = (ImageButton)findViewById( R.id.del );
button.setEnabled( enabled );
@@ -174,14 +174,14 @@ public class XWListItem extends LinearLayout
return m_cached;
}
- // SelectableItem.LongClickHandler interface
+ // SelectableItem.LongClickHandler interface
public void longClicked()
{
toggleSelected();
}
// View.OnClickListener interface
- public void onClick( View view )
+ public void onClick( View view )
{
if ( m_checkbox == view ) {
setSelected( m_checkbox.isChecked() );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java
index f49da5235..72a89ee10 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWPrefs.java
@@ -74,7 +74,7 @@ public class XWPrefs {
public static boolean getHideNewgameButtons( Context context )
{
- return getPrefsBoolean( context, R.string.key_hide_newgames,
+ return getPrefsBoolean( context, R.string.key_hide_newgames,
false );
}
@@ -101,7 +101,7 @@ public class XWPrefs {
try {
result = Integer.parseInt( val );
} catch ( Exception ex ) {
- }
+ }
return result;
}
@@ -117,7 +117,7 @@ public class XWPrefs {
try {
result = Integer.parseInt( val );
} catch ( Exception ex ) {
- }
+ }
// DbgUtils.logf( "getDefaultProxyPort=>%d", result );
return result;
}
@@ -139,7 +139,7 @@ public class XWPrefs {
public static int getDefaultPlayerMinutes( Context context )
{
- String value =
+ String value =
getPrefsString( context, R.string.key_initial_player_minutes );
int result;
try {
@@ -195,14 +195,14 @@ public class XWPrefs {
return sp.getBoolean( key, defaultValue );
}
- public static void setPrefsBoolean( Context context, int keyID,
+ public static void setPrefsBoolean( Context context, int keyID,
boolean newValue )
{
String key = context.getString( keyID );
setPrefsBoolean( context, key, newValue );
}
- private static void setPrefsBoolean( Context context, String key,
+ private static void setPrefsBoolean( Context context, String key,
boolean newValue )
{
SharedPreferences sp = PreferenceManager
@@ -233,7 +233,7 @@ public class XWPrefs {
public static void setClosedLangs( Context context, String[] langs )
{
- setPrefsString( context, R.string.key_closed_langs,
+ setPrefsString( context, R.string.key_closed_langs,
TextUtils.join( "\n", langs ) );
}
@@ -277,7 +277,7 @@ public class XWPrefs {
{
String id = getPrefsString( context, R.string.key_dev_id );
if ( null == id || 0 == id.length() ) {
- id = String.format( "%08X-%08X", Utils.nextRandomInt(),
+ id = String.format( "%08X-%08X", Utils.nextRandomInt(),
Utils.nextRandomInt() );
setPrefsString( context, R.string.key_dev_id, id );
}
@@ -296,7 +296,7 @@ public class XWPrefs {
{
return getPrefsString( context, R.string.key_download_path );
}
-
+
public static boolean getDefaultLocInternal( Context context )
{
return getPrefsBoolean( context, R.string.key_default_loc, true );
@@ -304,7 +304,7 @@ public class XWPrefs {
public static long getDefaultNewGameGroup( Context context )
{
- long groupID = getPrefsLong( context, R.string.key_default_group,
+ long groupID = getPrefsLong( context, R.string.key_default_group,
DBUtils.GROUPID_UNSPEC );
if ( DBUtils.GROUPID_UNSPEC == groupID ) {
groupID = DBUtils.getAnyGroup( context );
@@ -337,7 +337,7 @@ public class XWPrefs {
public static long[] getGroupPositions( Context context )
{
long[] posns = null;
- String[] longStrs = getPrefsStringArray( context,
+ String[] longStrs = getPrefsStringArray( context,
R.string.key_group_posns );
if ( null != longStrs ) {
posns = new long[longStrs.length];
@@ -384,7 +384,7 @@ public class XWPrefs {
return sp.getString( key, "" );
}
- protected static void setPrefsString( Context context, int keyID,
+ protected static void setPrefsString( Context context, int keyID,
String newValue )
{
SharedPreferences sp = PreferenceManager
@@ -412,7 +412,7 @@ public class XWPrefs {
return result;
}
- protected static void setPrefsStringArray( Context context, int keyID,
+ protected static void setPrefsStringArray( Context context, int keyID,
String[] value )
{
setPrefsString( context, keyID, TextUtils.join( "\n", value ) );
@@ -445,8 +445,15 @@ public class XWPrefs {
public static boolean getIsTablet( Context context )
{
- return isTablet( context ) ||
+ boolean result = isTablet( context ) ||
getPrefsBoolean( context, R.string.key_force_tablet, false );
+ // DbgUtils.logf( "getIsTablet() => %b", result );
+ return result;
+ }
+
+ public static boolean dualpaneEnabled( Context context )
+ {
+ return getPrefsBoolean( context, R.string.key_enable_dualpane, false );
}
public static CommsConnTypeSet getAddrTypes( Context context )
@@ -485,12 +492,12 @@ public class XWPrefs {
private static boolean isTablet( Context context )
{
if ( null == s_isTablet ) {
- int screenLayout =
+ int screenLayout =
context.getResources().getConfiguration().screenLayout;
int size = screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
- s_isTablet =
+ s_isTablet =
new Boolean(Configuration.SCREENLAYOUT_SIZE_LARGE <= size);
}
return s_isTablet;
- }
+ }
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java
index d1146b626..523817f3c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWService.java
@@ -95,8 +95,8 @@ class XWService extends Service {
// Meant to be overridden
protected MultiMsgSink getSink( long rowid ) { Assert.fail(); return null; }
- protected ReceiveResult receiveMessage( Context context, int gameID,
- MultiMsgSink sink, byte[] msg,
+ protected ReceiveResult receiveMessage( Context context, int gameID,
+ MultiMsgSink sink, byte[] msg,
CommsAddrRec addr )
{
ReceiveResult result;
@@ -114,8 +114,8 @@ class XWService extends Service {
return result;
}
- protected boolean receiveMessage( Context context, long rowid,
- MultiMsgSink sink, byte[] msg,
+ protected boolean receiveMessage( Context context, long rowid,
+ MultiMsgSink sink, byte[] msg,
CommsAddrRec addr )
{
boolean allConsumed = true;
@@ -126,12 +126,12 @@ class XWService extends Service {
consumed = true;
jniThread.receive( msg, addr ).release();
} else {
- GameUtils.BackMoveResult bmr =
+ GameUtils.BackMoveResult bmr =
new GameUtils.BackMoveResult();
if ( null == sink ) {
sink = getSink( rowid );
}
- if ( GameUtils.feedMessage( context, rowid, msg, addr,
+ if ( GameUtils.feedMessage( context, rowid, msg, addr,
sink, bmr, isLocalP ) ) {
consumed = true;
GameUtils.postMoveNotification( context, rowid, bmr,
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWSumListPreference.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWSumListPreference.java
index 7442500e4..b4c6cc017 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWSumListPreference.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/XWSumListPreference.java
@@ -68,9 +68,9 @@ public class XWSumListPreference extends XWListPreference {
if ( !done ) {
newEntries = new CharSequence[entries.length + addRows.length];
- System.arraycopy( entries, 0, newEntries, 0,
+ System.arraycopy( entries, 0, newEntries, 0,
entries.length );
- System.arraycopy( addRows, 0, newEntries, entries.length,
+ System.arraycopy( addRows, 0, newEntries, entries.length,
addRows.length );
setEntries( newEntries );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
index 9ca3ef16d..8fe89f59d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardDims.java
@@ -31,7 +31,7 @@ public class BoardDims {
public int cellSize, maxCellSize;
public int timerWidth;
- // public String toString()
+ // public String toString()
// {
// return "width: " + width
// + " height: " + height
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java
index c9451b80f..a9a60f9cc 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/BoardHandler.java
@@ -25,7 +25,7 @@ import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
public interface BoardHandler {
- void startHandling( Activity parent, JNIThread thread,
+ void startHandling( Activity parent, JNIThread thread,
CommsConnTypeSet connTypes );
void stopHandling();
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java
index 8c0a022b2..bdff30d33 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommonPrefs.java
@@ -47,7 +47,7 @@ public class CommonPrefs extends XWPrefs {
public boolean showBoardArrow;
public boolean showRobotScores;
- public boolean hideTileValues;
+ public boolean hideTileValues;
public boolean skipCommitConfirm;
public boolean showColors;
public boolean sortNewTiles;
@@ -72,13 +72,13 @@ public class CommonPrefs extends XWPrefs {
SharedPreferences sp = PreferenceManager
.getDefaultSharedPreferences( context );
- showBoardArrow = getBoolean( context, sp, R.string.key_show_arrow,
+ showBoardArrow = getBoolean( context, sp, R.string.key_show_arrow,
true );
- showRobotScores = getBoolean( context, sp, R.string.key_explain_robot,
+ showRobotScores = getBoolean( context, sp, R.string.key_explain_robot,
false );
- hideTileValues = getBoolean( context, sp, R.string.key_hide_values,
+ hideTileValues = getBoolean( context, sp, R.string.key_hide_values,
false );
- skipCommitConfirm = getBoolean( context, sp,
+ skipCommitConfirm = getBoolean( context, sp,
R.string.key_skip_confirm, false );
showColors = getBoolean( context, sp, R.string.key_color_tiles, true );
sortNewTiles = getBoolean( context, sp, R.string.key_sort_tiles, true );
@@ -117,7 +117,7 @@ public class CommonPrefs extends XWPrefs {
return this;
}
- private boolean getBoolean( Context context, SharedPreferences sp,
+ private boolean getBoolean( Context context, SharedPreferences sp,
int id, boolean dflt )
{
String key = LocUtils.getString( context, id );
@@ -149,7 +149,7 @@ public class CommonPrefs extends XWPrefs {
result = Integer.parseInt( value.substring( 0, 2 ) );
} catch ( Exception ex ) {
result = 15;
- }
+ }
return result;
}
@@ -170,7 +170,7 @@ public class CommonPrefs extends XWPrefs {
}
return value;
}
-
+
public static String getDefaultOriginalPlayerName( Context context,
int num )
{
@@ -205,12 +205,12 @@ public class CommonPrefs extends XWPrefs {
setPrefsString( context, R.string.key_player1_name, value );
}
- public static CurGameInfo.XWPhoniesChoice
+ public static CurGameInfo.XWPhoniesChoice
getDefaultPhonies( Context context )
{
String value = getPrefsString( context, R.string.key_default_phonies );
- CurGameInfo.XWPhoniesChoice result =
+ CurGameInfo.XWPhoniesChoice result =
CurGameInfo.XWPhoniesChoice.PHONIES_IGNORE;
Resources res = context.getResources();
String[] names = res.getStringArray( R.array.phony_names );
@@ -223,14 +223,14 @@ public class CommonPrefs extends XWPrefs {
}
return result;
}
-
+
public static boolean getDefaultTimerEnabled( Context context )
{
- return getPrefsBoolean( context, R.string.key_default_timerenabled,
+ return getPrefsBoolean( context, R.string.key_default_timerenabled,
false );
}
- public static boolean getDefaultHintsAllowed( Context context,
+ public static boolean getDefaultHintsAllowed( Context context,
boolean networked )
{
int key = networked ?
@@ -246,7 +246,7 @@ public class CommonPrefs extends XWPrefs {
public static boolean getHideTitleBar( Context context )
{
boolean hideByDefault = 11 > Integer.valueOf( Build.VERSION.SDK );
- return getPrefsBoolean( context, R.string.key_hide_title,
+ return getPrefsBoolean( context, R.string.key_hide_title,
hideByDefault );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
index 1859e5873..80b938ca0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CommsAddrRec.java
@@ -47,7 +47,7 @@ public class CommsAddrRec {
COMMS_CONN_BT,
COMMS_CONN_SMS;
- public String longName( Context context )
+ public String longName( Context context )
{
int id = 0;
switch( this ) {
@@ -69,13 +69,13 @@ public class CommsAddrRec {
public CommsConnTypeSet() { this(BIT_VECTOR_MASK); }
- public CommsConnTypeSet( int bits, boolean isVector )
+ public CommsConnTypeSet( int bits, boolean isVector )
{
this( bits | BIT_VECTOR_MASK );
Assert.assertTrue( isVector );
}
- public CommsConnTypeSet( int bits )
+ public CommsConnTypeSet( int bits )
{
boolean isVector = 0 != (BIT_VECTOR_MASK & bits);
bits &= ~BIT_VECTOR_MASK;
@@ -118,7 +118,7 @@ public class CommsAddrRec {
return s_supported;
}
- public static void removeUnsupported( Context context,
+ public static void removeUnsupported( Context context,
CommsConnTypeSet set )
{
// Remove anything no longer supported. This probably only
@@ -188,47 +188,47 @@ public class CommsAddrRec {
public String sms_phone;
public int sms_port; // SMS port, if they still use those
- public CommsAddrRec( CommsConnType cTyp )
+ public CommsAddrRec( CommsConnType cTyp )
{
this();
conTypes.add( cTyp );
}
- public CommsAddrRec()
+ public CommsAddrRec()
{
conTypes = new CommsConnTypeSet();
}
- public CommsAddrRec( CommsConnTypeSet types )
+ public CommsAddrRec( CommsConnTypeSet types )
{
conTypes = types;
}
- public CommsAddrRec( String host, int port )
+ public CommsAddrRec( String host, int port )
{
this( CommsConnType.COMMS_CONN_RELAY );
setRelayParams( host, port );
}
- public CommsAddrRec( String btName, String btAddr )
+ public CommsAddrRec( String btName, String btAddr )
{
this( CommsConnType.COMMS_CONN_BT );
setBTParams( btAddr, btName );
}
- public CommsAddrRec( String phone )
+ public CommsAddrRec( String phone )
{
this( CommsConnType.COMMS_CONN_SMS );
sms_phone = phone;
sms_port = 2; // something other that 0 (need to fix comms)
}
- public CommsAddrRec( final CommsAddrRec src )
+ public CommsAddrRec( final CommsAddrRec src )
{
this.copyFrom( src );
}
- public boolean contains( CommsConnType typ )
+ public boolean contains( CommsConnType typ )
{
return null != conTypes && conTypes.contains( typ );
}
@@ -289,12 +289,13 @@ public class CommsAddrRec {
CommsConnType conType = iter.next();
switch( conType ) {
case COMMS_CONN_RELAY:
- matter = ! ip_relay_invite.equals( other.ip_relay_invite )
- || ! ip_relay_hostName.equals( other.ip_relay_hostName )
- || ip_relay_port != other.ip_relay_port;
+ matter = null == ip_relay_invite
+ || ! ip_relay_invite.equals( other.ip_relay_invite )
+ || ! ip_relay_hostName.equals( other.ip_relay_hostName )
+ || ip_relay_port != other.ip_relay_port;
break;
default:
- DbgUtils.logf( "changesMatter: not handling case: %s",
+ DbgUtils.logf( "changesMatter: not handling case: %s",
conType.toString() );
break;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
index d9af90578..8d1b7324d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/CurGameInfo.java
@@ -85,7 +85,7 @@ public class CurGameInfo {
players = new LocalPlayer[MAX_NUM_PLAYERS];
serverRole = isNetworked ? DeviceRole.SERVER_ISCLIENT
: DeviceRole.SERVER_STANDALONE;
- hintsNotAllowed = !CommonPrefs.getDefaultHintsAllowed( context,
+ hintsNotAllowed = !CommonPrefs.getDefaultHintsAllowed( context,
isNetworked );
phoniesAction = CommonPrefs.getDefaultPhonies( context );
timerEnabled = CommonPrefs.getDefaultTimerEnabled( context );
@@ -143,7 +143,7 @@ public class CurGameInfo {
timerEnabled = src.timerEnabled;
allowPickTiles = src.allowPickTiles;
allowHintRect = src.allowHintRect;
-
+
int ii;
for ( ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
players[ii] = new LocalPlayer( src.players[ii] );
@@ -348,9 +348,9 @@ public class CurGameInfo {
}
// Replace any dict that doesn't exist with newDict
- public void replaceDicts( String newDict )
+ public void replaceDicts( String newDict )
{
- String[] dicts =
+ String[] dicts =
DictLangCache.getHaveLang( m_context, dictLang );
HashSet installed = new HashSet( Arrays.asList(dicts) );
@@ -391,24 +391,24 @@ public class CurGameInfo {
return dname;
}
- public String getName()
+ public String getName()
{
// Assert.assertNotNull( m_name );
return m_name;
}
- public void setName( String name )
+ public void setName( String name )
{
m_name = name;
}
- public boolean addPlayer()
+ public boolean addPlayer()
{
boolean added = nPlayers < MAX_NUM_PLAYERS;
// We can add either by adding a player, if nPlayers <
// MAX_NUM_PLAYERS, or by making an unusable player usable.
if ( added ) {
- players[nPlayers].isLocal =
+ players[nPlayers].isLocal =
serverRole == DeviceRole.SERVER_STANDALONE;
++nPlayers;
}
@@ -468,7 +468,7 @@ public class CurGameInfo {
for ( int ii = nPlayers - 1; ii > 0; --ii ) {
// Contrary to docs, nextInt() comes back negative!
- int rand = Math.abs(rgen.nextInt());
+ int rand = Math.abs(rgen.nextInt());
int indx = rand % (ii+1);
if ( indx != ii ) {
LocalPlayer tmp = players[ii];
@@ -487,14 +487,14 @@ public class CurGameInfo {
// matches langauge. Otherwise pick an arbitrary dict in the
// right language.
- String humanDict =
+ String humanDict =
DictLangCache.getBestDefault( m_context, dictLang, true );
- String robotDict =
+ String robotDict =
DictLangCache.getBestDefault( m_context, dictLang, false );
- if ( null == dictName
- || ! DictUtils.dictExists( m_context, dictName )
- || dictLang != DictLangCache.getDictLangCode( m_context,
+ if ( null == dictName
+ || ! DictUtils.dictExists( m_context, dictName )
+ || dictLang != DictLangCache.getDictLangCode( m_context,
dictName ) ) {
dictName = humanDict;
}
@@ -503,7 +503,7 @@ public class CurGameInfo {
LocalPlayer lp = players[ii];
if ( null != lp.dictName &&
- dictLang != DictLangCache.getDictLangCode( m_context,
+ dictLang != DictLangCache.getDictLangCode( m_context,
lp.dictName ) ) {
lp.dictName = null;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java
index 883b5f521..b1d65a74c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java
@@ -47,12 +47,12 @@ public interface DrawCtx {
boolean measureRemText( Rect r, int nTilesLeft, int[] width, int[] height );
void measureScoreText( Rect r, DrawScoreInfo dsi, int[] width, int[] height );
void drawRemText( Rect rInner, Rect rOuter, int nTilesLeft, boolean focussed );
- void score_drawPlayer( Rect rInner, Rect rOuter, int gotPct,
+ void score_drawPlayer( Rect rInner, Rect rOuter, int gotPct,
DrawScoreInfo dsi );
// New way of drawing
// boolean drawRemText( int nTilesLeft, boolean focussed, Rect rect );
- // void score_drawPlayers( Rect scoreRect, DrawScoreInfo[] playerData,
+ // void score_drawPlayers( Rect scoreRect, DrawScoreInfo[] playerData,
// Rect[] playerRects );
void drawTimer( Rect rect, int player, int secondsLeft );
@@ -64,11 +64,11 @@ public interface DrawCtx {
int flags );
boolean trayBegin ( Rect rect, int owner, int score );
boolean drawTile( Rect rect, String text, int val, int flags );
- boolean drawTileMidDrag ( Rect rect, String text, int val, int owner,
+ boolean drawTileMidDrag ( Rect rect, String text, int val, int owner,
int flags );
boolean drawTileBack( Rect rect, int flags );
void drawTrayDivider( Rect rect, int flags );
- void score_pendingScore( Rect rect, int score, int playerNum, int curTurn,
+ void score_pendingScore( Rect rect, int score, int playerNum, int curTurn,
int flags );
public static final int BONUS_NONE = 0;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java
index 41f7954f2..e81f10216 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/GameSummary.java
@@ -99,7 +99,7 @@ public class GameSummary {
public Context getContext()
{
Assert.assertNotNull( m_context );
- return m_context;
+ return m_context;
}
public boolean inRelayGame()
@@ -134,7 +134,7 @@ public class GameSummary {
public String getRematchName()
{
- return LocUtils.getString( m_context, R.string.rematch_name_fmt,
+ return LocUtils.getString( m_context, R.string.rematch_name_fmt,
playerNames() );
}
@@ -145,13 +145,13 @@ public class GameSummary {
m_remotePhones = new String[remoteDevs.length];
for ( int ii = 0; ii < remoteDevs.length; ++ii ) {
- m_remotePhones[ii] =
+ m_remotePhones[ii] =
Utils.phoneToContact( context, remoteDevs[ii], true );
}
}
}
- public void readPlayers( String playersStr )
+ public void readPlayers( String playersStr )
{
if ( null != playersStr ) {
m_players = new String[nPlayers];
@@ -167,7 +167,7 @@ public class GameSummary {
int prev = nxt;
nxt = playersStr.indexOf( sep, nxt );
String name = -1 == nxt ?
- playersStr.substring( prev ) :
+ playersStr.substring( prev ) :
playersStr.substring( prev, nxt );
m_players[ii] = name;
if ( -1 == nxt ) {
@@ -178,7 +178,7 @@ public class GameSummary {
}
}
- public void setPlayerSummary( String summary )
+ public void setPlayerSummary( String summary )
{
m_playersSummary = summary;
}
@@ -212,7 +212,7 @@ public class GameSummary {
R.string.summary_invites_out );
}
}
-
+
// If we're using relay to connect, get status from that
if ( null == result
&& conTypes.contains( CommsConnType.COMMS_CONN_RELAY ) ) {
@@ -229,7 +229,7 @@ public class GameSummary {
}
result = LocUtils.getString( m_context, fmtID, roomName );
}
-
+
// Otherwise, use BT or SMS
if ( null == result ) {
if ( conTypes.contains( CommsConnType.COMMS_CONN_BT )
@@ -242,9 +242,9 @@ public class GameSummary {
}
} else if ( gameOver ) {
fmtID = R.string.summary_gameover;
- } else if ( null != remoteDevs
+ } else if ( null != remoteDevs
&& conTypes.contains( CommsConnType.COMMS_CONN_SMS)){
- result =
+ result =
LocUtils.getString( m_context, R.string.summary_conn_sms_fmt,
TextUtils.join(", ", m_remotePhones) );
} else {
@@ -268,7 +268,7 @@ public class GameSummary {
// anyway, e.g. via BT.
result = 0 > turn && !gameOver;
}
- // DbgUtils.logf( "relayConnectPending()=>%b (turn=%d)", result,
+ // DbgUtils.logf( "relayConnectPending()=>%b (turn=%d)", result,
// turn );
return result;
}
@@ -299,7 +299,7 @@ public class GameSummary {
}
return result;
}
-
+
public boolean anyMissing()
{
return 0 < countMissing();
@@ -323,12 +323,12 @@ public class GameSummary {
return result;
}
- public void setGiFlags( int flags )
+ public void setGiFlags( int flags )
{
m_giFlags = new Integer( flags );
}
- public String summarizePlayer( int indx )
+ public String summarizePlayer( int indx )
{
String player = m_players[indx];
int formatID = 0;
@@ -367,7 +367,7 @@ public class GameSummary {
return result;
}
- public boolean isNextToPlay( int indx, boolean[] isLocal )
+ public boolean isNextToPlay( int indx, boolean[] isLocal )
{
boolean isNext = indx == turn;
if ( isNext ) {
@@ -392,7 +392,7 @@ public class GameSummary {
return m_players[prevTurn];
}
- public String dictNames( String separator )
+ public String dictNames( String separator )
{
String list = null;
if ( null != m_gi ) {
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java
index 75ce91f4b..f88d18c90 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIThread.java
@@ -55,21 +55,6 @@ import junit.framework.Assert;
public class JNIThread extends Thread {
- private static Set s_curThreads = new HashSet();
-
- public static JNIThread getCurrent() {
- JNIThread result = null;
- synchronized( s_curThreads ) {
- // DbgUtils.logf( "JNIThread.getCurrent(): have %d threads",
- // s_curThreads.size() );
- if ( 1 == s_curThreads.size() ) {
- result = s_curThreads.iterator().next();
- }
- }
- // DbgUtils.logf( "JNIThread.getCurrent() => %H", result );
- return result;
- }
-
public enum JNICmd { CMD_NONE,
// CMD_RUN,
CMD_DRAW,
@@ -186,9 +171,9 @@ public class JNIThread extends Thread {
m_rowid = rowid;
m_queue = new LinkedBlockingQueue();
}
-
+
public JNIThread configure( Context context, SyncedDraw drawer,
- UtilCtxtImpl utils,
+ UtilCtxtImpl utils,
TransportProcs.TPMsgHandler xportHandler,
Handler handler )
{
@@ -219,7 +204,7 @@ public class JNIThread extends Thread {
XwJNI.gi_from_stream( m_gi, stream );
m_summary = DBUtils.getSummary( context, m_lock );
-
+
if ( m_gi.serverRole != DeviceRole.SERVER_STANDALONE ) {
m_xport = new CommsTransport( context, xportHandler, m_rowid,
m_gi.serverRole );
@@ -229,16 +214,16 @@ public class JNIThread extends Thread {
CommonPrefs cp = CommonPrefs.get( context );
JNIUtils jniUtils = JNIUtilsImpl.get( context );
if ( null == stream ||
- ! XwJNI.game_makeFromStream( m_jniGamePtr, stream,
- m_gi, dictNames,
- pairs.m_bytes,
- pairs.m_paths,
- m_gi.langName(),
+ ! XwJNI.game_makeFromStream( m_jniGamePtr, stream,
+ m_gi, dictNames,
+ pairs.m_bytes,
+ pairs.m_paths,
+ m_gi.langName(),
utils, jniUtils,
null, cp, m_xport ) ) {
- XwJNI.game_makeNewGame( m_jniGamePtr, m_gi, dictNames,
- pairs.m_bytes, pairs.m_paths,
- m_gi.langName(), utils, jniUtils,
+ XwJNI.game_makeNewGame( m_jniGamePtr, m_gi, dictNames,
+ pairs.m_bytes, pairs.m_paths,
+ m_gi.langName(), utils, jniUtils,
null, cp, m_xport );
}
@@ -322,8 +307,8 @@ public class JNIThread extends Thread {
boolean squareTiles = XWPrefs.getSquareTiles( m_context );
XwJNI.board_figureLayout( m_jniGamePtr, m_gi, 0, 0, width, height,
- 150 /*scorePct*/, 200 /*trayPct*/,
- width, fontWidth, fontHeight, squareTiles,
+ 150 /*scorePct*/, 200 /*trayPct*/,
+ width, fontWidth, fontHeight, squareTiles,
dims /* out param */ );
// Make space for net status icon if appropriate
@@ -331,7 +316,7 @@ public class JNIThread extends Thread {
int statusWidth = dims.boardWidth / 15;
dims.scoreWidth -= statusWidth;
int left = dims.scoreLeft + dims.scoreWidth + dims.timerWidth;
- ConnStatusHandler.setRect( left, dims.top, left + statusWidth,
+ ConnStatusHandler.setRect( left, dims.top, left + statusWidth,
dims.top + dims.scoreHt );
} else {
ConnStatusHandler.clearRect();
@@ -342,7 +327,7 @@ public class JNIThread extends Thread {
m_drawer.dimsChanged( dims );
}
- private boolean nextSame( JNICmd cmd )
+ private boolean nextSame( JNICmd cmd )
{
QueueElem nextElem = m_queue.peek();
return null != nextElem && nextElem.m_cmd == cmd;
@@ -393,9 +378,12 @@ public class JNIThread extends Thread {
XwJNI.game_summarize( m_jniGamePtr, summary );
DBUtils.saveGame( m_context, m_lock, state, false );
DBUtils.saveSummary( m_context, m_lock, summary );
+
// There'd better be no way for saveGame above to fail!
XwJNI.game_saveSucceeded( m_jniGamePtr );
m_lastSavedState = state;
+
+ GameUtils.loadMakeBitmap( m_context, state, m_lock );
}
}
}
@@ -417,7 +405,7 @@ public class JNIThread extends Thread {
}
@SuppressWarnings("fallthrough")
- public void run()
+ public void run()
{
boolean[] barr = new boolean[2]; // scratch boolean
for ( ; ; ) {
@@ -470,7 +458,7 @@ public class JNIThread extends Thread {
dims = (BoardDims)args0;
XwJNI.board_applyLayout( m_jniGamePtr, dims );
} else {
- doLayout( (Integer)args0, (Integer)args[1],
+ doLayout( (Integer)args0, (Integer)args[1],
(Integer)args[2], (Integer)args[3] );
}
draw = true;
@@ -501,7 +489,7 @@ public class JNIThread extends Thread {
case CMD_RECEIVE:
CommsAddrRec ret = (CommsAddrRec)args[1];
Assert.assertNotNull( ret );
- draw = XwJNI.game_receiveMessage( m_jniGamePtr,
+ draw = XwJNI.game_receiveMessage( m_jniGamePtr,
(byte[])args[0], ret );
handle( JNICmd.CMD_DO );
if ( draw ) {
@@ -519,13 +507,13 @@ public class JNIThread extends Thread {
// e.g. colors, aren't known by common code so
// board_prefsChanged's return value isn't enough.
XwJNI.board_invalAll( m_jniGamePtr );
- XwJNI.board_server_prefsChanged( m_jniGamePtr,
+ XwJNI.board_server_prefsChanged( m_jniGamePtr,
CommonPrefs.get( m_context ) );
draw = true;
break;
case CMD_PEN_DOWN:
- draw = XwJNI.board_handlePenDown( m_jniGamePtr,
+ draw = XwJNI.board_handlePenDown( m_jniGamePtr,
((Integer)args[0]).intValue(),
((Integer)args[1]).intValue(),
barr );
@@ -534,12 +522,12 @@ public class JNIThread extends Thread {
if ( nextSame( JNICmd.CMD_PEN_MOVE ) ) {
continue;
}
- draw = XwJNI.board_handlePenMove( m_jniGamePtr,
+ draw = XwJNI.board_handlePenMove( m_jniGamePtr,
((Integer)args[0]).intValue(),
((Integer)args[1]).intValue() );
break;
case CMD_PEN_UP:
- draw = XwJNI.board_handlePenUp( m_jniGamePtr,
+ draw = XwJNI.board_handlePenUp( m_jniGamePtr,
((Integer)args[0]).intValue(),
((Integer)args[1]).intValue() );
break;
@@ -582,7 +570,7 @@ public class JNIThread extends Thread {
if ( nextSame( elem.m_cmd ) ) {
continue;
}
- draw = XwJNI.board_requestHint( m_jniGamePtr, false,
+ draw = XwJNI.board_requestHint( m_jniGamePtr, false,
JNICmd.CMD_PREV_HINT==elem.m_cmd,
barr );
if ( barr[0] ) {
@@ -602,7 +590,7 @@ public class JNIThread extends Thread {
draw = XwJNI.board_zoom( m_jniGamePtr, zoomBy, barr );
break;
case CMD_ZOOM:
- draw = XwJNI.board_zoom( m_jniGamePtr,
+ draw = XwJNI.board_zoom( m_jniGamePtr,
((Integer)args[0]).intValue(),
barr );
break;
@@ -623,9 +611,9 @@ public class JNIThread extends Thread {
break;
case CMD_RESEND:
- int nSent =
- XwJNI.comms_resendAll( m_jniGamePtr,
- ((Boolean)args[0]).booleanValue(),
+ int nSent =
+ XwJNI.comms_resendAll( m_jniGamePtr,
+ ((Boolean)args[0]).booleanValue(),
((Boolean)args[1]).booleanValue() );
if ( ((Boolean)args[2]).booleanValue() ) {
Message.obtain(m_handler, MSGS_SENT, nSent).sendToTarget();
@@ -638,7 +626,7 @@ public class JNIThread extends Thread {
case CMD_HISTORY:
boolean gameOver = XwJNI.server_getGameIsOver( m_jniGamePtr );
sendForDialog( ((Integer)args[0]).intValue(),
- XwJNI.model_writeGameHistory( m_jniGamePtr,
+ XwJNI.model_writeGameHistory( m_jniGamePtr,
gameOver ) );
break;
@@ -661,7 +649,7 @@ public class JNIThread extends Thread {
((Boolean)args[0]).booleanValue();
int titleID = auto? R.string.summary_gameover
: R.string.finalscores_title;
-
+
String text = XwJNI.server_writeFinalScores( m_jniGamePtr );
Message.obtain( m_handler, GAME_OVER, titleID, 0, text )
.sendToTarget();
@@ -679,7 +667,7 @@ public class JNIThread extends Thread {
break;
case CMD_TIMER_FIRED:
- draw = XwJNI.timerFired( m_jniGamePtr,
+ draw = XwJNI.timerFired( m_jniGamePtr,
((Integer)args[0]).intValue(),
((Integer)args[1]).intValue(),
((Integer)args[2]).intValue() );
@@ -728,12 +716,12 @@ public class JNIThread extends Thread {
{
handle( JNICmd.CMD_SENDCHAT, chat );
}
-
+
public void handle( JNICmd cmd, Object... args )
{
m_queue.add( new QueueElem( cmd, true, args ) );
if ( m_stopped && ! JNICmd.CMD_NONE.equals(cmd) ) {
- DbgUtils.logf( "WARNING: adding %s to stopped thread!!!",
+ DbgUtils.logf( "WARNING: adding %s to stopped thread!!!",
cmd.toString() );
DbgUtils.printStack();
}
@@ -752,10 +740,10 @@ public class JNIThread extends Thread {
private void retain_sync()
{
++m_refCount;
- DbgUtils.logf( "JNIThread.retain_sync(rowid=%d): m_refCount: %d",
+ DbgUtils.logf( "JNIThread.retain_sync(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
}
-
+
public JNIThread retain()
{
synchronized( s_instances ) {
@@ -764,7 +752,9 @@ public class JNIThread extends Thread {
return this;
}
- public void release()
+ public void release() { release( true ); }
+
+ public void release( boolean save )
{
boolean stop = false;
synchronized( s_instances ) {
@@ -773,12 +763,12 @@ public class JNIThread extends Thread {
stop = true;
}
}
- DbgUtils.logf( "JNIThread.release(rowid=%d): m_refCount: %d",
+ DbgUtils.logf( "JNIThread.release(rowid=%d): m_refCount: %d",
m_rowid, m_refCount );
if ( stop ) {
waitToStop( true );
- } else {
+ } else if ( save && null != m_lastSavedState ) { // has configure() run?
handle( JNICmd.CMD_SAVE ); // in case releaser has made changes
}
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java
index 1990f8f8a..3ca263ca5 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/JNIUtilsImpl.java
@@ -72,7 +72,7 @@ public class JNIUtilsImpl implements JNIUtils {
DbgUtils.logf( "splitFaces: %s", uee.toString() );
isr = new InputStreamReader( bais );
}
-
+
int[] codePoints = new int[1];
// "A aB bC c"
@@ -119,7 +119,7 @@ public class JNIUtilsImpl implements JNIUtils {
face.add( letter );
}
}
-
+
String[][] result = faces.toArray( new String[faces.size()][] );
return result;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LastMoveInfo.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LastMoveInfo.java
index dae2273b3..c2c8972de 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LastMoveInfo.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LastMoveInfo.java
@@ -40,7 +40,7 @@ public class LastMoveInfo {
public int nTiles;
public String word;
- public String format( Context context )
+ public String format( Context context )
{
String result = null;
if ( isValid ) {
@@ -50,20 +50,20 @@ public class LastMoveInfo {
break;
case MOVE_TYPE:
if ( 0 == nTiles ) {
- result = LocUtils.getString( context, R.string.lmi_pass_fmt,
+ result = LocUtils.getString( context, R.string.lmi_pass_fmt,
name );
} else {
- result = LocUtils.getQuantityString( context, R.plurals.lmi_move_fmt,
+ result = LocUtils.getQuantityString( context, R.plurals.lmi_move_fmt,
score, name, word, score );
}
break;
case TRADE_TYPE:
result = LocUtils
- .getQuantityString( context, R.plurals.lmi_trade_fmt,
+ .getQuantityString( context, R.plurals.lmi_trade_fmt,
nTiles, name, nTiles );
break;
case PHONY_TYPE:
- result = LocUtils.getString( context, R.string.lmi_phony_fmt,
+ result = LocUtils.getString( context, R.string.lmi_phony_fmt,
name );
break;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
index 45e57c38d..0214fc31a 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/LocalPlayer.java
@@ -51,7 +51,7 @@ public class LocalPlayer {
secondsUsed = src.secondsUsed;
}
- public boolean isRobot()
+ public boolean isRobot()
{
return robotIQ > 0;
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/TransportProcs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/TransportProcs.java
index 6810f4809..d0242af1c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/TransportProcs.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/TransportProcs.java
@@ -28,7 +28,7 @@ public interface TransportProcs {
public static final int COMMS_XPORT_FLAGS_HASNOCONN = 1;
int getFlags();
- int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
+ int transportSend( byte[] buf, String msgNo, CommsAddrRec addr,
CommsConnType conType, int gameID );
enum CommsRelayState { COMMS_RELAYSTATE_UNCONNECTED
@@ -43,11 +43,11 @@ public interface TransportProcs {
void relayConnd( String room, int devOrder, boolean allHere, int nMissing );
public static enum XWRELAY_ERROR { NONE
- ,OLDFLAGS
+ ,OLDFLAGS
,BADPROTO
,RELAYBUSY
,SHUTDOWN
- ,TIMEOUT
+ ,TIMEOUT
,HEART_YOU
,HEART_OTHER
,LOST_OTHER
@@ -64,7 +64,7 @@ public interface TransportProcs {
boolean relayNoConnProc( byte[] buf, String msgNo, String relayID );
public interface TPMsgHandler {
- public void tpmRelayConnd( String room, int devOrder, boolean allHere,
+ public void tpmRelayConnd( String room, int devOrder, boolean allHere,
int nMissing );
public void tpmRelayErrorProc( XWRELAY_ERROR relayErr );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java
index bb9719cac..3f5908a2b 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java
@@ -38,7 +38,7 @@ public interface UtilCtxt {
public static final int PICKER_BACKUP = -2;
int userPickTileBlank( int playerNum, String[] texts );
- int userPickTileTray( int playerNum, String[] tiles,
+ int userPickTileTray( int playerNum, String[] tiles,
String[] curTiles, int nPicked );
String askPassword( String name );
@@ -133,7 +133,7 @@ public interface UtilCtxt {
void informMove( int turn, String expl, String words );
void informUndo();
- void informNetDict( int lang, String oldName, String newName,
+ void informNetDict( int lang, String oldName, String newName,
String newSum, CurGameInfo.XWPhoniesChoice phonies );
void informMissing( boolean isServer, CommsConnTypeSet connTypes,
@@ -143,7 +143,7 @@ public interface UtilCtxt {
// Don't need this unless we have a scroll thumb to indicate position
//void yOffsetChange( int maxOffset, int oldOffset, int newOffset );
- boolean warnIllegalWord( String dict, String[] words, int turn,
+ boolean warnIllegalWord( String dict, String[] words, int turn,
boolean turnLost );
void showChat( String msg, int fromIndx, String fromName );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java
index 8b2aec7d2..84fab2093 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java
@@ -53,7 +53,7 @@ public class UtilCtxtImpl implements UtilCtxt {
return 0;
}
- public int userPickTileTray( int playerNum, String[] texts,
+ public int userPickTileTray( int playerNum, String[] texts,
String[] curTiles, int nPicked )
{
subclassOverride( "userPickTileTray" );
@@ -264,14 +264,14 @@ public class UtilCtxtImpl implements UtilCtxt {
subclassOverride( "informUndo" );
}
- public void informNetDict( int lang, String oldName,
- String newName, String newSum,
+ public void informNetDict( int lang, String oldName,
+ String newName, String newSum,
CurGameInfo.XWPhoniesChoice phonies )
{
subclassOverride( "informNetDict" );
}
- public void informMissing( boolean isServer,
+ public void informMissing( boolean isServer,
CommsConnTypeSet connTypes,
int nDevices, int nMissingPlayers )
{
@@ -285,7 +285,7 @@ public class UtilCtxtImpl implements UtilCtxt {
subclassOverride( "notifyGameOver" );
}
- public boolean warnIllegalWord( String dict, String[] words, int turn,
+ public boolean warnIllegalWord( String dict, String[] words, int turn,
boolean turnLost )
{
subclassOverride( "warnIllegalWord" );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
index ae015c1db..adcf125b0 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java
@@ -48,17 +48,17 @@ public class XwJNI {
public synchronized GamePtr retain()
{
++m_refCount;
- DbgUtils.logdf( "GamePtr.retain(this=%H, rowid=%d): refCount now %d",
+ DbgUtils.logdf( "GamePtr.retain(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
return this;
}
-
+
// Force (via an assert in finalize() below) that this is called. It's
// better if jni stuff isn't being done on the finalizer thread
public synchronized void release()
{
--m_refCount;
- DbgUtils.logdf( "GamePtr.release(this=%H, rowid=%d): refCount now %d",
+ DbgUtils.logdf( "GamePtr.release(this=%H, rowid=%d): refCount now %d",
this, m_rowid, m_refCount );
if ( 0 == m_refCount ) {
if ( 0 != m_ptr ) {
@@ -112,7 +112,7 @@ public class XwJNI {
static {
System.loadLibrary("xwjni");
}
-
+
/* XW_TrayVisState enum */
public static final int TRAY_HIDDEN = 0;
public static final int TRAY_REVERSED = 1;
@@ -122,7 +122,7 @@ public class XwJNI {
// how java/jni work (or perhaps my limited understanding of it.)
// callback into jni from java when timer set here fires.
- public static native boolean timerFired( GamePtr gamePtr, int why,
+ public static native boolean timerFired( GamePtr gamePtr, int why,
int when, int handle );
// Stateless methods
@@ -143,7 +143,7 @@ public class XwJNI {
}
private static native void nli_from_stream( NetLaunchInfo nli, byte[] stream );
public static native void comms_getInitialAddr( CommsAddrRec addr,
- String relayHost,
+ String relayHost,
int relayPort );
public static native String comms_getUUID();
@@ -169,24 +169,24 @@ public class XwJNI {
}
public static native void game_makeNewGame( GamePtr gamePtr,
- CurGameInfo gi,
+ CurGameInfo gi,
String[] dictNames,
- byte[][] dictBytes,
- String[] dictPaths,
+ byte[][] dictBytes,
+ String[] dictPaths,
String langName,
UtilCtxt util,
JNIUtils jniu,
- DrawCtx draw, CommonPrefs cp,
+ DrawCtx draw, CommonPrefs cp,
TransportProcs procs );
public static native boolean game_makeFromStream( GamePtr gamePtr,
- byte[] stream,
- CurGameInfo gi,
+ byte[] stream,
+ CurGameInfo gi,
String[] dictNames,
- byte[][] dictBytes,
- String[] dictPaths,
+ byte[][] dictBytes,
+ String[] dictPaths,
String langName,
- UtilCtxt util,
+ UtilCtxt util,
JNIUtils jniu,
DrawCtx draw,
CommonPrefs cp,
@@ -195,29 +195,29 @@ public class XwJNI {
// leave out options params for when game won't be rendered or
// played
public static void game_makeNewGame( GamePtr gamePtr, CurGameInfo gi,
- JNIUtils jniu, CommonPrefs cp,
- String[] dictNames, byte[][] dictBytes,
+ JNIUtils jniu, CommonPrefs cp,
+ String[] dictNames, byte[][] dictBytes,
String[] dictPaths, String langName ) {
game_makeNewGame( gamePtr, gi, dictNames, dictBytes, dictPaths, langName,
- (UtilCtxt)null, jniu, (DrawCtx)null, cp,
+ (UtilCtxt)null, jniu, (DrawCtx)null, cp,
(TransportProcs)null );
}
public static void game_makeNewGame( GamePtr gamePtr, CurGameInfo gi,
- String[] dictNames, byte[][] dictBytes,
+ String[] dictNames, byte[][] dictBytes,
String[] dictPaths, String langName,
- JNIUtils jniu, CommonPrefs cp,
+ JNIUtils jniu, CommonPrefs cp,
TransportProcs procs ) {
game_makeNewGame( gamePtr, gi, dictNames, dictBytes, dictPaths, langName,
(UtilCtxt)null, jniu, (DrawCtx)null, cp, procs );
}
public static boolean game_makeFromStream( GamePtr gamePtr,
- byte[] stream,
- CurGameInfo gi,
+ byte[] stream,
+ CurGameInfo gi,
String[] dictNames,
- byte[][] dictBytes,
- String[] dictPaths,
+ byte[][] dictBytes,
+ String[] dictPaths,
String langName,
JNIUtils jniu,
CommonPrefs cp
@@ -228,23 +228,23 @@ public class XwJNI {
}
public static boolean game_makeFromStream( GamePtr gamePtr,
- byte[] stream,
- CurGameInfo gi,
+ byte[] stream,
+ CurGameInfo gi,
String[] dictNames,
- byte[][] dictBytes,
- String[] dictPaths,
+ byte[][] dictBytes,
+ String[] dictPaths,
String langName,
- UtilCtxt util,
+ UtilCtxt util,
JNIUtils jniu,
CommonPrefs cp,
TransportProcs procs
) {
return game_makeFromStream( gamePtr, stream, gi, dictNames, dictBytes,
- dictPaths, langName, util, jniu,
+ dictPaths, langName, util, jniu,
(DrawCtx)null, cp, procs );
}
- public static native boolean game_receiveMessage( GamePtr gamePtr,
+ public static native boolean game_receiveMessage( GamePtr gamePtr,
byte[] stream,
CommsAddrRec retAddr );
public static native void game_summarize( GamePtr gamePtr, GameSummary summary );
@@ -252,16 +252,16 @@ public class XwJNI {
CurGameInfo gi );
public static native void game_saveSucceeded( GamePtr gamePtr );
public static native void game_getGi( GamePtr gamePtr, CurGameInfo gi );
- public static native void game_getState( GamePtr gamePtr,
+ public static native void game_getState( GamePtr gamePtr,
JNIThread.GameStateInfo gsi );
public static native boolean game_hasComms( GamePtr gamePtr );
// Keep for historical purposes. But threading issues make it
// impossible to implement this without a ton of work.
// public static native boolean game_changeDict( int gamePtr, CurGameInfo gi,
- // String dictName,
- // byte[] dictBytes,
- // String dictPath );
+ // String dictName,
+ // byte[] dictBytes,
+ // String dictPath );
private static native void game_dispose( GamePtr gamePtr );
// Board methods
@@ -270,41 +270,41 @@ public class XwJNI {
public static native boolean board_draw( GamePtr gamePtr );
// Only if COMMON_LAYOUT defined
- public static native void board_figureLayout( GamePtr gamePtr, CurGameInfo gi,
+ public static native void board_figureLayout( GamePtr gamePtr, CurGameInfo gi,
int left, int top, int width,
- int height, int scorePct,
+ int height, int scorePct,
int trayPct, int scoreWidth,
- int fontWidth, int fontHt,
- boolean squareTiles,
+ int fontWidth, int fontHt,
+ boolean squareTiles,
BoardDims dims );
// Only if COMMON_LAYOUT defined
public static native void board_applyLayout( GamePtr gamePtr, BoardDims dims );
// public static native void board_setPos( int gamePtr, int left, int top,
- // int width, int height,
+ // int width, int height,
// int maxCellHt, boolean lefty );
- // public static native void board_setScoreboardLoc( int gamePtr, int left,
- // int top, int width,
+ // public static native void board_setScoreboardLoc( int gamePtr, int left,
+ // int top, int width,
// int height,
// boolean divideHorizontally );
- // public static native void board_setTrayLoc( int gamePtr, int left,
- // int top, int width,
+ // public static native void board_setTrayLoc( int gamePtr, int left,
+ // int top, int width,
// int height, int minDividerWidth );
// public static native void board_setTimerLoc( int gamePtr,
// int timerLeft, int timerTop,
- // int timerWidth,
+ // int timerWidth,
// int timerHeight );
- public static native boolean board_zoom( GamePtr gamePtr, int zoomBy,
+ public static native boolean board_zoom( GamePtr gamePtr, int zoomBy,
boolean[] canZoom );
public static native boolean board_getActiveRect( GamePtr gamePtr, Rect rect,
int[] dims );
- public static native boolean board_handlePenDown( GamePtr gamePtr,
- int xx, int yy,
+ public static native boolean board_handlePenDown( GamePtr gamePtr,
+ int xx, int yy,
boolean[] handled );
- public static native boolean board_handlePenMove( GamePtr gamePtr,
+ public static native boolean board_handlePenMove( GamePtr gamePtr,
int xx, int yy );
- public static native boolean board_handlePenUp( GamePtr gamePtr,
+ public static native boolean board_handlePenUp( GamePtr gamePtr,
int xx, int yy );
public static native boolean board_juggleTray( GamePtr gamePtr );
@@ -318,7 +318,7 @@ public class XwJNI {
public static native int board_getSelPlayer( GamePtr gamePtr );
public static native boolean board_redoReplacedTiles( GamePtr gamePtr );
public static native void board_resetEngine( GamePtr gamePtr );
- public static native boolean board_requestHint( GamePtr gamePtr,
+ public static native boolean board_requestHint( GamePtr gamePtr,
boolean useTileLimits,
boolean goBackwards,
boolean[] workRemains );
@@ -345,20 +345,20 @@ public class XwJNI {
XP_KEY_LAST
};
- public static native boolean board_handleKey( GamePtr gamePtr, XP_Key key,
+ public static native boolean board_handleKey( GamePtr gamePtr, XP_Key key,
boolean up, boolean[] handled );
- // public static native boolean board_handleKeyDown( XP_Key key,
+ // public static native boolean board_handleKeyDown( XP_Key key,
// boolean[] handled );
- // public static native boolean board_handleKeyRepeat( XP_Key key,
+ // public static native boolean board_handleKeyRepeat( XP_Key key,
// boolean[] handled );
// Model
- public static native String model_writeGameHistory( GamePtr gamePtr,
+ public static native String model_writeGameHistory( GamePtr gamePtr,
boolean gameOver );
public static native int model_getNMoves( GamePtr gamePtr );
public static native int model_getNumTilesInTray( GamePtr gamePtr, int player );
- public static native void model_getPlayersLastScore( GamePtr gamePtr,
- int player,
+ public static native void model_getPlayersLastScore( GamePtr gamePtr,
+ int player,
LastMoveInfo lmi );
// Server
public static native void server_reset( GamePtr gamePtr );
@@ -371,7 +371,7 @@ public class XwJNI {
public static native void server_endGame( GamePtr gamePtr );
// hybrid to save work
- public static native boolean board_server_prefsChanged( GamePtr gamePtr,
+ public static native boolean board_server_prefsChanged( GamePtr gamePtr,
CommonPrefs cp );
// Comms
@@ -389,7 +389,7 @@ public class XwJNI {
return comms_resendAll( gamePtr, force, null, andAck );
}
public static native void comms_ackAny( GamePtr gamePtr );
- public static native void comms_transportFailed( GamePtr gamePtr,
+ public static native void comms_transportFailed( GamePtr gamePtr,
CommsConnType failed );
public static native boolean comms_isConnected( GamePtr gamePtr );
public static native String comms_formatRelayID( GamePtr gamePtr, int indx );
@@ -424,7 +424,7 @@ public class XwJNI {
}
// @Override
- public void finalize() throws java.lang.Throwable
+ public void finalize() throws java.lang.Throwable
{
release();
super.finalize();
@@ -435,10 +435,10 @@ public class XwJNI {
public static native boolean dict_tilesAreSame( int dict1, int dict2 );
public static native String[] dict_getChars( int dict );
public static boolean dict_getInfo( byte[] dict, String name,
- String path, JNIUtils jniu,
+ String path, JNIUtils jniu,
boolean check, DictInfo info )
{
- return dict_getInfo( getJNI().m_ptr, dict, name, path, jniu,
+ return dict_getInfo( getJNI().m_ptr, dict, name, path, jniu,
check, info );
}
@@ -459,7 +459,7 @@ public class XwJNI {
public static native String dict_iter_nthWord( int closure, int nn );
public static native String[] dict_iter_getPrefixes( int closure );
public static native int[] dict_iter_getIndices( int closure );
- public static native int dict_iter_getStartsWith( int closure,
+ public static native int dict_iter_getStartsWith( int closure,
String prefix );
public static native String dict_iter_getDesc( int closure );
@@ -475,11 +475,11 @@ public class XwJNI {
private static native void envDone( int globals );
private static native void dict_ref( int dictPtr );
private static native void dict_unref( int dictPtr );
- private static native boolean dict_getInfo( int jniState, byte[] dict,
- String name, String path,
- JNIUtils jniu, boolean check,
+ private static native boolean dict_getInfo( int jniState, byte[] dict,
+ String name, String path,
+ JNIUtils jniu, boolean check,
DictInfo info );
- private static native int dict_iter_init( int jniState, byte[] dict,
- String name, String path,
+ private static native int dict_iter_init( int jniState, byte[] dict,
+ String name, String path,
JNIUtils jniu );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocActivity.java
index 6ab0c5a02..2ba165b4c 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocActivity.java
@@ -29,7 +29,7 @@ public class LocActivity extends XWActivity {
private LocDelegate m_dlgt;
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new LocDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java
index 2cb07f04c..990328cc2 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocDelegate.java
@@ -37,7 +37,7 @@ import org.eehouse.android.xw4.R;
import org.eehouse.android.xw4.Utils;
import org.eehouse.android.xw4.Delegator;
-public class LocDelegate extends ListDelegateBase
+public class LocDelegate extends ListDelegateBase
implements View.OnClickListener,
OnItemSelectedListener {
@@ -56,14 +56,15 @@ public class LocDelegate extends ListDelegateBase
m_activity = delegator.getActivity();
}
- protected boolean onBackPressed()
+ @Override
+ protected boolean handleBackPressed()
{
LocUtils.saveLocalData( m_activity );
return false;
}
@Override
- public void onClick( View view )
+ public void onClick( View view )
{
if ( view instanceof LocListItem ) {
m_lastItem = (LocListItem)view;
@@ -94,7 +95,7 @@ public class LocDelegate extends ListDelegateBase
setListAdapter( m_adapter );
}
- protected void init( Bundle savedInstanceState )
+ protected void init( Bundle savedInstanceState )
{
m_searchButton = (ImageButton)findViewById( R.id.loc_search_button );
m_searchButton.setOnClickListener( this );
@@ -116,7 +117,7 @@ public class LocDelegate extends ListDelegateBase
//////////////////////////////////////////////////
// AdapterView.OnItemSelectedListener interface
//////////////////////////////////////////////////
- public void onItemSelected( AdapterView> parent, View view,
+ public void onItemSelected( AdapterView> parent, View view,
int position, long id )
{
m_searcher.start( position );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocIDs.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocIDs.java
index 05c33eadf..ae193451d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocIDs.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocIDs.java
@@ -49,7 +49,7 @@ public class LocIDs extends LocIDsData {
return S_IDS.length;
}
- protected static HashMap getS_MAP( Context context )
+ protected static HashMap getS_MAP( Context context )
{
if ( null == S_MAP ) {
S_MAP = new HashMap(S_IDS.length);
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditActivity.java
index 05ccc82f7..ff8de2034 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditActivity.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditActivity.java
@@ -32,7 +32,7 @@ public class LocItemEditActivity extends XWActivity {
private LocItemEditDelegate m_dlgt;
@Override
- protected void onCreate( Bundle savedInstanceState )
+ protected void onCreate( Bundle savedInstanceState )
{
m_dlgt = new LocItemEditDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java
index fd17838da..78900481d 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocItemEditDelegate.java
@@ -56,7 +56,7 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher {
protected LocItemEditDelegate( Delegator delegator, Bundle savedInstanceState )
{
- super( delegator, savedInstanceState, R.layout.loc_item_edit,
+ super( delegator, savedInstanceState, R.layout.loc_item_edit,
R.menu.loc_item_menu );
m_activity = delegator.getActivity();
}
@@ -69,7 +69,7 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher {
TextView view = (TextView)findViewById( R.id.english_view );
m_keyFmts = getFmtSet( key, view );
if ( 0 < m_keyFmts.size() ) {
- showNotAgainDlg( R.string.not_again_fmt_expl,
+ showNotAgainDlg( R.string.not_again_fmt_expl,
R.string.key_na_fmt_expl );
}
@@ -104,7 +104,7 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher {
}
@Override
- public boolean onPrepareOptionsMenu( Menu menu )
+ public boolean onPrepareOptionsMenu( Menu menu )
{
CharSequence editTxt = m_edit.getText();
boolean haveTxt = null != editTxt && 0 < editTxt.length();
@@ -112,14 +112,14 @@ public class LocItemEditDelegate extends DelegateBase implements TextWatcher {
Utils.setItemVisible( menu, R.id.loc_item_clear, haveTxt );
Utils.setItemVisible( menu, R.id.loc_item_check, haveTxt );
Utils.setItemVisible( menu, R.id.loc_item_copy_eng, !haveTxt );
- Utils.setItemVisible( menu, R.id.loc_item_copy_bless,
+ Utils.setItemVisible( menu, R.id.loc_item_copy_bless,
m_haveBlessed && !haveTxt );
return true;
}
@Override
- public boolean onOptionsItemSelected( MenuItem item )
+ public boolean onOptionsItemSelected( MenuItem item )
{
String newText = null;
int id = item.getItemId();
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListAdapter.java
index da70c2f27..435d033b3 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListAdapter.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListAdapter.java
@@ -36,7 +36,7 @@ public class LocListAdapter extends XWListAdapter {
private View.OnClickListener m_listener;
protected LocListAdapter( Context context, ListView listView,
- LocSearcher searcher,
+ LocSearcher searcher,
View.OnClickListener listener )
{
m_context = context;
@@ -46,7 +46,7 @@ public class LocListAdapter extends XWListAdapter {
}
@Override
- public int getCount()
+ public int getCount()
{
int count = m_searcher.matchSize();
// DbgUtils.logf(" LocListAdapter.getCount() => %d", count );
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListItem.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListItem.java
index 3c9afc96c..816230116 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListItem.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocListItem.java
@@ -43,7 +43,7 @@ public class LocListItem extends LinearLayout {
private int m_position;
private TextView m_xlated;
- public LocListItem( Context cx, AttributeSet as )
+ public LocListItem( Context cx, AttributeSet as )
{
super( cx, as );
}
@@ -52,7 +52,7 @@ public class LocListItem extends LinearLayout {
protected void onFinishInflate()
{
super.onFinishInflate();
- m_xlated = (TextView)findViewById( R.id.xlated_view );
+ m_xlated = (TextView)findViewById( R.id.xlated_view );
}
protected void update()
@@ -89,11 +89,11 @@ public class LocListItem extends LinearLayout {
}
}
- protected static LocListItem create( Context context,
- LocSearcher.Pair pair,
+ protected static LocListItem create( Context context,
+ LocSearcher.Pair pair,
int position )
{
- LocListItem result =
+ LocListItem result =
(LocListItem)LocUtils.inflate( context, R.layout.loc_list_item );
result.m_pair = pair;
result.m_position = position;
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocSearcher.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocSearcher.java
index cc2545312..25c840208 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocSearcher.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocSearcher.java
@@ -57,7 +57,7 @@ public class LocSearcher {
public boolean matches( String term )
{
- return m_english.contains( term ) ||
+ return m_english.contains( term ) ||
(null != m_xlation && m_xlation.contains( term ) );
}
@@ -115,7 +115,7 @@ public class LocSearcher {
matches.add( pair );
}
}
- m_filteredPairs = m_matchingPairs =
+ m_filteredPairs = m_matchingPairs =
matches.toArray( new Pair[matches.size()] );
}
String term = m_lastTerm;
@@ -130,7 +130,7 @@ public class LocSearcher {
if ( null == term || 0 == term.length() ) {
m_matchingPairs = m_filteredPairs;
} else {
- Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm)
+ Pair[] usePairs = null != m_lastTerm && term.contains(m_lastTerm)
? m_matchingPairs : m_filteredPairs;
DbgUtils.logf( "start: searching %d pairs", usePairs.length );
ArrayList matches = new ArrayList();
@@ -156,7 +156,7 @@ public class LocSearcher {
private static FilterFunc s_modifiedProc = new FilterFunc() {
public boolean passes( Context context, Pair pair ) {
- return null !=
+ return null !=
LocUtils.getLocalXlation( context, pair.getKey(), true );
}
};
@@ -174,7 +174,7 @@ public class LocSearcher {
m_contextName = contextName;
}
- public boolean passes( Context context, Pair pair )
+ public boolean passes( Context context, Pair pair )
{
return LocUtils.inLatestScreen( pair.getKey(), m_contextName );
}
diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java
index 8143b56a3..ce4092f21 100644
--- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java
+++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/loc/LocUtils.java
@@ -88,7 +88,7 @@ public class LocUtils {
private static Map > s_contextSets
= new HashMap >();
private static Map s_langMap = null;
-
+
public static void localeChanged( Context context, String newLocale )
{
saveLocalData( context );
@@ -160,7 +160,7 @@ public class LocUtils {
int result = 0;
if ( null == s_langCodeMap ) {
s_langCodeMap = new HashMap();
- String[] langCodes =
+ String[] langCodes =
context.getResources().getStringArray( R.array.language_codes );
for ( int ii = 0; ii < langCodes.length; ++ii ) {
String item = langCodes[ii];
@@ -193,7 +193,7 @@ public class LocUtils {
// DbgUtils.logf( "xlateView(%s, %s)", context.getClass().getName(),
// view.getClass().getName() );
if ( XWApp.LOCUTILS_ENABLED ) {
- xlateView( context, context.getClass().getName(), view, 0 );
+ xlateView( context, context.getClass().getSimpleName(), view, 0 );
}
}
@@ -215,7 +215,7 @@ public class LocUtils {
return result;
}
- private static String xlateString( Context context, String str,
+ private static String xlateString( Context context, String str,
boolean associate )
{
if ( LocIDs.getS_MAP( context ).containsKey( str ) ) {
@@ -263,7 +263,7 @@ public class LocUtils {
return result;
}
- public static String getString( Context context, int id )
+ public static String getString( Context context, int id )
{
return getString( context, true, id );
}
@@ -279,7 +279,7 @@ public class LocUtils {
result = getXlation( context, key, canUseDB );
}
}
-
+
if ( null == result ) {
result = context.getString( id );
}
@@ -307,7 +307,7 @@ public class LocUtils {
return result;
}
- public static String getQuantityString( Context context, int id,
+ public static String getQuantityString( Context context, int id,
int quantity )
{
if ( XWApp.LOCUTILS_ENABLED ) {
@@ -318,7 +318,7 @@ public class LocUtils {
return result;
}
- public static String getQuantityString( Context context, int id,
+ public static String getQuantityString( Context context, int id,
int quantity, Object... params )
{
if ( XWApp.LOCUTILS_ENABLED ) {
@@ -412,7 +412,7 @@ public class LocUtils {
JSONObject result = null;
if ( XWApp.LOCUTILS_ENABLED ) {
try {
- String version =
+ String version =
DBUtils.getStringFor( context, localeKey(locale), "0" );
result = new JSONObject()
.put( k_LOCALE, locale )
@@ -449,7 +449,7 @@ public class LocUtils {
pairs.length(), newVersion );
int len = pairs.length();
- Map newXlations =
+ Map newXlations =
new HashMap( len );
for ( int jj = 0; jj < len; ++jj ) {
JSONObject pair = pairs.getJSONObject( jj );
@@ -493,7 +493,7 @@ public class LocUtils {
return result;
}
- private static void xlateMenu( final Activity activity,
+ private static void xlateMenu( final Activity activity,
final WeakReference rootRef,
Menu menu, int depth )
{
@@ -530,13 +530,13 @@ public class LocUtils {
public boolean onMenuItemClick( MenuItem item ) {
s_latestMenuRef = rootRef;
- Intent intent =
+ Intent intent =
new Intent( activity, LocActivity.class );
- intent.putExtra( CONTEXT_NAME,
+ intent.putExtra( CONTEXT_NAME,
activity.getClass().getName() );
activity.startActivity( intent );
return true;
- }
+ }
});
}
}
@@ -594,7 +594,7 @@ public class LocUtils {
private static void loadXlations( Context context )
{
if ( null == s_xlationsLocal || null == s_xlationsBlessed ) {
- Object[] asObjs =
+ Object[] asObjs =
DBUtils.getXlations( context, getCurLocale( context ) );
s_xlationsLocal = (Map)asObjs[0];
s_xlationsBlessed = (Map)asObjs[1];
@@ -622,10 +622,10 @@ public class LocUtils {
return s_idsToKeys.get( id );
}
- private static void xlateView( Context context, String contextName,
+ private static void xlateView( Context context, String contextName,
View view, int depth )
{
- // DbgUtils.logf( "xlateView(depth=%d, view=%s, canRecurse=%b)", depth,
+ // DbgUtils.logf( "xlateView(depth=%d, view=%s, canRecurse=%b)", depth,
// view.getClass().getName(), view instanceof ViewGroup );
if ( view instanceof Button ) {
Button button = (Button)view;
@@ -652,7 +652,7 @@ public class LocUtils {
}
// A Spinner, for instance, ISA ViewGroup, so this is a separate test.
- if ( view instanceof ViewGroup ) {
+ if ( view instanceof ViewGroup ) {
ViewGroup asGroup = (ViewGroup)view;
int count = asGroup.getChildCount();
for ( int ii = 0; ii < count; ++ii ) {
@@ -662,10 +662,10 @@ public class LocUtils {
}
}
- public static void xlatePreferences( Context context, Preference pref,
+ public static void xlatePreferences( Context context, Preference pref,
int depth )
{
- // DbgUtils.logf( "xlatePreferences(depth=%d, view=%s, canRecurse=%b)", depth,
+ // DbgUtils.logf( "xlatePreferences(depth=%d, view=%s, canRecurse=%b)", depth,
// pref.getClass().getName(), pref instanceof PreferenceGroup );
String str = xlateString( context, pref.getSummary() );
@@ -693,7 +693,7 @@ public class LocUtils {
}
// ListPreference isa DialogPreference
- if ( dp instanceof ListPreference ) {
+ if ( dp instanceof ListPreference ) {
ListPreference lp = (ListPreference) dp;
CharSequence[] entries = lp.getEntries();
if ( null != entries ) {
@@ -797,7 +797,7 @@ public class LocUtils {
private static Pattern s_patUnicode = Pattern.compile("(\\\\[Uu][0-9a-fA-F]{4})");
private static Pattern s_patCr = Pattern.compile("\\\\n");
-
+
private static String replaceEscaped( String txt )
{
// String orig = txt;
@@ -862,14 +862,14 @@ public class LocUtils {
}
@Override
- public AlertDialog.Builder setPositiveButton( int textId,
+ public AlertDialog.Builder setPositiveButton( int textId,
OnClickListener listener )
{
String str = getString( m_context, textId );
return setPositiveButton( str, listener );
}
@Override
- public AlertDialog.Builder setNeutralButton( int textId,
+ public AlertDialog.Builder setNeutralButton( int textId,
OnClickListener listener )
{
String str = getString( m_context, textId );
@@ -877,7 +877,7 @@ public class LocUtils {
}
@Override
- public AlertDialog.Builder setNegativeButton( int textId,
+ public AlertDialog.Builder setNegativeButton( int textId,
OnClickListener listener )
{
String str = getString( m_context, textId );
diff --git a/xwords4/android/scripts/adb-install.sh b/xwords4/android/scripts/adb-install.sh
index 257229538..5c3cc4c0d 100755
--- a/xwords4/android/scripts/adb-install.sh
+++ b/xwords4/android/scripts/adb-install.sh
@@ -16,22 +16,9 @@ APKS=''
DEVICES=''
DIRNAME=$(basename $(pwd))
ADB="$(which adb)"
-MAIN=GamesListActivity
+MAIN=MainActivity
-case $DIRNAME in
- XWords4-dbg)
- PKG=xw4dbg
- ;;
- XWords4-bt)
- PKG=xw4bt
- ;;
- XWords4)
- PKG=xw4
- ;;
- *)
- usage "running in unexpected directory $DIRNAME"
- ;;
-esac
+PKG=$(xmlstarlet sel -T -t -m "/manifest" -v @package -n AndroidManifest.xml)
while [ $# -ge 1 ]; do
case $1 in
@@ -76,7 +63,7 @@ for DEVICE in $DEVICES; do
ls -l $APK
$ADB -s $DEVICE install -r $APK
$ADB -s $DEVICE shell am start \
- -n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.${MAIN}
+ -n ${PKG}/${PKG}.${MAIN}
done
COUNT=$((COUNT+1))
done
diff --git a/xwords4/android/scripts/adb-uninstall.sh b/xwords4/android/scripts/adb-uninstall.sh
index 672107820..07450b18c 100755
--- a/xwords4/android/scripts/adb-uninstall.sh
+++ b/xwords4/android/scripts/adb-uninstall.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-set -e -u -x
+set -e -u
# use this: adb -s 04bd25af2523aae6 shell "pm list packages" | grep org.eehouse
@@ -17,7 +17,7 @@ usage() {
echo " [--apk ] # default is to use package names of all known apks"
echo " [--pkg-name tld.whatever.more] # explicit package name"
echo " [--serial ] # default is to use all attached devices"
- echo "uninstall crosswords variant"
+ echo "uninstall apps based on known .apk or package name"
exit 1
}
diff --git a/xwords4/android/scripts/common_targets.xml b/xwords4/android/scripts/common_targets.xml
index d9081c737..e06f2367d 100644
--- a/xwords4/android/scripts/common_targets.xml
+++ b/xwords4/android/scripts/common_targets.xml
@@ -27,14 +27,10 @@
-
-
-
-
@@ -44,8 +40,11 @@
/>
+ failonerror="true" output="/dev/null"
+ >
+
+
+
-
-
-
-
-
@@ -97,6 +92,13 @@
+
+
+
+
+
diff --git a/xwords4/android/scripts/copy-strings.py b/xwords4/android/scripts/copy-strings.py
index f277735a6..9efb4efed 100755
--- a/xwords4/android/scripts/copy-strings.py
+++ b/xwords4/android/scripts/copy-strings.py
@@ -15,10 +15,14 @@ g_oneToOthers = ['values-ja']
sComment = """
DO NOT EDIT THIS FILE!!!!
- It was generated (from %s).
+ It was generated (from %s, by %s).
Any changes you make to it will be lost.
"""
+def usage():
+ print "usage:", sys.argv[0], '[-k ]'
+ sys.exit(1)
+
def sameOrSameWithPrefix( str1, str2 ):
result = str1 == str2
if not result:
@@ -126,7 +130,7 @@ def loadPlural(plural):
return items
def writeDoc(doc, src, dest):
- comment = etree.Comment(sComment % (src))
+ comment = etree.Comment(sComment % (src, os.path.basename(sys.argv[0])))
doc.getroot().insert( 0, comment )
dir = os.path.dirname( dest )
try: os.makedirs( dir )
@@ -182,6 +186,15 @@ def main():
excepts = ['values-ca_PS', 'values-ba_CK']
verboses = ['values-ja']
+ try:
+ pairs, rest = getopt.getopt(sys.argv[1:], "k:")
+ for option, value in pairs:
+ if option == '-k': excepts += value.split(' ')
+ else: usage()
+ except:
+ print "Unexpected error:", sys.exc_info()[0]
+ usage()
+
# summarize the english file
wd = os.path.dirname(sys.argv[0])
path = wd + '/../XWords4/res/values/strings.xml'
diff --git a/xwords4/android/scripts/find-and-ant.sh b/xwords4/android/scripts/find-and-ant.sh
index c879e165b..92858016f 100755
--- a/xwords4/android/scripts/find-and-ant.sh
+++ b/xwords4/android/scripts/find-and-ant.sh
@@ -72,7 +72,9 @@ esac
# if we're running for the first time in this directory/variant,
# generate local.properties
-[ -e local.properties ] || ../scripts/setup_local_props.sh
+if [ -e ../scripts/setup_local_props.sh ]; then
+ [ -e local.properties ] || ../scripts/setup_local_props.sh
+fi
# If this fails, the "set -e" above means we won't try to install anything
[ -n "$CMDS" ] && ant $CMDS
@@ -88,5 +90,5 @@ if [ -n "$INSTALL" ]; then
fi
# if [ "$CMDS" != "${CMDS%%install}" ]; then
-# adb shell am start -n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.GamesListActivity
+# adb shell am start -n org.eehouse.android.${PKG}/org.eehouse.android.${PKG}.MainActivity
# fi
diff --git a/xwords4/android/scripts/genvers.sh b/xwords4/android/scripts/genvers.sh
index 42d5da70f..1950e0461 100755
--- a/xwords4/android/scripts/genvers.sh
+++ b/xwords4/android/scripts/genvers.sh
@@ -6,14 +6,11 @@ STRINGS_HASH=""
OUT_PATH=""
VARIANT=""
CLIENT_VERS_RELAY=""
-CHAT_SUPPORTED=""
-THUMBNAIL_SUPPORTED=""
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
usage() {
echo "usage: $0 --variant --client-vers \\"
- echo " --chat-enabled --thumbnail-enabled \\"
echo " [--vers-outfile path/to/versout.txt]"
exit 1
}
@@ -29,14 +26,6 @@ while [ $# -gt 0 ]; do
CLIENT_VERS_RELAY=$2
shift
;;
- --chat-enabled)
- CHAT_SUPPORTED=$2
- shift
- ;;
- --thumbnail-enabled)
- THUMBNAIL_SUPPORTED=$2
- shift
- ;;
--vers-outfile)
OUT_PATH=$2
shift
@@ -48,7 +37,7 @@ while [ $# -gt 0 ]; do
shift
done
-[ -n "$VARIANT" -a -n "$CLIENT_VERS_RELAY" -a -n "$CHAT_SUPPORTED" -a -n "$THUMBNAIL_SUPPORTED" ] || usage
+[ -n "$VARIANT" -a -n "$CLIENT_VERS_RELAY" ] || usage
BUILD_DIR=$(basename $(pwd))
cd $(dirname $0)
@@ -119,8 +108,6 @@ public class BuildConstants {
public static final String GIT_REV = "$SHORTVERS";
public static final String STRINGS_HASH = "$STRINGS_HASH";
public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY;
- public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED;
- public static final boolean THUMBNAIL_SUPPORTED = $THUMBNAIL_SUPPORTED;
public static final long BUILD_STAMP = $(date +'%s');
public static final String DBG_TAG = "$DBG_TAG";
public static final String VARIANT = "$VARIANT";
diff --git a/xwords4/android/scripts/rm-non-git.sh b/xwords4/android/scripts/rm-non-git.sh
index b70786553..5047a0ee7 100755
--- a/xwords4/android/scripts/rm-non-git.sh
+++ b/xwords4/android/scripts/rm-non-git.sh
@@ -3,50 +3,16 @@
set -u -e
EXCEPTS=" "
-
-echo "$0 $*"
-pwd
+DRY_RUN=''
usage() {
[ $# -ge 1 ] && echo "ERROR: $1"
- echo "usage: $0 [--except path/to/file]*"
+ echo "usage: $0 [--dry-run] [--except path/to/file]*"
+ echo " Starting in current directory, recursively remove all non-git-controlled"
+ echo " files, excepting those named with --except flags."
exit 1
}
-# rm_not_excepted() {
-# FILE=$1
-# for EXCEPT in $EXCEPTS; do
-# if [ $EXCEPT = $FILE ]; then
-# echo "skipping delete of $FILE"
-# FILE=""
-# break
-# fi
-# done
-
-# [ -n "$FILE" ] && rm $FILE
-# }
-
-rm_in() {
- echo "rm_in $1"
- for FILE in $(ls $1); do
- FILE=$1/$FILE
- echo "FILE: $FILE"
- if [ ! "${EXCEPTS}" = "${EXCEPTS# $FILE }" ]; then
- echo "$FILE is in $EXCEPTS"
- continue
- elif [ -d $FILE ]; then
- rm_in $FILE
- elif git ls-files $FILE --error-unmatch 2>/dev/null; then
- echo "$FILE is a git file"
- continue
- else
- echo "rm $FILE"
- rm $FILE
- fi
- done
-}
-
-
while [ $# -ge 1 ]; do
case $1 in
--except)
@@ -61,6 +27,12 @@ while [ $# -ge 1 ]; do
fi
EXCEPTS=" $EXCEPTS $FILE "
;;
+ --dry-run)
+ DRY_RUN=1
+ ;;
+ --help)
+ usage
+ ;;
*)
usage "unexpected param $1"
;;
@@ -68,8 +40,15 @@ while [ $# -ge 1 ]; do
shift
done
-echo "EXCEPTS: $EXCEPTS"
-exit 0
+for FILE in $(find $(pwd) -type f); do
+ if [ ! "${EXCEPTS}" = "${EXCEPTS# $FILE }" ]; then
+ continue
+ elif git ls-files $FILE --error-unmatch 2>/dev/null 1>/dev/null; then
+ continue
+ else
+ echo "$FILE not under git; removing..."
+ [ -n "$DRY_RUN" ] || rm $FILE
+ fi
+done
-rm_in "."
-echo "$0: exiting cleanly"
+echo "$0: done" >&2
diff --git a/xwords4/common/server.c b/xwords4/common/server.c
index aa3beaa5f..83eb39056 100644
--- a/xwords4/common/server.c
+++ b/xwords4/common/server.c
@@ -2596,7 +2596,7 @@ setTurn( ServerCtxt* server, XP_S16 turn )
{
XP_ASSERT( -1 == turn
|| (!amServer(server) || (0 == server->nv.pendingRegistrations)));
- if ( server->nv.currentTurn != turn ) {
+ if ( server->nv.currentTurn != turn || 1 == server->vol.gi->nPlayers ) {
server->nv.currentTurn = turn;
server->nv.lastMoveTime = util_getCurSeconds( server->vol.util );
callTurnChangeListener( server );
diff --git a/xwords4/linux/gamesdb.c b/xwords4/linux/gamesdb.c
index e3fa4f2c0..6a48025b6 100644
--- a/xwords4/linux/gamesdb.c
+++ b/xwords4/linux/gamesdb.c
@@ -52,6 +52,7 @@ openGamesDB( const char* dbName )
",gameid INT"
",ntotal INT(2)"
",nmissing INT(2)"
+ ",lastMoveTime INT"
")";
result = sqlite3_exec( pDb, createGamesStr, NULL, NULL, NULL );
@@ -159,6 +160,7 @@ summarize( CommonGlobals* cGlobals )
XP_S16 nMoves = model_getNMoves( cGlobals->game.model );
XP_Bool gameOver = server_getGameIsOver( cGlobals->game.server );
XP_S16 turn = server_getCurrentTurn( cGlobals->game.server );
+ XP_U32 lastMoveTime = server_getLastMoveTime( cGlobals->game.server );
XP_U16 seed = 0;
XP_S16 nMissing = 0;
XP_U16 nTotal = cGlobals->gi->nPlayers;
@@ -203,11 +205,12 @@ summarize( CommonGlobals* cGlobals )
}
const char* fmt = "UPDATE games "
- " SET room='%s', ended=%d, turn=%d, ntotal=%d, nmissing=%d, nmoves=%d, seed=%d, gameid=%d, connvia='%s'"
+ " SET room='%s', ended=%d, turn=%d, ntotal=%d, nmissing=%d, nmoves=%d, seed=%d, "
+ " gameid=%d, connvia='%s', lastMoveTime=%d"
" WHERE rowid=%lld";
XP_UCHAR buf[256];
snprintf( buf, sizeof(buf), fmt, room, gameOver?1:0, turn, nTotal, nMissing,
- nMoves, seed, gameID, connvia, cGlobals->selRow );
+ nMoves, seed, gameID, connvia, lastMoveTime, cGlobals->selRow );
XP_LOGF( "query: %s", buf );
sqlite3_stmt* stmt = NULL;
int result = sqlite3_prepare_v2( cGlobals->pDb, buf, -1, &stmt, NULL );
@@ -259,7 +262,7 @@ getGameInfo( sqlite3* pDb, sqlite3_int64 rowid, GameInfo* gib )
{
XP_Bool success = XP_FALSE;
const char* fmt = "SELECT room, ended, turn, nmoves, ntotal, nmissing, "
- "seed, connvia, gameid "
+ "seed, connvia, gameid, lastMoveTime "
"FROM games WHERE rowid = %lld";
XP_UCHAR query[256];
snprintf( query, sizeof(query), fmt, rowid );
@@ -279,6 +282,7 @@ getGameInfo( sqlite3* pDb, sqlite3_int64 rowid, GameInfo* gib )
gib->seed = sqlite3_column_int( ppStmt, 6 );
getColumnText( ppStmt, 7, gib->conn, sizeof(gib->conn) );
gib->gameID = sqlite3_column_int( ppStmt, 8 );
+ gib->lastMoveTime = sqlite3_column_int( ppStmt, 9 );
snprintf( gib->name, sizeof(gib->name), "Game %lld", rowid );
}
sqlite3_finalize( ppStmt );
diff --git a/xwords4/linux/gamesdb.h b/xwords4/linux/gamesdb.h
index b9056e2ed..64417357d 100644
--- a/xwords4/linux/gamesdb.h
+++ b/xwords4/linux/gamesdb.h
@@ -38,9 +38,9 @@ typedef struct _GameInfo {
XP_U16 nTotal;
XP_S16 nMissing;
XP_U16 seed;
+ XP_U32 lastMoveTime;
} GameInfo;
-
sqlite3* openGamesDB( const char* dbName );
void closeGamesDB( sqlite3* dbp );
diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c
index 77c15f502..f5cf60f44 100644
--- a/xwords4/linux/gtkmain.c
+++ b/xwords4/linux/gtkmain.c
@@ -76,7 +76,7 @@ findOpenGame( const GtkAppGlobals* apg, sqlite3_int64 rowid )
}
enum { ROW_ITEM, NAME_ITEM, ROOM_ITEM, GAMEID_ITEM, SEED_ITEM, CONN_ITEM, OVER_ITEM, TURN_ITEM,
- NMOVES_ITEM, NTOTAL_ITEM, MISSING_ITEM, N_ITEMS };
+ NMOVES_ITEM, NTOTAL_ITEM, MISSING_ITEM, LASTTURN_ITEM, N_ITEMS };
static void
foreachProc( GtkTreeModel* model, GtkTreePath* XP_UNUSED(path),
@@ -159,6 +159,7 @@ init_games_list( GtkAppGlobals* apg )
addTextColumn( list, "NMoves", NMOVES_ITEM );
addTextColumn( list, "NTotal", NTOTAL_ITEM );
addTextColumn( list, "NMissing", MISSING_ITEM );
+ addTextColumn( list, "LastTurn", LASTTURN_ITEM );
GtkListStore* store = gtk_list_store_new( N_ITEMS,
G_TYPE_INT64, /* ROW_ITEM */
@@ -171,7 +172,8 @@ init_games_list( GtkAppGlobals* apg )
G_TYPE_INT, /* TURN_ITEM */
G_TYPE_INT, /* NMOVES_ITEM */
G_TYPE_INT, /* NTOTAL_ITEM */
- G_TYPE_INT /* MISSING_ITEM */
+ G_TYPE_INT, /* MISSING_ITEM */
+ G_TYPE_INT /* LASTTURN_ITEM */
);
gtk_tree_view_set_model( GTK_TREE_VIEW(list), GTK_TREE_MODEL(store) );
g_object_unref( store );
@@ -220,6 +222,7 @@ add_to_list( GtkWidget* list, sqlite3_int64 rowid, XP_Bool isNew,
NMOVES_ITEM, gib->nMoves,
NTOTAL_ITEM, gib->nTotal,
MISSING_ITEM, gib->nMissing,
+ LASTTURN_ITEM, gib->lastMoveTime,
-1 );
XP_LOGF( "DONE adding" );
}