mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
start rewrite of invitation dialogs
Moving stuff into superclass and trying in general to simplify things. BT and SMS invitation work, but the option to have more than one player per device isn't available. RelayID invitation is a mess, but was before I think. WiDir invitation crashes in assert because I can't debug it on this branch. Lots of work and cleanup still required.
This commit is contained in:
parent
a1e4d4da0e
commit
cd14001db1
15 changed files with 843 additions and 818 deletions
|
@ -88,263 +88,266 @@ public final class R {
|
|||
}
|
||||
public static final class id {
|
||||
public static final int about_xlator=0x7f0c0001;
|
||||
public static final int add_player=0x7f0c0031;
|
||||
public static final int advertise_new_room_check=0x7f0c0038;
|
||||
public static final int blessed_label=0x7f0c005e;
|
||||
public static final int board_menu_chat=0x7f0c00a5;
|
||||
public static final int board_menu_dict=0x7f0c00a2;
|
||||
public static final int board_menu_done=0x7f0c008c;
|
||||
public static final int board_menu_file_prefs=0x7f0c0099;
|
||||
public static final int board_menu_flip=0x7f0c00a4;
|
||||
public static final int board_menu_game_counts=0x7f0c0092;
|
||||
public static final int board_menu_game_history=0x7f0c0094;
|
||||
public static final int board_menu_game_invites=0x7f0c009b;
|
||||
public static final int board_menu_game_left=0x7f0c0093;
|
||||
public static final int board_menu_game_netstats=0x7f0c009a;
|
||||
public static final int board_menu_game_resend=0x7f0c0096;
|
||||
public static final int board_menu_game_resign=0x7f0c0095;
|
||||
public static final int board_menu_hint_next=0x7f0c00a0;
|
||||
public static final int board_menu_hint_prev=0x7f0c009f;
|
||||
public static final int board_menu_invite=0x7f0c009c;
|
||||
public static final int board_menu_juggle=0x7f0c00a3;
|
||||
public static final int board_menu_rematch=0x7f0c008b;
|
||||
public static final int board_menu_toggle=0x7f0c00a6;
|
||||
public static final int board_menu_trade=0x7f0c008d;
|
||||
public static final int board_menu_trade_cancel=0x7f0c008e;
|
||||
public static final int board_menu_trade_commit=0x7f0c008f;
|
||||
public static final int board_menu_tray=0x7f0c0091;
|
||||
public static final int board_menu_undo_current=0x7f0c00a1;
|
||||
public static final int board_menu_undo_last=0x7f0c0090;
|
||||
public static final int add_player=0x7f0c0033;
|
||||
public static final int advertise_new_room_check=0x7f0c003a;
|
||||
public static final int blessed_label=0x7f0c0060;
|
||||
public static final int board_menu_chat=0x7f0c00a7;
|
||||
public static final int board_menu_dict=0x7f0c00a4;
|
||||
public static final int board_menu_done=0x7f0c008e;
|
||||
public static final int board_menu_file_prefs=0x7f0c009b;
|
||||
public static final int board_menu_flip=0x7f0c00a6;
|
||||
public static final int board_menu_game_counts=0x7f0c0094;
|
||||
public static final int board_menu_game_history=0x7f0c0096;
|
||||
public static final int board_menu_game_invites=0x7f0c009d;
|
||||
public static final int board_menu_game_left=0x7f0c0095;
|
||||
public static final int board_menu_game_netstats=0x7f0c009c;
|
||||
public static final int board_menu_game_resend=0x7f0c0098;
|
||||
public static final int board_menu_game_resign=0x7f0c0097;
|
||||
public static final int board_menu_hint_next=0x7f0c00a2;
|
||||
public static final int board_menu_hint_prev=0x7f0c00a1;
|
||||
public static final int board_menu_invite=0x7f0c009e;
|
||||
public static final int board_menu_juggle=0x7f0c00a5;
|
||||
public static final int board_menu_rematch=0x7f0c008d;
|
||||
public static final int board_menu_toggle=0x7f0c00a8;
|
||||
public static final int board_menu_trade=0x7f0c008f;
|
||||
public static final int board_menu_trade_cancel=0x7f0c0090;
|
||||
public static final int board_menu_trade_commit=0x7f0c0091;
|
||||
public static final int board_menu_tray=0x7f0c0093;
|
||||
public static final int board_menu_undo_current=0x7f0c00a3;
|
||||
public static final int board_menu_undo_last=0x7f0c0092;
|
||||
public static final int board_root=0x7f0c0002;
|
||||
public static final int board_view=0x7f0c0003;
|
||||
public static final int boardsize_spinner=0x7f0c0044;
|
||||
public static final int button_add=0x7f0c0078;
|
||||
public static final int button_clear=0x7f0c0054;
|
||||
public static final int button_done=0x7f0c0069;
|
||||
public static final int button_invite=0x7f0c0055;
|
||||
public static final int button_newgame_multi=0x7f0c0046;
|
||||
public static final int button_newgame_solo=0x7f0c0045;
|
||||
public static final int button_rescan=0x7f0c0053;
|
||||
public static final int button_study=0x7f0c0068;
|
||||
public static final int change_connection=0x7f0c003c;
|
||||
public static final int chat_button=0x7f0c0084;
|
||||
public static final int chat_edit=0x7f0c000b;
|
||||
public static final int chat_history=0x7f0c000a;
|
||||
public static final int chat_menu_clear=0x7f0c00a8;
|
||||
public static final int chat_menu_send=0x7f0c00a7;
|
||||
public static final int chat_row_name=0x7f0c000d;
|
||||
public static final int chat_row_text=0x7f0c000e;
|
||||
public static final int chat_send=0x7f0c000c;
|
||||
public static final int checkbox=0x7f0c0058;
|
||||
public static final int color_display_sample=0x7f0c000f;
|
||||
public static final int color_edit_sample=0x7f0c0010;
|
||||
public static final int confirm_sms_reasons=0x7f0c0017;
|
||||
public static final int conn_types=0x7f0c0018;
|
||||
public static final int connect_set_relay=0x7f0c0034;
|
||||
public static final int conns_label=0x7f0c0033;
|
||||
public static final int default_check=0x7f0c0019;
|
||||
public static final int del=0x7f0c005b;
|
||||
public static final int desc=0x7f0c001c;
|
||||
public static final int details=0x7f0c0079;
|
||||
public static final int dict_label=0x7f0c0070;
|
||||
public static final int dict_spinner=0x7f0c002e;
|
||||
public static final int dictlist_button=0x7f0c0087;
|
||||
public static final int dicts_delete=0x7f0c00ab;
|
||||
public static final int dicts_deselect_all=0x7f0c00aa;
|
||||
public static final int dicts_download=0x7f0c00a9;
|
||||
public static final int dicts_move=0x7f0c00ac;
|
||||
public static final int dicts_select=0x7f0c00ad;
|
||||
public static final int divider=0x7f0c0024;
|
||||
public static final int download_button=0x7f0c007a;
|
||||
public static final int dwnld_message=0x7f0c0050;
|
||||
public static final int edit=0x7f0c006a;
|
||||
public static final int edit_blue=0x7f0c0016;
|
||||
public static final int edit_green=0x7f0c0014;
|
||||
public static final int edit_red=0x7f0c0012;
|
||||
public static final int english_label=0x7f0c005c;
|
||||
public static final int english_view=0x7f0c005d;
|
||||
public static final int boardsize_spinner=0x7f0c0046;
|
||||
public static final int button_add=0x7f0c0009;
|
||||
public static final int button_bar=0x7f0c0055;
|
||||
public static final int button_clear=0x7f0c000a;
|
||||
public static final int button_done=0x7f0c006b;
|
||||
public static final int button_invite=0x7f0c0056;
|
||||
public static final int button_newgame_multi=0x7f0c0048;
|
||||
public static final int button_newgame_solo=0x7f0c0047;
|
||||
public static final int button_relay_add=0x7f0c007a;
|
||||
public static final int button_study=0x7f0c006a;
|
||||
public static final int change_connection=0x7f0c003e;
|
||||
public static final int chat_button=0x7f0c0086;
|
||||
public static final int chat_edit=0x7f0c000d;
|
||||
public static final int chat_history=0x7f0c000c;
|
||||
public static final int chat_menu_clear=0x7f0c00aa;
|
||||
public static final int chat_menu_send=0x7f0c00a9;
|
||||
public static final int chat_row_name=0x7f0c000f;
|
||||
public static final int chat_row_text=0x7f0c0010;
|
||||
public static final int chat_send=0x7f0c000e;
|
||||
public static final int checkbox=0x7f0c005a;
|
||||
public static final int color_display_sample=0x7f0c0011;
|
||||
public static final int color_edit_sample=0x7f0c0012;
|
||||
public static final int confirm_sms_reasons=0x7f0c0019;
|
||||
public static final int conn_types=0x7f0c001a;
|
||||
public static final int connect_set_relay=0x7f0c0036;
|
||||
public static final int conns_label=0x7f0c0035;
|
||||
public static final int default_check=0x7f0c001b;
|
||||
public static final int del=0x7f0c005d;
|
||||
public static final int desc=0x7f0c001e;
|
||||
public static final int details=0x7f0c007c;
|
||||
public static final int dict_label=0x7f0c0072;
|
||||
public static final int dict_spinner=0x7f0c0030;
|
||||
public static final int dictlist_button=0x7f0c0089;
|
||||
public static final int dicts_delete=0x7f0c00ad;
|
||||
public static final int dicts_deselect_all=0x7f0c00ac;
|
||||
public static final int dicts_download=0x7f0c00ab;
|
||||
public static final int dicts_move=0x7f0c00ae;
|
||||
public static final int dicts_select=0x7f0c00af;
|
||||
public static final int divider=0x7f0c0026;
|
||||
public static final int download_button=0x7f0c007d;
|
||||
public static final int dwnld_message=0x7f0c0052;
|
||||
public static final int edit=0x7f0c006c;
|
||||
public static final int edit_blue=0x7f0c0018;
|
||||
public static final int edit_green=0x7f0c0016;
|
||||
public static final int edit_red=0x7f0c0014;
|
||||
public static final int english_label=0x7f0c005e;
|
||||
public static final int english_view=0x7f0c005f;
|
||||
public static final int exchange_buttons=0x7f0c0004;
|
||||
public static final int exchange_cancel=0x7f0c0006;
|
||||
public static final int exchange_commit=0x7f0c0005;
|
||||
public static final int expander=0x7f0c0027;
|
||||
public static final int filters=0x7f0c0063;
|
||||
public static final int flip_button=0x7f0c0089;
|
||||
public static final int game_locked_check=0x7f0c0029;
|
||||
public static final int game_name=0x7f0c0047;
|
||||
public static final int gamel_menu_checkmoves=0x7f0c0098;
|
||||
public static final int games_game_config=0x7f0c00b0;
|
||||
public static final int games_game_copy=0x7f0c00b5;
|
||||
public static final int games_game_delete=0x7f0c00ae;
|
||||
public static final int games_game_deselect=0x7f0c00b7;
|
||||
public static final int games_game_invites=0x7f0c00b8;
|
||||
public static final int games_game_move=0x7f0c00b1;
|
||||
public static final int games_game_new_from=0x7f0c00b3;
|
||||
public static final int games_game_rematch=0x7f0c00af;
|
||||
public static final int games_game_rename=0x7f0c00b4;
|
||||
public static final int games_game_reset=0x7f0c00b2;
|
||||
public static final int games_game_select=0x7f0c00b6;
|
||||
public static final int games_group_default=0x7f0c00bc;
|
||||
public static final int games_group_delete=0x7f0c00bb;
|
||||
public static final int games_group_movedown=0x7f0c00ba;
|
||||
public static final int games_group_moveup=0x7f0c00b9;
|
||||
public static final int games_group_rename=0x7f0c00bd;
|
||||
public static final int games_menu_about=0x7f0c00c6;
|
||||
public static final int games_menu_checkmoves=0x7f0c00c8;
|
||||
public static final int games_menu_checkupdates=0x7f0c00c9;
|
||||
public static final int games_menu_dicts=0x7f0c00c4;
|
||||
public static final int games_menu_disable_dualpane=0x7f0c00be;
|
||||
public static final int games_menu_email=0x7f0c00c5;
|
||||
public static final int games_menu_loaddb=0x7f0c00cb;
|
||||
public static final int games_menu_newgame_net=0x7f0c00c0;
|
||||
public static final int games_menu_newgame_solo=0x7f0c00bf;
|
||||
public static final int games_menu_newgroup=0x7f0c00c1;
|
||||
public static final int games_menu_prefs=0x7f0c00c2;
|
||||
public static final int games_menu_rateme=0x7f0c00c3;
|
||||
public static final int games_menu_resend=0x7f0c00c7;
|
||||
public static final int games_menu_storedb=0x7f0c00ca;
|
||||
public static final int games_menu_study=0x7f0c0097;
|
||||
public static final int group_done=0x7f0c008a;
|
||||
public static final int group_exchange=0x7f0c009d;
|
||||
public static final int group_hint=0x7f0c009e;
|
||||
public static final int hideable=0x7f0c004c;
|
||||
public static final int hints_allowed=0x7f0c003d;
|
||||
public static final int invite_desc=0x7f0c0052;
|
||||
public static final int inviter_check=0x7f0c0056;
|
||||
public static final int item_name=0x7f0c0074;
|
||||
public static final int item_score=0x7f0c0075;
|
||||
public static final int join_public_room_check=0x7f0c0035;
|
||||
public static final int juggle_players=0x7f0c0032;
|
||||
public static final int label=0x7f0c0026;
|
||||
public static final int lang_separator=0x7f0c002c;
|
||||
public static final int lang_spinner=0x7f0c002d;
|
||||
public static final int list_container=0x7f0c0023;
|
||||
public static final int loc_item_check=0x7f0c00cd;
|
||||
public static final int loc_item_clear=0x7f0c00cc;
|
||||
public static final int loc_item_copy_bless=0x7f0c00cf;
|
||||
public static final int loc_item_copy_eng=0x7f0c00ce;
|
||||
public static final int loc_search_button=0x7f0c0065;
|
||||
public static final int loc_search_field=0x7f0c0064;
|
||||
public static final int local_label=0x7f0c0060;
|
||||
public static final int local_player_set=0x7f0c006e;
|
||||
public static final int main_container=0x7f0c0025;
|
||||
public static final int manual_add_button=0x7f0c007c;
|
||||
public static final int modtime=0x7f0c004d;
|
||||
public static final int msg=0x7f0c006b;
|
||||
public static final int msg_marker=0x7f0c004a;
|
||||
public static final int name=0x7f0c007d;
|
||||
public static final int name_edit=0x7f0c001a;
|
||||
public static final int name_label=0x7f0c007b;
|
||||
public static final int nexthint_button=0x7f0c0083;
|
||||
public static final int not_again_check=0x7f0c006c;
|
||||
public static final int nperdev_spinner=0x7f0c0057;
|
||||
public static final int number=0x7f0c007e;
|
||||
public static final int other_lang=0x7f0c0066;
|
||||
public static final int password_edit=0x7f0c0073;
|
||||
public static final int password_set=0x7f0c0072;
|
||||
public static final int phonies_spinner=0x7f0c0042;
|
||||
public static final int pick_faceup=0x7f0c0043;
|
||||
public static final int pick_lang=0x7f0c007f;
|
||||
public static final int pick_lang_spinner=0x7f0c0080;
|
||||
public static final int play_button=0x7f0c002a;
|
||||
public static final int player_list=0x7f0c0030;
|
||||
public static final int player_name_edit=0x7f0c006f;
|
||||
public static final int players=0x7f0c0028;
|
||||
public static final int players_label=0x7f0c002f;
|
||||
public static final int prevhint_button=0x7f0c0082;
|
||||
public static final int private_rooms_set=0x7f0c0036;
|
||||
public static final int progress_bar=0x7f0c0051;
|
||||
public static final int public_rooms_set=0x7f0c0039;
|
||||
public static final int refresh_button=0x7f0c003b;
|
||||
public static final int remote_check=0x7f0c006d;
|
||||
public static final int revert_all=0x7f0c0077;
|
||||
public static final int revert_colors=0x7f0c0076;
|
||||
public static final int robot_check=0x7f0c0071;
|
||||
public static final int role=0x7f0c004f;
|
||||
public static final int room_edit=0x7f0c0037;
|
||||
public static final int room_spinner=0x7f0c003a;
|
||||
public static final int screen=0x7f0c002b;
|
||||
public static final int scroll=0x7f0c0009;
|
||||
public static final int search=0x7f0c001d;
|
||||
public static final int search_button=0x7f0c001f;
|
||||
public static final int seek_blue=0x7f0c0015;
|
||||
public static final int seek_green=0x7f0c0013;
|
||||
public static final int seek_red=0x7f0c0011;
|
||||
public static final int show_remote=0x7f0c001b;
|
||||
public static final int shuffle_button=0x7f0c0085;
|
||||
public static final int sizes=0x7f0c0020;
|
||||
public static final int slmenu_clear_sel=0x7f0c00d4;
|
||||
public static final int slmenu_copy_sel=0x7f0c00d3;
|
||||
public static final int slmenu_deselect_all=0x7f0c00d2;
|
||||
public static final int slmenu_lookup_sel=0x7f0c00d0;
|
||||
public static final int slmenu_select_all=0x7f0c00d1;
|
||||
public static final int smart_robot=0x7f0c0041;
|
||||
public static final int state=0x7f0c004e;
|
||||
public static final int summary=0x7f0c0067;
|
||||
public static final int expander=0x7f0c0029;
|
||||
public static final int filters=0x7f0c0065;
|
||||
public static final int flip_button=0x7f0c008b;
|
||||
public static final int frame=0x7f0c0059;
|
||||
public static final int game_locked_check=0x7f0c002b;
|
||||
public static final int game_name=0x7f0c0049;
|
||||
public static final int gamel_menu_checkmoves=0x7f0c009a;
|
||||
public static final int games_game_config=0x7f0c00b2;
|
||||
public static final int games_game_copy=0x7f0c00b7;
|
||||
public static final int games_game_delete=0x7f0c00b0;
|
||||
public static final int games_game_deselect=0x7f0c00b9;
|
||||
public static final int games_game_invites=0x7f0c00ba;
|
||||
public static final int games_game_move=0x7f0c00b3;
|
||||
public static final int games_game_new_from=0x7f0c00b5;
|
||||
public static final int games_game_rematch=0x7f0c00b1;
|
||||
public static final int games_game_rename=0x7f0c00b6;
|
||||
public static final int games_game_reset=0x7f0c00b4;
|
||||
public static final int games_game_select=0x7f0c00b8;
|
||||
public static final int games_group_default=0x7f0c00be;
|
||||
public static final int games_group_delete=0x7f0c00bd;
|
||||
public static final int games_group_movedown=0x7f0c00bc;
|
||||
public static final int games_group_moveup=0x7f0c00bb;
|
||||
public static final int games_group_rename=0x7f0c00bf;
|
||||
public static final int games_menu_about=0x7f0c00c8;
|
||||
public static final int games_menu_checkmoves=0x7f0c00ca;
|
||||
public static final int games_menu_checkupdates=0x7f0c00cb;
|
||||
public static final int games_menu_dicts=0x7f0c00c6;
|
||||
public static final int games_menu_disable_dualpane=0x7f0c00c0;
|
||||
public static final int games_menu_email=0x7f0c00c7;
|
||||
public static final int games_menu_loaddb=0x7f0c00cd;
|
||||
public static final int games_menu_newgame_net=0x7f0c00c2;
|
||||
public static final int games_menu_newgame_solo=0x7f0c00c1;
|
||||
public static final int games_menu_newgroup=0x7f0c00c3;
|
||||
public static final int games_menu_prefs=0x7f0c00c4;
|
||||
public static final int games_menu_rateme=0x7f0c00c5;
|
||||
public static final int games_menu_resend=0x7f0c00c9;
|
||||
public static final int games_menu_storedb=0x7f0c00cc;
|
||||
public static final int games_menu_study=0x7f0c0099;
|
||||
public static final int group_done=0x7f0c008c;
|
||||
public static final int group_exchange=0x7f0c009f;
|
||||
public static final int group_hint=0x7f0c00a0;
|
||||
public static final int hideable=0x7f0c004e;
|
||||
public static final int hints_allowed=0x7f0c003f;
|
||||
public static final int invite_desc=0x7f0c0054;
|
||||
public static final int inviter_check=0x7f0c0057;
|
||||
public static final int item_name=0x7f0c0076;
|
||||
public static final int item_score=0x7f0c0077;
|
||||
public static final int join_public_room_check=0x7f0c0037;
|
||||
public static final int juggle_players=0x7f0c0034;
|
||||
public static final int label=0x7f0c0028;
|
||||
public static final int lang_separator=0x7f0c002e;
|
||||
public static final int lang_spinner=0x7f0c002f;
|
||||
public static final int list_container=0x7f0c0025;
|
||||
public static final int loc_item_check=0x7f0c00cf;
|
||||
public static final int loc_item_clear=0x7f0c00ce;
|
||||
public static final int loc_item_copy_bless=0x7f0c00d1;
|
||||
public static final int loc_item_copy_eng=0x7f0c00d0;
|
||||
public static final int loc_search_button=0x7f0c0067;
|
||||
public static final int loc_search_field=0x7f0c0066;
|
||||
public static final int local_label=0x7f0c0062;
|
||||
public static final int local_player_set=0x7f0c0070;
|
||||
public static final int main_container=0x7f0c0027;
|
||||
public static final int manual_add_button=0x7f0c007b;
|
||||
public static final int modtime=0x7f0c004f;
|
||||
public static final int msg=0x7f0c006d;
|
||||
public static final int msg_marker=0x7f0c004c;
|
||||
public static final int name=0x7f0c007f;
|
||||
public static final int name_edit=0x7f0c001c;
|
||||
public static final int name_label=0x7f0c007e;
|
||||
public static final int nexthint_button=0x7f0c0085;
|
||||
public static final int not_again_check=0x7f0c006e;
|
||||
public static final int nperdev_spinner=0x7f0c0058;
|
||||
public static final int number=0x7f0c0080;
|
||||
public static final int other_lang=0x7f0c0068;
|
||||
public static final int password_edit=0x7f0c0075;
|
||||
public static final int password_set=0x7f0c0074;
|
||||
public static final int phonies_spinner=0x7f0c0044;
|
||||
public static final int pick_faceup=0x7f0c0045;
|
||||
public static final int pick_lang=0x7f0c0081;
|
||||
public static final int pick_lang_spinner=0x7f0c0082;
|
||||
public static final int play_button=0x7f0c002c;
|
||||
public static final int player_list=0x7f0c0032;
|
||||
public static final int player_name_edit=0x7f0c0071;
|
||||
public static final int players=0x7f0c002a;
|
||||
public static final int players_label=0x7f0c0031;
|
||||
public static final int prevhint_button=0x7f0c0084;
|
||||
public static final int private_rooms_set=0x7f0c0038;
|
||||
public static final int progress_bar=0x7f0c0053;
|
||||
public static final int public_rooms_set=0x7f0c003b;
|
||||
public static final int refresh_button=0x7f0c003d;
|
||||
public static final int remote_check=0x7f0c006f;
|
||||
public static final int revert_all=0x7f0c0079;
|
||||
public static final int revert_colors=0x7f0c0078;
|
||||
public static final int robot_check=0x7f0c0073;
|
||||
public static final int role=0x7f0c0051;
|
||||
public static final int room_edit=0x7f0c0039;
|
||||
public static final int room_spinner=0x7f0c003c;
|
||||
public static final int screen=0x7f0c002d;
|
||||
public static final int scroll=0x7f0c000b;
|
||||
public static final int search=0x7f0c001f;
|
||||
public static final int search_button=0x7f0c0021;
|
||||
public static final int seek_blue=0x7f0c0017;
|
||||
public static final int seek_green=0x7f0c0015;
|
||||
public static final int seek_red=0x7f0c0013;
|
||||
public static final int show_remote=0x7f0c001d;
|
||||
public static final int shuffle_button=0x7f0c0087;
|
||||
public static final int sizes=0x7f0c0022;
|
||||
public static final int slmenu_clear_sel=0x7f0c00d6;
|
||||
public static final int slmenu_copy_sel=0x7f0c00d5;
|
||||
public static final int slmenu_deselect_all=0x7f0c00d4;
|
||||
public static final int slmenu_lookup_sel=0x7f0c00d2;
|
||||
public static final int slmenu_select_all=0x7f0c00d3;
|
||||
public static final int smart_robot=0x7f0c0043;
|
||||
public static final int state=0x7f0c0050;
|
||||
public static final int summary=0x7f0c0069;
|
||||
public static final int tbar_parent_hor=0x7f0c0008;
|
||||
public static final int tbar_parent_vert=0x7f0c0007;
|
||||
public static final int text_item=0x7f0c0059;
|
||||
public static final int text_item2=0x7f0c005a;
|
||||
public static final int thumbnail=0x7f0c004b;
|
||||
public static final int timer_minutes_edit=0x7f0c0040;
|
||||
public static final int timer_set=0x7f0c003f;
|
||||
public static final int toolbar=0x7f0c0081;
|
||||
public static final int undo_button=0x7f0c0086;
|
||||
public static final int use_timer=0x7f0c003e;
|
||||
public static final int values_button=0x7f0c0088;
|
||||
public static final int text_item=0x7f0c005b;
|
||||
public static final int text_item2=0x7f0c005c;
|
||||
public static final int thumbnail=0x7f0c004d;
|
||||
public static final int timer_minutes_edit=0x7f0c0042;
|
||||
public static final int timer_set=0x7f0c0041;
|
||||
public static final int toolbar=0x7f0c0083;
|
||||
public static final int undo_button=0x7f0c0088;
|
||||
public static final int use_timer=0x7f0c0040;
|
||||
public static final int values_button=0x7f0c008a;
|
||||
public static final int version_string=0x7f0c0000;
|
||||
public static final int view_loaded=0x7f0c0049;
|
||||
public static final int view_unloaded=0x7f0c0048;
|
||||
public static final int word_edit=0x7f0c001e;
|
||||
public static final int wordlen_max=0x7f0c0022;
|
||||
public static final int wordlen_min=0x7f0c0021;
|
||||
public static final int xlated_view=0x7f0c0062;
|
||||
public static final int xlated_view_blessed=0x7f0c005f;
|
||||
public static final int xlated_view_local=0x7f0c0061;
|
||||
public static final int view_loaded=0x7f0c004b;
|
||||
public static final int view_unloaded=0x7f0c004a;
|
||||
public static final int word_edit=0x7f0c0020;
|
||||
public static final int wordlen_max=0x7f0c0024;
|
||||
public static final int wordlen_min=0x7f0c0023;
|
||||
public static final int xlated_view=0x7f0c0064;
|
||||
public static final int xlated_view_blessed=0x7f0c0061;
|
||||
public static final int xlated_view_local=0x7f0c0063;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int about_dlg=0x7f030000;
|
||||
public static final int board=0x7f030001;
|
||||
public static final int chat=0x7f030002;
|
||||
public static final int chat_row=0x7f030003;
|
||||
public static final int color_display=0x7f030004;
|
||||
public static final int color_edit=0x7f030005;
|
||||
public static final int confirm_sms=0x7f030006;
|
||||
public static final int conn_types_display=0x7f030007;
|
||||
public static final int dflt_name=0x7f030008;
|
||||
public static final int dict_browse=0x7f030009;
|
||||
public static final int dict_browser=0x7f03000a;
|
||||
public static final int dict_browser_list=0x7f03000b;
|
||||
public static final int divider_view=0x7f03000c;
|
||||
public static final int dualcontainer=0x7f03000d;
|
||||
public static final int expander_header=0x7f03000e;
|
||||
public static final int force_remote=0x7f03000f;
|
||||
public static final int game_config=0x7f030010;
|
||||
public static final int game_list=0x7f030011;
|
||||
public static final int game_list_group=0x7f030012;
|
||||
public static final int game_list_item=0x7f030013;
|
||||
public static final int import_dict=0x7f030014;
|
||||
public static final int import_dict_item=0x7f030015;
|
||||
public static final int inviter=0x7f030016;
|
||||
public static final int inviter_item=0x7f030017;
|
||||
public static final int list_group=0x7f030018;
|
||||
public static final int list_item=0x7f030019;
|
||||
public static final int loc_item_edit=0x7f03001a;
|
||||
public static final int loc_list_item=0x7f03001b;
|
||||
public static final int loc_main=0x7f03001c;
|
||||
public static final int lookup=0x7f03001d;
|
||||
public static final int msg_label_and_edit=0x7f03001e;
|
||||
public static final int not_again_view=0x7f03001f;
|
||||
public static final int passwd_view=0x7f030020;
|
||||
public static final int player_edit=0x7f030021;
|
||||
public static final int player_list_elem=0x7f030022;
|
||||
public static final int prefs_w_buttons=0x7f030023;
|
||||
public static final int relayinviter=0x7f030024;
|
||||
public static final int remote_dict_details=0x7f030025;
|
||||
public static final int rename_game=0x7f030026;
|
||||
public static final int smsinviter=0x7f030027;
|
||||
public static final int smsinviter_item=0x7f030028;
|
||||
public static final int studylist=0x7f030029;
|
||||
public static final int toolbar=0x7f03002a;
|
||||
public static final int bt_buttons=0x7f030002;
|
||||
public static final int chat=0x7f030003;
|
||||
public static final int chat_row=0x7f030004;
|
||||
public static final int color_display=0x7f030005;
|
||||
public static final int color_edit=0x7f030006;
|
||||
public static final int confirm_sms=0x7f030007;
|
||||
public static final int conn_types_display=0x7f030008;
|
||||
public static final int dflt_name=0x7f030009;
|
||||
public static final int dict_browse=0x7f03000a;
|
||||
public static final int dict_browser=0x7f03000b;
|
||||
public static final int dict_browser_list=0x7f03000c;
|
||||
public static final int divider_view=0x7f03000d;
|
||||
public static final int dualcontainer=0x7f03000e;
|
||||
public static final int expander_header=0x7f03000f;
|
||||
public static final int force_remote=0x7f030010;
|
||||
public static final int game_config=0x7f030011;
|
||||
public static final int game_list=0x7f030012;
|
||||
public static final int game_list_group=0x7f030013;
|
||||
public static final int game_list_item=0x7f030014;
|
||||
public static final int import_dict=0x7f030015;
|
||||
public static final int import_dict_item=0x7f030016;
|
||||
public static final int inviter=0x7f030017;
|
||||
public static final int inviter_item=0x7f030018;
|
||||
public static final int list_group=0x7f030019;
|
||||
public static final int list_item=0x7f03001a;
|
||||
public static final int loc_item_edit=0x7f03001b;
|
||||
public static final int loc_list_item=0x7f03001c;
|
||||
public static final int loc_main=0x7f03001d;
|
||||
public static final int lookup=0x7f03001e;
|
||||
public static final int msg_label_and_edit=0x7f03001f;
|
||||
public static final int not_again_view=0x7f030020;
|
||||
public static final int passwd_view=0x7f030021;
|
||||
public static final int player_edit=0x7f030022;
|
||||
public static final int player_list_elem=0x7f030023;
|
||||
public static final int prefs_w_buttons=0x7f030024;
|
||||
public static final int relay_buttons=0x7f030025;
|
||||
public static final int remote_dict_details=0x7f030026;
|
||||
public static final int rename_game=0x7f030027;
|
||||
public static final int sms_buttons=0x7f030028;
|
||||
public static final int smsinviter_item=0x7f030029;
|
||||
public static final int studylist=0x7f03002a;
|
||||
public static final int toolbar=0x7f03002b;
|
||||
}
|
||||
public static final class menu {
|
||||
public static final int board_menu=0x7f0b0000;
|
||||
|
|
17
xwords4/android/XWords4/res/layout/bt_buttons.xml
Normal file
17
xwords4/android/XWords4/res/layout/bt_buttons.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_add"
|
||||
android:text="@string/bt_pick_addall_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -21,25 +21,16 @@
|
|||
android:padding="8dp"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_rescan"
|
||||
android:text="@string/bt_pick_addall_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
<!-- <Button android:id="@+id/button_reconfigure" -->
|
||||
<!-- android:text="@string/bt_pick_reconfig_button" -->
|
||||
<!-- android:layout_width="wrap_content" -->
|
||||
<!-- android:layout_height="wrap_content" -->
|
||||
<!-- android:layout_weight="1" -->
|
||||
<!-- /> -->
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<TextView android:id="@android:id/empty"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp"
|
||||
/>
|
||||
|
||||
<FrameLayout android:id="@+id/button_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/button_invite"
|
||||
android:text="@string/button_invite"
|
||||
|
|
|
@ -7,14 +7,21 @@
|
|||
>
|
||||
|
||||
<CheckBox android:id="@+id/inviter_check"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<Spinner android:id="@+id/nperdev_spinner"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
android:prompt="@string/nplayers_prompt"
|
||||
android:drawSelectorOnTop="true"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<FrameLayout android:id="@+id/frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
26
xwords4/android/XWords4/res/layout/relay_buttons.xml
Normal file
26
xwords4/android/XWords4/res/layout/relay_buttons.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_relay_add"
|
||||
android:text="@string/button_relay_add"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/manual_add_button"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@android:drawable/ic_input_add"
|
||||
android:clickable="false"
|
||||
/>
|
||||
|
||||
add_self_button
|
||||
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
<TextView android:id="@+id/invite_desc"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:padding="8dp"
|
||||
/>
|
||||
|
||||
<ListView android:id="@id/android:list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:layout_weight="1"
|
||||
android:padding="8dp"
|
||||
/>
|
||||
|
||||
<TextView android:id="@android:id/empty"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/empty_relay_inviter"
|
||||
android:padding="20dp"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_add"
|
||||
android:text="@string/button_relay_add"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:id="@+id/button_invite"
|
||||
android:text="@string/button_invite"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dip"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
24
xwords4/android/XWords4/res/layout/sms_buttons.xml
Normal file
24
xwords4/android/XWords4/res/layout/sms_buttons.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_add"
|
||||
android:text="@string/button_sms_add"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
|
||||
<ImageButton android:id="@+id/manual_add_button"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@android:drawable/ic_input_add"
|
||||
android:clickable="false"
|
||||
/>
|
||||
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
<TextView android:id="@+id/invite_desc"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:padding="8dp"
|
||||
/>
|
||||
|
||||
<ListView android:id="@id/android:list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:drawSelectorOnTop="false"
|
||||
android:layout_weight="1"
|
||||
android:padding="8dp"
|
||||
/>
|
||||
|
||||
<TextView android:id="@android:id/empty"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/empty_sms_inviter"
|
||||
android:padding="20dp"
|
||||
/>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<Button android:id="@+id/button_add"
|
||||
android:text="@string/button_sms_add"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
<ImageButton android:id="@+id/manual_add_button"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@android:drawable/ic_input_add"
|
||||
android:clickable="false"
|
||||
/>
|
||||
<Button android:id="@+id/button_clear"
|
||||
android:text="@string/bt_pick_clear_button"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button android:id="@+id/button_invite"
|
||||
android:text="@string/button_invite"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,34 +9,18 @@
|
|||
android:paddingRight="8dp"
|
||||
>
|
||||
|
||||
<CheckBox android:id="@+id/checkbox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<LinearLayout android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView android:id="@+id/name"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
/>
|
||||
<TextView android:id="@+id/number"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<Spinner android:id="@+id/nperdev_spinner"
|
||||
style="@style/evenly_spaced_horizontal"
|
||||
android:prompt="@string/nplayers_prompt"
|
||||
android:drawSelectorOnTop="true"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<TextView android:id="@+id/name"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
/>
|
||||
<TextView android:id="@+id/number"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</org.eehouse.android.xw4.SMSListItem>
|
||||
|
|
|
@ -26,13 +26,14 @@ import android.content.Intent;
|
|||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -47,7 +48,9 @@ import java.util.Set;
|
|||
|
||||
public class BTInviteDelegate extends InviteDelegate {
|
||||
private static final String TAG = BTInviteDelegate.class.getSimpleName();
|
||||
|
||||
private static final int[] BUTTONIDS = { R.id.button_add,
|
||||
R.id.button_clear,
|
||||
};
|
||||
private Activity m_activity;
|
||||
|
||||
public static void launchForResult( Activity activity, int nMissing,
|
||||
|
@ -68,7 +71,7 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
|
||||
protected BTInviteDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||
{
|
||||
super( delegator, savedInstanceState, R.layout.inviter );
|
||||
super( delegator, savedInstanceState );
|
||||
m_activity = delegator.getActivity();
|
||||
}
|
||||
|
||||
|
@ -78,11 +81,24 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
String msg = getString( R.string.bt_pick_addall_button );
|
||||
msg = getQuantityString( R.plurals.invite_bt_desc_fmt, m_nMissing,
|
||||
m_nMissing, msg );
|
||||
super.init( R.id.button_invite, R.id.button_rescan,
|
||||
R.id.button_clear, R.id.invite_desc, msg );
|
||||
super.init( msg, 0 );
|
||||
addButtonBar( R.layout.bt_buttons, BUTTONIDS );
|
||||
BTService.clearDevices( m_activity, null ); // will return names
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBarButtonClicked( int id )
|
||||
{
|
||||
switch( id ) {
|
||||
case R.id.button_add:
|
||||
scan();
|
||||
break;
|
||||
case R.id.button_clear:
|
||||
Utils.notImpl( m_activity );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// MultiService.MultiEventListener interface
|
||||
@Override
|
||||
public void eventOccurred( MultiService.MultiEvent event, final Object ... args )
|
||||
|
@ -93,22 +109,15 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
public void run() {
|
||||
synchronized( BTInviteDelegate.this ) {
|
||||
|
||||
String[] btDevAddrs = null;
|
||||
String[] btDevNames = null;
|
||||
TwoStringPair[] pairs = null;
|
||||
if ( 0 < args.length ) {
|
||||
btDevAddrs = (String[])(args[0]);
|
||||
btDevNames = (String[])(args[1]);
|
||||
if ( null != btDevNames
|
||||
&& 0 == btDevNames.length ) {
|
||||
btDevNames = null;
|
||||
btDevAddrs = null;
|
||||
}
|
||||
pairs = TwoStringPair.make( (String[])(args[0]),
|
||||
(String[])(args[1]) );
|
||||
}
|
||||
|
||||
// m_setChecked = null != btDevNames
|
||||
// && m_nMissing == btDevNames.length;
|
||||
updateListAdapter( R.layout.inviter_item,
|
||||
btDevNames, btDevAddrs, false );
|
||||
updateListAdapter( R.layout.smsinviter_item, pairs );
|
||||
// m_adapter = new NameAddrDevsAdapter( BTInviteDelegate.this,
|
||||
// btDevAddrs, btDevNames );
|
||||
// setListAdapter( m_adapter );
|
||||
|
@ -123,7 +132,27 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
protected void scan()
|
||||
@Override
|
||||
protected void onChildAdded( View child, InviterItem data )
|
||||
{
|
||||
SMSListItem item = (SMSListItem)child; // change class name!
|
||||
TwoStringPair pair = (TwoStringPair)data;
|
||||
((TextView)item.findViewById(R.id.number)).setText( pair.str1 );
|
||||
((TextView)item.findViewById(R.id.name)).setText( pair.str2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void listSelected( InviterItem[] selected, String[] devs, int[] counts )
|
||||
{
|
||||
for ( int ii = 0; ii < selected.length; ++ii ) {
|
||||
TwoStringPair rec = (TwoStringPair)selected[ii];
|
||||
counts[ii] = 1; // rec.m_nPlayers;
|
||||
devs[ii] = rec.str1;
|
||||
DbgUtils.logd( TAG, "selecting address %s", devs[ii] );
|
||||
}
|
||||
}
|
||||
|
||||
private void scan()
|
||||
{
|
||||
int count = BTService.getPairedCount( m_activity );
|
||||
if ( 0 < count ) {
|
||||
|
@ -136,15 +165,15 @@ public class BTInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clearSelected( Integer[] itemIndices )
|
||||
{
|
||||
String[][] selected = new String[1][];
|
||||
listSelected( selected, null );
|
||||
BTService.clearDevices( m_activity, selected[0] );
|
||||
// @Override
|
||||
// protected void clearSelected( Integer[] itemIndices )
|
||||
// {
|
||||
// // String[][] selected = new String[1][];
|
||||
// // listSelected( selected, null );
|
||||
// // BTService.clearDevices( m_activity, selected[0] );
|
||||
|
||||
// super.clearSelected( itemIndices );
|
||||
}
|
||||
// // super.clearSelected( itemIndices );
|
||||
// }
|
||||
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
@Override
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.widget.Button;
|
|||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
@ -48,6 +49,31 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
ViewGroup.OnHierarchyChangeListener {
|
||||
private static final String TAG = InviteDelegate.class.getSimpleName();
|
||||
|
||||
protected interface InviterItem {
|
||||
}
|
||||
|
||||
protected static class TwoStringPair implements InviterItem {
|
||||
public String str1;
|
||||
public String str2;
|
||||
|
||||
public TwoStringPair( String str1, String str2 ) {
|
||||
this.str1 = str1; this.str2 = str2;
|
||||
}
|
||||
|
||||
public static TwoStringPair[] make( String[] names, String[] addrs )
|
||||
{
|
||||
TwoStringPair[] pairs = new TwoStringPair[names.length];
|
||||
for ( int ii = 0; ii < pairs.length; ++ii ) {
|
||||
pairs[ii] = new TwoStringPair( names[ii], addrs[ii] );
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
}
|
||||
|
||||
// Children implement ...
|
||||
abstract void onChildAdded( View child, InviterItem item );
|
||||
abstract void listSelected( InviterItem[] selected, String[] devsP, int[] countsP );
|
||||
|
||||
public static final String DEVS = "DEVS";
|
||||
public static final String COUNTS = "COUNTS";
|
||||
protected static final String INTENT_KEY_NMISSING = "NMISSING";
|
||||
|
@ -60,51 +86,37 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
protected Button m_clearButton;
|
||||
private Activity m_activity;
|
||||
private ListView m_lv;
|
||||
private View m_ev;
|
||||
private TextView m_ev;
|
||||
private boolean m_showAddrs;
|
||||
private InviteItemsAdapter m_adapter;
|
||||
protected Map<String, Integer> m_counts;
|
||||
protected Map<InviterItem, Integer> m_counts;
|
||||
protected Set<Integer> m_checked;
|
||||
private boolean m_setChecked;
|
||||
private LinearLayout[] m_items;
|
||||
// private LinearLayout[] m_items;
|
||||
|
||||
public InviteDelegate( Delegator delegator, Bundle savedInstanceState,
|
||||
int layoutID )
|
||||
public InviteDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||
{
|
||||
super( delegator, savedInstanceState, layoutID, R.menu.empty );
|
||||
super( delegator, savedInstanceState, R.layout.inviter, R.menu.empty );
|
||||
m_activity = delegator.getActivity();
|
||||
Intent intent = getIntent();
|
||||
m_nMissing = intent.getIntExtra( INTENT_KEY_NMISSING, -1 );
|
||||
m_lastDev = intent.getStringExtra( INTENT_KEY_LASTDEV );
|
||||
m_counts = new HashMap<String, Integer>();
|
||||
m_counts = new HashMap<InviterItem, Integer>();
|
||||
m_checked = new HashSet<Integer>();
|
||||
}
|
||||
|
||||
protected void init( int button_invite, int desc_id, String descTxt )
|
||||
protected void init( String descTxt, int emptyMsgId )
|
||||
{
|
||||
init( button_invite, 0, 0, desc_id, descTxt );
|
||||
}
|
||||
|
||||
protected void init( int button_invite, int button_rescan,
|
||||
int button_clear, int desc_id, String descTxt )
|
||||
{
|
||||
m_inviteButton = (Button)findViewById( button_invite );
|
||||
m_inviteButton = (Button)findViewById( R.id.button_invite );
|
||||
m_inviteButton.setOnClickListener( this );
|
||||
if ( 0 != button_rescan ) {
|
||||
m_rescanButton = (Button)findViewById( button_rescan );
|
||||
m_rescanButton.setOnClickListener( this );
|
||||
}
|
||||
if ( 0 != button_clear ) {
|
||||
m_clearButton = (Button)findViewById( button_clear );
|
||||
m_clearButton.setOnClickListener( this );
|
||||
}
|
||||
|
||||
TextView descView = (TextView)findViewById( desc_id );
|
||||
TextView descView = (TextView)findViewById( R.id.invite_desc );
|
||||
descView.setText( descTxt );
|
||||
|
||||
m_lv = (ListView)findViewById( android.R.id.list );
|
||||
m_ev = findViewById( android.R.id.empty );
|
||||
if ( null != m_lv && null != m_ev ) {
|
||||
m_ev = (TextView)findViewById( android.R.id.empty );
|
||||
if ( null != m_lv && null != m_ev && 0 != emptyMsgId ) {
|
||||
m_ev.setText( getString( emptyMsgId ) );
|
||||
m_lv.setOnHierarchyChangeListener( this );
|
||||
showEmptyIfEmpty();
|
||||
}
|
||||
|
@ -112,35 +124,71 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
tryEnable();
|
||||
}
|
||||
|
||||
protected void updateListAdapter( int itemId, String[] names, String[] addrs,
|
||||
boolean showAddrs )
|
||||
// Subclasses are meant to call this
|
||||
protected void addButtonBar( int buttonBarId, int[] buttonBarItemIds )
|
||||
{
|
||||
m_showAddrs = showAddrs;
|
||||
m_adapter = new InviteItemsAdapter( itemId, names, addrs );
|
||||
FrameLayout container = (FrameLayout)findViewById( R.id.button_bar );
|
||||
ViewGroup bar = (ViewGroup)inflate( buttonBarId );
|
||||
container.addView( bar );
|
||||
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View view ) {
|
||||
onBarButtonClicked( view.getId() );
|
||||
}
|
||||
};
|
||||
|
||||
for ( int id : buttonBarItemIds ) {
|
||||
bar.findViewById( id ).setOnClickListener( listener );
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateListAdapter( int itemId, InviterItem[] items )
|
||||
{
|
||||
// m_items = items;
|
||||
m_adapter = new InviteItemsAdapter( itemId, items );
|
||||
setListAdapter( m_adapter );
|
||||
}
|
||||
|
||||
protected void onBarButtonClicked( int id )
|
||||
{
|
||||
Assert.fail(); // subclass must implement
|
||||
}
|
||||
|
||||
// Subclasses can do something here
|
||||
protected void addToButtonBar( FrameLayout container ) {}
|
||||
|
||||
////////////////////////////////////////
|
||||
// View.OnClickListener
|
||||
////////////////////////////////////////
|
||||
public void onClick( View view )
|
||||
{
|
||||
if ( m_inviteButton == view ) {
|
||||
int len = m_checked.size();
|
||||
String[] devs = new String[len];
|
||||
int[] counts = new int[len];
|
||||
|
||||
listSelected( getSelItems(), devs, counts );
|
||||
|
||||
Intent intent = new Intent();
|
||||
String[][] devs = new String[1][];
|
||||
int[][] counts = new int[1][];
|
||||
listSelected( devs, counts );
|
||||
intent.putExtra( DEVS, devs[0] );
|
||||
intent.putExtra( COUNTS, counts[0] );
|
||||
intent.putExtra( DEVS, devs );
|
||||
intent.putExtra( COUNTS, counts );
|
||||
setResult( Activity.RESULT_OK, intent );
|
||||
finish();
|
||||
} else if ( m_rescanButton == view ) {
|
||||
scan();
|
||||
} else if ( m_clearButton == view ) {
|
||||
clearSelected( makeCheckedArray() );
|
||||
}
|
||||
}
|
||||
|
||||
private InviterItem[] getSelItems()
|
||||
{
|
||||
int ii = 0;
|
||||
InviterItem[] result = new InviterItem[m_checked.size()];
|
||||
InviterItem[] src = getAdapter().getItems();
|
||||
for ( int checked : m_checked ) {
|
||||
result[ii++] = src[checked];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
// ViewGroup.OnHierarchyChangeListener
|
||||
////////////////////////////////////////
|
||||
|
@ -159,60 +207,22 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
? View.VISIBLE : View.GONE );
|
||||
}
|
||||
|
||||
protected void listSelected( String[][] devsP, int[][] countsP )
|
||||
{
|
||||
int[] counts = null;
|
||||
int len = m_checked.size();
|
||||
Assert.assertTrue( 0 < len );
|
||||
|
||||
if ( null != countsP ) {
|
||||
counts = new int[len];
|
||||
countsP[0] = counts;
|
||||
}
|
||||
|
||||
String[] checked = new String[len];
|
||||
Iterator<Integer> iter = m_checked.iterator();
|
||||
for ( int ii = 0; iter.hasNext(); ++ii ) {
|
||||
int index = iter.next();
|
||||
String addr = m_adapter.getAddrs()[index];
|
||||
Assert.assertNotNull( addr ); // fired!!!
|
||||
checked[ii] = addr;
|
||||
if ( null != counts ) {
|
||||
counts[ii] = m_counts.get( addr );
|
||||
}
|
||||
}
|
||||
DbgUtils.logd( TAG, "listSelected() adding %s",
|
||||
checked.toString() );
|
||||
devsP[0] = checked;
|
||||
}
|
||||
|
||||
protected void tryEnable()
|
||||
{
|
||||
int count = m_checked.size();
|
||||
m_inviteButton.setEnabled( count > 0 && count <= m_nMissing );
|
||||
if ( null != m_clearButton ) {
|
||||
m_clearButton.setEnabled( count > 0 );
|
||||
}
|
||||
// if ( null != m_clearButton ) {
|
||||
// m_clearButton.setEnabled( count > 0 );
|
||||
// }
|
||||
}
|
||||
|
||||
protected void scan() {}
|
||||
final Set<Integer> getChecked() { return m_checked; }
|
||||
|
||||
protected void clearSelected( Integer[] itemIndices )
|
||||
{
|
||||
for ( Iterator<Integer> iter = m_checked.iterator();
|
||||
iter.hasNext(); ) {
|
||||
int index = iter.next();
|
||||
LinearLayout item = m_items[index];
|
||||
CheckBox box = (CheckBox)item.findViewById( R.id.inviter_check );
|
||||
if ( null != box ) {
|
||||
box.setChecked( false );
|
||||
}
|
||||
m_checked.remove( iter );
|
||||
}
|
||||
}
|
||||
protected void clearChecked() { m_checked.clear(); }
|
||||
|
||||
// protected void scan() {}
|
||||
|
||||
// callbacks made by InviteItemsAdapter
|
||||
|
||||
protected void onItemChecked( int index, boolean checked )
|
||||
{
|
||||
DbgUtils.logd( TAG, "onItemChecked(%d, %b)", index, checked );
|
||||
|
@ -234,35 +244,42 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
}
|
||||
|
||||
private class InviteItemsAdapter extends XWListAdapter {
|
||||
private String[] m_devAddrs;
|
||||
private String[] m_devNames;
|
||||
private InviterItem[] m_items;
|
||||
private int m_itemId;
|
||||
|
||||
public InviteItemsAdapter( int itemID, String[] names, String[] addrs )
|
||||
public InviteItemsAdapter( int itemID, InviterItem[] items )
|
||||
{
|
||||
super( null == addrs? 0 : addrs.length );
|
||||
super( null == items? 0 : items.length );
|
||||
m_itemId = itemID;
|
||||
m_devAddrs = addrs;
|
||||
m_devNames = names;
|
||||
m_items = new LinearLayout[getCount()];
|
||||
m_items = items;
|
||||
// m_items = new LinearLayout[getCount()];
|
||||
}
|
||||
|
||||
public String[] getAddrs() { return m_devAddrs; }
|
||||
public InviterItem[] getItems() { return m_items; }
|
||||
|
||||
// public String[] getAddrs() { return m_devAddrs; }
|
||||
|
||||
@Override
|
||||
public Object getItem( int position ) { return m_devNames[position]; }
|
||||
public Object getItem( int position ) { return m_items[position]; }
|
||||
|
||||
@Override
|
||||
public View getView( final int position, View convertView,
|
||||
ViewGroup parent )
|
||||
{
|
||||
final String addr = m_devAddrs[position];
|
||||
final LinearLayout layout = (LinearLayout)inflate( m_itemId );
|
||||
final InviterItem item = m_items[position];
|
||||
final LinearLayout layout = (LinearLayout)inflate( R.layout.inviter_item );
|
||||
CheckBox box = (CheckBox)layout.findViewById( R.id.inviter_check );
|
||||
box.setText( m_devNames[position] );
|
||||
box.setTag( addr );
|
||||
// box.setText( m_devNames[position] );
|
||||
// box.setTag( addr );
|
||||
|
||||
m_counts.put( addr, 1 );
|
||||
// Give subclass a chance to install and populate its view
|
||||
FrameLayout frame = (FrameLayout)layout.findViewById( R.id.frame );
|
||||
Assert.assertNotNull( frame );
|
||||
View child = inflate( m_itemId );
|
||||
frame.addView( child );
|
||||
onChildAdded( child, m_items[position] );
|
||||
|
||||
m_counts.put( item, 1 );
|
||||
if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
|
||||
Spinner spinner = (Spinner)
|
||||
layout.findViewById(R.id.nperdev_spinner);
|
||||
|
@ -280,7 +297,7 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
View view, int pos,
|
||||
long id )
|
||||
{
|
||||
m_counts.put( addr, 1 + pos );
|
||||
m_counts.put( item, 1 + pos );
|
||||
tryEnable();
|
||||
}
|
||||
|
||||
|
@ -295,13 +312,13 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
if ( !isChecked ) {
|
||||
m_setChecked = false;
|
||||
}
|
||||
// if ( isChecked ) {
|
||||
// m_checked.add( position );
|
||||
// } else {
|
||||
// m_checked.remove( position );
|
||||
if ( isChecked ) {
|
||||
m_checked.add( position );
|
||||
} else {
|
||||
m_checked.remove( position );
|
||||
// // User's now making changes; don't check new views
|
||||
// m_setChecked = false;
|
||||
// }
|
||||
}
|
||||
onItemChecked( position, isChecked );
|
||||
|
||||
tryEnable();
|
||||
|
@ -311,15 +328,16 @@ abstract class InviteDelegate extends ListDelegateBase
|
|||
|
||||
if ( m_setChecked || m_checked.contains( position ) ) {
|
||||
box.setChecked( true );
|
||||
} else if ( null != m_lastDev && m_lastDev.equals( addr ) ) {
|
||||
} else if ( null != m_lastDev && m_lastDev.equals( item ) ) {
|
||||
m_lastDev = null;
|
||||
box.setChecked( true );
|
||||
}
|
||||
m_items[position] = layout;
|
||||
// m_items[position] = layout;
|
||||
return layout;
|
||||
}
|
||||
|
||||
public String getAddr( CheckBox box ) { return (String)box.getTag(); }
|
||||
public String getName( CheckBox box ) { return box.getText().toString(); }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,18 +20,21 @@
|
|||
|
||||
package org.eehouse.android.xw4;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
@ -51,12 +54,18 @@ import java.util.Set;
|
|||
public class RelayInviteDelegate extends InviteDelegate {
|
||||
private static final String TAG = RelayInviteDelegate.class.getSimpleName();
|
||||
|
||||
private static int[] BUTTONIDS = {
|
||||
R.id.button_relay_add,
|
||||
R.id.manual_add_button,
|
||||
R.id.button_clear,
|
||||
};
|
||||
|
||||
// private static final int GET_CONTACT = 1;
|
||||
private static final String SAVE_NAME = "SAVE_NAME";
|
||||
private static final String SAVE_NUMBER = "SAVE_NUMBER";
|
||||
|
||||
private ArrayList<DevIDRec> m_devIDRecs;
|
||||
private RelayDevsAdapter m_adapter;
|
||||
// private RelayDevsAdapter m_adapter;
|
||||
private boolean m_immobileConfirmed;
|
||||
private Activity m_activity;
|
||||
|
||||
|
@ -70,7 +79,7 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
|
||||
public RelayInviteDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||
{
|
||||
super( delegator, savedInstanceState, R.layout.relayinviter );
|
||||
super( delegator, savedInstanceState );
|
||||
m_activity = delegator.getActivity();
|
||||
}
|
||||
|
||||
|
@ -79,8 +88,8 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
String msg = getString( R.string.button_invite );
|
||||
msg = getQuantityString( R.plurals.invite_relay_desc_fmt, m_nMissing,
|
||||
m_nMissing, msg );
|
||||
super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
|
||||
R.id.invite_desc, msg );
|
||||
super.init( msg, R.string.empty_relay_inviter );
|
||||
addButtonBar( R.layout.relay_buttons, BUTTONIDS );
|
||||
|
||||
// getBundledData( savedInstanceState );
|
||||
|
||||
|
@ -110,6 +119,27 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
rebuildList( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBarButtonClicked( int id )
|
||||
{
|
||||
switch( id ) {
|
||||
case R.id.button_relay_add:
|
||||
Utils.notImpl( m_activity );
|
||||
break;
|
||||
case R.id.manual_add_button:
|
||||
showDialog( DlgID.GET_NUMBER );
|
||||
break;
|
||||
case R.id.button_clear:
|
||||
Utils.notImpl( m_activity );
|
||||
// int count = getChecked().size();
|
||||
// String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
|
||||
// count, count );
|
||||
// makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// protected void onSaveInstanceState( Bundle outState )
|
||||
// {
|
||||
// outState.putString( SAVE_NAME, m_pendingName );
|
||||
|
@ -171,74 +201,86 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
// return dialog;
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onChildAdded( View child, InviterItem data )
|
||||
{
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void listSelected( InviterItem[] selected, String[] devsP, int[] countsP )
|
||||
{
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
// We want to present user with list of previous opponents and devices. We
|
||||
// can easily get list of relayIDs. The relay, if reachable, can convert
|
||||
// that to a (likely shorter) list of devices. Then for each deviceID,
|
||||
// open the newest game with a relayID mapping to it and get the name of
|
||||
// the opponent?
|
||||
|
||||
protected void scan()
|
||||
{
|
||||
long[][] rowIDss = new long[1][];
|
||||
String[] relayIDs = DBUtils.getRelayIDs( m_activity, rowIDss );
|
||||
// protected void scan()
|
||||
// {
|
||||
// long[][] rowIDss = new long[1][];
|
||||
// String[] relayIDs = DBUtils.getRelayIDs( m_activity, rowIDss );
|
||||
|
||||
if ( null != relayIDs && 0 < relayIDs.length ) {
|
||||
new ListOpponentsTask( m_activity, relayIDs, rowIDss[0] ).execute();
|
||||
}
|
||||
// if ( null != relayIDs && 0 < relayIDs.length ) {
|
||||
// new ListOpponentsTask( m_activity, relayIDs, rowIDss[0] ).execute();
|
||||
// }
|
||||
|
||||
// Intent intent = new Intent( Intent.ACTION_PICK,
|
||||
// ContactsContract.Contacts.CONTENT_URI );
|
||||
// intent.setType( Phone.CONTENT_TYPE );
|
||||
// startActivityForResult( intent, GET_CONTACT );
|
||||
}
|
||||
// // Intent intent = new Intent( Intent.ACTION_PICK,
|
||||
// // ContactsContract.Contacts.CONTENT_URI );
|
||||
// // intent.setType( Phone.CONTENT_TYPE );
|
||||
// // startActivityForResult( intent, GET_CONTACT );
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void clearSelected( Integer[] selected )
|
||||
{
|
||||
makeConfirmThenBuilder( R.string.confirm_clear_relay, Action.CLEAR_ACTION )
|
||||
.show();
|
||||
}
|
||||
// @Override
|
||||
// protected void clearSelected( Integer[] selected )
|
||||
// {
|
||||
// makeConfirmThenBuilder( R.string.confirm_clear_relay, Action.CLEAR_ACTION )
|
||||
// .show();
|
||||
// }
|
||||
|
||||
protected void listSelected( String[][] devsP, int[][] countsP )
|
||||
{
|
||||
int count = m_adapter.getCount();
|
||||
String[] result = new String[countChecks()];
|
||||
int[] counts = new int[result.length];
|
||||
// protected void listSelected( String[][] devsP, int[][] countsP )
|
||||
// {
|
||||
// // int count = m_adapter.getCount();
|
||||
// // String[] result = new String[countChecks()];
|
||||
// // int[] counts = new int[result.length];
|
||||
|
||||
int index = 0;
|
||||
Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
for ( int ii = 0; iter.hasNext(); ++ii ) {
|
||||
DevIDRec rec = iter.next();
|
||||
if ( rec.m_isChecked ) {
|
||||
counts[index] = rec.m_nPlayers;
|
||||
result[index] = ((SMSListItem)m_adapter.getItem(ii)).getNumber();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
devsP[0] = result;
|
||||
if ( null != countsP ) {
|
||||
countsP[0] = counts;
|
||||
}
|
||||
}
|
||||
// // int index = 0;
|
||||
// // Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
// // for ( int ii = 0; iter.hasNext(); ++ii ) {
|
||||
// // DevIDRec rec = iter.next();
|
||||
// // if ( rec.m_isChecked ) {
|
||||
// // counts[index] = rec.m_nPlayers;
|
||||
// // result[index] = ((SMSListItem)m_adapter.getItem(ii)).getNumber();
|
||||
// // index++;
|
||||
// // }
|
||||
// // }
|
||||
// // devsP[0] = result;
|
||||
// // if ( null != countsP ) {
|
||||
// // countsP[0] = counts;
|
||||
// // }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void tryEnable()
|
||||
{
|
||||
if ( null != m_devIDRecs ) {
|
||||
int nPlayers = 0;
|
||||
int nDevs = 0;
|
||||
Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
DevIDRec rec = iter.next();
|
||||
if ( rec.m_isChecked ) {
|
||||
++nDevs;
|
||||
nPlayers += rec.m_nPlayers;
|
||||
}
|
||||
}
|
||||
m_inviteButton.setEnabled( 0 < nPlayers && nPlayers <= m_nMissing );
|
||||
m_clearButton.setEnabled( 0 < nDevs );
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// protected void tryEnable()
|
||||
// {
|
||||
// if ( null != m_devIDRecs ) {
|
||||
// int nPlayers = 0;
|
||||
// int nDevs = 0;
|
||||
// Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
// while ( iter.hasNext() ) {
|
||||
// DevIDRec rec = iter.next();
|
||||
// if ( rec.m_isChecked ) {
|
||||
// ++nDevs;
|
||||
// nPlayers += rec.m_nPlayers;
|
||||
// }
|
||||
// }
|
||||
// m_inviteButton.setEnabled( 0 < nPlayers && nPlayers <= m_nMissing );
|
||||
// m_clearButton.setEnabled( 0 < nDevs );
|
||||
// }
|
||||
// }
|
||||
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
@Override
|
||||
|
@ -266,19 +308,19 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
private int countChecks()
|
||||
{
|
||||
int count = 0;
|
||||
if ( null != m_devIDRecs ) {
|
||||
Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( iter.next().m_isChecked ) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
// private int countChecks()
|
||||
// {
|
||||
// int count = 0;
|
||||
// if ( null != m_devIDRecs ) {
|
||||
// Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
// while ( iter.hasNext() ) {
|
||||
// if ( iter.next().m_isChecked ) {
|
||||
// ++count;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return count;
|
||||
// }
|
||||
|
||||
// private void addPhoneNumbers( Intent intent )
|
||||
// {
|
||||
|
@ -323,20 +365,20 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
|
||||
private void rebuildList( boolean checkIfAll )
|
||||
{
|
||||
Collections.sort( m_devIDRecs, new Comparator<DevIDRec>() {
|
||||
public int compare( DevIDRec rec1, DevIDRec rec2 ) {
|
||||
return rec1.m_opponent.compareTo(rec2.m_opponent);
|
||||
}
|
||||
});
|
||||
m_adapter = new RelayDevsAdapter();
|
||||
setListAdapter( m_adapter );
|
||||
if ( checkIfAll && m_devIDRecs.size() <= m_nMissing ) {
|
||||
Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
iter.next().m_isChecked = true;
|
||||
}
|
||||
}
|
||||
tryEnable();
|
||||
// Collections.sort( m_devIDRecs, new Comparator<DevIDRec>() {
|
||||
// public int compare( DevIDRec rec1, DevIDRec rec2 ) {
|
||||
// return rec1.m_opponent.compareTo(rec2.m_opponent);
|
||||
// }
|
||||
// });
|
||||
// m_adapter = new RelayDevsAdapter();
|
||||
// setListAdapter( m_adapter );
|
||||
// if ( checkIfAll && m_devIDRecs.size() <= m_nMissing ) {
|
||||
// Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
// while ( iter.hasNext() ) {
|
||||
// iter.next().m_isChecked = true;
|
||||
// }
|
||||
// }
|
||||
// tryEnable();
|
||||
}
|
||||
|
||||
private void getSavedState()
|
||||
|
@ -363,122 +405,120 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
rebuildList( false );
|
||||
}
|
||||
|
||||
private void addChecked( DevIDRec rec )
|
||||
{
|
||||
if ( m_nMissing <= countChecks() ) {
|
||||
Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
iter.next().m_isChecked = false;
|
||||
}
|
||||
}
|
||||
// private void addChecked( DevIDRec rec )
|
||||
// {
|
||||
// if ( m_nMissing <= countChecks() ) {
|
||||
// Iterator<DevIDRec> iter = m_devIDRecs.iterator();
|
||||
// while ( iter.hasNext() ) {
|
||||
// iter.next().m_isChecked = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
rec.m_isChecked = true;
|
||||
m_devIDRecs.add( rec );
|
||||
}
|
||||
// rec.m_isChecked = true;
|
||||
// m_devIDRecs.add( rec );
|
||||
// }
|
||||
|
||||
private void clearSelectedImpl()
|
||||
{
|
||||
int count = m_adapter.getCount();
|
||||
for ( int ii = count - 1; ii >= 0; --ii ) {
|
||||
if ( m_devIDRecs.get( ii ).m_isChecked ) {
|
||||
m_devIDRecs.remove( ii );
|
||||
}
|
||||
}
|
||||
saveAndRebuild();
|
||||
// int count = m_adapter.getCount();
|
||||
// for ( int ii = count - 1; ii >= 0; --ii ) {
|
||||
// if ( m_devIDRecs.get( ii ).m_isChecked ) {
|
||||
// m_devIDRecs.remove( ii );
|
||||
// }
|
||||
// }
|
||||
// saveAndRebuild();
|
||||
}
|
||||
|
||||
private class DevIDRec {
|
||||
private class DevIDRec implements InviterItem {
|
||||
public String m_devID;
|
||||
public String m_opponent;
|
||||
public boolean m_isChecked;
|
||||
public int m_nPlayers;
|
||||
public DevIDRec( String name, String devID )
|
||||
{
|
||||
this( name, devID, false );
|
||||
}
|
||||
// public DevIDRec( String name, String devID )
|
||||
// {
|
||||
// this( name, devID, false );
|
||||
// }
|
||||
// public DevIDRec( String devID )
|
||||
// {
|
||||
// this( null, devID, false );
|
||||
// }
|
||||
|
||||
public DevIDRec( String opponent, String devID, boolean checked )
|
||||
public DevIDRec( String opponent, String devID )
|
||||
{
|
||||
m_devID = devID;
|
||||
m_isChecked = checked;
|
||||
m_nPlayers = 1;
|
||||
m_opponent = opponent;
|
||||
}
|
||||
}
|
||||
|
||||
private class RelayDevsAdapter extends XWListAdapter {
|
||||
private SMSListItem[] m_items;
|
||||
// private class RelayDevsAdapter extends XWListAdapter {
|
||||
// private SMSListItem[] m_items;
|
||||
|
||||
public RelayDevsAdapter()
|
||||
{
|
||||
super( m_devIDRecs.size() );
|
||||
m_items = new SMSListItem[m_devIDRecs.size()];
|
||||
}
|
||||
// public RelayDevsAdapter()
|
||||
// {
|
||||
// super( m_devIDRecs.size() );
|
||||
// m_items = new SMSListItem[m_devIDRecs.size()];
|
||||
// }
|
||||
|
||||
public Object getItem( final int position )
|
||||
{
|
||||
// For some reason I can't cache items to be returned.
|
||||
// Checking/unchecking breaks for some but not all items,
|
||||
// with some relation to whether they were scrolled into
|
||||
// view. So build them anew each time (but still cache
|
||||
// for by-index access.)
|
||||
// public Object getItem( final int position )
|
||||
// {
|
||||
// // For some reason I can't cache items to be returned.
|
||||
// // Checking/unchecking breaks for some but not all items,
|
||||
// // with some relation to whether they were scrolled into
|
||||
// // view. So build them anew each time (but still cache
|
||||
// // for by-index access.)
|
||||
|
||||
SMSListItem item =
|
||||
(SMSListItem)inflate( R.layout.smsinviter_item );
|
||||
item.setChecked( m_devIDRecs.get(position).m_isChecked );
|
||||
// SMSListItem item =
|
||||
// (SMSListItem)inflate( R.layout.smsinviter_item );
|
||||
// // item.setChecked( m_devIDRecs.get(position).m_isChecked );
|
||||
|
||||
CompoundButton.OnCheckedChangeListener lstnr =
|
||||
new CompoundButton.OnCheckedChangeListener() {
|
||||
public void onCheckedChanged( CompoundButton bv,
|
||||
boolean isChecked ) {
|
||||
m_devIDRecs.get(position).m_isChecked = isChecked;
|
||||
tryEnable();
|
||||
}
|
||||
};
|
||||
item.setOnCheckedChangeListener( lstnr );
|
||||
final DevIDRec rec = m_devIDRecs.get( position );
|
||||
item.setContents( rec.m_opponent, rec.m_devID );
|
||||
m_items[position] = item;
|
||||
// CompoundButton.OnCheckedChangeListener lstnr =
|
||||
// new CompoundButton.OnCheckedChangeListener() {
|
||||
// public void onCheckedChanged( CompoundButton bv,
|
||||
// boolean isChecked ) {
|
||||
// m_devIDRecs.get(position).m_isChecked = isChecked;
|
||||
// tryEnable();
|
||||
// }
|
||||
// };
|
||||
// item.setOnCheckedChangeListener( lstnr );
|
||||
// final DevIDRec rec = m_devIDRecs.get( position );
|
||||
// item.setContents( rec.m_opponent, rec.m_devID );
|
||||
// m_items[position] = item;
|
||||
|
||||
// Set up spinner
|
||||
Assert.assertTrue( 1 == rec.m_nPlayers );
|
||||
if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
|
||||
Spinner spinner = (Spinner)
|
||||
item.findViewById(R.id.nperdev_spinner);
|
||||
ArrayAdapter<String> adapter =
|
||||
new ArrayAdapter<String>( m_activity, android.R.layout
|
||||
.simple_spinner_item );
|
||||
for ( int ii = 1; ii <= m_nMissing; ++ii ) {
|
||||
String str = getQuantityString( R.plurals.nplayers_fmt, ii, ii );
|
||||
adapter.add( str );
|
||||
}
|
||||
spinner.setAdapter( adapter );
|
||||
spinner.setVisibility( View.VISIBLE );
|
||||
spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
|
||||
public void onItemSelected( AdapterView<?> parent,
|
||||
View view, int pos,
|
||||
long id )
|
||||
{
|
||||
rec.m_nPlayers = 1 + pos;
|
||||
tryEnable();
|
||||
}
|
||||
// // Set up spinner
|
||||
// Assert.assertTrue( 1 == rec.m_nPlayers );
|
||||
// if ( XWPrefs.getCanInviteMulti( m_activity ) && 1 < m_nMissing ) {
|
||||
// Spinner spinner = (Spinner)
|
||||
// item.findViewById(R.id.nperdev_spinner);
|
||||
// ArrayAdapter<String> adapter =
|
||||
// new ArrayAdapter<String>( m_activity, android.R.layout
|
||||
// .simple_spinner_item );
|
||||
// for ( int ii = 1; ii <= m_nMissing; ++ii ) {
|
||||
// String str = getQuantityString( R.plurals.nplayers_fmt, ii, ii );
|
||||
// adapter.add( str );
|
||||
// }
|
||||
// spinner.setAdapter( adapter );
|
||||
// spinner.setVisibility( View.VISIBLE );
|
||||
// spinner.setOnItemSelectedListener( new OnItemSelectedListener() {
|
||||
// public void onItemSelected( AdapterView<?> parent,
|
||||
// View view, int pos,
|
||||
// long id )
|
||||
// {
|
||||
// rec.m_nPlayers = 1 + pos;
|
||||
// tryEnable();
|
||||
// }
|
||||
|
||||
public void onNothingSelected( AdapterView<?> parent ) {}
|
||||
} );
|
||||
}
|
||||
// public void onNothingSelected( AdapterView<?> parent ) {}
|
||||
// } );
|
||||
// }
|
||||
|
||||
return item;
|
||||
}
|
||||
// return item;
|
||||
// }
|
||||
|
||||
public View getView( final int position, View convertView,
|
||||
ViewGroup parent ) {
|
||||
return (View)getItem( position );
|
||||
}
|
||||
}
|
||||
// public View getView( final int position, View convertView,
|
||||
// ViewGroup parent ) {
|
||||
// return (View)getItem( position );
|
||||
// }
|
||||
// }
|
||||
|
||||
private class ListOpponentsTask extends AsyncTask<Void, Void, Set<String>> {
|
||||
private Context m_context;
|
||||
|
@ -554,10 +594,10 @@ public class RelayInviteDelegate extends InviteDelegate {
|
|||
m_devIDRecs.add( rec );
|
||||
}
|
||||
|
||||
m_adapter = new RelayDevsAdapter();
|
||||
setListAdapter( m_adapter );
|
||||
// m_checked.clear();
|
||||
tryEnable();
|
||||
// m_adapter = new RelayDevsAdapter();
|
||||
// setListAdapter( m_adapter );
|
||||
// // m_checked.clear();
|
||||
// tryEnable();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,17 +28,16 @@ import android.content.Intent;
|
|||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.method.DialerKeyListener;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -49,9 +48,16 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public class SMSInviteDelegate extends InviteDelegate {
|
||||
public class SMSInviteDelegate extends InviteDelegate
|
||||
implements View.OnClickListener {
|
||||
private static final String TAG = SMSInviteDelegate.class.getSimpleName();
|
||||
private static int[] BUTTONIDS = {
|
||||
R.id.button_add,
|
||||
R.id.manual_add_button,
|
||||
R.id.button_clear,
|
||||
};
|
||||
|
||||
private static final String SAVE_NAME = "SAVE_NAME";
|
||||
private static final String SAVE_NUMBER = "SAVE_NUMBER";
|
||||
|
@ -78,7 +84,7 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
|
||||
public SMSInviteDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||
{
|
||||
super( delegator, savedInstanceState, R.layout.smsinviter );
|
||||
super( delegator, savedInstanceState );
|
||||
m_activity = delegator.getActivity();
|
||||
}
|
||||
|
||||
|
@ -87,19 +93,11 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
String msg = getString( R.string.button_invite );
|
||||
msg = getQuantityString( R.plurals.invite_sms_desc_fmt, m_nMissing,
|
||||
m_nMissing, msg );
|
||||
super.init( R.id.button_invite, R.id.button_add, R.id.button_clear,
|
||||
R.id.invite_desc, msg );
|
||||
super.init( msg, R.string.empty_sms_inviter );
|
||||
addButtonBar( R.layout.sms_buttons, BUTTONIDS );
|
||||
|
||||
getBundledData( savedInstanceState );
|
||||
|
||||
m_addButton = (ImageButton)findViewById( R.id.manual_add_button );
|
||||
m_addButton.setOnClickListener( new View.OnClickListener() {
|
||||
public void onClick( View view )
|
||||
{
|
||||
showDialog( DlgID.GET_NUMBER );
|
||||
}
|
||||
} );
|
||||
|
||||
getSavedState();
|
||||
rebuildList( true );
|
||||
}
|
||||
|
@ -120,13 +118,34 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBarButtonClicked( int id )
|
||||
{
|
||||
switch( id ) {
|
||||
case R.id.button_add:
|
||||
Intent intent = new Intent( Intent.ACTION_PICK,
|
||||
ContactsContract.Contacts.CONTENT_URI );
|
||||
intent.setType( Phone.CONTENT_TYPE );
|
||||
startActivityForResult( intent, RequestCode.GET_CONTACT );
|
||||
break;
|
||||
case R.id.manual_add_button:
|
||||
showDialog( DlgID.GET_NUMBER );
|
||||
break;
|
||||
case R.id.button_clear:
|
||||
int count = getChecked().size();
|
||||
String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
|
||||
count, count );
|
||||
makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult( RequestCode requestCode, int resultCode,
|
||||
Intent data )
|
||||
{
|
||||
// super.onActivityResult( requestCode, resultCode, data );
|
||||
if ( Activity.RESULT_CANCELED != resultCode && data != null ) {
|
||||
switch (requestCode) {
|
||||
switch ( requestCode ) {
|
||||
case GET_CONTACT:
|
||||
addPhoneNumbers( data );
|
||||
break;
|
||||
|
@ -134,6 +153,7 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Dialog onCreateDialog( int id )
|
||||
{
|
||||
Dialog dialog = super.onCreateDialog( id );
|
||||
|
@ -171,63 +191,24 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
return dialog;
|
||||
}
|
||||
|
||||
protected void scan()
|
||||
{
|
||||
Intent intent = new Intent( Intent.ACTION_PICK,
|
||||
ContactsContract.Contacts.CONTENT_URI );
|
||||
intent.setType( Phone.CONTENT_TYPE );
|
||||
startActivityForResult( intent, RequestCode.GET_CONTACT );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clearSelected( Integer[] checked )
|
||||
protected void listSelected( InviterItem[] selected, String[] devs,
|
||||
int[] counts )
|
||||
{
|
||||
int count = checked.length;
|
||||
String msg = getQuantityString( R.plurals.confirm_clear_sms_fmt,
|
||||
count, count );
|
||||
makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
|
||||
}
|
||||
|
||||
protected void listSelected( String[][] devsP, int[][] countsP )
|
||||
{
|
||||
XWListAdapter adapter = getAdapter();
|
||||
int count = adapter.getCount();
|
||||
String[] result = new String[countChecks()];
|
||||
int[] counts = new int[result.length];
|
||||
|
||||
int index = 0;
|
||||
Iterator<PhoneRec> iter = m_phoneRecs.iterator();
|
||||
for ( int ii = 0; iter.hasNext(); ++ii ) {
|
||||
PhoneRec rec = iter.next();
|
||||
if ( rec.m_isChecked ) {
|
||||
counts[index] = rec.m_nPlayers;
|
||||
result[index] = ((SMSListItem)adapter.getItem(ii)).getNumber();
|
||||
index++;
|
||||
}
|
||||
}
|
||||
devsP[0] = result;
|
||||
if ( null != countsP ) {
|
||||
countsP[0] = counts;
|
||||
for ( int ii = 0; ii < selected.length; ++ii ) {
|
||||
PhoneRec rec = (PhoneRec)selected[ii];
|
||||
counts[ii] = rec.m_nPlayers;
|
||||
devs[ii] = rec.m_phone;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tryEnable()
|
||||
protected void onChildAdded( View child, InviterItem data )
|
||||
{
|
||||
if ( null != m_phoneRecs ) {
|
||||
int nPlayers = 0;
|
||||
int nDevs = 0;
|
||||
Iterator<PhoneRec> iter = m_phoneRecs.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
PhoneRec rec = iter.next();
|
||||
if ( rec.m_isChecked ) {
|
||||
++nDevs;
|
||||
nPlayers += rec.m_nPlayers;
|
||||
}
|
||||
}
|
||||
m_inviteButton.setEnabled( 0 < nPlayers && nPlayers <= m_nMissing );
|
||||
m_clearButton.setEnabled( 0 < nDevs );
|
||||
}
|
||||
SMSListItem item = (SMSListItem)child;
|
||||
PhoneRec rec = (PhoneRec)data;
|
||||
((TextView)item.findViewById(R.id.name)).setText( rec.m_name );
|
||||
((TextView)item.findViewById(R.id.number)).setText( rec.m_phone );
|
||||
}
|
||||
|
||||
// DlgDelegate.DlgClickNotify interface
|
||||
|
@ -324,15 +305,16 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
return rec1.m_name.compareTo(rec2.m_name);
|
||||
}
|
||||
});
|
||||
String[] phones = new String[m_phoneRecs.size()];
|
||||
String[] names = new String[m_phoneRecs.size()];
|
||||
for ( int ii = 0; ii < m_phoneRecs.size(); ++ii ) {
|
||||
PhoneRec rec = m_phoneRecs.get( ii );
|
||||
phones[ii] = rec.m_phone;
|
||||
names[ii] = rec.m_name;
|
||||
}
|
||||
// String[] phones = new String[m_phoneRecs.size()];
|
||||
// String[] names = new String[m_phoneRecs.size()];
|
||||
// for ( int ii = 0; ii < m_phoneRecs.size(); ++ii ) {
|
||||
// PhoneRec rec = m_phoneRecs.get( ii );
|
||||
// phones[ii] = rec.m_phone;
|
||||
// names[ii] = rec.m_name;
|
||||
// }
|
||||
|
||||
updateListAdapter( R.layout.smsinviter_item, phones, names, true );
|
||||
updateListAdapter( R.layout.smsinviter_item,
|
||||
m_phoneRecs.toArray( new PhoneRec[m_phoneRecs.size()] ) );
|
||||
tryEnable();
|
||||
}
|
||||
|
||||
|
@ -376,17 +358,17 @@ public class SMSInviteDelegate extends InviteDelegate {
|
|||
|
||||
private void clearSelectedImpl()
|
||||
{
|
||||
XWListAdapter adapter = getAdapter();
|
||||
int count = adapter.getCount();
|
||||
for ( int ii = count - 1; ii >= 0; --ii ) {
|
||||
if ( m_phoneRecs.get( ii ).m_isChecked ) {
|
||||
Set<Integer> checked = getChecked();
|
||||
for ( int ii = m_phoneRecs.size() - 1; ii >= 0; --ii ) {
|
||||
if ( checked.contains( ii ) ) {
|
||||
m_phoneRecs.remove( ii );
|
||||
}
|
||||
}
|
||||
clearChecked();
|
||||
saveAndRebuild();
|
||||
}
|
||||
|
||||
private class PhoneRec {
|
||||
private class PhoneRec implements InviterItem {
|
||||
public String m_phone;
|
||||
public String m_name;
|
||||
public boolean m_isChecked;
|
||||
|
|
|
@ -43,11 +43,11 @@ public class SMSListItem extends LinearLayout {
|
|||
tv.setText( number );
|
||||
}
|
||||
|
||||
public void setOnCheckedChangeListener( OnCheckedChangeListener lstnr )
|
||||
{
|
||||
CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
cb.setOnCheckedChangeListener( lstnr );
|
||||
}
|
||||
// public void setOnCheckedChangeListener( OnCheckedChangeListener lstnr )
|
||||
// {
|
||||
// CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
// cb.setOnCheckedChangeListener( lstnr );
|
||||
// }
|
||||
|
||||
public String getNumber()
|
||||
{
|
||||
|
@ -55,15 +55,15 @@ public class SMSListItem extends LinearLayout {
|
|||
return tv.getText().toString();
|
||||
}
|
||||
|
||||
public void setChecked( boolean checked )
|
||||
{
|
||||
CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
cb.setChecked( checked );
|
||||
}
|
||||
// public void setChecked( boolean checked )
|
||||
// {
|
||||
// CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
// cb.setChecked( checked );
|
||||
// }
|
||||
|
||||
public boolean isChecked()
|
||||
{
|
||||
CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
return cb.isChecked();
|
||||
}
|
||||
// public boolean isChecked()
|
||||
// {
|
||||
// CheckBox cb = (CheckBox)findViewById( R.id.checkbox );
|
||||
// return cb.isChecked();
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class WiDirInviteDelegate extends InviteDelegate
|
|||
|
||||
public WiDirInviteDelegate( Delegator delegator, Bundle savedInstanceState )
|
||||
{
|
||||
super( delegator, savedInstanceState, R.layout.inviter );
|
||||
super( delegator, savedInstanceState );
|
||||
m_activity = delegator.getActivity();
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,7 @@ public class WiDirInviteDelegate extends InviteDelegate
|
|||
msg = getQuantityString( R.plurals.invite_p2p_desc_fmt, m_nMissing,
|
||||
m_nMissing, msg );
|
||||
msg += "\n\n" + getString( R.string.invite_p2p_desc_extra );
|
||||
super.init( R.id.button_invite, R.id.invite_desc, msg );
|
||||
findViewById( R.id.button_rescan ).setVisibility( View.GONE );
|
||||
findViewById( R.id.button_clear ).setVisibility( View.GONE );
|
||||
super.init( msg, R.string.empty_p2p_inviter );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,6 +75,19 @@ public class WiDirInviteDelegate extends InviteDelegate
|
|||
WiDirService.unregisterDevSetListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChildAdded( View child, InviterItem data )
|
||||
{
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void listSelected( InviterItem[] selected, String[] devsP,
|
||||
int[] countsP )
|
||||
{
|
||||
Assert.fail();
|
||||
}
|
||||
|
||||
// DevSetListener interface
|
||||
public void setChanged( Map<String, String> macToName )
|
||||
{
|
||||
|
@ -92,15 +103,17 @@ public class WiDirInviteDelegate extends InviteDelegate
|
|||
private void rebuildList()
|
||||
{
|
||||
int count = m_macsToName.size();
|
||||
String[] names = new String[count];
|
||||
String[] addrs = new String[count];
|
||||
TwoStringPair[] pairs = new TwoStringPair[count];
|
||||
// String[] names = new String[count];
|
||||
// String[] addrs = new String[count];
|
||||
Iterator<String> iter = m_macsToName.keySet().iterator();
|
||||
for ( int ii = 0; ii < count; ++ii ) {
|
||||
String mac = iter.next();
|
||||
addrs[ii] = mac;
|
||||
names[ii] = m_macsToName.get(mac);
|
||||
pairs[ii] = new TwoStringPair(mac, m_macsToName.get(mac) );
|
||||
// addrs[ii] = mac;
|
||||
// names[ii] = m_macsToName.get(mac);
|
||||
}
|
||||
|
||||
updateListAdapter( R.layout.inviter_item, names, addrs, false );
|
||||
updateListAdapter( R.layout.inviter_item, pairs );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue