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_main.xml
loc_item_edit.xml
import_dict_item.xml
list_group.xml

View file

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

View file

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

View file

@ -9,3 +9,5 @@ LocListItem.java
LocSearcher.java
LocUtils.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 add_player=0x7f0a0032;
public static final int advertise_new_room_check=0x7f0a0038;
public static final int blessed_label=0x7f0a0059;
public static final int board_menu_chat=0x7f0a00a7;
public static final int board_menu_dict=0x7f0a00a3;
public static final int board_menu_done=0x7f0a008e;
public static final int board_menu_file_about=0x7f0a009c;
public static final int board_menu_file_prefs=0x7f0a009b;
public static final int board_menu_flip=0x7f0a00a5;
public static final int board_menu_game_counts=0x7f0a0094;
public static final int board_menu_game_history=0x7f0a0096;
public static final int board_menu_game_left=0x7f0a0095;
public static final int board_menu_game_netstats=0x7f0a009d;
public static final int board_menu_game_resend=0x7f0a0098;
public static final int board_menu_game_resign=0x7f0a0097;
public static final int board_menu_hint_next=0x7f0a00a1;
public static final int board_menu_hint_prev=0x7f0a00a0;
public static final int board_menu_invite=0x7f0a008d;
public static final int board_menu_juggle=0x7f0a00a4;
public static final int board_menu_toggle=0x7f0a00a8;
public static final int board_menu_trade=0x7f0a008f;
public static final int board_menu_trade_cancel=0x7f0a0090;
public static final int board_menu_trade_commit=0x7f0a0091;
public static final int board_menu_tray=0x7f0a0093;
public static final int board_menu_undo_current=0x7f0a00a2;
public static final int board_menu_undo_last=0x7f0a0092;
public static final int board_menu_zoom=0x7f0a00a6;
public static final int blessed_label=0x7f0a0058;
public static final int board_menu_chat=0x7f0a00a8;
public static final int board_menu_dict=0x7f0a00a4;
public static final int board_menu_done=0x7f0a008f;
public static final int board_menu_file_about=0x7f0a009d;
public static final int board_menu_file_prefs=0x7f0a009c;
public static final int board_menu_flip=0x7f0a00a6;
public static final int board_menu_game_counts=0x7f0a0095;
public static final int board_menu_game_history=0x7f0a0097;
public static final int board_menu_game_left=0x7f0a0096;
public static final int board_menu_game_netstats=0x7f0a009e;
public static final int board_menu_game_resend=0x7f0a0099;
public static final int board_menu_game_resign=0x7f0a0098;
public static final int board_menu_hint_next=0x7f0a00a2;
public static final int board_menu_hint_prev=0x7f0a00a1;
public static final int board_menu_invite=0x7f0a008e;
public static final int board_menu_juggle=0x7f0a00a5;
public static final int board_menu_toggle=0x7f0a00a9;
public static final int board_menu_trade=0x7f0a0090;
public static final int board_menu_trade_cancel=0x7f0a0091;
public static final int board_menu_trade_commit=0x7f0a0092;
public static final int board_menu_tray=0x7f0a0094;
public static final int board_menu_undo_current=0x7f0a00a3;
public static final int board_menu_undo_last=0x7f0a0093;
public static final int board_menu_zoom=0x7f0a00a7;
public static final int board_root=0x7f0a0002;
public static final int board_view=0x7f0a0003;
public static final int boardsize_spinner=0x7f0a0045;
public static final int bt_disabled=0x7f0a0071;
public static final int bt_separator=0x7f0a0070;
public static final int bt_stuff=0x7f0a0073;
public static final int button_add=0x7f0a0086;
public static final int bt_disabled=0x7f0a0070;
public static final int bt_separator=0x7f0a006f;
public static final int bt_stuff=0x7f0a0072;
public static final int button_add=0x7f0a0087;
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_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_edit=0x7f0a0016;
public static final int chat_history=0x7f0a0015;
public static final int chat_menu_clear=0x7f0a00a9;
public static final int checkbox=0x7f0a0053;
public static final int chat_menu_clear=0x7f0a00aa;
public static final int checkbox=0x7f0a0052;
public static final int color_display_sample=0x7f0a0018;
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 connect_set_relay=0x7f0a0034;
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 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 dictlist_button_horizontal=0x7f0a000c;
public static final int dicts_delete=0x7f0a00ac;
public static final int dicts_deselect_all=0x7f0a00ab;
public static final int dicts_download=0x7f0a00aa;
public static final int dicts_move=0x7f0a00ad;
public static final int dicts_select=0x7f0a00ae;
public static final int dicts_delete=0x7f0a00ad;
public static final int dicts_deselect_all=0x7f0a00ac;
public static final int dicts_download=0x7f0a00ab;
public static final int dicts_move=0x7f0a00ae;
public static final int dicts_select=0x7f0a00af;
public static final int divider=0x7f0a0028;
public static final int download_button=0x7f0a0085;
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_green=0x7f0a001d;
public static final int edit_red=0x7f0a001b;
public static final int english_label=0x7f0a0057;
public static final int english_view=0x7f0a0058;
public static final int english_label=0x7f0a0056;
public static final int english_view=0x7f0a0057;
public static final int exchange_buttons=0x7f0a0004;
public static final int exchange_cancel=0x7f0a0006;
public static final int exchange_commit=0x7f0a0005;
public static final int expander=0x7f0a0047;
public static final int explain=0x7f0a0082;
public static final int filters=0x7f0a005e;
public static final int explain=0x7f0a0081;
public static final int filters=0x7f0a005d;
public static final int flip_button_horizontal=0x7f0a000f;
public static final int game_locked_check=0x7f0a002a;
public static final int game_name=0x7f0a0046;
public static final int gamel_menu_checkmoves=0x7f0a009a;
public static final int games_game_config=0x7f0a00b9;
public static final int games_game_copy=0x7f0a00be;
public static final int games_game_delete=0x7f0a00b8;
public static final int games_game_move=0x7f0a00ba;
public static final int games_game_new_from=0x7f0a00bc;
public static final int games_game_rename=0x7f0a00bd;
public static final int games_game_reset=0x7f0a00bb;
public static final int games_group_default=0x7f0a00c2;
public static final int games_group_delete=0x7f0a00c1;
public static final int games_group_movedown=0x7f0a00c0;
public static final int games_group_moveup=0x7f0a00bf;
public static final int games_group_rename=0x7f0a00c3;
public static final int games_menu_about=0x7f0a00b5;
public static final int games_menu_checkmoves=0x7f0a00b7;
public static final int games_menu_checkupdates=0x7f0a00c4;
public static final int games_menu_dicts=0x7f0a00b3;
public static final int games_menu_email=0x7f0a00b4;
public static final int games_menu_loaddb=0x7f0a00c6;
public static final int games_menu_newgame=0x7f0a00af;
public static final int games_menu_newgroup=0x7f0a00b0;
public static final int games_menu_prefs=0x7f0a00b1;
public static final int games_menu_rateme=0x7f0a00b2;
public static final int games_menu_resend=0x7f0a00b6;
public static final int games_menu_storedb=0x7f0a00c5;
public static final int games_menu_study=0x7f0a0099;
public static final int group_done=0x7f0a008c;
public static final int group_exchange=0x7f0a009e;
public static final int group_hint=0x7f0a009f;
public static final int gamel_menu_checkmoves=0x7f0a009b;
public static final int games_game_config=0x7f0a00ba;
public static final int games_game_copy=0x7f0a00bf;
public static final int games_game_delete=0x7f0a00b9;
public static final int games_game_move=0x7f0a00bb;
public static final int games_game_new_from=0x7f0a00bd;
public static final int games_game_rename=0x7f0a00be;
public static final int games_game_reset=0x7f0a00bc;
public static final int games_group_default=0x7f0a00c3;
public static final int games_group_delete=0x7f0a00c2;
public static final int games_group_movedown=0x7f0a00c1;
public static final int games_group_moveup=0x7f0a00c0;
public static final int games_group_rename=0x7f0a00c4;
public static final int games_menu_about=0x7f0a00b6;
public static final int games_menu_checkmoves=0x7f0a00b8;
public static final int games_menu_checkupdates=0x7f0a00c5;
public static final int games_menu_dicts=0x7f0a00b4;
public static final int games_menu_email=0x7f0a00b5;
public static final int games_menu_loaddb=0x7f0a00c7;
public static final int games_menu_newgame=0x7f0a00b0;
public static final int games_menu_newgroup=0x7f0a00b1;
public static final int games_menu_prefs=0x7f0a00b2;
public static final int games_menu_rateme=0x7f0a00b3;
public static final int games_menu_resend=0x7f0a00b7;
public static final int games_menu_storedb=0x7f0a00c6;
public static final int games_menu_study=0x7f0a009a;
public static final int group_done=0x7f0a008d;
public static final int group_exchange=0x7f0a009f;
public static final int group_hint=0x7f0a00a0;
public static final int hideable=0x7f0a004c;
public static final int hints_allowed=0x7f0a003e;
public static final int invite_desc=0x7f0a0011;
public static final int item_name=0x7f0a007e;
public static final int item_score=0x7f0a007f;
public static final int item_name=0x7f0a007d;
public static final int item_score=0x7f0a007e;
public static final int join_public_room_check=0x7f0a0035;
public static final int juggle_players=0x7f0a0033;
public static final int lang_separator=0x7f0a002d;
public static final int lang_spinner=0x7f0a002e;
public static final int loc_item_check=0x7f0a00c8;
public static final int loc_item_clear=0x7f0a00c7;
public static final int loc_item_copy_bless=0x7f0a00ca;
public static final int loc_item_copy_eng=0x7f0a00c9;
public static final int loc_search_button=0x7f0a0060;
public static final int loc_search_field=0x7f0a005f;
public static final int local_label=0x7f0a005b;
public static final int local_name_edit=0x7f0a0083;
public static final int local_player_set=0x7f0a0078;
public static final int manual_add_button=0x7f0a0087;
public static final int loc_item_check=0x7f0a00c9;
public static final int loc_item_clear=0x7f0a00c8;
public static final int loc_item_copy_bless=0x7f0a00cb;
public static final int loc_item_copy_eng=0x7f0a00ca;
public static final int loc_search_button=0x7f0a005f;
public static final int loc_search_field=0x7f0a005e;
public static final int local_label=0x7f0a005a;
public static final int local_name_edit=0x7f0a0082;
public static final int local_player_set=0x7f0a0077;
public static final int manual_add_button=0x7f0a0088;
public static final int modtime=0x7f0a004d;
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_label=0x7f0a0085;
public static final int newgame_bt_config=0x7f0a0075;
public static final int newgame_enable_bt=0x7f0a0072;
public static final int newgame_enable_sms=0x7f0a006c;
public static final int newgame_invite_bt=0x7f0a0074;
public static final int newgame_invite_net=0x7f0a0068;
public static final int newgame_invite_sms=0x7f0a006e;
public static final int newgame_local=0x7f0a0066;
public static final int newgame_local_config=0x7f0a0067;
public static final int newgame_local_desc=0x7f0a0065;
public static final int newgame_net_config=0x7f0a0069;
public static final int newgame_sms_config=0x7f0a006f;
public static final int name_label=0x7f0a0086;
public static final int newgame_bt_config=0x7f0a0074;
public static final int newgame_enable_bt=0x7f0a0071;
public static final int newgame_enable_sms=0x7f0a006b;
public static final int newgame_invite_bt=0x7f0a0073;
public static final int newgame_invite_net=0x7f0a0067;
public static final int newgame_invite_sms=0x7f0a006d;
public static final int newgame_local=0x7f0a0065;
public static final int newgame_local_config=0x7f0a0066;
public static final int newgame_local_desc=0x7f0a0064;
public static final int newgame_net_config=0x7f0a0068;
public static final int newgame_sms_config=0x7f0a006e;
public static final int nexthint_button_horizontal=0x7f0a0009;
public static final int number=0x7f0a0089;
public static final int other_lang=0x7f0a0061;
public static final int password_edit=0x7f0a007d;
public static final int password_set=0x7f0a007c;
public static final int number=0x7f0a008a;
public static final int other_lang=0x7f0a0060;
public static final int password_edit=0x7f0a007c;
public static final int password_set=0x7f0a007b;
public static final int phonies_spinner=0x7f0a0043;
public static final int pick_faceup=0x7f0a0044;
public static final int pick_lang=0x7f0a008a;
public static final int pick_lang_spinner=0x7f0a008b;
public static final int pick_lang=0x7f0a008b;
public static final int pick_lang_spinner=0x7f0a008c;
public static final int play_button=0x7f0a002b;
public static final int player_list=0x7f0a0031;
public static final int player_name_edit=0x7f0a0079;
public static final int player_view=0x7f0a0052;
public static final int player_name_edit=0x7f0a0078;
public static final int players=0x7f0a0029;
public static final int players_label=0x7f0a0030;
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 public_rooms_set=0x7f0a0039;
public static final int refresh_button=0x7f0a003b;
public static final int remote_check=0x7f0a0077;
public static final int revert_all=0x7f0a0081;
public static final int revert_colors=0x7f0a0080;
public static final int robot_check=0x7f0a007b;
public static final int remote_check=0x7f0a0076;
public static final int revert_all=0x7f0a0080;
public static final int revert_colors=0x7f0a007f;
public static final int robot_check=0x7f0a007a;
public static final int role=0x7f0a004f;
public static final int room_edit=0x7f0a0037;
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 show_remote=0x7f0a0022;
public static final int shuffle_button_horizontal=0x7f0a000a;
public static final int slmenu_clear_sel=0x7f0a00cf;
public static final int slmenu_copy_sel=0x7f0a00ce;
public static final int slmenu_deselect_all=0x7f0a00cd;
public static final int slmenu_lookup_sel=0x7f0a00cb;
public static final int slmenu_select_all=0x7f0a00cc;
public static final int slmenu_clear_sel=0x7f0a00d0;
public static final int slmenu_copy_sel=0x7f0a00cf;
public static final int slmenu_deselect_all=0x7f0a00ce;
public static final int slmenu_lookup_sel=0x7f0a00cc;
public static final int slmenu_select_all=0x7f0a00cd;
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_separator=0x7f0a006a;
public static final int sms_stuff=0x7f0a006d;
public static final int sms_separator=0x7f0a0069;
public static final int sms_stuff=0x7f0a006c;
public static final int state=0x7f0a004e;
public static final int summary=0x7f0a0062;
public static final int text_item=0x7f0a0054;
public static final int text_item2=0x7f0a0055;
public static final int summary=0x7f0a0061;
public static final int text_item=0x7f0a0053;
public static final int text_item2=0x7f0a0054;
public static final int thumbnail=0x7f0a004b;
public static final int timer_minutes_edit=0x7f0a0041;
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 wordlen_max=0x7f0a0027;
public static final int wordlen_min=0x7f0a0026;
public static final int xlated_view=0x7f0a005d;
public static final int xlated_view_blessed=0x7f0a005a;
public static final int xlated_view_local=0x7f0a005c;
public static final int xlated_view=0x7f0a005c;
public static final int xlated_view_blessed=0x7f0a0059;
public static final int xlated_view_local=0x7f0a005b;
public static final int zoom_button_horizontal=0x7f0a0010;
}
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 prefs_w_buttons=0x7f03001f;
public static final int relay_game_config=0x7f030020;
public static final int rename_game=0x7f030021;
public static final int smsinviter=0x7f030022;
public static final int smsinviter_item=0x7f030023;
public static final int studylist=0x7f030024;
public static final int remote_dict_details=0x7f030021;
public static final int rename_game=0x7f030022;
public static final int smsinviter=0x7f030023;
public static final int smsinviter_item=0x7f030024;
public static final int studylist=0x7f030025;
}
public static final class menu {
public static final int board_menu=0x7f090000;
@ -945,7 +947,7 @@ public final class R {
"%1$s".
*/
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
*/
public static final int dict_url=0x7f060072;
@ -974,6 +976,11 @@ public final class R {
will use is substituted in for "%1$s".
*/
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_failed=0x7f060265;
public static final int download_path_title=0x7f060268;
@ -1412,6 +1419,7 @@ public final class R {
different wordlists.)
*/
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 list_group_default=0x7f06026c;
public static final int list_group_delete=0x7f06026a;
@ -1890,6 +1898,7 @@ public final class R {
the main Board screen
*/
public static final int not_again_zoom=0x7f0601d2;
public static final int note_none=0x7f0602bf;
public static final int notify_body_fmt=0x7f0601b7;
/** This text is displayed as the "summary" for both of the
notify choices above, as extra information. (There could be
@ -2564,7 +2573,6 @@ public final class R {
window title
*/
public static final int title_prefs=0x7f06012b;
public static final int title_remote_dicts=0x7f0600ad;
public static final int title_send_data_sms=0x7f06007e;
/** If this preference is checked, tiles in the rack will be
re-ordered alphabetically whenever tiles are added,

View file

@ -4,20 +4,24 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp">
>
<CheckBox android:id="@+id/show_remote"
android:text="@string/show_remote"
android:layout_width="fill_parent"
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"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
android:drawSelectorOnTop="false"
/>
</LinearLayout>

View file

@ -1,44 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<org.eehouse.android.xw4.XWListItem
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/player_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:focusable="true"
android:clickable="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:longClickable="true"
android:background="@android:drawable/list_selector_background"
>
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:focusable="true"
android:clickable="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:longClickable="true"
android:background="@android:drawable/list_selector_background"
android:orientation="vertical"
>
<CheckBox android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:id="@+id/text_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<CheckBox android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<TextView android:id="@+id/text_item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:visibility="gone"
/>
<TextView android:id="@+id/text_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<ImageButton android:id="@+id/del"
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@android:drawable/ic_delete"
android:visibility="invisible"
/>
<TextView android:id="@+id/text_item2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
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 -->
<string name="title_dicts_list">Installed Crosswords Wordlists</string>
<string name="title_remote_dicts">Available Crosswords Wordlists</string>
<string name="title_dicts_list">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
installed wordlists to describe those that are part of
@ -2252,16 +2256,16 @@
<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
installed wordlists. Would you like to download the new
version[s] of %1$s now?</string>
<string name="progress_title">Downloading</string>
<string name="dict_info_fmt">Wordlist %1$s is available for
download.\n\nDetails:\nNumber of words: %2$d\nDownload size:
%3$dK\nNote: %4$s</string>
<string name="dict_info_fmt">Number of words: %1$d\nDownload size:
%2$dK\nNote: %3$s</string>
<string name="note_none">(None)</string>
<string name="dict_on_server">Downloadable</string>
<string name="lang_name_fmt">%1$s (%2$d wordlists)</string>
</resources>

View file

@ -152,8 +152,11 @@
############################################################
-->
<!-- window title -->
<string name="title_dicts_list">Dellatsni Sdrowssorc Stsildrow</string>
<string name="title_remote_dicts">Elbaliava Sdrowssorc Stsildrow</string>
<string name="title_dicts_list">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
installed wordlists to describe those that are part of
Crosswords and that cannot be uninstalled or moved.
@ -1928,13 +1931,14 @@
morf revres.</string>
<string name="getinfo">Teg ofni</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
dellatsni stsildrow. Dluow uoy ekil ot daolnwod eht wen
]s[noisrev fo %1$s ?won</string>
<string name="progress_title">Gnidaolnwod</string>
<string name="dict_info_fmt">Tsildrow %1$s si elbaliava rof
daolnwod.\n\nSliated:\nRebmun fo sdrow: %2$d\nDaolnwod ezis:
%3$dK\nEton: %4$s</string>
<string name="dict_info_fmt">Rebmun fo sdrow: %1$d\nDaolnwod ezis:
%2$dK\nEton: %3$s</string>
<string name="note_none">)Enon(</string>
<string name="dict_on_server">Elbadaolnwod</string>
<string name="lang_name_fmt">%1$s (%2$d )stsildrow</string>
</resources>

View file

@ -152,8 +152,11 @@
############################################################
-->
<!-- window title -->
<string name="title_dicts_list">INSTALLED CROSSWORDS WORDLISTS</string>
<string name="title_remote_dicts">AVAILABLE CROSSWORDS WORDLISTS</string>
<string name="title_dicts_list">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
installed wordlists to describe those that are part of
Crosswords and that cannot be uninstalled or moved.
@ -1928,13 +1931,14 @@
FROM SERVER.</string>
<string name="getinfo">GET INFO</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
INSTALLED WORDLISTS. WOULD YOU LIKE TO DOWNLOAD THE NEW
VERSION[S] OF %1$s NOW?</string>
<string name="progress_title">DOWNLOADING</string>
<string name="dict_info_fmt">WORDLIST %1$s IS AVAILABLE FOR
DOWNLOAD.\n\nDETAILS:\nNUMBER OF WORDS: %2$d\nDOWNLOAD SIZE:
%3$dK\nNOTE: %4$s</string>
<string name="dict_info_fmt">NUMBER OF WORDS: %1$d\nDOWNLOAD SIZE:
%2$dK\nNOTE: %3$s</string>
<string name="note_none">(NONE)</string>
<string name="dict_on_server">DOWNLOADABLE</string>
<string name="lang_name_fmt">%1$s (%2$d WORDLISTS)</string>
</resources>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,6 +27,7 @@ import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@ -57,7 +58,7 @@ public class DwnldDelegate extends ListDelegateBase {
private ArrayList<LinearLayout> m_views;
public interface DownloadFinishedListener {
void downloadFinished( String name, boolean success );
void downloadFinished( String lang, String name, boolean success );
}
public DwnldDelegate( ListActivity activity, Bundle savedInstanceState )
@ -298,6 +299,14 @@ public class DwnldDelegate extends ListDelegateBase {
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,
DownloadFinishedListener lstnr )
{
@ -328,10 +337,11 @@ public class DwnldDelegate extends ListDelegateBase {
}
if ( null != ld ) {
String name = ld.m_name;
String lang = langFromUrl( url );
if ( null == name ) {
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 {
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 CheckBox m_joinPublicCheck;
@ -74,6 +76,7 @@ public class GameConfigDelegate extends DelegateBase
private View m_connectSetRelay;
private View m_connectSetSMS;
private Spinner m_dictSpinner;
private Spinner m_playerDictSpinner;
private Spinner m_roomChoose;
// private Button m_configureButton;
private long m_rowid;
@ -314,11 +317,12 @@ public class GameConfigDelegate extends DelegateBase
} else {
dictLabel.setVisibility( View.GONE );
}
Spinner dictSpinner = (Spinner)dialog.findViewById( R.id.dict_spinner );
m_playerDictSpinner = (Spinner)dialog.findViewById( R.id.dict_spinner );
if ( localOnlyGame() ) {
configDictSpinner( dictSpinner, m_gi.dictLang, m_gi.dictName(lp) );
configDictSpinner( m_playerDictSpinner, m_gi.dictLang, m_gi.dictName(lp) );
} else {
dictSpinner.setVisibility( View.GONE );
m_playerDictSpinner.setVisibility( View.GONE );
m_playerDictSpinner = null;
}
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 );
if ( localOnlyGame() ) {
Spinner spinner =
(Spinner)((Dialog)di).findViewById( R.id.dict_spinner );
int position = spinner.getSelectedItemPosition();
SpinnerAdapter adapter = spinner.getAdapter();
{
Spinner spinner =
(Spinner)((Dialog)di).findViewById( R.id.dict_spinner );
Assert.assertTrue( m_playerDictSpinner == spinner );
}
int position = m_playerDictSpinner.getSelectedItemPosition();
SpinnerAdapter adapter = m_playerDictSpinner.getAdapter();
if ( null != adapter && position < adapter.getCount() ) {
String name = (String)adapter.getItem( position );
@ -391,8 +398,8 @@ public class GameConfigDelegate extends DelegateBase
// sdk_int = Integer.decode( android.os.Build.VERSION.SDK );
// } catch ( Exception ex ) {}
// m_canDoSMS = sdk_int >= android.os.Build.VERSION_CODES.DONUT;
// m_browseText = getString( R.string.download_dicts );
// DictLangCache.setLast( m_browseText );
m_browseText = getString( R.string.download_dicts );
DictLangCache.setLast( m_browseText );
m_cp = CommonPrefs.get( m_activity );
@ -417,11 +424,10 @@ public class GameConfigDelegate extends DelegateBase
m_playButton.setOnClickListener( this );
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_boardsizeSpinner = (Spinner)findViewById( R.id.boardsize_spinner );
m_smartnessSpinner = (Spinner)findViewById( R.id.smart_robot );
} // onCreate
} // init
protected void onStart()
{
@ -449,6 +455,25 @@ public class GameConfigDelegate extends DelegateBase
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()
{
if ( null == m_giOrig ) {
@ -740,8 +765,8 @@ public class GameConfigDelegate extends DelegateBase
(String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) {
DictsDelegate.launchAndDownload( m_activity,
m_gi.dictLang );
DictsDelegate.launchForResult( m_activity, REQUEST_DICT,
m_gi.dictLang );
}
}
@ -757,40 +782,43 @@ public class GameConfigDelegate extends DelegateBase
private void configLangSpinner()
{
OnItemSelectedListener onSel =
new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView,
View selectedItemView,
int position, long id ) {
String chosen =
(String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) {
DictsDelegate.launchAndDownload( m_activity );
} else {
m_gi.setLang( DictLangCache.
getLangLangCode( m_activity,
chosen ) );
loadPlayersList();
if ( null != m_dictSpinner ) {
configDictSpinner( m_dictSpinner, m_gi.dictLang,
m_gi.dictName );
if ( null == m_langSpinner ) {
m_langSpinner = (Spinner)findViewById( R.id.lang_spinner );
OnItemSelectedListener onSel =
new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parentView,
View selectedItemView,
int position, long id ) {
String chosen =
(String)parentView.getItemAtPosition( position );
if ( chosen.equals( m_browseText ) ) {
DictsDelegate.launchForResult( m_activity, REQUEST_LANG );
} else {
m_gi.setLang( DictLangCache.
getLangLangCode( m_activity,
chosen ) );
loadPlayersList();
if ( null != m_dictSpinner ) {
configDictSpinner( m_dictSpinner, m_gi.dictLang,
m_gi.dictName );
}
}
}
}
@Override
@Override
public void onNothingSelected(AdapterView<?> parentView) {}
};
};
ArrayAdapter<String> adapter =
DictLangCache.getLangsAdapter( m_activity );
String lang = DictLangCache.getLangName( m_activity, m_gi.dictLang );
configSpinnerWDownload( m_langSpinner, adapter, onSel, lang );
ArrayAdapter adapter = DictLangCache.getLangsAdapter( m_activity );
String lang = DictLangCache.getLangName( m_activity, m_gi.dictLang );
configSpinnerWDownload( m_langSpinner, adapter, onSel, lang );
}
}
private void configSpinnerWDownload( Spinner spinner,
ArrayAdapter<String> adapter,
ArrayAdapter adapter,
OnItemSelectedListener onSel,
String curSel )
{
@ -798,17 +826,17 @@ public class GameConfigDelegate extends DelegateBase
adapter.setDropDownViewResource( resID );
spinner.setAdapter( adapter );
spinner.setOnItemSelectedListener( onSel );
setSpinnerSelection( spinner, adapter, curSel );
setSpinnerSelection( spinner, curSel );
}
private void setSpinnerSelection( Spinner spinner,
ArrayAdapter<String> adapter,
String sel )
private void setSpinnerSelection( Spinner spinner, String sel )
{
if ( null != sel ) {
for ( int ii = 0; ii < adapter.getCount(); ++ii ) {
if ( sel.equals( adapter.getItem(ii) ) ) {
spinner.setSelection( ii );
if ( null != sel && null != spinner ) {
SpinnerAdapter adapter = spinner.getAdapter();
int count = adapter.getCount();
for ( int ii = 0; ii < count; ++ii ) {
if ( sel.equals( adapter.getItem( ii ) ) ) {
spinner.setSelection( ii, true );
break;
}
}

View file

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

View file

@ -136,7 +136,7 @@ public class LookupAlert extends LinearLayout
{
m_parent = activity;
m_words = params.getStringArray( WORDS );
setLang( params.getInt( LANG, -1 ) );
setLang( activity, params.getInt( LANG, -1 ) );
m_forceList = params.getBoolean( FORCELIST, false );
m_studyOn = XWPrefs.getStudyEnabled( m_context );
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 )
{
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 )
{
if ( STATE_WORDS == m_state ) {
@ -265,7 +269,8 @@ public class LookupAlert extends LinearLayout
}
break;
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 );
break;
default:
@ -274,7 +279,7 @@ public class LookupAlert extends LinearLayout
}
} // switchState
private void lookupWord( String word, String fmt )
private static void lookupWord( Context context, String word, String fmt )
{
if ( false ) {
DbgUtils.logf( "skipping lookupWord(%s)", word );
@ -286,21 +291,21 @@ public class LookupAlert extends LinearLayout
intent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
try {
m_context.startActivity( intent );
context.startActivity( intent );
} catch ( android.content.ActivityNotFoundException anfe ) {
DbgUtils.loge( anfe );
}
}
} // lookupWord
private void setLang( int lang )
private static void setLang( Context context, int lang )
{
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 ) {
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> tmpNames = new ArrayList<String>();
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_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_lang = lang;
}
@ -344,6 +349,17 @@ public class LookupAlert extends LinearLayout
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,
boolean noStudyOption )
{
@ -354,7 +370,7 @@ public class LookupAlert extends LinearLayout
return bundle;
}
public static Dialog createDialog( Activity parent, Bundle bundle )
public static Dialog makeDialog( Activity parent, Bundle bundle )
{
LookupAlert view = (LookupAlert)
LocUtils.inflate( parent, R.layout.lookup );
@ -367,4 +383,11 @@ public class LookupAlert extends LinearLayout
result.setOnKeyListener( view );
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 );
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 );
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.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@ -123,4 +124,11 @@ public class XWActivity extends Activity {
super.onPrepareDialog( 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.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@ -123,4 +124,11 @@ public class XWListActivity extends ListActivity {
super.onPrepareDialog( 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 DrawSelDelegate m_dsdel;
private ExpandedListener m_expListener;
private boolean m_expanded = false;
private View m_expandedView;
public interface DeleteCallback {
void deleteCalled( XWListItem item );
}
public interface ExpandedListener {
void expanded( XWListItem me, boolean expanded );
}
public XWListItem( Context cx, AttributeSet as ) {
super( cx, as );
m_context = cx;
@ -65,6 +73,36 @@ public class XWListItem extends LinearLayout
public int getPosition() { return m_position; }
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 )
{
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.
// So rather than create a subclass that knows about its purpose
// I'll extend this with a general mechanism. Hackery but ok.
public void cache( Object obj )
public void setCached( Object obj )
{
m_cached = obj;
}
@ -148,6 +186,8 @@ public class XWListItem extends LinearLayout
{
if ( m_checkbox == view ) {
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 HashMap<Integer, String> s_idsToKeys = null;
private static Boolean s_enabled = null;
private static Boolean UPPER_CASE = false;
private static String s_curLocale;
private static WeakReference<Menu> s_latestMenuRef;
private static HashMap<WeakReference<Menu>, HashSet<String> > s_menuSets
@ -272,9 +271,6 @@ public class LocUtils {
result = getBlessedXlation( context, key, canUseDB );
}
if ( UPPER_CASE && null == result ) {
result = toUpperCase( key );
}
return result;
}
@ -622,29 +618,6 @@ public class LocUtils {
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 )
{
s_xlationsBlessed = null;

View file

@ -68,7 +68,7 @@ cp *.apk /tmp/releases_${VARIANT}
cd $CURDIR
echo "remove build dir $BUILDIR? (y or n):"
echo -n "==> "
echo -n "(y or n) ==> "
read ANSWER
if [ "$ANSWER" = 'y' ]; then
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
$(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
rm -f $@
for WORD in $$(zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$"); do \
grep -q "^$$WORD$$" /tmp/Top_5000.dict && echo $$WORD; \
done | gzip -c > $@
zcat $(ENGLISH)/Top_5000.dict.gz | tr [a-z] [A-Z] | sort > /tmp/Top_5000.dict
zcat $< | tr -d '\r' | tr [a-z] [A-Z] | grep -e "^[A-Z]\{2,15\}$$" | sort > /tmp/$$(basename $<)
rm -f $@
comm -12 /tmp/$$(basename $<) /tmp/Top_5000.dict | gzip -c > $@
# Everything but creating of the Main.dict file is inherited from the
# "parent" Makefile.langcommon in the parent directory.