Merge remote branch 'origin/android_localize' into android_localize

This commit is contained in:
Eric House 2014-06-24 08:16:56 -07:00
commit 4d9c7c97ba
28 changed files with 626 additions and 401 deletions

View file

@ -35,3 +35,5 @@ studylist.xml
loc_list_item.xml loc_list_item.xml
loc_main.xml loc_main.xml
loc_item_edit.xml loc_item_edit.xml
import_dict_item.xml
list_group.xml

View file

@ -7,3 +7,4 @@ dicts_menu.xml
studylist.xml studylist.xml
loc_menu.xml loc_menu.xml
empty.xml empty.xml
loc_item_menu.xml

View file

@ -107,3 +107,7 @@ InviteDelegate.java
ListDelegateBase.java ListDelegateBase.java
PrefsDelegate.java PrefsDelegate.java
SMSInviteDelegate.java SMSInviteDelegate.java
DwnldActivity.java
DwnldDelegate.java
GroupStateListener.java
ListGroup.java

View file

@ -9,3 +9,5 @@ LocListItem.java
LocSearcher.java LocSearcher.java
LocUtils.java LocUtils.java
XlatingSpinnerAdapter.java XlatingSpinnerAdapter.java
LocItemEditActivity.java
LocItemEditDelegate.java

View file

@ -80,158 +80,159 @@ public final class R {
public static final int about_xlator=0x7f0a0001; public static final int about_xlator=0x7f0a0001;
public static final int add_player=0x7f0a0032; public static final int add_player=0x7f0a0032;
public static final int advertise_new_room_check=0x7f0a0038; public static final int advertise_new_room_check=0x7f0a0038;
public static final int blessed_label=0x7f0a0059; public static final int blessed_label=0x7f0a0058;
public static final int board_menu_chat=0x7f0a00a7; public static final int board_menu_chat=0x7f0a00a8;
public static final int board_menu_dict=0x7f0a00a3; public static final int board_menu_dict=0x7f0a00a4;
public static final int board_menu_done=0x7f0a008e; public static final int board_menu_done=0x7f0a008f;
public static final int board_menu_file_about=0x7f0a009c; public static final int board_menu_file_about=0x7f0a009d;
public static final int board_menu_file_prefs=0x7f0a009b; public static final int board_menu_file_prefs=0x7f0a009c;
public static final int board_menu_flip=0x7f0a00a5; public static final int board_menu_flip=0x7f0a00a6;
public static final int board_menu_game_counts=0x7f0a0094; public static final int board_menu_game_counts=0x7f0a0095;
public static final int board_menu_game_history=0x7f0a0096; public static final int board_menu_game_history=0x7f0a0097;
public static final int board_menu_game_left=0x7f0a0095; public static final int board_menu_game_left=0x7f0a0096;
public static final int board_menu_game_netstats=0x7f0a009d; public static final int board_menu_game_netstats=0x7f0a009e;
public static final int board_menu_game_resend=0x7f0a0098; public static final int board_menu_game_resend=0x7f0a0099;
public static final int board_menu_game_resign=0x7f0a0097; public static final int board_menu_game_resign=0x7f0a0098;
public static final int board_menu_hint_next=0x7f0a00a1; public static final int board_menu_hint_next=0x7f0a00a2;
public static final int board_menu_hint_prev=0x7f0a00a0; public static final int board_menu_hint_prev=0x7f0a00a1;
public static final int board_menu_invite=0x7f0a008d; public static final int board_menu_invite=0x7f0a008e;
public static final int board_menu_juggle=0x7f0a00a4; public static final int board_menu_juggle=0x7f0a00a5;
public static final int board_menu_toggle=0x7f0a00a8; public static final int board_menu_toggle=0x7f0a00a9;
public static final int board_menu_trade=0x7f0a008f; public static final int board_menu_trade=0x7f0a0090;
public static final int board_menu_trade_cancel=0x7f0a0090; public static final int board_menu_trade_cancel=0x7f0a0091;
public static final int board_menu_trade_commit=0x7f0a0091; public static final int board_menu_trade_commit=0x7f0a0092;
public static final int board_menu_tray=0x7f0a0093; public static final int board_menu_tray=0x7f0a0094;
public static final int board_menu_undo_current=0x7f0a00a2; public static final int board_menu_undo_current=0x7f0a00a3;
public static final int board_menu_undo_last=0x7f0a0092; public static final int board_menu_undo_last=0x7f0a0093;
public static final int board_menu_zoom=0x7f0a00a6; public static final int board_menu_zoom=0x7f0a00a7;
public static final int board_root=0x7f0a0002; public static final int board_root=0x7f0a0002;
public static final int board_view=0x7f0a0003; public static final int board_view=0x7f0a0003;
public static final int boardsize_spinner=0x7f0a0045; public static final int boardsize_spinner=0x7f0a0045;
public static final int bt_disabled=0x7f0a0071; public static final int bt_disabled=0x7f0a0070;
public static final int bt_separator=0x7f0a0070; public static final int bt_separator=0x7f0a006f;
public static final int bt_stuff=0x7f0a0073; public static final int bt_stuff=0x7f0a0072;
public static final int button_add=0x7f0a0086; public static final int button_add=0x7f0a0087;
public static final int button_clear=0x7f0a0013; public static final int button_clear=0x7f0a0013;
public static final int button_done=0x7f0a0064; public static final int button_done=0x7f0a0063;
public static final int button_invite=0x7f0a0014; public static final int button_invite=0x7f0a0014;
public static final int button_rescan=0x7f0a0012; public static final int button_rescan=0x7f0a0012;
public static final int button_study=0x7f0a0063; public static final int button_study=0x7f0a0062;
public static final int chat_button_horizontal=0x7f0a000d; public static final int chat_button_horizontal=0x7f0a000d;
public static final int chat_edit=0x7f0a0016; public static final int chat_edit=0x7f0a0016;
public static final int chat_history=0x7f0a0015; public static final int chat_history=0x7f0a0015;
public static final int chat_menu_clear=0x7f0a00a9; public static final int chat_menu_clear=0x7f0a00aa;
public static final int checkbox=0x7f0a0053; public static final int checkbox=0x7f0a0052;
public static final int color_display_sample=0x7f0a0018; public static final int color_display_sample=0x7f0a0018;
public static final int color_edit_sample=0x7f0a0019; public static final int color_edit_sample=0x7f0a0019;
public static final int config_button=0x7f0a0084; public static final int config_button=0x7f0a0083;
public static final int confirm_sms_reasons=0x7f0a0020; public static final int confirm_sms_reasons=0x7f0a0020;
public static final int connect_set_relay=0x7f0a0034; public static final int connect_set_relay=0x7f0a0034;
public static final int connect_set_sms=0x7f0a003c; public static final int connect_set_sms=0x7f0a003c;
public static final int del=0x7f0a0056; public static final int del=0x7f0a0055;
public static final int desc=0x7f0a0023; public static final int desc=0x7f0a0023;
public static final int dict_label=0x7f0a007a; public static final int details=0x7f0a0084;
public static final int dict_label=0x7f0a0079;
public static final int dict_spinner=0x7f0a002f; public static final int dict_spinner=0x7f0a002f;
public static final int dictlist_button_horizontal=0x7f0a000c; public static final int dictlist_button_horizontal=0x7f0a000c;
public static final int dicts_delete=0x7f0a00ac; public static final int dicts_delete=0x7f0a00ad;
public static final int dicts_deselect_all=0x7f0a00ab; public static final int dicts_deselect_all=0x7f0a00ac;
public static final int dicts_download=0x7f0a00aa; public static final int dicts_download=0x7f0a00ab;
public static final int dicts_move=0x7f0a00ad; public static final int dicts_move=0x7f0a00ae;
public static final int dicts_select=0x7f0a00ae; public static final int dicts_select=0x7f0a00af;
public static final int divider=0x7f0a0028; public static final int divider=0x7f0a0028;
public static final int download_button=0x7f0a0085;
public static final int dwnld_message=0x7f0a0050; public static final int dwnld_message=0x7f0a0050;
public static final int edit=0x7f0a0076; public static final int edit=0x7f0a0075;
public static final int edit_blue=0x7f0a001f; public static final int edit_blue=0x7f0a001f;
public static final int edit_green=0x7f0a001d; public static final int edit_green=0x7f0a001d;
public static final int edit_red=0x7f0a001b; public static final int edit_red=0x7f0a001b;
public static final int english_label=0x7f0a0057; public static final int english_label=0x7f0a0056;
public static final int english_view=0x7f0a0058; public static final int english_view=0x7f0a0057;
public static final int exchange_buttons=0x7f0a0004; public static final int exchange_buttons=0x7f0a0004;
public static final int exchange_cancel=0x7f0a0006; public static final int exchange_cancel=0x7f0a0006;
public static final int exchange_commit=0x7f0a0005; public static final int exchange_commit=0x7f0a0005;
public static final int expander=0x7f0a0047; public static final int expander=0x7f0a0047;
public static final int explain=0x7f0a0082; public static final int explain=0x7f0a0081;
public static final int filters=0x7f0a005e; public static final int filters=0x7f0a005d;
public static final int flip_button_horizontal=0x7f0a000f; public static final int flip_button_horizontal=0x7f0a000f;
public static final int game_locked_check=0x7f0a002a; public static final int game_locked_check=0x7f0a002a;
public static final int game_name=0x7f0a0046; public static final int game_name=0x7f0a0046;
public static final int gamel_menu_checkmoves=0x7f0a009a; public static final int gamel_menu_checkmoves=0x7f0a009b;
public static final int games_game_config=0x7f0a00b9; public static final int games_game_config=0x7f0a00ba;
public static final int games_game_copy=0x7f0a00be; public static final int games_game_copy=0x7f0a00bf;
public static final int games_game_delete=0x7f0a00b8; public static final int games_game_delete=0x7f0a00b9;
public static final int games_game_move=0x7f0a00ba; public static final int games_game_move=0x7f0a00bb;
public static final int games_game_new_from=0x7f0a00bc; public static final int games_game_new_from=0x7f0a00bd;
public static final int games_game_rename=0x7f0a00bd; public static final int games_game_rename=0x7f0a00be;
public static final int games_game_reset=0x7f0a00bb; public static final int games_game_reset=0x7f0a00bc;
public static final int games_group_default=0x7f0a00c2; public static final int games_group_default=0x7f0a00c3;
public static final int games_group_delete=0x7f0a00c1; public static final int games_group_delete=0x7f0a00c2;
public static final int games_group_movedown=0x7f0a00c0; public static final int games_group_movedown=0x7f0a00c1;
public static final int games_group_moveup=0x7f0a00bf; public static final int games_group_moveup=0x7f0a00c0;
public static final int games_group_rename=0x7f0a00c3; public static final int games_group_rename=0x7f0a00c4;
public static final int games_menu_about=0x7f0a00b5; public static final int games_menu_about=0x7f0a00b6;
public static final int games_menu_checkmoves=0x7f0a00b7; public static final int games_menu_checkmoves=0x7f0a00b8;
public static final int games_menu_checkupdates=0x7f0a00c4; public static final int games_menu_checkupdates=0x7f0a00c5;
public static final int games_menu_dicts=0x7f0a00b3; public static final int games_menu_dicts=0x7f0a00b4;
public static final int games_menu_email=0x7f0a00b4; public static final int games_menu_email=0x7f0a00b5;
public static final int games_menu_loaddb=0x7f0a00c6; public static final int games_menu_loaddb=0x7f0a00c7;
public static final int games_menu_newgame=0x7f0a00af; public static final int games_menu_newgame=0x7f0a00b0;
public static final int games_menu_newgroup=0x7f0a00b0; public static final int games_menu_newgroup=0x7f0a00b1;
public static final int games_menu_prefs=0x7f0a00b1; public static final int games_menu_prefs=0x7f0a00b2;
public static final int games_menu_rateme=0x7f0a00b2; public static final int games_menu_rateme=0x7f0a00b3;
public static final int games_menu_resend=0x7f0a00b6; public static final int games_menu_resend=0x7f0a00b7;
public static final int games_menu_storedb=0x7f0a00c5; public static final int games_menu_storedb=0x7f0a00c6;
public static final int games_menu_study=0x7f0a0099; public static final int games_menu_study=0x7f0a009a;
public static final int group_done=0x7f0a008c; public static final int group_done=0x7f0a008d;
public static final int group_exchange=0x7f0a009e; public static final int group_exchange=0x7f0a009f;
public static final int group_hint=0x7f0a009f; public static final int group_hint=0x7f0a00a0;
public static final int hideable=0x7f0a004c; public static final int hideable=0x7f0a004c;
public static final int hints_allowed=0x7f0a003e; public static final int hints_allowed=0x7f0a003e;
public static final int invite_desc=0x7f0a0011; public static final int invite_desc=0x7f0a0011;
public static final int item_name=0x7f0a007e; public static final int item_name=0x7f0a007d;
public static final int item_score=0x7f0a007f; public static final int item_score=0x7f0a007e;
public static final int join_public_room_check=0x7f0a0035; public static final int join_public_room_check=0x7f0a0035;
public static final int juggle_players=0x7f0a0033; public static final int juggle_players=0x7f0a0033;
public static final int lang_separator=0x7f0a002d; public static final int lang_separator=0x7f0a002d;
public static final int lang_spinner=0x7f0a002e; public static final int lang_spinner=0x7f0a002e;
public static final int loc_item_check=0x7f0a00c8; public static final int loc_item_check=0x7f0a00c9;
public static final int loc_item_clear=0x7f0a00c7; public static final int loc_item_clear=0x7f0a00c8;
public static final int loc_item_copy_bless=0x7f0a00ca; public static final int loc_item_copy_bless=0x7f0a00cb;
public static final int loc_item_copy_eng=0x7f0a00c9; public static final int loc_item_copy_eng=0x7f0a00ca;
public static final int loc_search_button=0x7f0a0060; public static final int loc_search_button=0x7f0a005f;
public static final int loc_search_field=0x7f0a005f; public static final int loc_search_field=0x7f0a005e;
public static final int local_label=0x7f0a005b; public static final int local_label=0x7f0a005a;
public static final int local_name_edit=0x7f0a0083; public static final int local_name_edit=0x7f0a0082;
public static final int local_player_set=0x7f0a0078; public static final int local_player_set=0x7f0a0077;
public static final int manual_add_button=0x7f0a0087; public static final int manual_add_button=0x7f0a0088;
public static final int modtime=0x7f0a004d; public static final int modtime=0x7f0a004d;
public static final int msg_marker=0x7f0a004a; public static final int msg_marker=0x7f0a004a;
public static final int name=0x7f0a0088; public static final int name=0x7f0a0089;
public static final int name_edit=0x7f0a0021; public static final int name_edit=0x7f0a0021;
public static final int name_label=0x7f0a0085; public static final int name_label=0x7f0a0086;
public static final int newgame_bt_config=0x7f0a0075; public static final int newgame_bt_config=0x7f0a0074;
public static final int newgame_enable_bt=0x7f0a0072; public static final int newgame_enable_bt=0x7f0a0071;
public static final int newgame_enable_sms=0x7f0a006c; public static final int newgame_enable_sms=0x7f0a006b;
public static final int newgame_invite_bt=0x7f0a0074; public static final int newgame_invite_bt=0x7f0a0073;
public static final int newgame_invite_net=0x7f0a0068; public static final int newgame_invite_net=0x7f0a0067;
public static final int newgame_invite_sms=0x7f0a006e; public static final int newgame_invite_sms=0x7f0a006d;
public static final int newgame_local=0x7f0a0066; public static final int newgame_local=0x7f0a0065;
public static final int newgame_local_config=0x7f0a0067; public static final int newgame_local_config=0x7f0a0066;
public static final int newgame_local_desc=0x7f0a0065; public static final int newgame_local_desc=0x7f0a0064;
public static final int newgame_net_config=0x7f0a0069; public static final int newgame_net_config=0x7f0a0068;
public static final int newgame_sms_config=0x7f0a006f; public static final int newgame_sms_config=0x7f0a006e;
public static final int nexthint_button_horizontal=0x7f0a0009; public static final int nexthint_button_horizontal=0x7f0a0009;
public static final int number=0x7f0a0089; public static final int number=0x7f0a008a;
public static final int other_lang=0x7f0a0061; public static final int other_lang=0x7f0a0060;
public static final int password_edit=0x7f0a007d; public static final int password_edit=0x7f0a007c;
public static final int password_set=0x7f0a007c; public static final int password_set=0x7f0a007b;
public static final int phonies_spinner=0x7f0a0043; public static final int phonies_spinner=0x7f0a0043;
public static final int pick_faceup=0x7f0a0044; public static final int pick_faceup=0x7f0a0044;
public static final int pick_lang=0x7f0a008a; public static final int pick_lang=0x7f0a008b;
public static final int pick_lang_spinner=0x7f0a008b; public static final int pick_lang_spinner=0x7f0a008c;
public static final int play_button=0x7f0a002b; public static final int play_button=0x7f0a002b;
public static final int player_list=0x7f0a0031; public static final int player_list=0x7f0a0031;
public static final int player_name_edit=0x7f0a0079; public static final int player_name_edit=0x7f0a0078;
public static final int player_view=0x7f0a0052;
public static final int players=0x7f0a0029; public static final int players=0x7f0a0029;
public static final int players_label=0x7f0a0030; public static final int players_label=0x7f0a0030;
public static final int prevhint_button_horizontal=0x7f0a0008; public static final int prevhint_button_horizontal=0x7f0a0008;
@ -239,10 +240,10 @@ public final class R {
public static final int progress_bar=0x7f0a0051; public static final int progress_bar=0x7f0a0051;
public static final int public_rooms_set=0x7f0a0039; public static final int public_rooms_set=0x7f0a0039;
public static final int refresh_button=0x7f0a003b; public static final int refresh_button=0x7f0a003b;
public static final int remote_check=0x7f0a0077; public static final int remote_check=0x7f0a0076;
public static final int revert_all=0x7f0a0081; public static final int revert_all=0x7f0a0080;
public static final int revert_colors=0x7f0a0080; public static final int revert_colors=0x7f0a007f;
public static final int robot_check=0x7f0a007b; public static final int robot_check=0x7f0a007a;
public static final int role=0x7f0a004f; public static final int role=0x7f0a004f;
public static final int room_edit=0x7f0a0037; public static final int room_edit=0x7f0a0037;
public static final int room_spinner=0x7f0a003a; public static final int room_spinner=0x7f0a003a;
@ -254,20 +255,20 @@ public final class R {
public static final int send_button=0x7f0a0017; public static final int send_button=0x7f0a0017;
public static final int show_remote=0x7f0a0022; public static final int show_remote=0x7f0a0022;
public static final int shuffle_button_horizontal=0x7f0a000a; public static final int shuffle_button_horizontal=0x7f0a000a;
public static final int slmenu_clear_sel=0x7f0a00cf; public static final int slmenu_clear_sel=0x7f0a00d0;
public static final int slmenu_copy_sel=0x7f0a00ce; public static final int slmenu_copy_sel=0x7f0a00cf;
public static final int slmenu_deselect_all=0x7f0a00cd; public static final int slmenu_deselect_all=0x7f0a00ce;
public static final int slmenu_lookup_sel=0x7f0a00cb; public static final int slmenu_lookup_sel=0x7f0a00cc;
public static final int slmenu_select_all=0x7f0a00cc; public static final int slmenu_select_all=0x7f0a00cd;
public static final int smart_robot=0x7f0a0042; public static final int smart_robot=0x7f0a0042;
public static final int sms_disabled=0x7f0a006b; public static final int sms_disabled=0x7f0a006a;
public static final int sms_phones=0x7f0a003d; public static final int sms_phones=0x7f0a003d;
public static final int sms_separator=0x7f0a006a; public static final int sms_separator=0x7f0a0069;
public static final int sms_stuff=0x7f0a006d; public static final int sms_stuff=0x7f0a006c;
public static final int state=0x7f0a004e; public static final int state=0x7f0a004e;
public static final int summary=0x7f0a0062; public static final int summary=0x7f0a0061;
public static final int text_item=0x7f0a0054; public static final int text_item=0x7f0a0053;
public static final int text_item2=0x7f0a0055; public static final int text_item2=0x7f0a0054;
public static final int thumbnail=0x7f0a004b; public static final int thumbnail=0x7f0a004b;
public static final int timer_minutes_edit=0x7f0a0041; public static final int timer_minutes_edit=0x7f0a0041;
public static final int timer_set=0x7f0a0040; public static final int timer_set=0x7f0a0040;
@ -281,9 +282,9 @@ public final class R {
public static final int word_edit=0x7f0a0024; public static final int word_edit=0x7f0a0024;
public static final int wordlen_max=0x7f0a0027; public static final int wordlen_max=0x7f0a0027;
public static final int wordlen_min=0x7f0a0026; public static final int wordlen_min=0x7f0a0026;
public static final int xlated_view=0x7f0a005d; public static final int xlated_view=0x7f0a005c;
public static final int xlated_view_blessed=0x7f0a005a; public static final int xlated_view_blessed=0x7f0a0059;
public static final int xlated_view_local=0x7f0a005c; public static final int xlated_view_local=0x7f0a005b;
public static final int zoom_button_horizontal=0x7f0a0010; public static final int zoom_button_horizontal=0x7f0a0010;
} }
public static final class layout { public static final class layout {
@ -320,10 +321,11 @@ public final class R {
public static final int player_list_elem=0x7f03001e; public static final int player_list_elem=0x7f03001e;
public static final int prefs_w_buttons=0x7f03001f; public static final int prefs_w_buttons=0x7f03001f;
public static final int relay_game_config=0x7f030020; public static final int relay_game_config=0x7f030020;
public static final int rename_game=0x7f030021; public static final int remote_dict_details=0x7f030021;
public static final int smsinviter=0x7f030022; public static final int rename_game=0x7f030022;
public static final int smsinviter_item=0x7f030023; public static final int smsinviter=0x7f030023;
public static final int studylist=0x7f030024; public static final int smsinviter_item=0x7f030024;
public static final int studylist=0x7f030025;
} }
public static final class menu { public static final class menu {
public static final int board_menu=0x7f090000; public static final int board_menu=0x7f090000;
@ -945,7 +947,7 @@ public final class R {
"%1$s". "%1$s".
*/ */
public static final int dict_lang_label_fmt=0x7f0600e7; public static final int dict_lang_label_fmt=0x7f0600e7;
public static final int dict_on_server=0x7f0602bf; public static final int dict_on_server=0x7f0602c0;
/** string name="invite_mime">text/plain</string /** string name="invite_mime">text/plain</string
*/ */
public static final int dict_url=0x7f060072; public static final int dict_url=0x7f060072;
@ -974,6 +976,11 @@ public final class R {
will use is substituted in for "%1$s". will use is substituted in for "%1$s".
*/ */
public static final int dicts_list_prompt_fmt=0x7f0600e8; public static final int dicts_list_prompt_fmt=0x7f0600e8;
/** text of item at bottom of dicts choice spinner. It
launches the browser pointed at the site where additional
wordlists can be found.
*/
public static final int download_dicts=0x7f0600ad;
public static final int download_done=0x7f060264; public static final int download_done=0x7f060264;
public static final int download_failed=0x7f060265; public static final int download_failed=0x7f060265;
public static final int download_path_title=0x7f060268; public static final int download_path_title=0x7f060268;
@ -1412,6 +1419,7 @@ public final class R {
different wordlists.) different wordlists.)
*/ */
public static final int lang_label=0x7f0600c6; public static final int lang_label=0x7f0600c6;
public static final int lang_name_fmt=0x7f0602c1;
public static final int langdict_label=0x7f0600c7; public static final int langdict_label=0x7f0600c7;
public static final int list_group_default=0x7f06026c; public static final int list_group_default=0x7f06026c;
public static final int list_group_delete=0x7f06026a; public static final int list_group_delete=0x7f06026a;
@ -1890,6 +1898,7 @@ public final class R {
the main Board screen the main Board screen
*/ */
public static final int not_again_zoom=0x7f0601d2; public static final int not_again_zoom=0x7f0601d2;
public static final int note_none=0x7f0602bf;
public static final int notify_body_fmt=0x7f0601b7; public static final int notify_body_fmt=0x7f0601b7;
/** This text is displayed as the "summary" for both of the /** This text is displayed as the "summary" for both of the
notify choices above, as extra information. (There could be notify choices above, as extra information. (There could be
@ -2564,7 +2573,6 @@ public final class R {
window title window title
*/ */
public static final int title_prefs=0x7f06012b; public static final int title_prefs=0x7f06012b;
public static final int title_remote_dicts=0x7f0600ad;
public static final int title_send_data_sms=0x7f06007e; public static final int title_send_data_sms=0x7f06007e;
/** If this preference is checked, tiles in the rack will be /** If this preference is checked, tiles in the rack will be
re-ordered alphabetically whenever tiles are added, re-ordered alphabetically whenever tiles are added,

View file

@ -4,20 +4,24 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="8dp" >
android:paddingRight="8dp">
<CheckBox android:id="@+id/show_remote" <CheckBox android:id="@+id/show_remote"
android:text="@string/show_remote" android:text="@string/show_remote"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:textSize="20dp"
/> />
<ListView android:id="@id/android:list" <ListView android:id="@id/android:list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_weight="1" android:layout_weight="1"
android:drawSelectorOnTop="false"/> android:drawSelectorOnTop="false"
/>
</LinearLayout> </LinearLayout>

View file

@ -1,44 +1,49 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<org.eehouse.android.xw4.XWListItem <org.eehouse.android.xw4.XWListItem
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/player_view" android:layout_width="fill_parent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_weight="1" android:focusable="true"
android:focusable="true" android:clickable="true"
android:clickable="true" android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceLarge" android:longClickable="true"
android:longClickable="true" android:background="@android:drawable/list_selector_background"
android:background="@android:drawable/list_selector_background" android:orientation="vertical"
> >
<CheckBox android:id="@+id/checkbox" <LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" >
/>
<TextView android:id="@+id/text_item" <CheckBox android:id="@+id/checkbox"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:visibility="gone"
android:textAppearance="?android:attr/textAppearanceMedium" />
/>
<TextView android:id="@+id/text_item2" <TextView android:id="@+id/text_item"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:gravity="right" android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
/>
<ImageButton android:id="@+id/del" <TextView android:id="@+id/text_item2"
android:layout_width="32dp" android:layout_width="wrap_content"
android:layout_height="32dp" android:layout_height="wrap_content"
android:src="@android:drawable/ic_delete" android:layout_weight="1"
android:visibility="invisible" android:gravity="right"
/> android:visibility="gone"
/>
</org.eehouse.android.xw4.XWListItem> <ImageButton android:id="@+id/del"
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@android:drawable/ic_delete"
android:visibility="invisible"
/>
</LinearLayout>
</org.eehouse.android.xw4.XWListItem>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
>
<TextView android:id="@+id/details"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
/>
<Button android:id="@+id/download_button"
android:text="@string/button_download"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

View file

@ -175,8 +175,12 @@
############################################################ ############################################################
--> -->
<!-- window title --> <!-- window title -->
<string name="title_dicts_list">Installed Crosswords Wordlists</string> <string name="title_dicts_list">Crosswords Wordlists</string>
<string name="title_remote_dicts">Available Crosswords Wordlists</string> <!-- text of item at bottom of dicts choice spinner. It
launches the browser pointed at the site where additional
wordlists can be found. -->
<string name="download_dicts">Download more…</string>
<!-- One of the strings used in the right column of the list of <!-- One of the strings used in the right column of the list of
installed wordlists to describe those that are part of installed wordlists to describe those that are part of
@ -2252,16 +2256,16 @@
<string name="delete_dicts">Delete wordlist[s]</string> <string name="delete_dicts">Delete wordlist[s]</string>
<string name="show_remote">Include downloadable</string> <string name="show_remote">Show downloadable</string>
<string name="update_dicts_fmt">Updates are available for one or more <string name="update_dicts_fmt">Updates are available for one or more
installed wordlists. Would you like to download the new installed wordlists. Would you like to download the new
version[s] of %1$s now?</string> version[s] of %1$s now?</string>
<string name="progress_title">Downloading</string> <string name="progress_title">Downloading</string>
<string name="dict_info_fmt">Wordlist %1$s is available for <string name="dict_info_fmt">Number of words: %1$d\nDownload size:
download.\n\nDetails:\nNumber of words: %2$d\nDownload size: %2$dK\nNote: %3$s</string>
%3$dK\nNote: %4$s</string> <string name="note_none">(None)</string>
<string name="dict_on_server">Downloadable</string> <string name="dict_on_server">Downloadable</string>
<string name="lang_name_fmt">%1$s (%2$d wordlists)</string>
</resources> </resources>

View file

@ -152,8 +152,11 @@
############################################################ ############################################################
--> -->
<!-- window title --> <!-- window title -->
<string name="title_dicts_list">Dellatsni Sdrowssorc Stsildrow</string> <string name="title_dicts_list">Sdrowssorc Stsildrow</string>
<string name="title_remote_dicts">Elbaliava Sdrowssorc Stsildrow</string> <!-- text of item at bottom of dicts choice spinner. It
launches the browser pointed at the site where additional
wordlists can be found. -->
<string name="download_dicts">Daolnwod erom…</string>
<!-- One of the strings used in the right column of the list of <!-- One of the strings used in the right column of the list of
installed wordlists to describe those that are part of installed wordlists to describe those that are part of
Crosswords and that cannot be uninstalled or moved. Crosswords and that cannot be uninstalled or moved.
@ -1928,13 +1931,14 @@
morf revres.</string> morf revres.</string>
<string name="getinfo">Teg ofni</string> <string name="getinfo">Teg ofni</string>
<string name="delete_dicts">Eteled ]s[tsildrow</string> <string name="delete_dicts">Eteled ]s[tsildrow</string>
<string name="show_remote">Edulcni elbadaolnwod</string> <string name="show_remote">Wohs elbadaolnwod</string>
<string name="update_dicts_fmt">Setadpu era elbaliava rof eno ro erom <string name="update_dicts_fmt">Setadpu era elbaliava rof eno ro erom
dellatsni stsildrow. Dluow uoy ekil ot daolnwod eht wen dellatsni stsildrow. Dluow uoy ekil ot daolnwod eht wen
]s[noisrev fo %1$s ?won</string> ]s[noisrev fo %1$s ?won</string>
<string name="progress_title">Gnidaolnwod</string> <string name="progress_title">Gnidaolnwod</string>
<string name="dict_info_fmt">Tsildrow %1$s si elbaliava rof <string name="dict_info_fmt">Rebmun fo sdrow: %1$d\nDaolnwod ezis:
daolnwod.\n\nSliated:\nRebmun fo sdrow: %2$d\nDaolnwod ezis: %2$dK\nEton: %3$s</string>
%3$dK\nEton: %4$s</string> <string name="note_none">)Enon(</string>
<string name="dict_on_server">Elbadaolnwod</string> <string name="dict_on_server">Elbadaolnwod</string>
<string name="lang_name_fmt">%1$s (%2$d )stsildrow</string>
</resources> </resources>

View file

@ -152,8 +152,11 @@
############################################################ ############################################################
--> -->
<!-- window title --> <!-- window title -->
<string name="title_dicts_list">INSTALLED CROSSWORDS WORDLISTS</string> <string name="title_dicts_list">CROSSWORDS WORDLISTS</string>
<string name="title_remote_dicts">AVAILABLE CROSSWORDS WORDLISTS</string> <!-- text of item at bottom of dicts choice spinner. It
launches the browser pointed at the site where additional
wordlists can be found. -->
<string name="download_dicts">DOWNLOAD MORE…</string>
<!-- One of the strings used in the right column of the list of <!-- One of the strings used in the right column of the list of
installed wordlists to describe those that are part of installed wordlists to describe those that are part of
Crosswords and that cannot be uninstalled or moved. Crosswords and that cannot be uninstalled or moved.
@ -1928,13 +1931,14 @@
FROM SERVER.</string> FROM SERVER.</string>
<string name="getinfo">GET INFO</string> <string name="getinfo">GET INFO</string>
<string name="delete_dicts">DELETE WORDLIST[S]</string> <string name="delete_dicts">DELETE WORDLIST[S]</string>
<string name="show_remote">INCLUDE DOWNLOADABLE</string> <string name="show_remote">SHOW DOWNLOADABLE</string>
<string name="update_dicts_fmt">UPDATES ARE AVAILABLE FOR ONE OR MORE <string name="update_dicts_fmt">UPDATES ARE AVAILABLE FOR ONE OR MORE
INSTALLED WORDLISTS. WOULD YOU LIKE TO DOWNLOAD THE NEW INSTALLED WORDLISTS. WOULD YOU LIKE TO DOWNLOAD THE NEW
VERSION[S] OF %1$s NOW?</string> VERSION[S] OF %1$s NOW?</string>
<string name="progress_title">DOWNLOADING</string> <string name="progress_title">DOWNLOADING</string>
<string name="dict_info_fmt">WORDLIST %1$s IS AVAILABLE FOR <string name="dict_info_fmt">NUMBER OF WORDS: %1$d\nDOWNLOAD SIZE:
DOWNLOAD.\n\nDETAILS:\nNUMBER OF WORDS: %2$d\nDOWNLOAD SIZE: %2$dK\nNOTE: %3$s</string>
%3$dK\nNOTE: %4$s</string> <string name="note_none">(NONE)</string>
<string name="dict_on_server">DOWNLOADABLE</string> <string name="dict_on_server">DOWNLOADABLE</string>
<string name="lang_name_fmt">%1$s (%2$d WORDLISTS)</string>
</resources> </resources>

View file

@ -42,12 +42,6 @@ public class BoardActivity extends XWActivity {
} }
} // onCreate } // onCreate
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data )
{
m_dlgt.onActivityResult( requestCode, resultCode, data );
}
@Override @Override
public void onWindowFocusChanged( boolean hasFocus ) public void onWindowFocusChanged( boolean hasFocus )
{ {

View file

@ -1138,7 +1138,8 @@ public class BoardDelegate extends DelegateBase
////////////////////////////////////////////////// //////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface // DwnldActivity.DownloadFinishedListener interface
////////////////////////////////////////////////// //////////////////////////////////////////////////
public void downloadFinished( final String name, final boolean success ) public void downloadFinished( String lang, final String name,
boolean success )
{ {
if ( success ) { if ( success ) {
post( new Runnable() { post( new Runnable() {

View file

@ -68,14 +68,11 @@ public class DelegateBase implements DlgDelegate.DlgClickNotify,
protected void onDestroy() {} protected void onDestroy() {}
protected boolean onBackPressed() { return false; } protected boolean onBackPressed() { return false; }
protected void prepareDialog( DlgID dlgID, Dialog dialog ) {} protected void prepareDialog( DlgID dlgID, Dialog dialog ) {}
protected void onActivityResult( int requestCode, int resultCode,
// public boolean onOptionsItemSelected( MenuItem item ) Intent data ) {}
// {
// }
public boolean onCreateOptionsMenu( Menu menu ) public boolean onCreateOptionsMenu( Menu menu )
{ {
DbgUtils.logf( "DelegateBase.onCreateOptionsMenu()" );
boolean handled = 0 < m_optionsMenuID; boolean handled = 0 < m_optionsMenuID;
if ( handled ) { if ( handled ) {
m_activity.getMenuInflater().inflate( m_optionsMenuID, menu ); m_activity.getMenuInflater().inflate( m_optionsMenuID, menu );

View file

@ -41,7 +41,9 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.json.JSONArray; import org.json.JSONArray;
@ -69,28 +71,39 @@ public class DictsDelegate extends ListDelegateBase
implements View.OnClickListener, AdapterView.OnItemLongClickListener, implements View.OnClickListener, AdapterView.OnItemLongClickListener,
SelectableItem, MountEventReceiver.SDCardNotifiee, SelectableItem, MountEventReceiver.SDCardNotifiee,
DlgDelegate.DlgClickNotify, GroupStateListener, DlgDelegate.DlgClickNotify, GroupStateListener,
DwnldDelegate.DownloadFinishedListener { DwnldDelegate.DownloadFinishedListener,
XWListItem.ExpandedListener {
protected static final String DICT_DOLAUNCH = "do_launch"; protected static final String DICT_SHOWREMOTE = "do_launch";
protected static final String DICT_LANG_EXTRA = "use_lang"; protected static final String DICT_LANG_EXTRA = "use_lang";
protected static final String DICT_NAME_EXTRA = "use_dict"; protected static final String DICT_NAME_EXTRA = "use_dict";
protected static final String RESULT_LAST_LANG = "last_lang";
protected static final String RESULT_LAST_DICT = "last_dict";
private static final int SEL_LOCAL = 0; private static final int SEL_LOCAL = 0;
private static final int SEL_REMOTE = 1; private static final int SEL_REMOTE = 1;
private ListActivity m_activity; private ListActivity m_activity;
private Set<String> m_closedLangs; private Set<String> m_closedLangs;
private Set<DictInfo> m_expandedItems;
private DictListAdapter m_adapter; private DictListAdapter m_adapter;
private boolean m_quickFetchMode;
private String[] m_langs; private String[] m_langs;
private ListView m_listView; private ListView m_listView;
private CheckBox m_checkbox; private CheckBox m_checkbox;
private String[] m_locNames; private String[] m_locNames;
private String m_finishOnName;
private Map<String, XWListItem> m_selDicts; private Map<String, XWListItem> m_selDicts;
private String m_origTitle; private String m_origTitle;
private boolean m_showRemote = false; private boolean m_showRemote = false;
private String m_filterLang;
private Map<String, String> m_needUpdates; private Map<String, String> m_needUpdates;
private HashMap<String, XWListItem> m_curDownloads; private HashMap<String, XWListItem> m_curDownloads;
private String m_onServerStr; private String m_onServerStr;
private String m_lastLang;
private String m_lastDict;
private String m_noteNone;
private static class DictInfo implements Comparable { private static class DictInfo implements Comparable {
public String m_name; public String m_name;
@ -99,18 +112,29 @@ public class DictsDelegate extends ListDelegateBase
public int m_nWords; public int m_nWords;
public long m_nBytes; public long m_nBytes;
public String m_note; public String m_note;
public DictInfo( String name, String lang, int nWords, long nBytes ) { public DictInfo( String name, String lang, int nWords, long nBytes,
String note )
{
m_name = name; m_name = name;
m_lang = lang; m_lang = lang;
m_nWords = nWords; m_nWords = nWords;
m_nBytes = nBytes; m_nBytes = nBytes;
m_note = "This is the note"; m_note = note;
} }
public int compareTo( Object obj ) { public int compareTo( Object obj ) {
DictInfo other = (DictInfo)obj; DictInfo other = (DictInfo)obj;
return m_name.compareTo( other.m_name ); return m_name.compareTo( other.m_name );
} }
} }
private static class LangInfo {
int m_numDicts;
int m_posn;
public LangInfo( int posn, int numDicts )
{
m_posn = posn;
m_numDicts = numDicts;
}
}
private HashMap<String, DictAndLoc[]> m_localInfo; private HashMap<String, DictAndLoc[]> m_localInfo;
private HashMap<String, DictInfo[]> m_remoteInfo; private HashMap<String, DictInfo[]> m_remoteInfo;
@ -133,15 +157,18 @@ public class DictsDelegate extends ListDelegateBase
ArrayList<Object> alist = new ArrayList<Object>(); ArrayList<Object> alist = new ArrayList<Object>();
int nLangs = m_langs.length; int nLangs = m_langs.length;
for ( int ii = 0; ii < nLangs; ++ii ) { for ( int ii = 0; ii < nLangs; ++ii ) {
alist.add( new Integer(ii) );
String langName = m_langs[ii]; String langName = m_langs[ii];
if ( m_closedLangs.contains( langName ) ) { if ( null != m_filterLang &&
! m_filterLang.equals(langName) ) {
continue; continue;
} }
ArrayList<Object> items = makeLangItems( langName ); ArrayList<Object> items = makeLangItems( langName );
alist.addAll( items );
alist.add( new LangInfo( ii, items.size() ) );
if ( ! m_closedLangs.contains( langName ) ) {
alist.addAll( items );
}
} }
m_listInfo = alist.toArray( new Object[alist.size()] ); m_listInfo = alist.toArray( new Object[alist.size()] );
} }
@ -157,14 +184,17 @@ public class DictsDelegate extends ListDelegateBase
View result = null; View result = null;
Object obj = m_listInfo[position]; Object obj = m_listInfo[position];
if ( obj instanceof Integer ) { if ( obj instanceof LangInfo ) {
int groupPos = (Integer)obj; LangInfo info = (LangInfo)obj;
int groupPos = info.m_posn;
String langName = m_langs[groupPos]; String langName = m_langs[groupPos];
int langCode = DictLangCache.getLangLangCode( m_context, int langCode = DictLangCache.getLangLangCode( m_context,
langName ); langName );
boolean expanded = ! m_closedLangs.contains( langName ); boolean expanded = ! m_closedLangs.contains( langName );
result = ListGroup.make( m_context, DictsDelegate.this, groupPos, String name = getString( R.string.lang_name_fmt, langName,
langName, expanded ); info.m_numDicts );
result = ListGroup.make( m_context, DictsDelegate.this,
groupPos, name, expanded );
} else if ( obj instanceof DictAndLoc ) { } else if ( obj instanceof DictAndLoc ) {
DictAndLoc dal = (DictAndLoc)obj; DictAndLoc dal = (DictAndLoc)obj;
XWListItem item = XWListItem item =
@ -176,7 +206,7 @@ public class DictsDelegate extends ListDelegateBase
DictLoc loc = dal.loc; DictLoc loc = dal.loc;
item.setComment( m_locNames[loc.ordinal()] ); item.setComment( m_locNames[loc.ordinal()] );
item.cache( loc ); item.setCached( loc );
item.setOnClickListener( DictsDelegate.this ); item.setOnClickListener( DictsDelegate.this );
@ -193,12 +223,12 @@ public class DictsDelegate extends ListDelegateBase
String name = info.m_name; String name = info.m_name;
item.setText( name ); item.setText( name );
item.setCached( info );
item.setOnClickListener( DictsDelegate.this ); item.setExpandedListener( DictsDelegate.this );
item.setExpanded( m_expandedItems.contains( info ) );
item.setComment( m_onServerStr ); item.setComment( m_onServerStr );
item.cache( info );
if ( m_selDicts.containsKey( name ) ) { if ( m_selDicts.containsKey( name ) ) {
m_selDicts.put( name, item ); m_selDicts.put( name, item );
item.setSelected( true ); item.setSelected( true );
@ -215,7 +245,7 @@ public class DictsDelegate extends ListDelegateBase
asList.addAll( Arrays.asList( m_listInfo ) ); asList.addAll( Arrays.asList( m_listInfo ) );
int indx = findLangItem( langName ) + 1; int indx = findLangItem( langName ) + 1;
while ( indx < asList.size() && ! (asList.get(indx) instanceof Integer) ) { while ( indx < asList.size() && ! (asList.get(indx) instanceof LangInfo) ) {
asList.remove( indx ); asList.remove( indx );
} }
@ -247,7 +277,7 @@ public class DictsDelegate extends ListDelegateBase
} }
} }
if ( m_showRemote ) { if ( m_showRemote && null != m_remoteInfo ) {
DictInfo[] infos = m_remoteInfo.get( langName ); DictInfo[] infos = m_remoteInfo.get( langName );
if ( null != infos ) { if ( null != infos ) {
for ( DictInfo info : infos ) { for ( DictInfo info : infos ) {
@ -274,8 +304,8 @@ public class DictsDelegate extends ListDelegateBase
int nLangs = m_langs.length; int nLangs = m_langs.length;
for ( int ii = 0; ii < m_listInfo.length; ++ii ) { for ( int ii = 0; ii < m_listInfo.length; ++ii ) {
Object obj = m_listInfo[ii]; Object obj = m_listInfo[ii];
if ( obj instanceof Integer ) { if ( obj instanceof LangInfo ) {
if ( m_langs[(Integer)obj].equals( langName ) ) { if ( m_langs[((LangInfo)obj).m_posn].equals( langName ) ) {
result = ii; result = ii;
break; break;
} }
@ -331,7 +361,7 @@ public class DictsDelegate extends ListDelegateBase
name, fromLoc, name, fromLoc,
toLoc ) ) { toLoc ) ) {
selItem.setComment( m_locNames[toLoc.ordinal()] ); selItem.setComment( m_locNames[toLoc.ordinal()] );
selItem.cache( toLoc ); selItem.setCached( toLoc );
selItem.invalidate(); selItem.invalidate();
DBUtils.dictsMoveInfo( m_activity, name, DBUtils.dictsMoveInfo( m_activity, name,
fromLoc, toLoc ); fromLoc, toLoc );
@ -433,7 +463,10 @@ public class DictsDelegate extends ListDelegateBase
m_closedLangs.addAll( Arrays.asList( closed ) ); m_closedLangs.addAll( Arrays.asList( closed ) );
} }
m_expandedItems = new HashSet<DictInfo>();
m_locNames = getStringArray( R.array.loc_names ); m_locNames = getStringArray( R.array.loc_names );
m_noteNone = getString( R.string.note_none );
setContentView( R.layout.dict_browse ); setContentView( R.layout.dict_browse );
m_listView = getListView(); m_listView = getListView();
@ -449,11 +482,24 @@ public class DictsDelegate extends ListDelegateBase
if ( MultiService.isMissingDictIntent( intent ) ) { if ( MultiService.isMissingDictIntent( intent ) ) {
showDialog( DlgID.DICT_OR_DECLINE ); showDialog( DlgID.DICT_OR_DECLINE );
} else { } else {
boolean downloadNow = intent.getBooleanExtra( DICT_DOLAUNCH, false ); boolean showRemote = intent.getBooleanExtra( DICT_SHOWREMOTE,
if ( downloadNow ) { false );
if ( showRemote ) {
m_quickFetchMode = true;
m_showRemote = true;
m_checkbox.setVisibility( View.GONE );
int lang = intent.getIntExtra( DICT_LANG_EXTRA, 0 ); int lang = intent.getIntExtra( DICT_LANG_EXTRA, 0 );
if ( 0 < lang ) {
m_filterLang = DictLangCache.getLangNames( m_activity )[lang];
}
String name = intent.getStringExtra( DICT_NAME_EXTRA ); String name = intent.getStringExtra( DICT_NAME_EXTRA );
startDownload( lang, name ); if ( null == name ) {
new FetchListTask( m_activity ).execute();
} else {
m_finishOnName = name;
startDownload( lang, name );
}
} }
downloadNewDict( intent ); downloadNewDict( intent );
@ -485,20 +531,8 @@ public class DictsDelegate extends ListDelegateBase
switchShowingRemote( m_checkbox.isChecked() ); switchShowingRemote( m_checkbox.isChecked() );
} else { } else {
XWListItem item = (XWListItem)view; XWListItem item = (XWListItem)view;
Object obj = item.getCached(); DictBrowseDelegate.launch( m_activity, item.getText(),
if ( obj instanceof DictLoc ) { (DictLoc)item.getCached() );
DictBrowseDelegate.launch( m_activity, item.getText(),
(DictLoc)obj );
} else {
DictInfo info = (DictInfo)obj;
long kBytes = (info.m_nBytes + 999) / 1000;
String msg = getString( R.string.dict_info_fmt, info.m_name,
info.m_nWords, kBytes, info.m_note );
int langCode = DictLangCache.getLangLangCode( m_activity, info.m_lang );
showConfirmThen( msg, R.string.button_download,
Action.DOWNLOAD_DICT_ACTION,
langCode, info.m_name );
}
} }
} }
@ -507,6 +541,15 @@ public class DictsDelegate extends ListDelegateBase
boolean handled = 0 < m_selDicts.size(); boolean handled = 0 < m_selDicts.size();
if ( handled ) { if ( handled ) {
clearSelections(); clearSelections();
} else {
Intent intent = new Intent();
if ( null != m_lastLang ) {
intent.putExtra( RESULT_LAST_LANG, m_lastLang );
}
if ( null != m_lastDict ) {
intent.putExtra( RESULT_LAST_DICT, m_lastDict );
}
setResult( Activity.RESULT_OK, intent );
} }
return handled; return handled;
} }
@ -751,11 +794,6 @@ public class DictsDelegate extends ListDelegateBase
} }
clearSelections(); clearSelections();
break; break;
case DOWNLOAD_DICT_ACTION:
int lang = (Integer)params[0];
String name = (String)params[1];
DwnldDelegate.downloadDictInBack( m_activity, lang, name, this );
break;
case UPDATE_DICTS_ACTION: case UPDATE_DICTS_ACTION:
String[] urls = m_needUpdates.values(). String[] urls = m_needUpdates.values().
toArray( new String[m_needUpdates.size()] ); toArray( new String[m_needUpdates.size()] );
@ -791,7 +829,7 @@ public class DictsDelegate extends ListDelegateBase
{ {
Set<String> langs = new HashSet<String>(); Set<String> langs = new HashSet<String>();
langs.addAll( Arrays.asList(DictLangCache.listLangs( m_activity )) ); langs.addAll( Arrays.asList(DictLangCache.listLangs( m_activity )) );
if ( m_showRemote ) { if ( m_showRemote && null != m_remoteInfo ) {
langs.addAll( m_remoteInfo.keySet() ); langs.addAll( m_remoteInfo.keySet() );
} }
m_langs = langs.toArray( new String[langs.size()] ); m_langs = langs.toArray( new String[langs.size()] );
@ -907,11 +945,11 @@ public class DictsDelegate extends ListDelegateBase
// return mkDownloadIntent( context, dict_url ); // return mkDownloadIntent( context, dict_url );
} }
public static void launchAndDownload( Activity activity, int lang, public static void launchForResult( Activity activity, int requestCode,
String name ) int lang, String name )
{ {
Intent intent = new Intent( activity, DictsActivity.class ); Intent intent = new Intent( activity, DictsActivity.class );
intent.putExtra( DICT_DOLAUNCH, true ); intent.putExtra( DICT_SHOWREMOTE, true );
if ( lang > 0 ) { if ( lang > 0 ) {
intent.putExtra( DICT_LANG_EXTRA, lang ); intent.putExtra( DICT_LANG_EXTRA, lang );
} }
@ -920,22 +958,66 @@ public class DictsDelegate extends ListDelegateBase
intent.putExtra( DICT_NAME_EXTRA, name ); intent.putExtra( DICT_NAME_EXTRA, name );
} }
activity.startActivity( intent ); activity.startActivityForResult( intent, requestCode );
} }
public static void launchAndDownload( Activity activity, int lang ) public static void launchForResult( Activity activity, int requestCode,
int lang )
{ {
launchAndDownload( activity, lang, null ); launchForResult( activity, requestCode, lang, null );
} }
public static void launchAndDownload( Activity activity ) public static void launchForResult( Activity activity, int requestCode )
{ {
launchAndDownload( activity, 0, null ); launchForResult( activity, requestCode, 0, null );
} }
//////////////////////////////////////////////////////////////////////
// XWListItem.ExpandedListener interface
//////////////////////////////////////////////////////////////////////
public void expanded( XWListItem me, boolean expanded )
{
final DictInfo info = (DictInfo)me.getCached();
if ( expanded ) {
m_expandedItems.add( info ); // may already be there
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 ) {
int langCode = DictLangCache.getLangLangCode( m_activity,
info.m_lang );
DwnldDelegate.downloadDictInBack( m_activity, langCode,
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,
kBytes, note );
TextView summary = (TextView)view.findViewById( R.id.details );
summary.setText( msg );
me.addExpandedView( view );
} else {
me.removeExpandedView();
m_expandedItems.remove( info );
}
}
//////////////////////////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface // DwnldActivity.DownloadFinishedListener interface
public void downloadFinished( String name, final boolean success ) //////////////////////////////////////////////////////////////////////
public void downloadFinished( String lang, final String name,
final boolean success )
{ {
if ( success && m_showRemote ) {
m_lastLang = lang;
m_lastDict = name;
}
if ( m_launchedForMissing ) { if ( m_launchedForMissing ) {
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
@ -944,6 +1026,9 @@ public class DictsDelegate extends ListDelegateBase
if ( MultiService.returnOnDownload( m_activity, if ( MultiService.returnOnDownload( m_activity,
intent ) ) { intent ) ) {
finish(); finish();
} else if ( null != m_finishOnName
&& m_finishOnName.equals( name ) ) {
finish();
} }
} else { } else {
showToast( R.string.download_failed ); showToast( R.string.download_failed );
@ -987,6 +1072,7 @@ public class DictsDelegate extends ListDelegateBase
{ {
boolean success = false; boolean success = false;
JSONArray langs = null; JSONArray langs = null;
m_needUpdates = new HashMap<String, String>(); m_needUpdates = new HashMap<String, String>();
if ( null != jsonData ) { if ( null != jsonData ) {
Set<String> closedLangs = new HashSet<String>(); Set<String> closedLangs = new HashSet<String>();
@ -1005,6 +1091,10 @@ public class DictsDelegate extends ListDelegateBase
for ( int ii = 0; ii < nLangs; ++ii ) { for ( int ii = 0; ii < nLangs; ++ii ) {
JSONObject langObj = langs.getJSONObject( ii ); JSONObject langObj = langs.getJSONObject( ii );
String langName = langObj.getString( "lang" ); String langName = langObj.getString( "lang" );
if ( null != m_filterLang && ! m_filterLang.equals( langName ) ) {
continue;
}
if ( ! curLangs.contains( langName ) ) { if ( ! curLangs.contains( langName ) ) {
closedLangs.add( langName ); closedLangs.add( langName );
@ -1019,24 +1109,32 @@ public class DictsDelegate extends ListDelegateBase
name = DictUtils.removeDictExtn( name ); name = DictUtils.removeDictExtn( name );
long nBytes = dict.optLong( "nBytes", -1 ); long nBytes = dict.optLong( "nBytes", -1 );
int nWords = dict.optInt( "nWords", -1 ); int nWords = dict.optInt( "nWords", -1 );
DictInfo info = new DictInfo( name, langName, nWords, nBytes ); String note = dict.optString( "note" );
if ( DictLangCache.haveDict( m_activity, langName, name ) ) { if ( 0 == note.length() ) {
boolean matches = true; note = null;
String curSum = DictLangCache.getDictMD5Sum( m_activity, name ); }
if ( null != curSum ) { DictInfo info = new DictInfo( name, langName, nWords, nBytes, note );
JSONArray sums = dict.getJSONArray("md5sums");
if ( null != sums ) { if ( !m_quickFetchMode ) {
matches = false; // Check if we have it and it needs an update
for ( int kk = 0; !matches && kk < sums.length(); ++kk ) { if ( DictLangCache.haveDict( m_activity, langName, name ) ) {
String sum = sums.getString( kk ); boolean matches = true;
matches = sum.equals( curSum ); String curSum = DictLangCache.getDictMD5Sum( m_activity, name );
if ( null != curSum ) {
JSONArray sums = dict.getJSONArray("md5sums");
if ( null != sums ) {
matches = false;
for ( int kk = 0; !matches && kk < sums.length(); ++kk ) {
String sum = sums.getString( kk );
matches = sum.equals( curSum );
}
} }
} }
} if ( !matches ) {
if ( !matches ) { DbgUtils.logf( "adding %s to set needing update", name );
DbgUtils.logf( "adding %s to set needing update", name ); String url = Utils.makeDictUrl( m_activity, langName, name );
String url = Utils.makeDictUrl( m_activity, langName, name ); m_needUpdates.put( name, url );
m_needUpdates.put( name, url ); }
} }
} }
dictNames.add( info ); dictNames.add( info );

View file

@ -79,7 +79,6 @@ public class DlgDelegate {
// Dict Browser // Dict Browser
FINISH_ACTION, FINISH_ACTION,
DELETE_DICT_ACTION, DELETE_DICT_ACTION,
DOWNLOAD_DICT_ACTION,
UPDATE_DICTS_ACTION, UPDATE_DICTS_ACTION,
// Game configs // Game configs
@ -168,7 +167,6 @@ public class DlgDelegate {
public Dialog createDialog( int id ) public Dialog createDialog( int id )
{ {
// DbgUtils.logf("createDialog(id=%d)", id );
Dialog dialog = null; Dialog dialog = null;
DlgID dlgID = DlgID.values()[id]; DlgID dlgID = DlgID.values()[id];
DlgState state = findForID( dlgID ); DlgState state = findForID( dlgID );
@ -208,7 +206,7 @@ public class DlgDelegate {
// Assert.assertNull( m_dlgStates ); // Assert.assertNull( m_dlgStates );
DlgState state = new DlgState( DlgID.DIALOG_OKONLY, msg, action ); DlgState state = new DlgState( DlgID.DIALOG_OKONLY, msg, action );
addState( state ); addState( state );
m_activity.showDialog( DlgID.DIALOG_OKONLY.ordinal() ); showDialog( DlgID.DIALOG_OKONLY );
} }
public void showOKOnlyDialog( int msgID ) public void showOKOnlyDialog( int msgID )
@ -218,12 +216,12 @@ public class DlgDelegate {
public void showDictGoneFinish() public void showDictGoneFinish()
{ {
m_activity.showDialog( DlgID.DLG_DICTGONE.ordinal() ); showDialog( DlgID.DLG_DICTGONE );
} }
public void showAboutDialog() public void showAboutDialog()
{ {
m_activity.showDialog( DlgID.DIALOG_ABOUT.ordinal() ); showDialog( DlgID.DIALOG_ABOUT );
} }
public void showNotAgainDlgThen( int msgID, int prefsKey, public void showNotAgainDlgThen( int msgID, int prefsKey,
@ -256,7 +254,7 @@ public class DlgDelegate {
new DlgState( DlgID.DIALOG_NOTAGAIN, msg, action, prefsKey, new DlgState( DlgID.DIALOG_NOTAGAIN, msg, action, prefsKey,
params ); params );
addState( state ); addState( state );
m_activity.showDialog( DlgID.DIALOG_NOTAGAIN.ordinal() ); showDialog( DlgID.DIALOG_NOTAGAIN );
} }
} }
@ -305,7 +303,7 @@ public class DlgDelegate {
DlgState state = new DlgState( DlgID.CONFIRM_THEN, msg, posButton, DlgState state = new DlgState( DlgID.CONFIRM_THEN, msg, posButton,
action, 0, params ); action, 0, params );
addState( state ); addState( state );
m_activity.showDialog( DlgID.CONFIRM_THEN.ordinal() ); showDialog( DlgID.CONFIRM_THEN );
} }
public void showInviteChoicesThen( final Action action ) public void showInviteChoicesThen( final Action action )
@ -314,7 +312,7 @@ public class DlgDelegate {
|| NFCUtils.nfcAvail( m_activity )[0] ) { || NFCUtils.nfcAvail( m_activity )[0] ) {
DlgState state = new DlgState( DlgID.INVITE_CHOICES_THEN, action ); DlgState state = new DlgState( DlgID.INVITE_CHOICES_THEN, action );
addState( state ); addState( state );
m_activity.showDialog( DlgID.INVITE_CHOICES_THEN.ordinal() ); showDialog( DlgID.INVITE_CHOICES_THEN );
} else { } else {
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
@ -337,9 +335,13 @@ public class DlgDelegate {
public void launchLookup( String[] words, int lang, boolean noStudyOption ) public void launchLookup( String[] words, int lang, boolean noStudyOption )
{ {
Bundle params = LookupAlert.makeParams( words, lang, noStudyOption ); if ( LookupAlert.needAlert( m_activity, words, lang ) ) {
addState( new DlgState( DlgID.LOOKUP, new Object[]{params} ) ); Bundle params = LookupAlert.makeParams( words, lang, noStudyOption );
m_activity.showDialog( DlgID.LOOKUP.ordinal() ); addState( new DlgState( DlgID.LOOKUP, new Object[]{params} ) );
showDialog( DlgID.LOOKUP );
} else {
LookupAlert.launchWordLookup( m_activity, words[0], lang );
}
} }
public void startProgress( int id ) public void startProgress( int id )
@ -451,7 +453,7 @@ public class DlgDelegate {
{ {
DlgState state = findForID( DlgID.LOOKUP ); DlgState state = findForID( DlgID.LOOKUP );
Bundle bundle = (Bundle)state.m_params[0]; Bundle bundle = (Bundle)state.m_params[0];
return LookupAlert.createDialog( m_activity, bundle ); return LookupAlert.makeDialog( m_activity, bundle );
} }
private Dialog createOKDialog( DlgState state, DlgID dlgID ) private Dialog createOKDialog( DlgState state, DlgID dlgID )

View file

@ -27,6 +27,7 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
@ -57,7 +58,7 @@ public class DwnldDelegate extends ListDelegateBase {
private ArrayList<LinearLayout> m_views; private ArrayList<LinearLayout> m_views;
public interface DownloadFinishedListener { public interface DownloadFinishedListener {
void downloadFinished( String name, boolean success ); void downloadFinished( String lang, String name, boolean success );
} }
public DwnldDelegate( ListActivity activity, Bundle savedInstanceState ) public DwnldDelegate( ListActivity activity, Bundle savedInstanceState )
@ -298,6 +299,14 @@ public class DwnldDelegate extends ListDelegateBase {
return new File(path).getName(); return new File(path).getName();
} }
private static String langFromUrl( String url )
{
String[] parts = TextUtils.split( url, "/" );
String result = parts[parts.length - 2];
// DbgUtils.logf( "langFromUrl(%s) => %s", url, result );
return result;
}
private static void rememberListener( String url, String name, private static void rememberListener( String url, String name,
DownloadFinishedListener lstnr ) DownloadFinishedListener lstnr )
{ {
@ -328,10 +337,11 @@ public class DwnldDelegate extends ListDelegateBase {
} }
if ( null != ld ) { if ( null != ld ) {
String name = ld.m_name; String name = ld.m_name;
String lang = langFromUrl( url );
if ( null == name ) { if ( null == name ) {
name = uri.toString(); name = uri.toString();
} }
ld.m_lstnr.downloadFinished( name, success ); ld.m_lstnr.downloadFinished( lang, name, success );
} }
} }
} }

View file

@ -58,6 +58,8 @@ public class GameConfigDelegate extends DelegateBase
,RefreshNamesTask.NoNameFound { ,RefreshNamesTask.NoNameFound {
private static final String WHICH_PLAYER = "WHICH_PLAYER"; private static final String WHICH_PLAYER = "WHICH_PLAYER";
private static final int REQUEST_LANG = 1;
private static final int REQUEST_DICT = 2;
private Activity m_activity; private Activity m_activity;
private CheckBox m_joinPublicCheck; private CheckBox m_joinPublicCheck;
@ -74,6 +76,7 @@ public class GameConfigDelegate extends DelegateBase
private View m_connectSetRelay; private View m_connectSetRelay;
private View m_connectSetSMS; private View m_connectSetSMS;
private Spinner m_dictSpinner; private Spinner m_dictSpinner;
private Spinner m_playerDictSpinner;
private Spinner m_roomChoose; private Spinner m_roomChoose;
// private Button m_configureButton; // private Button m_configureButton;
private long m_rowid; private long m_rowid;
@ -314,11 +317,12 @@ public class GameConfigDelegate extends DelegateBase
} else { } else {
dictLabel.setVisibility( View.GONE ); dictLabel.setVisibility( View.GONE );
} }
Spinner dictSpinner = (Spinner)dialog.findViewById( R.id.dict_spinner ); m_playerDictSpinner = (Spinner)dialog.findViewById( R.id.dict_spinner );
if ( localOnlyGame() ) { if ( localOnlyGame() ) {
configDictSpinner( dictSpinner, m_gi.dictLang, m_gi.dictName(lp) ); configDictSpinner( m_playerDictSpinner, m_gi.dictLang, m_gi.dictName(lp) );
} else { } else {
dictSpinner.setVisibility( View.GONE ); m_playerDictSpinner.setVisibility( View.GONE );
m_playerDictSpinner = null;
} }
final View localSet = dialog.findViewById( R.id.local_player_set ); final View localSet = dialog.findViewById( R.id.local_player_set );
@ -364,10 +368,13 @@ public class GameConfigDelegate extends DelegateBase
lp.password = Utils.getText( dialog, R.id.password_edit ); lp.password = Utils.getText( dialog, R.id.password_edit );
if ( localOnlyGame() ) { if ( localOnlyGame() ) {
Spinner spinner = {
(Spinner)((Dialog)di).findViewById( R.id.dict_spinner ); Spinner spinner =
int position = spinner.getSelectedItemPosition(); (Spinner)((Dialog)di).findViewById( R.id.dict_spinner );
SpinnerAdapter adapter = spinner.getAdapter(); Assert.assertTrue( m_playerDictSpinner == spinner );
}
int position = m_playerDictSpinner.getSelectedItemPosition();
SpinnerAdapter adapter = m_playerDictSpinner.getAdapter();
if ( null != adapter && position < adapter.getCount() ) { if ( null != adapter && position < adapter.getCount() ) {
String name = (String)adapter.getItem( position ); String name = (String)adapter.getItem( position );
@ -391,8 +398,8 @@ public class GameConfigDelegate extends DelegateBase
// sdk_int = Integer.decode( android.os.Build.VERSION.SDK ); // sdk_int = Integer.decode( android.os.Build.VERSION.SDK );
// } catch ( Exception ex ) {} // } catch ( Exception ex ) {}
// m_canDoSMS = sdk_int >= android.os.Build.VERSION_CODES.DONUT; // m_canDoSMS = sdk_int >= android.os.Build.VERSION_CODES.DONUT;
// m_browseText = getString( R.string.download_dicts ); m_browseText = getString( R.string.download_dicts );
// DictLangCache.setLast( m_browseText ); DictLangCache.setLast( m_browseText );
m_cp = CommonPrefs.get( m_activity ); m_cp = CommonPrefs.get( m_activity );
@ -417,11 +424,10 @@ public class GameConfigDelegate extends DelegateBase
m_playButton.setOnClickListener( this ); m_playButton.setOnClickListener( this );
m_playerLayout = (LinearLayout)findViewById( R.id.player_list ); m_playerLayout = (LinearLayout)findViewById( R.id.player_list );
m_langSpinner = (Spinner)findViewById( R.id.lang_spinner );
m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner ); m_phoniesSpinner = (Spinner)findViewById( R.id.phonies_spinner );
m_boardsizeSpinner = (Spinner)findViewById( R.id.boardsize_spinner ); m_boardsizeSpinner = (Spinner)findViewById( R.id.boardsize_spinner );
m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot ); m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot );
} // onCreate } // init
protected void onStart() protected void onStart()
{ {
@ -449,6 +455,25 @@ public class GameConfigDelegate extends DelegateBase
outState.putInt( WHICH_PLAYER, m_whichPlayer ); outState.putInt( WHICH_PLAYER, m_whichPlayer );
} }
@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data )
{
if ( Activity.RESULT_CANCELED != resultCode ) {
switch( requestCode ) {
case REQUEST_DICT:
String dictName = data.getStringExtra( DictsDelegate.RESULT_LAST_DICT );
setSpinnerSelection( m_playerDictSpinner, dictName );
break;
case REQUEST_LANG:
String langName = data.getStringExtra( DictsDelegate.RESULT_LAST_LANG );
setSpinnerSelection( m_langSpinner, langName );
break;
default:
Assert.fail();
}
}
}
private void loadGame() private void loadGame()
{ {
if ( null == m_giOrig ) { if ( null == m_giOrig ) {
@ -740,8 +765,8 @@ public class GameConfigDelegate extends DelegateBase
(String)parentView.getItemAtPosition( position ); (String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) { if ( chosen.equals( m_browseText ) ) {
DictsDelegate.launchAndDownload( m_activity, DictsDelegate.launchForResult( m_activity, REQUEST_DICT,
m_gi.dictLang ); m_gi.dictLang );
} }
} }
@ -757,40 +782,43 @@ public class GameConfigDelegate extends DelegateBase
private void configLangSpinner() private void configLangSpinner()
{ {
OnItemSelectedListener onSel = if ( null == m_langSpinner ) {
new OnItemSelectedListener() { m_langSpinner = (Spinner)findViewById( R.id.lang_spinner );
@Override
public void onItemSelected(AdapterView<?> parentView, OnItemSelectedListener onSel =
View selectedItemView, new OnItemSelectedListener() {
int position, long id ) { @Override
String chosen = public void onItemSelected(AdapterView<?> parentView,
(String)parentView.getItemAtPosition( position ); View selectedItemView,
if ( chosen.equals( m_browseText ) ) { int position, long id ) {
DictsDelegate.launchAndDownload( m_activity ); String chosen =
} else { (String)parentView.getItemAtPosition( position );
m_gi.setLang( DictLangCache. if ( chosen.equals( m_browseText ) ) {
getLangLangCode( m_activity, DictsDelegate.launchForResult( m_activity, REQUEST_LANG );
chosen ) ); } else {
loadPlayersList(); m_gi.setLang( DictLangCache.
if ( null != m_dictSpinner ) { getLangLangCode( m_activity,
configDictSpinner( m_dictSpinner, m_gi.dictLang, chosen ) );
m_gi.dictName ); loadPlayersList();
if ( null != m_dictSpinner ) {
configDictSpinner( m_dictSpinner, m_gi.dictLang,
m_gi.dictName );
}
} }
} }
}
@Override @Override
public void onNothingSelected(AdapterView<?> parentView) {} public void onNothingSelected(AdapterView<?> parentView) {}
}; };
ArrayAdapter<String> adapter = ArrayAdapter adapter = DictLangCache.getLangsAdapter( m_activity );
DictLangCache.getLangsAdapter( m_activity ); String lang = DictLangCache.getLangName( m_activity, m_gi.dictLang );
String lang = DictLangCache.getLangName( m_activity, m_gi.dictLang ); configSpinnerWDownload( m_langSpinner, adapter, onSel, lang );
configSpinnerWDownload( m_langSpinner, adapter, onSel, lang ); }
} }
private void configSpinnerWDownload( Spinner spinner, private void configSpinnerWDownload( Spinner spinner,
ArrayAdapter<String> adapter, ArrayAdapter adapter,
OnItemSelectedListener onSel, OnItemSelectedListener onSel,
String curSel ) String curSel )
{ {
@ -798,17 +826,17 @@ public class GameConfigDelegate extends DelegateBase
adapter.setDropDownViewResource( resID ); adapter.setDropDownViewResource( resID );
spinner.setAdapter( adapter ); spinner.setAdapter( adapter );
spinner.setOnItemSelectedListener( onSel ); spinner.setOnItemSelectedListener( onSel );
setSpinnerSelection( spinner, adapter, curSel ); setSpinnerSelection( spinner, curSel );
} }
private void setSpinnerSelection( Spinner spinner, private void setSpinnerSelection( Spinner spinner, String sel )
ArrayAdapter<String> adapter,
String sel )
{ {
if ( null != sel ) { if ( null != sel && null != spinner ) {
for ( int ii = 0; ii < adapter.getCount(); ++ii ) { SpinnerAdapter adapter = spinner.getAdapter();
if ( sel.equals( adapter.getItem(ii) ) ) { int count = adapter.getCount();
spinner.setSelection( ii ); for ( int ii = 0; ii < count; ++ii ) {
if ( sel.equals( adapter.getItem( ii ) ) ) {
spinner.setSelection( ii, true );
break; break;
} }
} }

View file

@ -131,9 +131,8 @@ public class GamesListDelegate extends ListDelegateBase
public void onClick( DialogInterface dlg, int item ) { public void onClick( DialogInterface dlg, int item ) {
// no name, so user must pick // no name, so user must pick
if ( null == m_missingDictName ) { if ( null == m_missingDictName ) {
DictsDelegate DictsDelegate.launchForResult( m_activity,
.launchAndDownload( m_activity, m_missingDictLang );
m_missingDictLang );
} else { } else {
DwnldDelegate DwnldDelegate
.downloadDictInBack( m_activity, .downloadDictInBack( m_activity,
@ -688,6 +687,7 @@ public class GamesListDelegate extends ListDelegateBase
{ {
Assert.assertTrue( m_menuPrepared ); Assert.assertTrue( m_menuPrepared );
int itemID = item.getItemId();
boolean handled = true; boolean handled = true;
boolean changeContent = false; boolean changeContent = false;
boolean dropSels = false; boolean dropSels = false;
@ -698,12 +698,12 @@ public class GamesListDelegate extends ListDelegateBase
} }
final long[] selRowIDs = getSelRowIDs(); final long[] selRowIDs = getSelRowIDs();
if ( 1 == selRowIDs.length && !checkWarnNoDict( selRowIDs[0] ) ) { if ( 1 == selRowIDs.length && R.id.games_game_delete != itemID
&& !checkWarnNoDict( selRowIDs[0] ) ) {
return true; // FIXME: RETURN FROM MIDDLE!!! return true; // FIXME: RETURN FROM MIDDLE!!!
} }
switch ( item.getItemId() ) { switch ( itemID ) {
// There's no selection for these items, so nothing to clear // There's no selection for these items, so nothing to clear
case R.id.games_menu_resend: case R.id.games_menu_resend:
GameUtils.resendAllIf( m_activity, true ); GameUtils.resendAllIf( m_activity, true );
@ -880,7 +880,8 @@ public class GamesListDelegate extends ListDelegateBase
} }
// DwnldActivity.DownloadFinishedListener interface // DwnldActivity.DownloadFinishedListener interface
public void downloadFinished( String name, final boolean success ) public void downloadFinished( String lang, String name,
final boolean success )
{ {
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {

View file

@ -136,7 +136,7 @@ public class LookupAlert extends LinearLayout
{ {
m_parent = activity; m_parent = activity;
m_words = params.getStringArray( WORDS ); m_words = params.getStringArray( WORDS );
setLang( params.getInt( LANG, -1 ) ); setLang( activity, params.getInt( LANG, -1 ) );
m_forceList = params.getBoolean( FORCELIST, false ); m_forceList = params.getBoolean( FORCELIST, false );
m_studyOn = XWPrefs.getStudyEnabled( m_context ); m_studyOn = XWPrefs.getStudyEnabled( m_context );
if ( m_studyOn ) { if ( m_studyOn ) {
@ -186,7 +186,9 @@ public class LookupAlert extends LinearLayout
// } // }
// } // }
/* View.OnClickListener -- just the Done button */ //////////////////////////////////////////////////////////////////////
// View.OnClickListener
//////////////////////////////////////////////////////////////////////
public void onClick( View view ) public void onClick( View view )
{ {
if ( view == m_doneButton ) { if ( view == m_doneButton ) {
@ -200,8 +202,10 @@ public class LookupAlert extends LinearLayout
} }
} }
/* AdapterView.OnItemClickListener */ //////////////////////////////////////////////////////////////////////
public void onItemClick( AdapterView<?> parent, View view, // AdapterView.OnItemClickListener
//////////////////////////////////////////////////////////////////////
public void onItemClick( AdapterView<?> parentView, View view,
int position, long id ) int position, long id )
{ {
if ( STATE_WORDS == m_state ) { if ( STATE_WORDS == m_state ) {
@ -265,7 +269,8 @@ public class LookupAlert extends LinearLayout
} }
break; break;
case STATE_LOOKUP: case STATE_LOOKUP:
lookupWord( m_words[m_wordIndex], s_lookupUrls[m_urlIndex] ); lookupWord( m_context, m_words[m_wordIndex],
s_lookupUrls[m_urlIndex] );
switchState( -1 ); switchState( -1 );
break; break;
default: default:
@ -274,7 +279,7 @@ public class LookupAlert extends LinearLayout
} }
} // switchState } // switchState
private void lookupWord( String word, String fmt ) private static void lookupWord( Context context, String word, String fmt )
{ {
if ( false ) { if ( false ) {
DbgUtils.logf( "skipping lookupWord(%s)", word ); DbgUtils.logf( "skipping lookupWord(%s)", word );
@ -286,21 +291,21 @@ public class LookupAlert extends LinearLayout
intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK ); intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
try { try {
m_context.startActivity( intent ); context.startActivity( intent );
} catch ( android.content.ActivityNotFoundException anfe ) { } catch ( android.content.ActivityNotFoundException anfe ) {
DbgUtils.loge( anfe ); DbgUtils.loge( anfe );
} }
} }
} // lookupWord } // lookupWord
private void setLang( int lang ) private static void setLang( Context context, int lang )
{ {
if ( null == s_langCodes ) { if ( null == s_langCodes ) {
s_langCodes = getResources().getStringArray( R.array.language_codes ); s_langCodes = context.getResources().getStringArray( R.array.language_codes );
} }
if ( s_lang != lang ) { if ( s_lang != lang ) {
String[] urls = getResources().getStringArray( R.array.lookup_urls ); String[] urls = context.getResources().getStringArray( R.array.lookup_urls );
ArrayList<String> tmpUrls = new ArrayList<String>(); ArrayList<String> tmpUrls = new ArrayList<String>();
ArrayList<String> tmpNames = new ArrayList<String>(); ArrayList<String> tmpNames = new ArrayList<String>();
String langCode = String.format( ":%s:", s_langCodes[lang] ); String langCode = String.format( ":%s:", s_langCodes[lang] );
@ -313,7 +318,7 @@ public class LookupAlert extends LinearLayout
} }
s_lookupNames = tmpNames.toArray( new String[tmpNames.size()] ); s_lookupNames = tmpNames.toArray( new String[tmpNames.size()] );
s_lookupUrls = tmpUrls.toArray( new String[tmpUrls.size()] ); s_lookupUrls = tmpUrls.toArray( new String[tmpUrls.size()] );
s_urlsAdapter = new ArrayAdapter<String>( m_context, LIST_LAYOUT, s_urlsAdapter = new ArrayAdapter<String>( context, LIST_LAYOUT,
s_lookupNames ); s_lookupNames );
s_lang = lang; s_lang = lang;
} }
@ -344,6 +349,17 @@ public class LookupAlert extends LinearLayout
return handled; return handled;
} }
public static boolean needAlert( Context context, String[] words,
int langCode )
{
boolean result = 1 < words.length;
if ( !result ) {
setLang( context, langCode );
result = 1 < s_lookupUrls.length;
}
return result;
}
public static Bundle makeParams( String[] words, int lang, public static Bundle makeParams( String[] words, int lang,
boolean noStudyOption ) boolean noStudyOption )
{ {
@ -354,7 +370,7 @@ public class LookupAlert extends LinearLayout
return bundle; return bundle;
} }
public static Dialog createDialog( Activity parent, Bundle bundle ) public static Dialog makeDialog( Activity parent, Bundle bundle )
{ {
LookupAlert view = (LookupAlert) LookupAlert view = (LookupAlert)
LocUtils.inflate( parent, R.layout.lookup ); LocUtils.inflate( parent, R.layout.lookup );
@ -367,4 +383,11 @@ public class LookupAlert extends LinearLayout
result.setOnKeyListener( view ); result.setOnKeyListener( view );
return result; return result;
} }
protected static void launchWordLookup( Context context, String word,
int langCode )
{
setLang( context, langCode );
lookupWord( context, word, s_lookupUrls[0] );
}
} }

View file

@ -41,11 +41,4 @@ public class NewGameActivity extends XWActivity {
super.onWindowFocusChanged( hasFocus ); super.onWindowFocusChanged( hasFocus );
m_dlgt.onWindowFocusChanged( hasFocus ); m_dlgt.onWindowFocusChanged( hasFocus );
} }
@Override
protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
m_dlgt.onActivityResult( requestCode, resultCode, data );
}
} }

View file

@ -34,12 +34,4 @@ public class SMSInviteActivity extends InviteActivity {
m_dlgt = new SMSInviteDelegate( this, savedInstanceState ); m_dlgt = new SMSInviteDelegate( this, savedInstanceState );
super.onCreate( savedInstanceState, m_dlgt ); super.onCreate( savedInstanceState, m_dlgt );
} }
@Override
protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
super.onActivityResult( requestCode, resultCode, data );
m_dlgt.onActivityResult( requestCode, resultCode, data );
}
} }

View file

@ -21,6 +21,7 @@ package org.eehouse.android.xw4;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -123,4 +124,11 @@ public class XWActivity extends Activity {
super.onPrepareDialog( id, dialog ); super.onPrepareDialog( id, dialog );
m_dlgt.prepareDialog( DlgID.values()[id], dialog ); m_dlgt.prepareDialog( DlgID.values()[id], dialog );
} }
@Override
protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
m_dlgt.onActivityResult( requestCode, resultCode, data );
}
} }

View file

@ -21,6 +21,7 @@ package org.eehouse.android.xw4;
import android.app.Dialog; import android.app.Dialog;
import android.app.ListActivity; import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -123,4 +124,11 @@ public class XWListActivity extends ListActivity {
super.onPrepareDialog( id, dialog ); super.onPrepareDialog( id, dialog );
m_dlgt.prepareDialog( DlgID.values()[id], dialog ); m_dlgt.prepareDialog( DlgID.values()[id], dialog );
} }
@Override
protected void onActivityResult( int requestCode, int resultCode,
Intent data )
{
m_dlgt.onActivityResult( requestCode, resultCode, data );
}
} }

View file

@ -44,10 +44,18 @@ public class XWListItem extends LinearLayout
private CheckBox m_checkbox; private CheckBox m_checkbox;
private DrawSelDelegate m_dsdel; private DrawSelDelegate m_dsdel;
private ExpandedListener m_expListener;
private boolean m_expanded = false;
private View m_expandedView;
public interface DeleteCallback { public interface DeleteCallback {
void deleteCalled( XWListItem item ); void deleteCalled( XWListItem item );
} }
public interface ExpandedListener {
void expanded( XWListItem me, boolean expanded );
}
public XWListItem( Context cx, AttributeSet as ) { public XWListItem( Context cx, AttributeSet as ) {
super( cx, as ); super( cx, as );
m_context = cx; m_context = cx;
@ -65,6 +73,36 @@ public class XWListItem extends LinearLayout
public int getPosition() { return m_position; } public int getPosition() { return m_position; }
public void setPosition( int indx ) { m_position = indx; } public void setPosition( int indx ) { m_position = indx; }
protected void setExpandedListener( ExpandedListener lstnr )
{
Assert.assertNull( m_expListener ); // call me only once
m_expListener = lstnr;
setOnClickListener( this );
}
protected void setExpanded( boolean expanded )
{
m_expanded = expanded;
if ( null != m_expListener ) {
m_expListener.expanded( this, m_expanded );
}
}
protected void addExpandedView( View view )
{
if ( null != m_expandedView ) {
removeExpandedView();
}
m_expandedView = view;
addView( view );
}
protected void removeExpandedView()
{
removeView( m_expandedView );
m_expandedView = null;
}
public void setText( String text ) public void setText( String text )
{ {
TextView view = (TextView)findViewById( R.id.text_item ); TextView view = (TextView)findViewById( R.id.text_item );
@ -127,7 +165,7 @@ public class XWListItem extends LinearLayout
// cast exception when inflating it and casting to the subclass. // cast exception when inflating it and casting to the subclass.
// So rather than create a subclass that knows about its purpose // So rather than create a subclass that knows about its purpose
// I'll extend this with a general mechanism. Hackery but ok. // I'll extend this with a general mechanism. Hackery but ok.
public void cache( Object obj ) public void setCached( Object obj )
{ {
m_cached = obj; m_cached = obj;
} }
@ -148,6 +186,8 @@ public class XWListItem extends LinearLayout
{ {
if ( m_checkbox == view ) { if ( m_checkbox == view ) {
setSelected( m_checkbox.isChecked() ); setSelected( m_checkbox.isChecked() );
} else {
setExpanded( !m_expanded ); // toggle
} }
} }

View file

@ -78,7 +78,6 @@ public class LocUtils {
private static Map<String, String> s_xlationsBlessed = null; private static Map<String, String> s_xlationsBlessed = null;
private static HashMap<Integer, String> s_idsToKeys = null; private static HashMap<Integer, String> s_idsToKeys = null;
private static Boolean s_enabled = null; private static Boolean s_enabled = null;
private static Boolean UPPER_CASE = false;
private static String s_curLocale; private static String s_curLocale;
private static WeakReference<Menu> s_latestMenuRef; private static WeakReference<Menu> s_latestMenuRef;
private static HashMap<WeakReference<Menu>, HashSet<String> > s_menuSets private static HashMap<WeakReference<Menu>, HashSet<String> > s_menuSets
@ -272,9 +271,6 @@ public class LocUtils {
result = getBlessedXlation( context, key, canUseDB ); result = getBlessedXlation( context, key, canUseDB );
} }
if ( UPPER_CASE && null == result ) {
result = toUpperCase( key );
}
return result; return result;
} }
@ -622,29 +618,6 @@ public class LocUtils {
return result; return result;
} }
// This is for testing, but the ability to pull the formatters will be
// critical for validating local transations of strings containing
// formatters.
private static String toUpperCase( String str )
{
String result = null;
if ( UPPER_CASE ) {
String[] parts = str.split( RES_FORMAT );
StringBuilder sb = new StringBuilder();
int offset = 0;
for ( String part : parts ) {
sb.append( part.toUpperCase() );
offset += part.length();
if ( offset < str.length() ) {
sb.append( str.substring( offset, offset + FMT_LEN ) );
offset += FMT_LEN;
}
}
result = sb.toString();
}
return result;
}
private static void dropXLations( Context context ) private static void dropXLations( Context context )
{ {
s_xlationsBlessed = null; s_xlationsBlessed = null;

View file

@ -68,7 +68,7 @@ cp *.apk /tmp/releases_${VARIANT}
cd $CURDIR cd $CURDIR
echo "remove build dir $BUILDIR? (y or n):" echo "remove build dir $BUILDIR? (y or n):"
echo -n "==> " echo -n "(y or n) ==> "
read ANSWER read ANSWER
if [ "$ANSWER" = 'y' ]; then if [ "$ANSWER" = 'y' ]; then
rm -rf $BUILDIR rm -rf $BUILDIR

View file

@ -32,11 +32,10 @@ SOURCEDICT ?= $(ENGLISH)/CSW.dict.gz
# word from CSW that's also in top5000 makes the grade # word from CSW that's also in top5000 makes the grade
$(XWLANG)Main.dict.gz: $(SOURCEDICT) $(ENGLISH)/Top_5000.dict.gz $(XWLANG)Main.dict.gz: $(SOURCEDICT) $(ENGLISH)/Top_5000.dict.gz
zcat $(ENGLISH)/Top_5000.dict.gz | tr [a-z] [A-Z] > /tmp/Top_5000.dict zcat $(ENGLISH)/Top_5000.dict.gz | tr [a-z] [A-Z] | sort > /tmp/Top_5000.dict
rm -f $@ zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$" | sort > /tmp/$$(basename $<)
for WORD in $$(zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$"); do \ rm -f $@
grep -q "^$$WORD$$" /tmp/Top_5000.dict && echo $$WORD; \ comm -12 /tmp/$$(basename $<) /tmp/Top_5000.dict | gzip -c > $@
done | gzip -c > $@
# Everything but creating of the Main.dict file is inherited from the # Everything but creating of the Main.dict file is inherited from the
# "parent" Makefile.langcommon in the parent directory. # "parent" Makefile.langcommon in the parent directory.