增加了NotesListActivity和NotesPreferenceActivity注释

master
蔡文涛 2 years ago
parent aeb3480fcc
commit 9db18cff41

@ -1,4 +1,4 @@
#Thu May 25 23:08:44 CST 2023
#Wed May 31 17:02:15 CST 2023
base.0=D\:\\SoftEngineering\\MiNotesPlusDemo\\Notes-master2\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex
path.0=classes.dex

@ -582,84 +582,84 @@ int drawable bg_color_btn_mask 0x7f070055
int drawable call_record 0x7f070056
int drawable clock 0x7f070057
int drawable delete 0x7f070058
int drawable dog 0x7f0700a4
int drawable dropdown_icon 0x7f070059
int drawable edit_blue 0x7f07005a
int drawable edit_green 0x7f07005b
int drawable edit_red 0x7f07005c
int drawable edit_title_blue 0x7f07005d
int drawable edit_title_green 0x7f07005e
int drawable edit_title_red 0x7f07005f
int drawable edit_title_white 0x7f070060
int drawable edit_title_yellow 0x7f070061
int drawable edit_white 0x7f070062
int drawable edit_yellow 0x7f070063
int drawable font_large 0x7f070064
int drawable font_normal 0x7f070065
int drawable font_size_selector_bg 0x7f070066
int drawable font_small 0x7f070067
int drawable font_super 0x7f070068
int drawable icon_app 0x7f070069
int drawable list_background 0x7f07006a
int drawable list_blue_down 0x7f07006b
int drawable list_blue_middle 0x7f07006c
int drawable list_blue_single 0x7f07006d
int drawable list_blue_up 0x7f07006e
int drawable list_folder 0x7f07006f
int drawable list_footer_bg 0x7f070070
int drawable list_green_down 0x7f070071
int drawable list_green_middle 0x7f070072
int drawable list_green_single 0x7f070073
int drawable list_green_up 0x7f070074
int drawable list_red_down 0x7f070075
int drawable list_red_middle 0x7f070076
int drawable list_red_single 0x7f070077
int drawable list_red_up 0x7f070078
int drawable list_white_down 0x7f070079
int drawable list_white_middle 0x7f07007a
int drawable list_white_single 0x7f07007b
int drawable list_white_up 0x7f07007c
int drawable list_yellow_down 0x7f07007d
int drawable list_yellow_middle 0x7f07007e
int drawable list_yellow_single 0x7f07007f
int drawable list_yellow_up 0x7f070080
int drawable menu_delete 0x7f070081
int drawable menu_move 0x7f070082
int drawable new_note 0x7f070083
int drawable new_note_normal 0x7f070084
int drawable new_note_pressed 0x7f070085
int drawable note_edit_color_selector_panel 0x7f070086
int drawable notification 0x7f070087
int drawable notification_action_background 0x7f070088
int drawable notification_bg 0x7f070089
int drawable notification_bg_low 0x7f07008a
int drawable notification_bg_low_normal 0x7f07008b
int drawable notification_bg_low_pressed 0x7f07008c
int drawable notification_bg_normal 0x7f07008d
int drawable notification_bg_normal_pressed 0x7f07008e
int drawable notification_icon_background 0x7f07008f
int drawable notification_template_icon_bg 0x7f070090
int drawable notification_template_icon_low_bg 0x7f070091
int drawable notification_tile_bg 0x7f070092
int drawable notify_panel_notification_icon_bg 0x7f070093
int drawable plane 0x7f0700a5
int drawable scmzu 0x7f0700a6
int drawable search_result 0x7f070094
int drawable selected 0x7f070095
int drawable title_alert 0x7f070096
int drawable title_bar_bg 0x7f070097
int drawable tooltip_frame_dark 0x7f070098
int drawable tooltip_frame_light 0x7f070099
int drawable widget_2x_blue 0x7f07009a
int drawable widget_2x_green 0x7f07009b
int drawable widget_2x_red 0x7f07009c
int drawable widget_2x_white 0x7f07009d
int drawable widget_2x_yellow 0x7f07009e
int drawable widget_4x_blue 0x7f07009f
int drawable widget_4x_green 0x7f0700a0
int drawable widget_4x_red 0x7f0700a1
int drawable widget_4x_white 0x7f0700a2
int drawable widget_4x_yellow 0x7f0700a3
int drawable dog 0x7f070059
int drawable dropdown_icon 0x7f07005a
int drawable edit_blue 0x7f07005b
int drawable edit_green 0x7f07005c
int drawable edit_red 0x7f07005d
int drawable edit_title_blue 0x7f07005e
int drawable edit_title_green 0x7f07005f
int drawable edit_title_red 0x7f070060
int drawable edit_title_white 0x7f070061
int drawable edit_title_yellow 0x7f070062
int drawable edit_white 0x7f070063
int drawable edit_yellow 0x7f070064
int drawable font_large 0x7f070065
int drawable font_normal 0x7f070066
int drawable font_size_selector_bg 0x7f070067
int drawable font_small 0x7f070068
int drawable font_super 0x7f070069
int drawable icon_app 0x7f07006a
int drawable list_background 0x7f07006b
int drawable list_blue_down 0x7f07006c
int drawable list_blue_middle 0x7f07006d
int drawable list_blue_single 0x7f07006e
int drawable list_blue_up 0x7f07006f
int drawable list_folder 0x7f070070
int drawable list_footer_bg 0x7f070071
int drawable list_green_down 0x7f070072
int drawable list_green_middle 0x7f070073
int drawable list_green_single 0x7f070074
int drawable list_green_up 0x7f070075
int drawable list_red_down 0x7f070076
int drawable list_red_middle 0x7f070077
int drawable list_red_single 0x7f070078
int drawable list_red_up 0x7f070079
int drawable list_white_down 0x7f07007a
int drawable list_white_middle 0x7f07007b
int drawable list_white_single 0x7f07007c
int drawable list_white_up 0x7f07007d
int drawable list_yellow_down 0x7f07007e
int drawable list_yellow_middle 0x7f07007f
int drawable list_yellow_single 0x7f070080
int drawable list_yellow_up 0x7f070081
int drawable menu_delete 0x7f070082
int drawable menu_move 0x7f070083
int drawable new_note 0x7f070084
int drawable new_note_normal 0x7f070085
int drawable new_note_pressed 0x7f070086
int drawable note_edit_color_selector_panel 0x7f070087
int drawable notification 0x7f070088
int drawable notification_action_background 0x7f070089
int drawable notification_bg 0x7f07008a
int drawable notification_bg_low 0x7f07008b
int drawable notification_bg_low_normal 0x7f07008c
int drawable notification_bg_low_pressed 0x7f07008d
int drawable notification_bg_normal 0x7f07008e
int drawable notification_bg_normal_pressed 0x7f07008f
int drawable notification_icon_background 0x7f070090
int drawable notification_template_icon_bg 0x7f070091
int drawable notification_template_icon_low_bg 0x7f070092
int drawable notification_tile_bg 0x7f070093
int drawable notify_panel_notification_icon_bg 0x7f070094
int drawable plane 0x7f070095
int drawable scmzu 0x7f070096
int drawable search_result 0x7f070097
int drawable selected 0x7f070098
int drawable title_alert 0x7f070099
int drawable title_bar_bg 0x7f07009a
int drawable tooltip_frame_dark 0x7f07009b
int drawable tooltip_frame_light 0x7f07009c
int drawable widget_2x_blue 0x7f07009d
int drawable widget_2x_green 0x7f07009e
int drawable widget_2x_red 0x7f07009f
int drawable widget_2x_white 0x7f0700a0
int drawable widget_2x_yellow 0x7f0700a1
int drawable widget_4x_blue 0x7f0700a2
int drawable widget_4x_green 0x7f0700a3
int drawable widget_4x_red 0x7f0700a4
int drawable widget_4x_white 0x7f0700a5
int drawable widget_4x_yellow 0x7f0700a6
int id ALT 0x7f080000
int id CTRL 0x7f080001
int id FUNCTION 0x7f080002
@ -767,103 +767,103 @@ int id ll_font_super 0x7f080067
int id menu_alert 0x7f080068
int id menu_delete 0x7f080069
int id menu_delete_remind 0x7f08006a
int id menu_dog 0x7f0800c9
int id menu_export_text 0x7f08006b
int id menu_font_size 0x7f08006c
int id menu_list_mode 0x7f08006d
int id menu_new_folder 0x7f08006e
int id menu_new_note 0x7f08006f
int id menu_plane 0x7f0800ca
int id menu_scmzu 0x7f0800cb
int id menu_search 0x7f080070
int id menu_send_to_desktop 0x7f080071
int id menu_setting 0x7f080072
int id menu_share 0x7f080073
int id menu_sync 0x7f080074
int id message 0x7f080075
int id middle 0x7f080076
int id minute 0x7f080077
int id move 0x7f080078
int id multiply 0x7f080079
int id navigation_bar 0x7f08007a
int id never 0x7f08007b
int id none 0x7f08007c
int id normal 0x7f08007d
int id note_bg_color_selector 0x7f08007e
int id note_edit_list 0x7f08007f
int id note_edit_view 0x7f080080
int id note_item 0x7f080081
int id note_title 0x7f080082
int id notes_list 0x7f080083
int id notification_background 0x7f080084
int id notification_main_column 0x7f080085
int id notification_main_column_container 0x7f080086
int id parentPanel 0x7f080087
int id prefenerece_sync_status_textview 0x7f080088
int id preference_sync_button 0x7f080089
int id progress_circular 0x7f08008a
int id progress_horizontal 0x7f08008b
int id radio 0x7f08008c
int id right 0x7f08008d
int id right_icon 0x7f08008e
int id right_side 0x7f08008f
int id screen 0x7f080090
int id scrollIndicatorDown 0x7f080091
int id scrollIndicatorUp 0x7f080092
int id scrollView 0x7f080093
int id search_badge 0x7f080094
int id search_bar 0x7f080095
int id search_button 0x7f080096
int id search_close_btn 0x7f080097
int id search_edit_frame 0x7f080098
int id search_go_btn 0x7f080099
int id search_mag_icon 0x7f08009a
int id search_plate 0x7f08009b
int id search_src_text 0x7f08009c
int id search_voice_btn 0x7f08009d
int id select_dialog_listview 0x7f08009e
int id selection_menu 0x7f08009f
int id shortcut 0x7f0800a0
int id showCustom 0x7f0800a1
int id showHome 0x7f0800a2
int id showTitle 0x7f0800a3
int id spacer 0x7f0800a4
int id split_action_bar 0x7f0800a5
int id src_atop 0x7f0800a6
int id src_in 0x7f0800a7
int id src_over 0x7f0800a8
int id start 0x7f0800a9
int id submenuarrow 0x7f0800aa
int id submit_area 0x7f0800ab
int id sv_note_edit 0x7f0800ac
int id tabMode 0x7f0800ad
int id tag_transition_group 0x7f0800ae
int id tag_unhandled_key_event_manager 0x7f0800af
int id tag_unhandled_key_listeners 0x7f0800b0
int id text 0x7f0800b1
int id text2 0x7f0800b2
int id textSpacerNoButtons 0x7f0800b3
int id textSpacerNoTitle 0x7f0800b4
int id time 0x7f0800b5
int id title 0x7f0800b6
int id titleDividerNoCustom 0x7f0800b7
int id title_template 0x7f0800b8
int id top 0x7f0800b9
int id topPanel 0x7f0800ba
int id tv_alert_date 0x7f0800bb
int id tv_folder_name 0x7f0800bc
int id tv_modified_date 0x7f0800bd
int id tv_name 0x7f0800be
int id tv_time 0x7f0800bf
int id tv_title 0x7f0800c0
int id tv_title_bar 0x7f0800c1
int id uniform 0x7f0800c2
int id up 0x7f0800c3
int id useLogo 0x7f0800c4
int id widget_bg_image 0x7f0800c5
int id widget_text 0x7f0800c6
int id withText 0x7f0800c7
int id wrap_content 0x7f0800c8
int id menu_dog 0x7f08006b
int id menu_export_text 0x7f08006c
int id menu_font_size 0x7f08006d
int id menu_list_mode 0x7f08006e
int id menu_new_folder 0x7f08006f
int id menu_new_note 0x7f080070
int id menu_plane 0x7f080071
int id menu_scmzu 0x7f080072
int id menu_search 0x7f080073
int id menu_send_to_desktop 0x7f080074
int id menu_setting 0x7f080075
int id menu_share 0x7f080076
int id menu_sync 0x7f080077
int id message 0x7f080078
int id middle 0x7f080079
int id minute 0x7f08007a
int id move 0x7f08007b
int id multiply 0x7f08007c
int id navigation_bar 0x7f08007d
int id never 0x7f08007e
int id none 0x7f08007f
int id normal 0x7f080080
int id note_bg_color_selector 0x7f080081
int id note_edit_list 0x7f080082
int id note_edit_view 0x7f080083
int id note_item 0x7f080084
int id note_title 0x7f080085
int id notes_list 0x7f080086
int id notification_background 0x7f080087
int id notification_main_column 0x7f080088
int id notification_main_column_container 0x7f080089
int id parentPanel 0x7f08008a
int id prefenerece_sync_status_textview 0x7f08008b
int id preference_sync_button 0x7f08008c
int id progress_circular 0x7f08008d
int id progress_horizontal 0x7f08008e
int id radio 0x7f08008f
int id right 0x7f080090
int id right_icon 0x7f080091
int id right_side 0x7f080092
int id screen 0x7f080093
int id scrollIndicatorDown 0x7f080094
int id scrollIndicatorUp 0x7f080095
int id scrollView 0x7f080096
int id search_badge 0x7f080097
int id search_bar 0x7f080098
int id search_button 0x7f080099
int id search_close_btn 0x7f08009a
int id search_edit_frame 0x7f08009b
int id search_go_btn 0x7f08009c
int id search_mag_icon 0x7f08009d
int id search_plate 0x7f08009e
int id search_src_text 0x7f08009f
int id search_voice_btn 0x7f0800a0
int id select_dialog_listview 0x7f0800a1
int id selection_menu 0x7f0800a2
int id shortcut 0x7f0800a3
int id showCustom 0x7f0800a4
int id showHome 0x7f0800a5
int id showTitle 0x7f0800a6
int id spacer 0x7f0800a7
int id split_action_bar 0x7f0800a8
int id src_atop 0x7f0800a9
int id src_in 0x7f0800aa
int id src_over 0x7f0800ab
int id start 0x7f0800ac
int id submenuarrow 0x7f0800ad
int id submit_area 0x7f0800ae
int id sv_note_edit 0x7f0800af
int id tabMode 0x7f0800b0
int id tag_transition_group 0x7f0800b1
int id tag_unhandled_key_event_manager 0x7f0800b2
int id tag_unhandled_key_listeners 0x7f0800b3
int id text 0x7f0800b4
int id text2 0x7f0800b5
int id textSpacerNoButtons 0x7f0800b6
int id textSpacerNoTitle 0x7f0800b7
int id time 0x7f0800b8
int id title 0x7f0800b9
int id titleDividerNoCustom 0x7f0800ba
int id title_template 0x7f0800bb
int id top 0x7f0800bc
int id topPanel 0x7f0800bd
int id tv_alert_date 0x7f0800be
int id tv_folder_name 0x7f0800bf
int id tv_modified_date 0x7f0800c0
int id tv_name 0x7f0800c1
int id tv_time 0x7f0800c2
int id tv_title 0x7f0800c3
int id tv_title_bar 0x7f0800c4
int id uniform 0x7f0800c5
int id up 0x7f0800c6
int id useLogo 0x7f0800c7
int id widget_bg_image 0x7f0800c8
int id widget_text 0x7f0800c9
int id withText 0x7f0800ca
int id wrap_content 0x7f0800cb
int integer abc_config_activityDefaultDur 0x7f090000
int integer abc_config_activityShortDur 0x7f090001
int integer cancel_button_image_alpha 0x7f090002
@ -1004,78 +1004,78 @@ int string menu_alert 0x7f0e0046
int string menu_create_folder 0x7f0e0047
int string menu_delete 0x7f0e0048
int string menu_deselect_all 0x7f0e0049
int string menu_dog 0x7f0e008f
int string menu_export_text 0x7f0e004a
int string menu_folder_change_name 0x7f0e004b
int string menu_folder_delete 0x7f0e004c
int string menu_folder_view 0x7f0e004d
int string menu_font_large 0x7f0e004e
int string menu_font_normal 0x7f0e004f
int string menu_font_size 0x7f0e0050
int string menu_font_small 0x7f0e0051
int string menu_font_super 0x7f0e0052
int string menu_list_mode 0x7f0e0053
int string menu_move 0x7f0e0054
int string menu_move_parent_folder 0x7f0e0055
int string menu_normal_mode 0x7f0e0056
int string menu_plane 0x7f0e0090
int string menu_remove_remind 0x7f0e0057
int string menu_scmzu 0x7f0e0091
int string menu_search 0x7f0e0058
int string menu_select_all 0x7f0e0059
int string menu_select_none 0x7f0e005a
int string menu_select_title 0x7f0e005b
int string menu_send_to_desktop 0x7f0e005c
int string menu_setting 0x7f0e005d
int string menu_share 0x7f0e005e
int string menu_sync 0x7f0e005f
int string menu_sync_cancel 0x7f0e0060
int string menu_title_select_folder 0x7f0e0061
int string note_alert_expired 0x7f0e0062
int string note_link_email 0x7f0e0063
int string note_link_other 0x7f0e0064
int string note_link_tel 0x7f0e0065
int string note_link_web 0x7f0e0066
int string notealert_enter 0x7f0e0067
int string notealert_ok 0x7f0e0068
int string notelist_menu_new 0x7f0e0069
int string notelist_string_info 0x7f0e006a
int string preferences_account_summary 0x7f0e006b
int string preferences_account_title 0x7f0e006c
int string preferences_add_account 0x7f0e006d
int string preferences_bg_random_appear_title 0x7f0e006e
int string preferences_button_sync_cancel 0x7f0e006f
int string preferences_button_sync_immediately 0x7f0e0070
int string preferences_dialog_change_account_title 0x7f0e0071
int string preferences_dialog_change_account_warn_msg 0x7f0e0072
int string preferences_dialog_select_account_tips 0x7f0e0073
int string preferences_dialog_select_account_title 0x7f0e0074
int string preferences_last_sync_time 0x7f0e0075
int string preferences_last_sync_time_format 0x7f0e0076
int string preferences_menu_cancel 0x7f0e0077
int string preferences_menu_change_account 0x7f0e0078
int string preferences_menu_remove_account 0x7f0e0079
int string preferences_title 0x7f0e007a
int string preferences_toast_cannot_change_account 0x7f0e007b
int string preferences_toast_success_set_accout 0x7f0e007c
int string search 0x7f0e007d
int string search_hint 0x7f0e007e
int string search_label 0x7f0e007f
int string search_menu_title 0x7f0e0080
int string search_setting_description 0x7f0e0081
int string set_remind_time_message 0x7f0e0082
int string status_bar_notification_info_overflow 0x7f0e0083
int string success_sdcard_export 0x7f0e0084
int string success_sync_account 0x7f0e0085
int string sync_progress_init_list 0x7f0e0086
int string sync_progress_login 0x7f0e0087
int string sync_progress_syncing 0x7f0e0088
int string ticker_cancel 0x7f0e0089
int string ticker_fail 0x7f0e008a
int string ticker_success 0x7f0e008b
int string ticker_syncing 0x7f0e008c
int string widget_havenot_content 0x7f0e008d
int string widget_under_visit_mode 0x7f0e008e
int string menu_dog 0x7f0e004a
int string menu_export_text 0x7f0e004b
int string menu_folder_change_name 0x7f0e004c
int string menu_folder_delete 0x7f0e004d
int string menu_folder_view 0x7f0e004e
int string menu_font_large 0x7f0e004f
int string menu_font_normal 0x7f0e0050
int string menu_font_size 0x7f0e0051
int string menu_font_small 0x7f0e0052
int string menu_font_super 0x7f0e0053
int string menu_list_mode 0x7f0e0054
int string menu_move 0x7f0e0055
int string menu_move_parent_folder 0x7f0e0056
int string menu_normal_mode 0x7f0e0057
int string menu_plane 0x7f0e0058
int string menu_remove_remind 0x7f0e0059
int string menu_scmzu 0x7f0e005a
int string menu_search 0x7f0e005b
int string menu_select_all 0x7f0e005c
int string menu_select_none 0x7f0e005d
int string menu_select_title 0x7f0e005e
int string menu_send_to_desktop 0x7f0e005f
int string menu_setting 0x7f0e0060
int string menu_share 0x7f0e0061
int string menu_sync 0x7f0e0062
int string menu_sync_cancel 0x7f0e0063
int string menu_title_select_folder 0x7f0e0064
int string note_alert_expired 0x7f0e0065
int string note_link_email 0x7f0e0066
int string note_link_other 0x7f0e0067
int string note_link_tel 0x7f0e0068
int string note_link_web 0x7f0e0069
int string notealert_enter 0x7f0e006a
int string notealert_ok 0x7f0e006b
int string notelist_menu_new 0x7f0e006c
int string notelist_string_info 0x7f0e006d
int string preferences_account_summary 0x7f0e006e
int string preferences_account_title 0x7f0e006f
int string preferences_add_account 0x7f0e0070
int string preferences_bg_random_appear_title 0x7f0e0071
int string preferences_button_sync_cancel 0x7f0e0072
int string preferences_button_sync_immediately 0x7f0e0073
int string preferences_dialog_change_account_title 0x7f0e0074
int string preferences_dialog_change_account_warn_msg 0x7f0e0075
int string preferences_dialog_select_account_tips 0x7f0e0076
int string preferences_dialog_select_account_title 0x7f0e0077
int string preferences_last_sync_time 0x7f0e0078
int string preferences_last_sync_time_format 0x7f0e0079
int string preferences_menu_cancel 0x7f0e007a
int string preferences_menu_change_account 0x7f0e007b
int string preferences_menu_remove_account 0x7f0e007c
int string preferences_title 0x7f0e007d
int string preferences_toast_cannot_change_account 0x7f0e007e
int string preferences_toast_success_set_accout 0x7f0e007f
int string search 0x7f0e0080
int string search_hint 0x7f0e0081
int string search_label 0x7f0e0082
int string search_menu_title 0x7f0e0083
int string search_setting_description 0x7f0e0084
int string set_remind_time_message 0x7f0e0085
int string status_bar_notification_info_overflow 0x7f0e0086
int string success_sdcard_export 0x7f0e0087
int string success_sync_account 0x7f0e0088
int string sync_progress_init_list 0x7f0e0089
int string sync_progress_login 0x7f0e008a
int string sync_progress_syncing 0x7f0e008b
int string ticker_cancel 0x7f0e008c
int string ticker_fail 0x7f0e008d
int string ticker_success 0x7f0e008e
int string ticker_syncing 0x7f0e008f
int string widget_havenot_content 0x7f0e0090
int string widget_under_visit_mode 0x7f0e0091
int style AlertDialog_AppCompat 0x7f0f0000
int style AlertDialog_AppCompat_Light 0x7f0f0001
int style Animation_AppCompat_Dialog 0x7f0f0002

@ -161,26 +161,30 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
@Override
// 返回一些子模块完成的数据交给主Activity处理
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// 结果值 和 要求值 符合要求
if (resultCode == RESULT_OK
&& (requestCode == REQUEST_CODE_OPEN_NODE || requestCode == REQUEST_CODE_NEW_NODE)) {
mNotesListAdapter.changeCursor(null);
} else {
super.onActivityResult(requestCode, resultCode, data);
// 调用 Activity 的onActivityResult
}
}
private void setAppInfoFromRawRes() {
// Android平台给我们提供了一个SharedPreferences类它是一个轻量级的存储类特别适合用于保存软件配置参数。
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (!sp.getBoolean(PREFERENCE_ADD_INTRODUCTION, false)) {
StringBuilder sb = new StringBuilder();
InputStream in = null;
try {
// 把资源文件放到应用程序的/raw/raw下那么就可以在应用中使用getResources获取资源后,
// 以openRawResource方法不带后缀的资源文件名打开这个文件。
in = getResources().openRawResource(R.raw.introduction);
if (in != null) {
InputStreamReader isr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(isr);
char [] buf = new char[1024];
char [] buf = new char[1024]; // 自行定义的数值,使用者不知道有什么意义
int len = 0;
while ((len = br.read(buf)) > 0) {
sb.append(buf, 0, len);
@ -193,7 +197,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
e.printStackTrace();
return;
} finally {
if(in != null) {
if (in != null) {
try {
in.close();
} catch (IOException e) {
@ -203,11 +207,13 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
}
}
// 创建空的WorkingNote
WorkingNote note = WorkingNote.createEmptyNote(this, Notes.ID_ROOT_FOLDER,
AppWidgetManager.INVALID_APPWIDGET_ID, Notes.TYPE_WIDGET_INVALIDE,
ResourceParser.RED);
note.setWorkingText(sb.toString());
if (note.saveNote()) {
// 更新保存note的信息
sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit();
} else {
Log.e(TAG, "Save introduction note error");
@ -217,23 +223,26 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
}
@Override
//开始启动的函数
protected void onStart() {
super.onStart();
startAsyncNotesListQuery();
}
private void initResources() {
mContentResolver = this.getContentResolver();
mContentResolver = this.getContentResolver(); // 获取应用程序的数据,得到类似数据表的东西
mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver());
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
mNotesListView = (ListView) findViewById(R.id.notes_list);
// findViewById 是安卓编程的定位函数,主要是引用.R文件里的引用名
mNotesListView = (ListView) findViewById(R.id.notes_list); // 绑定XML中的ListView作为Item的容器
mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null),
null, false);
mNotesListView.setOnItemClickListener(new OnListItemClickListener());
mNotesListView.setOnItemLongClickListener(this);
mNotesListAdapter = new NotesListAdapter(this);
mNotesListView.setAdapter(mNotesListAdapter);
mAddNewNote = (Button) findViewById(R.id.btn_new_note);
mAddNewNote = (Button) findViewById(R.id.btn_new_note);// 在activity中要获取该按钮
mAddNewNote.setOnClickListener(this);
mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener());
mDispatch = false;
@ -244,6 +253,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
mModeCallBack = new ModeCallback();
}
// 继承自ListView.MultiChoiceModeListener 和 OnMenuItemClickListener
private class ModeCallback implements ListView.MultiChoiceModeListener, OnMenuItemClickListener {
private DropdownMenu mDropDownMenu;
private ActionMode mActionMode;
@ -272,7 +282,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
(Button) customView.findViewById(R.id.selection_menu),
R.menu.note_list_dropdown);
mDropDownMenu.setOnDropdownMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
public boolean onMenuItemClick(MenuItem item) {
public boolean onMenuItemClick(final MenuItem item) {
mNotesListAdapter.selectAll(!mNotesListAdapter.isAllSelected());
updateMenu();
return true;
@ -282,11 +292,12 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
return true;
}
// 更新菜单
private void updateMenu() {
int selectedCount = mNotesListAdapter.getSelectedCount();
// Update dropdown menu
String format = getResources().getString(R.string.menu_select_title, selectedCount);
mDropDownMenu.setTitle(format);
mDropDownMenu.setTitle(format); // 更改标题
MenuItem item = mDropDownMenu.findItem(R.id.action_select_all);
if (item != null) {
if (mNotesListAdapter.isAllSelected()) {

@ -1,19 +1,3 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* 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.
*/
package net.micode.notes.ui;
import android.accounts.Account;
@ -47,66 +31,90 @@ import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.remote.GTaskSyncService;
/**
* NotesPreferenceActivity便
* PreferenceActivityActivity
*/
public class NotesPreferenceActivity extends PreferenceActivity {
public static final String PREFERENCE_NAME = "notes_preferences";
//优先名
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";
//同步账号
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";
//同步时间
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";
//同步密码
private static final String AUTHORITIES_FILTER_KEY = "authorities";
//本地密码
private PreferenceCategory mAccountCategory;
//账户分组
private GTaskReceiver mReceiver;
//同步任务接收器
private Account[] mOriAccounts;
//账户
private boolean mHasAddedAccount;
//账户的hash标记
/**
* activity
* @param icicle activity
*/
@Override
protected void onCreate(Bundle icicle) {
//先执行父类的创建函数
super.onCreate(icicle);
/* using the app icon for navigation */
getActionBar().setDisplayHomeAsUpEnabled(true);
//给左上角图标的左边加上一个返回的图标
addPreferencesFromResource(R.xml.preferences);
//添加xml来源并显示 xml
mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);
//根据同步账户关键码来初始化分组
mReceiver = new GTaskReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME);
registerReceiver(mReceiver, filter);
//初始化同步组件
mOriAccounts = null;
View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);
//获取listvivewListView的作用:用于列出所有选择
getListView().addHeaderView(header, null, true);
//在listview组件上方添加其他组件
}
/**
* activity
*/
@Override
protected void onResume() {
//先执行父类 的交互实现
super.onResume();
// need to set sync account automatically if user has added a new
// account
if (mHasAddedAccount) {
//若用户新加了账户则自动设置同步账户
Account[] accounts = getGoogleAccounts();
//获取google同步账户
if (mOriAccounts != null && accounts.length > mOriAccounts.length) {
//若原账户不为空且当前账户有增加
for (Account accountNew : accounts) {
boolean found = false;
for (Account accountOld : mOriAccounts) {
if (TextUtils.equals(accountOld.name, accountNew.name)) {
//更新账户
found = true;
break;
}
}
if (!found) {
setSyncAccount(accountNew.name);
//若是没有找到旧的账户,那么同步账号中就只添加新账户
break;
}
}
@ -114,35 +122,50 @@ public class NotesPreferenceActivity extends PreferenceActivity {
}
refreshUI();
//刷新标签界面
}
/**
* activity
*/
@Override
protected void onDestroy() {
if (mReceiver != null) {
unregisterReceiver(mReceiver);
//注销接收器
}
super.onDestroy();
//执行父类的销毁动作
}
/**
*
*/
private void loadAccountPreference() {
mAccountCategory.removeAll();
//销毁所有的分组
Preference accountPref = new Preference(this);
//建立首选项
final String defaultAccount = getSyncAccountName(this);
accountPref.setTitle(getString(R.string.preferences_account_title));
accountPref.setSummary(getString(R.string.preferences_account_summary));
//设置首选项的大标题和小标题
accountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
//建立监听器
if (!GTaskSyncService.isSyncing()) {
if (TextUtils.isEmpty(defaultAccount)) {
// the first time to set account
//若是第一次建立账户显示选择账户提示对话框
showSelectAccountAlertDialog();
} else {
// if the account has already been set, we need to promp
// user about the risk
//若是已经建立则显示修改对话框并进行修改操作
showChangeAccountConfirmAlertDialog();
}
} else {
//若在没有同步的情况下则在toast中显示不能修改
Toast.makeText(NotesPreferenceActivity.this,
R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
.show();
@ -151,21 +174,28 @@ public class NotesPreferenceActivity extends PreferenceActivity {
}
});
//根据新建首选项编辑新的账户分组
mAccountCategory.addPreference(accountPref);
}
/**
*
*/
private void loadSyncButton() {
Button syncButton = (Button) findViewById(R.id.preference_sync_button);
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
//获取同步按钮控件和最终同步时间的的窗口
// set button state
//设置按钮的状态
if (GTaskSyncService.isSyncing()) {
//若是在同步状态下
syncButton.setText(getString(R.string.preferences_button_sync_cancel));
syncButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GTaskSyncService.cancelSync(NotesPreferenceActivity.this);
}
});
//设置按钮显示的文本为“取消同步”以及监听器
} else {
syncButton.setText(getString(R.string.preferences_button_sync_immediately));
syncButton.setOnClickListener(new View.OnClickListener() {
@ -173,50 +203,66 @@ public class NotesPreferenceActivity extends PreferenceActivity {
GTaskSyncService.startSync(NotesPreferenceActivity.this);
}
});
//若是不同步则设置按钮显示的文本为“立即同步”以及对应监听器
}
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));
//设置按键可用还是不可用
// set last sync time
// 设置最终同步时间
if (GTaskSyncService.isSyncing()) {
//若是在同步的情况下
lastSyncTimeView.setText(GTaskSyncService.getProgressString());
lastSyncTimeView.setVisibility(View.VISIBLE);
// 根据当前同步服务器设置时间显示框的文本以及可见性
} else {
//若是非同步情况
long lastSyncTime = getLastSyncTime(this);
if (lastSyncTime != 0) {
lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time,
DateFormat.format(getString(R.string.preferences_last_sync_time_format),
lastSyncTime)));
lastSyncTimeView.setVisibility(View.VISIBLE);
//则根据最后同步时间的信息来编辑时间显示框的文本内容和可见性
} else {
//若时间为空直接设置为不可见状态
lastSyncTimeView.setVisibility(View.GONE);
}
}
}
/**
*
*/
private void refreshUI() {
loadAccountPreference();
loadSyncButton();
}
/**
*
*/
private void showSelectAccountAlertDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
//创建一个新的对话框
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_select_account_title));
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));
//设置标题以及子标题的内容
dialogBuilder.setCustomTitle(titleView);
dialogBuilder.setPositiveButton(null, null);
//设置对话框的自定义标题建立一个YES的按钮
Account[] accounts = getGoogleAccounts();
String defAccount = getSyncAccountName(this);
//获取同步账户信息
mOriAccounts = accounts;
mHasAddedAccount = false;
if (accounts.length > 0) {
//若账户不为空
CharSequence[] items = new CharSequence[accounts.length];
final CharSequence[] itemMapping = items;
int checkedItem = -1;
@ -224,83 +270,118 @@ public class NotesPreferenceActivity extends PreferenceActivity {
for (Account account : accounts) {
if (TextUtils.equals(account.name, defAccount)) {
checkedItem = index;
//在账户列表中查询到所需账户
}
items[index++] = account.name;
}
dialogBuilder.setSingleChoiceItems(items, checkedItem,
//在对话框建立一个单选的复选框
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setSyncAccount(itemMapping[which].toString());
dialog.dismiss();
//取消对话框
refreshUI();
}
//设置点击后执行的事件,包括检录新同步账户和刷新标签界面
});
//建立对话框网络版的监听器
}
View addAccountView = LayoutInflater.from(this).inflate(R.layout.add_account_text, null);
dialogBuilder.setView(addAccountView);
//给新加账户对话框设置自定义样式
final AlertDialog dialog = dialogBuilder.show();
//显示对话框
addAccountView.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mHasAddedAccount = true;
//将新加账户的hash置true
Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
//建立网络建立组件
intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] {
"gmail-ls"
});
startActivityForResult(intent, -1);
//跳回上一个选项
dialog.dismiss();
}
});
//建立新加账户对话框的监听器
}
/**
*
*/
private void showChangeAccountConfirmAlertDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
//创建一个新的对话框
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_change_account_title,
getSyncAccountName(this)));
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg));
//根据同步修改的账户信息设置标题以及子标题的内容
dialogBuilder.setCustomTitle(titleView);
//设置对话框的自定义标题
CharSequence[] menuItemArray = new CharSequence[] {
getString(R.string.preferences_menu_change_account),
getString(R.string.preferences_menu_remove_account),
getString(R.string.preferences_menu_cancel)
};
//定义一些标记字符串
dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() {
//设置对话框要显示的一个list用于显示几个命令时,即changeremovecancel
public void onClick(DialogInterface dialog, int which) {
//按键功能由which来决定
if (which == 0) {
//进入账户选择对话框
showSelectAccountAlertDialog();
} else if (which == 1) {
//删除账户并且跟新便签界面
removeSyncAccount();
refreshUI();
}
}
});
dialogBuilder.show();
//显示对话框
}
/**
*
* @return
*/
private Account[] getGoogleAccounts() {
AccountManager accountManager = AccountManager.get(this);
return accountManager.getAccountsByType("com.google");
}
/**
*
* @param account
*/
private void setSyncAccount(String account) {
if (!getSyncAccountName(this).equals(account)) {
//假如该账号不在同步账号列表中
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
//编辑共享的首选项
if (account != null) {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account);
} else {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
}
//将该账号加入到首选项中
editor.commit();
//提交修改的数据
// clean up last sync time
setLastSyncTime(this, 0);
//将最后同步时间清零
// clean up local gtask related info
new Thread(new Runnable() {
@ -311,23 +392,33 @@ public class NotesPreferenceActivity extends PreferenceActivity {
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
}
}).start();
//重置当地同步任务的信息
Toast.makeText(NotesPreferenceActivity.this,
getString(R.string.preferences_toast_success_set_accout, account),
Toast.LENGTH_SHORT).show();
//将toast的文本信息置为“设置账户成功”并显示出来
}
}
/**
*
*/
private void removeSyncAccount() {
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
//设置共享首选项
if (settings.contains(PREFERENCE_SYNC_ACCOUNT_NAME)) {
editor.remove(PREFERENCE_SYNC_ACCOUNT_NAME);
//假如当前首选项中有账户就删除
}
if (settings.contains(PREFERENCE_LAST_SYNC_TIME)) {
editor.remove(PREFERENCE_LAST_SYNC_TIME);
//删除当前首选项中有账户时间
}
editor.commit();
//提交更新后的数据
// clean up local gtask related info
new Thread(new Runnable() {
@ -338,51 +429,83 @@ public class NotesPreferenceActivity extends PreferenceActivity {
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
}
}).start();
//重置当地同步任务的信息
}
/**
*
* @param context
* @return
*/
public static String getSyncAccountName(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
}
/**
*
* @param context
* @param time
*/
public static void setLastSyncTime(Context context, long time) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
// 从共享首选项中找到相关账户并获取其编辑器
editor.putLong(PREFERENCE_LAST_SYNC_TIME, time);
editor.commit();
//编辑最终同步时间并提交更新
}
/**
*
*
* @param context
* @return
*/
public static long getLastSyncTime(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);
}
/**
*
*/
private class GTaskReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
refreshUI();
if (intent.getBooleanExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_IS_SYNCING, false)) {
//获取随广播而来的Intent中的同步服务的数据
TextView syncStatus = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
syncStatus.setText(intent
.getStringExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_PROGRESS_MSG));
//通过获取的数据在设置系统的状态
}
}
}
/**
*
* @param item MenuItem
* @return
*/
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
//根据选项的id选择这里只有一个主页
case android.R.id.home:
Intent intent = new Intent(this, NotesListActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
//在主页情况下在创建连接组件intent发出清空的信号并开始一个相应的activity
default:
return false;
}
}
}
Loading…
Cancel
Save