switch to providing details about remote wordlist via expanding view

rather than a separate alert.
This commit is contained in:
Eric House 2014-06-22 13:36:25 -07:00
parent 91fe1537cb
commit 46fba6204a
9 changed files with 274 additions and 190 deletions

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;
@ -1417,7 +1419,7 @@ public final class R {
different wordlists.)
*/
public static final int lang_label=0x7f0600c6;
public static final int lang_name_fmt=0x7f0602c0;
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;
@ -1896,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

View file

@ -2,7 +2,6 @@
<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"
@ -11,35 +10,40 @@
android:textAppearance="?android:attr/textAppearanceLarge"
android:longClickable="true"
android:background="@android:drawable/list_selector_background"
android:orientation="horizontal"
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"
/>
<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,21 @@
<?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"
android:padding="10sp"
>
<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

@ -2263,9 +2263,9 @@
<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

@ -1936,9 +1936,9 @@
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

@ -1936,9 +1936,9 @@
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

@ -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,7 +71,8 @@ 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_SHOWREMOTE = "do_launch";
protected static final String DICT_LANG_EXTRA = "use_lang";
@ -99,6 +102,7 @@ public class DictsDelegate extends ListDelegateBase
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;
@ -114,7 +118,7 @@ public class DictsDelegate extends ListDelegateBase
m_lang = lang;
m_nWords = nWords;
m_nBytes = nBytes;
m_note = null == note? "" : note;
m_note = note;
}
public int compareTo( Object obj ) {
DictInfo other = (DictInfo)obj;
@ -219,7 +223,7 @@ public class DictsDelegate extends ListDelegateBase
String name = info.m_name;
item.setText( name );
item.setOnClickListener( DictsDelegate.this );
item.setExpandedListener( DictsDelegate.this );
item.setComment( m_onServerStr );
item.setCached( info );
@ -459,6 +463,7 @@ public class DictsDelegate extends ListDelegateBase
}
m_locNames = getStringArray( R.array.loc_names );
m_noteNone = getString( R.string.note_none );
setContentView( R.layout.dict_browse );
m_listView = getListView();
@ -523,20 +528,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() );
}
}
@ -798,11 +791,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()] );
@ -981,6 +969,39 @@ public class DictsDelegate extends ListDelegateBase
launchForResult( activity, requestCode, 0, null );
}
//////////////////////////////////////////////////////////////////////
// XWListItem.ExpandedListener
//////////////////////////////////////////////////////////////////////
public void expanded( XWListItem me, boolean expanded )
{
if ( expanded ) {
LinearLayout view =
(LinearLayout)inflate( R.layout.remote_dict_details );
final DictInfo info = (DictInfo)me.getCached();
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();
}
}
//////////////////////////////////////////////////////////////////////
// DwnldActivity.DownloadFinishedListener interface
//////////////////////////////////////////////////////////////////////
@ -1084,6 +1105,9 @@ public class DictsDelegate extends ListDelegateBase
long nBytes = dict.optLong( "nBytes", -1 );
int nWords = dict.optInt( "nWords", -1 );
String note = dict.optString( "note" );
if ( 0 == note.length() ) {
note = null;
}
DictInfo info = new DictInfo( name, langName, nWords, nBytes, note );
if ( !m_quickFetchMode ) {

View file

@ -79,7 +79,6 @@ public class DlgDelegate {
// Dict Browser
FINISH_ACTION,
DELETE_DICT_ACTION,
DOWNLOAD_DICT_ACTION,
UPDATE_DICTS_ACTION,
// Game configs

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,28 @@ 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 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 );
@ -148,6 +178,9 @@ public class XWListItem extends LinearLayout
{
if ( m_checkbox == view ) {
setSelected( m_checkbox.isChecked() );
} else if ( null != m_expListener ) {
m_expanded = !m_expanded;
m_expListener.expanded( this, m_expanded );
}
}