store and present chat sender's name instead of the lame "Me"/"Not me"

thing. Requires a new table, and includes code to convert from old
format. Still need to clean up the presentation (TableRow).
This commit is contained in:
Eric House 2016-03-06 07:03:54 -08:00
parent 2ca0fe5ca4
commit 0b7dca2222
17 changed files with 442 additions and 315 deletions

View file

@ -1,20 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- -*- compile-command: "ant install"; -*- -->
<!-- Copyright (C) 2007 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Declare the contents of this Android application. The namespace <!-- Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package attribute brings in the Android platform namespace, and the package
supplies a unique name for the application. When writing your supplies a unique name for the application. When writing your
@ -26,7 +10,7 @@
android:versionName="@string/app_version" android:versionName="@string/app_version"
> >
<!-- BE SURE TO MODIFY project.project AND the variable TARGET in <!-- BE SURE TO MODIFY project.properties AND the variable TARGET in
../scripts/setup_local_props.sh if targetSdkVersion changes!!! ../scripts/setup_local_props.sh if targetSdkVersion changes!!!
--> -->
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="22" /> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="22" />

View file

@ -44,3 +44,4 @@ not_again_view.xml
relayinviter.xml relayinviter.xml
remote_dict_details.xml remote_dict_details.xml
toolbar.xml toolbar.xml
chat_row.xml

View file

@ -83,212 +83,214 @@ public final class R {
} }
public static final class id { public static final class id {
public static final int about_xlator=0x7f0a0001; public static final int about_xlator=0x7f0a0001;
public static final int add_player=0x7f0a0030; public static final int add_player=0x7f0a0032;
public static final int advertise_new_room_check=0x7f0a0037; public static final int advertise_new_room_check=0x7f0a0039;
public static final int blessed_label=0x7f0a0057; public static final int blessed_label=0x7f0a0059;
public static final int board_menu_chat=0x7f0a00a0; public static final int board_menu_chat=0x7f0a00a2;
public static final int board_menu_dict=0x7f0a009c; public static final int board_menu_dict=0x7f0a009e;
public static final int board_menu_done=0x7f0a0086; public static final int board_menu_done=0x7f0a0088;
public static final int board_menu_file_prefs=0x7f0a0093; public static final int board_menu_file_prefs=0x7f0a0095;
public static final int board_menu_flip=0x7f0a009e; public static final int board_menu_flip=0x7f0a00a0;
public static final int board_menu_game_counts=0x7f0a008c; public static final int board_menu_game_counts=0x7f0a008e;
public static final int board_menu_game_history=0x7f0a008e; public static final int board_menu_game_history=0x7f0a0090;
public static final int board_menu_game_invites=0x7f0a0095; public static final int board_menu_game_invites=0x7f0a0097;
public static final int board_menu_game_left=0x7f0a008d; public static final int board_menu_game_left=0x7f0a008f;
public static final int board_menu_game_netstats=0x7f0a0094; public static final int board_menu_game_netstats=0x7f0a0096;
public static final int board_menu_game_resend=0x7f0a0090; public static final int board_menu_game_resend=0x7f0a0092;
public static final int board_menu_game_resign=0x7f0a008f; public static final int board_menu_game_resign=0x7f0a0091;
public static final int board_menu_hint_next=0x7f0a009a; public static final int board_menu_hint_next=0x7f0a009c;
public static final int board_menu_hint_prev=0x7f0a0099; public static final int board_menu_hint_prev=0x7f0a009b;
public static final int board_menu_invite=0x7f0a0096; public static final int board_menu_invite=0x7f0a0098;
public static final int board_menu_juggle=0x7f0a009d; public static final int board_menu_juggle=0x7f0a009f;
public static final int board_menu_rematch=0x7f0a0085; public static final int board_menu_rematch=0x7f0a0087;
public static final int board_menu_toggle=0x7f0a00a1; public static final int board_menu_toggle=0x7f0a00a3;
public static final int board_menu_trade=0x7f0a0087; public static final int board_menu_trade=0x7f0a0089;
public static final int board_menu_trade_cancel=0x7f0a0088; public static final int board_menu_trade_cancel=0x7f0a008a;
public static final int board_menu_trade_commit=0x7f0a0089; public static final int board_menu_trade_commit=0x7f0a008b;
public static final int board_menu_tray=0x7f0a008b; public static final int board_menu_tray=0x7f0a008d;
public static final int board_menu_undo_current=0x7f0a009b; public static final int board_menu_undo_current=0x7f0a009d;
public static final int board_menu_undo_last=0x7f0a008a; public static final int board_menu_undo_last=0x7f0a008c;
public static final int board_menu_zoom=0x7f0a009f; public static final int board_menu_zoom=0x7f0a00a1;
public static final int board_root=0x7f0a0002; public static final int board_root=0x7f0a0002;
public static final int board_view=0x7f0a0003; public static final int board_view=0x7f0a0003;
public static final int boardsize_spinner=0x7f0a0043; public static final int boardsize_spinner=0x7f0a0045;
public static final int button_add=0x7f0a0071; public static final int button_add=0x7f0a0073;
public static final int button_clear=0x7f0a000b; public static final int button_clear=0x7f0a000b;
public static final int button_done=0x7f0a0062; public static final int button_done=0x7f0a0064;
public static final int button_invite=0x7f0a000c; public static final int button_invite=0x7f0a000c;
public static final int button_newgame_multi=0x7f0a0045; public static final int button_newgame_multi=0x7f0a0047;
public static final int button_newgame_solo=0x7f0a0044; public static final int button_newgame_solo=0x7f0a0046;
public static final int button_rescan=0x7f0a000a; public static final int button_rescan=0x7f0a000a;
public static final int button_study=0x7f0a0061; public static final int button_study=0x7f0a0063;
public static final int change_connection=0x7f0a003b; public static final int change_connection=0x7f0a003d;
public static final int chat_button=0x7f0a0080; public static final int chat_button=0x7f0a0082;
public static final int chat_edit=0x7f0a0011; public static final int chat_edit=0x7f0a0011;
public static final int chat_history=0x7f0a0010; public static final int chat_history=0x7f0a0010;
public static final int chat_menu_clear=0x7f0a00a3; public static final int chat_menu_clear=0x7f0a00a5;
public static final int chat_menu_send=0x7f0a00a2; public static final int chat_menu_send=0x7f0a00a4;
public static final int checkbox=0x7f0a0051; public static final int chat_row_name=0x7f0a0012;
public static final int color_display_sample=0x7f0a0012; public static final int chat_row_text=0x7f0a0013;
public static final int color_edit_sample=0x7f0a0013; public static final int checkbox=0x7f0a0053;
public static final int confirm_sms_reasons=0x7f0a001a; public static final int color_display_sample=0x7f0a0014;
public static final int conn_types=0x7f0a001b; public static final int color_edit_sample=0x7f0a0015;
public static final int connect_set_relay=0x7f0a0033; public static final int confirm_sms_reasons=0x7f0a001c;
public static final int conns_label=0x7f0a0032; public static final int conn_types=0x7f0a001d;
public static final int default_check=0x7f0a001c; public static final int connect_set_relay=0x7f0a0035;
public static final int del=0x7f0a0054; public static final int conns_label=0x7f0a0034;
public static final int desc=0x7f0a001f; public static final int default_check=0x7f0a001e;
public static final int details=0x7f0a0072; public static final int del=0x7f0a0056;
public static final int dict_label=0x7f0a0069; public static final int desc=0x7f0a0021;
public static final int dict_spinner=0x7f0a002d; public static final int details=0x7f0a0074;
public static final int dictlist_button=0x7f0a007f; public static final int dict_label=0x7f0a006b;
public static final int dicts_delete=0x7f0a00a6; public static final int dict_spinner=0x7f0a002f;
public static final int dicts_deselect_all=0x7f0a00a5; public static final int dictlist_button=0x7f0a0081;
public static final int dicts_download=0x7f0a00a4; public static final int dicts_delete=0x7f0a00a8;
public static final int dicts_move=0x7f0a00a7; public static final int dicts_deselect_all=0x7f0a00a7;
public static final int dicts_select=0x7f0a00a8; public static final int dicts_download=0x7f0a00a6;
public static final int divider=0x7f0a0024; public static final int dicts_move=0x7f0a00a9;
public static final int download_button=0x7f0a0073; public static final int dicts_select=0x7f0a00aa;
public static final int dwnld_message=0x7f0a004f; public static final int divider=0x7f0a0026;
public static final int edit=0x7f0a0063; public static final int download_button=0x7f0a0075;
public static final int edit_blue=0x7f0a0019; public static final int dwnld_message=0x7f0a0051;
public static final int edit_green=0x7f0a0017; public static final int edit=0x7f0a0065;
public static final int edit_red=0x7f0a0015; public static final int edit_blue=0x7f0a001b;
public static final int english_label=0x7f0a0055; public static final int edit_green=0x7f0a0019;
public static final int english_view=0x7f0a0056; public static final int edit_red=0x7f0a0017;
public static final int english_label=0x7f0a0057;
public static final int english_view=0x7f0a0058;
public static final int exchange_buttons=0x7f0a0004; public static final int exchange_buttons=0x7f0a0004;
public static final int exchange_cancel=0x7f0a0006; public static final int exchange_cancel=0x7f0a0006;
public static final int exchange_commit=0x7f0a0005; public static final int exchange_commit=0x7f0a0005;
public static final int expander=0x7f0a0026; public static final int expander=0x7f0a0028;
public static final int filters=0x7f0a005c; public static final int filters=0x7f0a005e;
public static final int flip_button=0x7f0a0082; public static final int flip_button=0x7f0a0084;
public static final int game_locked_check=0x7f0a0028; public static final int game_locked_check=0x7f0a002a;
public static final int game_name=0x7f0a0046; public static final int game_name=0x7f0a0048;
public static final int gamel_menu_checkmoves=0x7f0a0092; public static final int gamel_menu_checkmoves=0x7f0a0094;
public static final int games_game_config=0x7f0a00ab; public static final int games_game_config=0x7f0a00ad;
public static final int games_game_copy=0x7f0a00b0; public static final int games_game_copy=0x7f0a00b2;
public static final int games_game_delete=0x7f0a00a9; public static final int games_game_delete=0x7f0a00ab;
public static final int games_game_deselect=0x7f0a00b2; public static final int games_game_deselect=0x7f0a00b4;
public static final int games_game_invites=0x7f0a00b3; public static final int games_game_invites=0x7f0a00b5;
public static final int games_game_move=0x7f0a00ac; public static final int games_game_move=0x7f0a00ae;
public static final int games_game_new_from=0x7f0a00ae; public static final int games_game_new_from=0x7f0a00b0;
public static final int games_game_rematch=0x7f0a00aa; public static final int games_game_rematch=0x7f0a00ac;
public static final int games_game_rename=0x7f0a00af; public static final int games_game_rename=0x7f0a00b1;
public static final int games_game_reset=0x7f0a00ad; public static final int games_game_reset=0x7f0a00af;
public static final int games_game_select=0x7f0a00b1; public static final int games_game_select=0x7f0a00b3;
public static final int games_group_default=0x7f0a00b7; public static final int games_group_default=0x7f0a00b9;
public static final int games_group_delete=0x7f0a00b6; public static final int games_group_delete=0x7f0a00b8;
public static final int games_group_movedown=0x7f0a00b5; public static final int games_group_movedown=0x7f0a00b7;
public static final int games_group_moveup=0x7f0a00b4; public static final int games_group_moveup=0x7f0a00b6;
public static final int games_group_rename=0x7f0a00b8; public static final int games_group_rename=0x7f0a00ba;
public static final int games_menu_about=0x7f0a00c0; public static final int games_menu_about=0x7f0a00c2;
public static final int games_menu_checkmoves=0x7f0a00c2; public static final int games_menu_checkmoves=0x7f0a00c4;
public static final int games_menu_checkupdates=0x7f0a00c3; public static final int games_menu_checkupdates=0x7f0a00c5;
public static final int games_menu_dicts=0x7f0a00be; public static final int games_menu_dicts=0x7f0a00c0;
public static final int games_menu_email=0x7f0a00bf; public static final int games_menu_email=0x7f0a00c1;
public static final int games_menu_loaddb=0x7f0a00c5; public static final int games_menu_loaddb=0x7f0a00c7;
public static final int games_menu_newgame_net=0x7f0a00ba; public static final int games_menu_newgame_net=0x7f0a00bc;
public static final int games_menu_newgame_solo=0x7f0a00b9; public static final int games_menu_newgame_solo=0x7f0a00bb;
public static final int games_menu_newgroup=0x7f0a00bb; public static final int games_menu_newgroup=0x7f0a00bd;
public static final int games_menu_prefs=0x7f0a00bc; public static final int games_menu_prefs=0x7f0a00be;
public static final int games_menu_rateme=0x7f0a00bd; public static final int games_menu_rateme=0x7f0a00bf;
public static final int games_menu_resend=0x7f0a00c1; public static final int games_menu_resend=0x7f0a00c3;
public static final int games_menu_storedb=0x7f0a00c4; public static final int games_menu_storedb=0x7f0a00c6;
public static final int games_menu_study=0x7f0a0091; public static final int games_menu_study=0x7f0a0093;
public static final int group_done=0x7f0a0084; public static final int group_done=0x7f0a0086;
public static final int group_exchange=0x7f0a0097; public static final int group_exchange=0x7f0a0099;
public static final int group_hint=0x7f0a0098; public static final int group_hint=0x7f0a009a;
public static final int hideable=0x7f0a004b; public static final int hideable=0x7f0a004d;
public static final int hints_allowed=0x7f0a003c; public static final int hints_allowed=0x7f0a003e;
public static final int invite_desc=0x7f0a0009; public static final int invite_desc=0x7f0a0009;
public static final int inviter_check=0x7f0a000d; public static final int inviter_check=0x7f0a000d;
public static final int item_name=0x7f0a006d; public static final int item_name=0x7f0a006f;
public static final int item_score=0x7f0a006e; public static final int item_score=0x7f0a0070;
public static final int join_public_room_check=0x7f0a0034; public static final int join_public_room_check=0x7f0a0036;
public static final int juggle_players=0x7f0a0031; public static final int juggle_players=0x7f0a0033;
public static final int label=0x7f0a0025; public static final int label=0x7f0a0027;
public static final int lang_separator=0x7f0a002b; public static final int lang_separator=0x7f0a002d;
public static final int lang_spinner=0x7f0a002c; public static final int lang_spinner=0x7f0a002e;
public static final int loc_item_check=0x7f0a00c7; public static final int loc_item_check=0x7f0a00c9;
public static final int loc_item_clear=0x7f0a00c6; public static final int loc_item_clear=0x7f0a00c8;
public static final int loc_item_copy_bless=0x7f0a00c9; public static final int loc_item_copy_bless=0x7f0a00cb;
public static final int loc_item_copy_eng=0x7f0a00c8; public static final int loc_item_copy_eng=0x7f0a00ca;
public static final int loc_search_button=0x7f0a005e; public static final int loc_search_button=0x7f0a0060;
public static final int loc_search_field=0x7f0a005d; public static final int loc_search_field=0x7f0a005f;
public static final int local_label=0x7f0a0059; public static final int local_label=0x7f0a005b;
public static final int local_player_set=0x7f0a0067; public static final int local_player_set=0x7f0a0069;
public static final int manual_add_button=0x7f0a0075; public static final int manual_add_button=0x7f0a0077;
public static final int modtime=0x7f0a004c; public static final int modtime=0x7f0a004e;
public static final int msg=0x7f0a0064; public static final int msg=0x7f0a0066;
public static final int msg_marker=0x7f0a0049; public static final int msg_marker=0x7f0a004b;
public static final int name=0x7f0a0076; public static final int name=0x7f0a0078;
public static final int name_edit=0x7f0a001d; public static final int name_edit=0x7f0a001f;
public static final int name_label=0x7f0a0074; public static final int name_label=0x7f0a0076;
public static final int nexthint_button=0x7f0a007c; public static final int nexthint_button=0x7f0a007e;
public static final int not_again_check=0x7f0a0065; public static final int not_again_check=0x7f0a0067;
public static final int nperdev_spinner=0x7f0a000e; public static final int nperdev_spinner=0x7f0a000e;
public static final int number=0x7f0a0077; public static final int number=0x7f0a0079;
public static final int other_lang=0x7f0a005f; public static final int other_lang=0x7f0a0061;
public static final int password_edit=0x7f0a006c; public static final int password_edit=0x7f0a006e;
public static final int password_set=0x7f0a006b; public static final int password_set=0x7f0a006d;
public static final int phonies_spinner=0x7f0a0041; public static final int phonies_spinner=0x7f0a0043;
public static final int pick_faceup=0x7f0a0042; public static final int pick_faceup=0x7f0a0044;
public static final int pick_lang=0x7f0a0078; public static final int pick_lang=0x7f0a007a;
public static final int pick_lang_spinner=0x7f0a0079; public static final int pick_lang_spinner=0x7f0a007b;
public static final int play_button=0x7f0a0029; public static final int play_button=0x7f0a002b;
public static final int player_list=0x7f0a002f; public static final int player_list=0x7f0a0031;
public static final int player_name_edit=0x7f0a0068; public static final int player_name_edit=0x7f0a006a;
public static final int players=0x7f0a0027; public static final int players=0x7f0a0029;
public static final int players_label=0x7f0a002e; public static final int players_label=0x7f0a0030;
public static final int prevhint_button=0x7f0a007b; public static final int prevhint_button=0x7f0a007d;
public static final int private_rooms_set=0x7f0a0035; public static final int private_rooms_set=0x7f0a0037;
public static final int progress_bar=0x7f0a0050; public static final int progress_bar=0x7f0a0052;
public static final int public_rooms_set=0x7f0a0038; public static final int public_rooms_set=0x7f0a003a;
public static final int refresh_button=0x7f0a003a; public static final int refresh_button=0x7f0a003c;
public static final int remote_check=0x7f0a0066; public static final int remote_check=0x7f0a0068;
public static final int revert_all=0x7f0a0070; public static final int revert_all=0x7f0a0072;
public static final int revert_colors=0x7f0a006f; public static final int revert_colors=0x7f0a0071;
public static final int robot_check=0x7f0a006a; public static final int robot_check=0x7f0a006c;
public static final int role=0x7f0a004e; public static final int role=0x7f0a0050;
public static final int room_edit=0x7f0a0036; public static final int room_edit=0x7f0a0038;
public static final int room_spinner=0x7f0a0039; public static final int room_spinner=0x7f0a003b;
public static final int screen=0x7f0a002a; public static final int screen=0x7f0a002c;
public static final int scroll=0x7f0a000f; public static final int scroll=0x7f0a000f;
public static final int search_button=0x7f0a0021; public static final int search_button=0x7f0a0023;
public static final int seek_blue=0x7f0a0018; public static final int seek_blue=0x7f0a001a;
public static final int seek_green=0x7f0a0016; public static final int seek_green=0x7f0a0018;
public static final int seek_red=0x7f0a0014; public static final int seek_red=0x7f0a0016;
public static final int show_remote=0x7f0a001e; public static final int show_remote=0x7f0a0020;
public static final int shuffle_button=0x7f0a007d; public static final int shuffle_button=0x7f0a007f;
public static final int slmenu_clear_sel=0x7f0a00ce; public static final int slmenu_clear_sel=0x7f0a00d0;
public static final int slmenu_copy_sel=0x7f0a00cd; public static final int slmenu_copy_sel=0x7f0a00cf;
public static final int slmenu_deselect_all=0x7f0a00cc; public static final int slmenu_deselect_all=0x7f0a00ce;
public static final int slmenu_lookup_sel=0x7f0a00ca; public static final int slmenu_lookup_sel=0x7f0a00cc;
public static final int slmenu_select_all=0x7f0a00cb; public static final int slmenu_select_all=0x7f0a00cd;
public static final int smart_robot=0x7f0a0040; public static final int smart_robot=0x7f0a0042;
public static final int state=0x7f0a004d; public static final int state=0x7f0a004f;
public static final int summary=0x7f0a0060; public static final int summary=0x7f0a0062;
public static final int tbar_parent_hor=0x7f0a0007; public static final int tbar_parent_hor=0x7f0a0007;
public static final int tbar_parent_vert=0x7f0a0008; public static final int tbar_parent_vert=0x7f0a0008;
public static final int text_item=0x7f0a0052; public static final int text_item=0x7f0a0054;
public static final int text_item2=0x7f0a0053; public static final int text_item2=0x7f0a0055;
public static final int thumbnail=0x7f0a004a; public static final int thumbnail=0x7f0a004c;
public static final int timer_minutes_edit=0x7f0a003f; public static final int timer_minutes_edit=0x7f0a0041;
public static final int timer_set=0x7f0a003e; public static final int timer_set=0x7f0a0040;
public static final int toolbar=0x7f0a007a; public static final int toolbar=0x7f0a007c;
public static final int undo_button=0x7f0a007e; public static final int undo_button=0x7f0a0080;
public static final int use_timer=0x7f0a003d; public static final int use_timer=0x7f0a003f;
public static final int values_button=0x7f0a0081; public static final int values_button=0x7f0a0083;
public static final int version_string=0x7f0a0000; public static final int version_string=0x7f0a0000;
public static final int view_loaded=0x7f0a0048; public static final int view_loaded=0x7f0a004a;
public static final int view_unloaded=0x7f0a0047; public static final int view_unloaded=0x7f0a0049;
public static final int word_edit=0x7f0a0020; public static final int word_edit=0x7f0a0022;
public static final int wordlen_max=0x7f0a0023; public static final int wordlen_max=0x7f0a0025;
public static final int wordlen_min=0x7f0a0022; public static final int wordlen_min=0x7f0a0024;
public static final int xlated_view=0x7f0a005b; public static final int xlated_view=0x7f0a005d;
public static final int xlated_view_blessed=0x7f0a0058; public static final int xlated_view_blessed=0x7f0a005a;
public static final int xlated_view_local=0x7f0a005a; public static final int xlated_view_local=0x7f0a005c;
public static final int zoom_button=0x7f0a0083; public static final int zoom_button=0x7f0a0085;
} }
public static final class layout { public static final class layout {
public static final int about_dlg=0x7f030000; public static final int about_dlg=0x7f030000;
@ -296,43 +298,42 @@ public final class R {
public static final int btinviter=0x7f030002; public static final int btinviter=0x7f030002;
public static final int btinviter_item=0x7f030003; public static final int btinviter_item=0x7f030003;
public static final int chat=0x7f030004; public static final int chat=0x7f030004;
public static final int chat_history_local=0x7f030005; public static final int chat_row=0x7f030005;
public static final int chat_history_remote=0x7f030006; public static final int color_display=0x7f030006;
public static final int color_display=0x7f030007; public static final int color_edit=0x7f030007;
public static final int color_edit=0x7f030008; public static final int confirm_sms=0x7f030008;
public static final int confirm_sms=0x7f030009; public static final int conn_types_display=0x7f030009;
public static final int conn_types_display=0x7f03000a; public static final int dflt_name=0x7f03000a;
public static final int dflt_name=0x7f03000b; public static final int dict_browse=0x7f03000b;
public static final int dict_browse=0x7f03000c; public static final int dict_browser=0x7f03000c;
public static final int dict_browser=0x7f03000d; public static final int divider_view=0x7f03000d;
public static final int divider_view=0x7f03000e; public static final int expander_header=0x7f03000e;
public static final int expander_header=0x7f03000f; public static final int force_remote=0x7f03000f;
public static final int force_remote=0x7f030010; public static final int game_config=0x7f030010;
public static final int game_config=0x7f030011; public static final int game_list=0x7f030011;
public static final int game_list=0x7f030012; public static final int game_list_group=0x7f030012;
public static final int game_list_group=0x7f030013; public static final int game_list_item=0x7f030013;
public static final int game_list_item=0x7f030014; public static final int import_dict=0x7f030014;
public static final int import_dict=0x7f030015; public static final int import_dict_item=0x7f030015;
public static final int import_dict_item=0x7f030016; public static final int list_group=0x7f030016;
public static final int list_group=0x7f030017; public static final int list_item=0x7f030017;
public static final int list_item=0x7f030018; public static final int loc_item_edit=0x7f030018;
public static final int loc_item_edit=0x7f030019; public static final int loc_list_item=0x7f030019;
public static final int loc_list_item=0x7f03001a; public static final int loc_main=0x7f03001a;
public static final int loc_main=0x7f03001b; public static final int lookup=0x7f03001b;
public static final int lookup=0x7f03001c; public static final int msg_label_and_edit=0x7f03001c;
public static final int msg_label_and_edit=0x7f03001d; public static final int not_again_view=0x7f03001d;
public static final int not_again_view=0x7f03001e; public static final int passwd_view=0x7f03001e;
public static final int passwd_view=0x7f03001f; public static final int player_edit=0x7f03001f;
public static final int player_edit=0x7f030020; public static final int player_list_elem=0x7f030020;
public static final int player_list_elem=0x7f030021; public static final int prefs_w_buttons=0x7f030021;
public static final int prefs_w_buttons=0x7f030022; public static final int relayinviter=0x7f030022;
public static final int relayinviter=0x7f030023; public static final int remote_dict_details=0x7f030023;
public static final int remote_dict_details=0x7f030024; public static final int rename_game=0x7f030024;
public static final int rename_game=0x7f030025; public static final int smsinviter=0x7f030025;
public static final int smsinviter=0x7f030026; public static final int smsinviter_item=0x7f030026;
public static final int smsinviter_item=0x7f030027; public static final int studylist=0x7f030027;
public static final int studylist=0x7f030028; public static final int toolbar=0x7f030028;
public static final int toolbar=0x7f030029;
} }
public static final class menu { public static final class menu {
public static final int board_menu=0x7f090000; public static final int board_menu=0x7f090000;

View file

@ -503,7 +503,7 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
static void static void
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from ) and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from )
{ {
UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;Ljava/lang/String;)V" ); UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;ILjava/lang/String;)V" );
jstring jname = NULL; jstring jname = NULL;
if ( 0 <= from ) { if ( 0 <= from ) {
LocalPlayer* lp = &uc->gameInfo->players[from]; LocalPlayer* lp = &uc->gameInfo->players[from];
@ -512,7 +512,7 @@ and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from )
} }
jstring jmsg = (*env)->NewStringUTF( env, msg ); jstring jmsg = (*env)->NewStringUTF( env, msg );
(*env)->CallVoidMethod( env, util->jutil, mid, jmsg, jname ); (*env)->CallVoidMethod( env, util->jutil, mid, jmsg, from, jname );
deleteLocalRefs( env, jmsg, jname, DELETE_NO_REF ); deleteLocalRefs( env, jmsg, jname, DELETE_NO_REF );
UTIL_CBK_TAIL(); UTIL_CBK_TAIL();
} }

View file

@ -1127,6 +1127,17 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1getTrayVisState
return result; return result;
} }
JNIEXPORT jint JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1getSelPlayer
(JNIEnv* env, jclass C, GamePtrType gamePtr)
{
jint result;
XWJNI_START();
result = board_getSelPlayer( state->game.board );
XWJNI_END();
return result;
}
JNIEXPORT jboolean JNICALL JNIEXPORT jboolean JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1hideTray Java_org_eehouse_android_xw4_jni_XwJNI_board_1hideTray
(JNIEnv* env, jclass C, GamePtrType gamePtr) (JNIEnv* env, jclass C, GamePtrType gamePtr)

View file

@ -6,20 +6,19 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
> >
<!-- history is kept in a scrolling list of textview elems so
different style can be applied based on whether they're local or
remote. Inserted at runtime.... -->
<ScrollView android:id="@+id/scroll" <ScrollView android:id="@+id/scroll"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
> >
<LinearLayout android:id="@+id/chat_history"
android:orientation="vertical" <!-- contents inserted at runtime -->
android:layout_width="fill_parent" <TableLayout android:id="@+id/chat_history"
android:layout_height="wrap_content" android:layout_width="fill_parent"
/> android:layout_height="wrap_content"
/>
</ScrollView> </ScrollView>
<EditText android:id="@+id/chat_edit" <EditText android:id="@+id/chat_edit"

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FF202020"
/>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/chat_row_name"
android:layout_height="wrap_content"
/>
<TextView android:id="@+id/chat_row_text"
android:layout_height="wrap_content"
/>
</TableRow>

View file

@ -1983,13 +1983,14 @@ public class BoardDelegate extends DelegateBase
// and may stack dialogs on top of this one. Including later // and may stack dialogs on top of this one. Including later
// chat-messages. // chat-messages.
@Override @Override
public void showChat( final String msg, String fromPlayer ) public void showChat( final String msg, final int fromIndx,
String fromPlayer )
{ {
if ( BuildConstants.CHAT_SUPPORTED ) { if ( BuildConstants.CHAT_SUPPORTED ) {
post( new Runnable() { post( new Runnable() {
public void run() { public void run() {
DBUtils.appendChatHistory( m_activity, DBUtils.appendChatHistory( m_activity, m_rowid, msg,
m_rowid, msg, false ); fromIndx );
startChatActivity(); startChatActivity();
} }
} ); } );
@ -2363,9 +2364,11 @@ public class BoardDelegate extends DelegateBase
private void startChatActivity() private void startChatActivity()
{ {
if ( BuildConstants.CHAT_SUPPORTED ) { if ( BuildConstants.CHAT_SUPPORTED ) {
Intent intent = new Intent( m_activity, ChatActivity.class ); int curPlayer = XwJNI.board_getSelPlayer( m_jniGamePtr );
intent.putExtra( GameUtils.INTENT_KEY_ROWID, m_rowid ); String[] names = m_gi.playerNames();
startActivityForResult( intent, RequestCode.CHAT_REQUEST ); boolean[] locs = m_gi.playersLocal(); // to convert old histories
ChatDelegate.startForResult( m_activity, RequestCode.CHAT_REQUEST,
m_rowid, curPlayer, names, locs );
} }
} }

View file

@ -30,15 +30,23 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
import junit.framework.Assert;
import org.eehouse.android.xw4.DlgDelegate.Action; import org.eehouse.android.xw4.DlgDelegate.Action;
public class ChatDelegate extends DelegateBase { public class ChatDelegate extends DelegateBase {
private static final String INTENT_KEY_PLAYER = "intent_key_player";
private static final String INTENT_KEY_NAMES = "intent_key_names";
private static final String INTENT_KEY_LOCS = "intent_key_locs";
private long m_rowid; private long m_rowid;
private int m_curPlayer;
private Activity m_activity; private Activity m_activity;
private EditText mEdit; private EditText mEdit;
@ -63,20 +71,25 @@ public class ChatDelegate extends DelegateBase {
int before, int count ) {} int before, int count ) {}
} ); } );
m_rowid = getIntent().getLongExtra( GameUtils.INTENT_KEY_ROWID, -1 ); Intent intent = getIntent();
m_rowid = intent.getLongExtra( GameUtils.INTENT_KEY_ROWID, -1 );
m_curPlayer = intent.getIntExtra( INTENT_KEY_PLAYER, -1 );
String[] names = intent.getStringArrayExtra( INTENT_KEY_NAMES );
boolean[] locals = intent.getBooleanArrayExtra( INTENT_KEY_LOCS );
DBUtils.HistoryPair[] pairs = DBUtils.getChatHistory( m_activity, m_rowid ); DBUtils.HistoryPair[] pairs
= DBUtils.getChatHistory( m_activity, m_rowid, locals );
if ( null != pairs ) { if ( null != pairs ) {
LinearLayout layout = (LinearLayout) TableLayout layout = (TableLayout)
findViewById( R.id.chat_history ); findViewById( R.id.chat_history );
for ( DBUtils.HistoryPair pair : pairs ) { for ( DBUtils.HistoryPair pair : pairs ) {
TextView view = (TextView) TableRow row = (TableRow)inflate( R.layout.chat_row );
inflate( pair.sourceLocal TextView view = (TextView)row.findViewById( R.id.chat_row_text );
? R.layout.chat_history_local
: R.layout.chat_history_remote );
view.setText( pair.msg ); view.setText( pair.msg );
layout.addView( view ); view = (TextView)row.findViewById( R.id.chat_row_name );
view.setText( names[pair.playerIndx] );
layout.addView( row );
} }
} }
@ -121,7 +134,7 @@ public class ChatDelegate extends DelegateBase {
if ( null == text || text.length() == 0 ) { if ( null == text || text.length() == 0 ) {
setResult( Activity.RESULT_CANCELED ); setResult( Activity.RESULT_CANCELED );
} else { } else {
DBUtils.appendChatHistory( m_activity, m_rowid, text, true ); DBUtils.appendChatHistory( m_activity, m_rowid, text, m_curPlayer );
Intent result = new Intent(); Intent result = new Intent();
result.putExtra( BoardDelegate.INTENT_KEY_CHAT, text ); result.putExtra( BoardDelegate.INTENT_KEY_CHAT, text );
@ -143,8 +156,8 @@ public class ChatDelegate extends DelegateBase {
case CLEAR_ACTION: case CLEAR_ACTION:
if ( AlertDialog.BUTTON_POSITIVE == which ) { if ( AlertDialog.BUTTON_POSITIVE == which ) {
DBUtils.clearChatHistory( m_activity, m_rowid ); DBUtils.clearChatHistory( m_activity, m_rowid );
LinearLayout layout = TableLayout layout =
(LinearLayout)findViewById( R.id.chat_history ); (TableLayout)findViewById( R.id.chat_history );
layout.removeAllViews(); layout.removeAllViews();
} }
break; break;
@ -152,4 +165,18 @@ public class ChatDelegate extends DelegateBase {
super.dlgButtonClicked( action, which, params ); super.dlgButtonClicked( action, which, params );
} }
} }
public static void startForResult( Activity parent, RequestCode requestCode,
long rowID, int curPlayer,
String[] names, boolean[] locs )
{
Assert.assertFalse( -1 == curPlayer );
Intent intent = new Intent( parent, ChatActivity.class );
intent.putExtra( GameUtils.INTENT_KEY_ROWID, rowID );
intent.putExtra( INTENT_KEY_PLAYER, curPlayer );
intent.putExtra( INTENT_KEY_NAMES, names );
intent.putExtra( INTENT_KEY_LOCS, locs );
parent.startActivityForResult( intent, requestCode.ordinal() );
}
} }

View file

@ -96,13 +96,13 @@ public class DBUtils {
} }
public static class HistoryPair { public static class HistoryPair {
private HistoryPair( String p_msg, boolean p_sourceLocal ) private HistoryPair( String p_msg, int p_playerIndx )
{ {
msg = p_msg; msg = p_msg;
sourceLocal = p_sourceLocal; playerIndx = p_playerIndx;
} }
String msg; String msg;
boolean sourceLocal; int playerIndx;
} }
public static class DictBrowseState { public static class DictBrowseState {
@ -1176,21 +1176,83 @@ public class DBUtils {
updateRow( context, DBHelper.TABLE_NAME_SUM, rowid, values ); updateRow( context, DBHelper.TABLE_NAME_SUM, rowid, values );
} }
public static HistoryPair[] getChatHistory( Context context, long rowid ) private static HistoryPair[] convertChatString( Context context, long rowid,
boolean[] playersLocal )
{
HistoryPair[] result = null;
String oldHistory = getChatHistoryStr( context, rowid );
if ( null != oldHistory ) {
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
ArrayList<HistoryPair> pairs = new ArrayList<HistoryPair>();
String localPrefix = LocUtils.getString( context, R.string.chat_local_id );
String rmtPrefix = LocUtils.getString( context, R.string.chat_other_id );
String[] msgs = oldHistory.split( "\n" );
int localPlayerIndx = -1;
int remotePlayerIndx = -1;
for ( int ii = playersLocal.length - 1; ii >= 0; --ii ) {
if ( playersLocal[ii] ) {
localPlayerIndx = ii;
} else {
remotePlayerIndx = ii;
}
}
for ( String msg : msgs ) {
int indx = -1;
String prefix = null;
if ( msg.startsWith( localPrefix ) ) {
prefix = localPrefix;
indx = localPlayerIndx;
} else if ( msg.startsWith( rmtPrefix ) ) {
prefix = rmtPrefix;
indx = remotePlayerIndx;
}
if ( -1 != indx ) {
DbgUtils.logf( "removing substring %s; was: %s", prefix, msg );
msg = msg.substring( prefix.length(), msg.length() );
DbgUtils.logf( "removED substring; now %s", msg );
valuess.add( cvForChat( rowid, msg, indx ) );
HistoryPair pair = new HistoryPair(msg, indx );
pairs.add( pair );
}
}
result = pairs.toArray( new HistoryPair[pairs.size()] );
appendChatHistory( context, valuess );
// saveChatHistory( context, rowid, null );
}
return result;
}
public static HistoryPair[] getChatHistory( Context context, long rowid,
boolean[] playersLocal )
{ {
HistoryPair[] result = null; HistoryPair[] result = null;
if ( BuildConstants.CHAT_SUPPORTED ) { if ( BuildConstants.CHAT_SUPPORTED ) {
final String localPrefix = String[] columns = { DBHelper.SENDER, DBHelper.MESSAGE };
LocUtils.getString( context, R.string.chat_local_id ); String selection = String.format( "%s=%d", DBHelper.ROW, rowid );
String history = getChatHistoryStr( context, rowid ); initDB( context );
if ( null != history ) { synchronized( s_dbHelper ) {
String[] msgs = history.split( "\n" ); SQLiteDatabase db = s_dbHelper.getReadableDatabase();
result = new HistoryPair[msgs.length]; Cursor cursor = db.query( DBHelper.TABLE_NAME_CHAT, columns,
for ( int ii = 0; ii < result.length; ++ii ) { selection, null, null, null, null );
String msg = msgs[ii]; if ( 0 < cursor.getCount() ) {
boolean isLocal = msg.startsWith( localPrefix ); result = new HistoryPair[cursor.getCount()];
result[ii] = new HistoryPair( msg, isLocal ); int msgIndex = cursor.getColumnIndex( DBHelper.MESSAGE );
int plyrIndex = cursor.getColumnIndex( DBHelper.SENDER );
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
String msg = cursor.getString( msgIndex );
int plyr = cursor.getInt( plyrIndex );
HistoryPair pair = new HistoryPair(msg, plyr );
result[ii] = pair;
}
} }
cursor.close();
db.close();
}
if ( null == result ) {
result = convertChatString( context, rowid, playersLocal );
} }
} }
return result; return result;
@ -1674,26 +1736,49 @@ public class DBUtils {
return result; return result;
} }
public static void appendChatHistory( Context context, long rowid, private static void appendChatHistory( Context context,
String msg, boolean local ) ArrayList<ContentValues> valuess )
{ {
if ( BuildConstants.CHAT_SUPPORTED ) { initDB( context );
Assert.assertNotNull( msg ); synchronized( s_dbHelper ) {
int id = local ? R.string.chat_local_id : R.string.chat_other_id; SQLiteDatabase db = s_dbHelper.getWritableDatabase();
msg = LocUtils.getString( context, id ) + msg; for ( ContentValues values : valuess ) {
db.insert( DBHelper.TABLE_NAME_CHAT, null, values );
String cur = getChatHistoryStr( context, rowid );
if ( null != cur ) {
msg = cur + "\n" + msg;
} }
db.close();
saveChatHistory( context, rowid, msg );
} }
}
private static ContentValues cvForChat( long rowid, String msg, int plyr )
{
ContentValues values = new ContentValues();
values.put( DBHelper.ROW, rowid );
values.put( DBHelper.MESSAGE, msg );
values.put( DBHelper.SENDER, plyr );
return values;
}
public static void appendChatHistory( Context context, long rowid,
String msg, int fromPlayer )
{
Assert.assertNotNull( msg );
Assert.assertFalse( -1 == fromPlayer );
ArrayList<ContentValues> valuess = new ArrayList<ContentValues>();
valuess.add( cvForChat( rowid, msg, fromPlayer ) );
appendChatHistory( context, valuess );
DbgUtils.logf( "appendChatHistory: inserted %s from player %d",
msg, fromPlayer );
} // appendChatHistory } // appendChatHistory
public static void clearChatHistory( Context context, long rowid ) public static void clearChatHistory( Context context, long rowid )
{ {
saveChatHistory( context, rowid, null ); String selection = String.format( "%s = %d", DBHelper.ROW, rowid );
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getWritableDatabase();
db.delete( DBHelper.TABLE_NAME_CHAT, selection, null );
db.close();
}
} }
public static void setDBChangeListener( DBChangeListener listener ) public static void setDBChangeListener( DBChangeListener listener )

View file

@ -862,9 +862,9 @@ public class GameUtils {
m_gameOver = false; m_gameOver = false;
} }
@Override @Override
public void showChat( String msg, String fromName ) public void showChat( String msg, int fromIndx, String fromName )
{ {
DBUtils.appendChatHistory( m_context, m_rowid, msg, false ); DBUtils.appendChatHistory( m_context, m_rowid, msg, fromIndx );
m_gotChat = true; m_gotChat = true;
m_chatFrom = fromName; m_chatFrom = fromName;
m_chat = msg; m_chat = msg;

View file

@ -295,6 +295,24 @@ public class CurGameInfo {
return !consistent; return !consistent;
} }
public String[] playerNames()
{
String[] names = new String[nPlayers];
for ( int ii = 0; ii < nPlayers; ++ii ) {
names[ii] = players[ii].name;
}
return names;
}
public boolean[] playersLocal()
{
boolean[] locs = new boolean[nPlayers];
for ( int ii = 0; ii < nPlayers; ++ii ) {
locs[ii] = players[ii].isLocal;
}
return locs;
}
public String[] visibleNames( boolean withDicts ) public String[] visibleNames( boolean withDicts )
{ {
String nameFmt = withDicts? String nameFmt = withDicts?

View file

@ -146,7 +146,7 @@ public interface UtilCtxt {
boolean warnIllegalWord( String dict, String[] words, int turn, boolean warnIllegalWord( String dict, String[] words, int turn,
boolean turnLost ); boolean turnLost );
void showChat( String msg, String fromPlayer ); void showChat( String msg, int fromIndx, String fromName );
boolean phoneNumbersSame( String num1, String num2 ); boolean phoneNumbersSame( String num1, String num2 );
} }

View file

@ -293,7 +293,7 @@ public class UtilCtxtImpl implements UtilCtxt {
} }
// These need to go into some sort of chat DB, not dropped. // These need to go into some sort of chat DB, not dropped.
public void showChat( String msg, String fromPlayer ) public void showChat( String msg, int fromIndx, String fromName )
{ {
subclassOverride( "showChat" ); subclassOverride( "showChat" );
} }

View file

@ -296,6 +296,7 @@ public class XwJNI {
public static native boolean board_commitTurn( GamePtr gamePtr ); public static native boolean board_commitTurn( GamePtr gamePtr );
public static native boolean board_flip( GamePtr gamePtr ); public static native boolean board_flip( GamePtr gamePtr );
public static native boolean board_replaceTiles( GamePtr gamePtr ); public static native boolean board_replaceTiles( GamePtr gamePtr );
public static native int board_getSelPlayer( GamePtr gamePtr );
public static native boolean board_redoReplacedTiles( GamePtr gamePtr ); public static native boolean board_redoReplacedTiles( GamePtr gamePtr );
public static native void board_resetEngine( GamePtr gamePtr ); public static native void board_resetEngine( GamePtr gamePtr );
public static native boolean board_requestHint( GamePtr gamePtr, public static native boolean board_requestHint( GamePtr gamePtr,