From 86c43eee7e8dcf850494f8eb0d1c6229e9aab124 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 11 Jun 2024 21:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E4=B8=BAui=E9=83=A8=E5=88=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Notes-master/.idea/.gitignore | 8 - Notes-master/.idea/misc.xml | 6 - Notes-master/.idea/modules.xml | 8 - Notes-master/Notes-master.iml | 11 - Notes-master/Notes-master/.gitignore | 9 - Notes-master/Notes-master/NOTICE | 190 ------- Notes-master/Notes-master/README | 23 - .../res/drawable-hdpi/edit_title_green.9.png | Bin 5627 -> 0 bytes NotesMaster/.gitignore | 5 + NotesMaster/README.md | 2 + NotesMaster/app/build.gradle | 37 ++ .../app/src/main}/AndroidManifest.xml | 55 +- .../java}/net/micode/notes/data/Contact.java | 4 +- .../java}/net/micode/notes/data/Notes.java | 20 +- .../notes/data/NotesDatabaseHelper.java | 219 ++++---- .../net/micode/notes/data/NotesProvider.java | 22 +- .../net/micode/notes/gtask/data/MetaData.java | 0 .../net/micode/notes/gtask/data/Node.java | 0 .../net/micode/notes/gtask/data/SqlData.java | 2 +- .../net/micode/notes/gtask/data/SqlNote.java | 8 +- .../net/micode/notes/gtask/data/Task.java | 0 .../net/micode/notes/gtask/data/TaskList.java | 0 .../exception/ActionFailureException.java | 0 .../exception/NetworkFailureException.java | 0 .../notes/gtask/remote/GTaskASyncTask.java | 5 +- .../notes/gtask/remote/GTaskClient.java | 116 ++-- .../notes/gtask/remote/GTaskManager.java | 4 +- .../notes/gtask/remote/GTaskSyncService.java | 0 .../java}/net/micode/notes/model/Note.java | 0 .../net/micode/notes/model/WorkingNote.java | 50 +- .../net/micode/notes/tool/BackupUtils.java | 4 +- .../net/micode/notes/tool/DataUtils.java | 95 +++- .../notes/tool/FingerprintDialogFragment.java | 135 +++++ .../micode/notes/tool/GTaskStringUtils.java | 0 .../net/micode/notes/tool/ResourceParser.java | 95 ++-- .../micode/notes/ui/AlarmAlertActivity.java | 75 ++- .../micode/notes/ui/AlarmInitReceiver.java | 32 +- .../net/micode/notes/ui/AlarmReceiver.java | 3 + .../net/micode/notes/ui/DateTimePicker.java | 54 +- .../micode/notes/ui/DateTimePickerDialog.java | 34 +- .../net/micode/notes/ui/DropdownMenu.java | 12 +- .../micode/notes/ui/FoldersListAdapter.java | 21 +- .../net/micode/notes/ui/NoteEditActivity.java | 436 +++++++++++++-- .../net/micode/notes/ui/NoteEditText.java | 0 .../net/micode/notes/ui/NoteItemData.java | 64 ++- .../micode/notes/ui/NotesListActivity.java | 498 +++++++++++++----- .../net/micode/notes/ui/NotesListAdapter.java | 155 +++++- .../net/micode/notes/ui/NotesListItem.java | 48 +- .../notes/ui/NotesPreferenceActivity.java | 215 ++++++-- .../micode/notes/ui/VoiceNoteActivity.java | 47 ++ .../notes/widget/NoteWidgetProvider.java | 8 +- .../notes/widget/NoteWidgetProvider_2x.java | 0 .../notes/widget/NoteWidgetProvider_4x.java | 0 .../src/main}/res/color/primary_text_dark.xml | 0 .../main}/res/color/secondary_text_dark.xml | 0 .../src/main/res/drawable-hdpi/add_node.png | Bin 0 -> 2296 bytes .../res/drawable-hdpi/bg_btn_set_color.png | Bin .../res/drawable-hdpi/bg_color_btn_mask.png | Bin .../main}/res/drawable-hdpi/call_record.png | Bin .../app/src/main}/res/drawable-hdpi/clock.png | Bin .../src/main}/res/drawable-hdpi/delete.png | Bin .../res/drawable-hdpi/dropdown_icon.9.png | Bin .../main}/res/drawable-hdpi/edit_blue.9.png | Bin .../main}/res/drawable-hdpi/edit_green.9.png | Bin .../main}/res/drawable-hdpi/edit_red.9.png | Bin .../res/drawable-hdpi/edit_title_blue.9.png | Bin .../res/drawable-hdpi/edit_title_green.9.png | Bin 0 -> 2610 bytes .../res/drawable-hdpi/edit_title_red.9.png | Bin .../res/drawable-hdpi/edit_title_white.9.png | Bin .../res/drawable-hdpi/edit_title_yellow.9.png | Bin .../main}/res/drawable-hdpi/edit_white.9.png | Bin .../main}/res/drawable-hdpi/edit_yellow.9.png | Bin .../main}/res/drawable-hdpi/font_large.png | Bin .../main}/res/drawable-hdpi/font_normal.png | Bin .../drawable-hdpi/font_size_selector_bg.9.png | Bin .../main}/res/drawable-hdpi/font_small.png | Bin .../main}/res/drawable-hdpi/font_super.png | Bin .../src/main}/res/drawable-hdpi/icon_app.png | Bin .../res/drawable-hdpi/list_background.png | Bin .../res/drawable-hdpi/list_blue_down.9.png | Bin .../res/drawable-hdpi/list_blue_middle.9.png | Bin .../res/drawable-hdpi/list_blue_single.9.png | Bin .../res/drawable-hdpi/list_blue_up.9.png | Bin .../main}/res/drawable-hdpi/list_folder.9.png | Bin .../res/drawable-hdpi/list_footer_bg.9.png | Bin .../res/drawable-hdpi/list_green_down.9.png | Bin .../res/drawable-hdpi/list_green_middle.9.png | Bin .../res/drawable-hdpi/list_green_single.9.png | Bin .../res/drawable-hdpi/list_green_up.9.png | Bin .../res/drawable-hdpi/list_red_down.9.png | Bin .../res/drawable-hdpi/list_red_middle.9.png | Bin .../res/drawable-hdpi/list_red_single.9.png | Bin .../main}/res/drawable-hdpi/list_red_up.9.png | Bin .../res/drawable-hdpi/list_white_down.9.png | Bin .../res/drawable-hdpi/list_white_middle.9.png | Bin .../res/drawable-hdpi/list_white_single.9.png | Bin .../res/drawable-hdpi/list_white_up.9.png | Bin .../res/drawable-hdpi/list_yellow_down.9.png | Bin .../drawable-hdpi/list_yellow_middle.9.png | Bin .../drawable-hdpi/list_yellow_single.9.png | Bin .../res/drawable-hdpi/list_yellow_up.9.png | Bin .../src/main/res/drawable-hdpi/listtest.png | Bin 0 -> 2295 bytes .../app/src/main/res/drawable-hdpi/lock.png | Bin 0 -> 751 bytes .../main}/res/drawable-hdpi/menu_delete.png | Bin .../src/main}/res/drawable-hdpi/menu_move.png | Bin .../res/drawable-hdpi/new_note_normal.png | Bin .../res/drawable-hdpi/new_note_pressed.png | Bin .../src/main/res/drawable-hdpi/note_bk.png | Bin 0 -> 484 bytes .../note_edit_color_selector_panel.png | Bin .../main}/res/drawable-hdpi/notification.png | Bin .../main}/res/drawable-hdpi/search_result.png | Bin .../src/main}/res/drawable-hdpi/selected.png | Bin .../main}/res/drawable-hdpi/title_alert.png | Bin .../res/drawable-hdpi/title_bar_bg.9.png | Bin .../app/src/main/res/drawable-hdpi/unlock.png | Bin 0 -> 754 bytes .../res/drawable-hdpi/widget_2x_blue.png | Bin .../res/drawable-hdpi/widget_2x_green.png | Bin .../main}/res/drawable-hdpi/widget_2x_red.png | Bin .../res/drawable-hdpi/widget_2x_white.png | Bin .../res/drawable-hdpi/widget_2x_yellow.png | Bin .../res/drawable-hdpi/widget_4x_blue.png | Bin .../res/drawable-hdpi/widget_4x_green.png | Bin .../main}/res/drawable-hdpi/widget_4x_red.png | Bin .../res/drawable-hdpi/widget_4x_white.png | Bin .../res/drawable-hdpi/widget_4x_yellow.png | Bin .../app/src/main/res/drawable/ic_fp_40px.png | Bin 0 -> 4001 bytes .../app/src/main}/res/drawable/new_note.xml | 0 .../main}/res/layout/account_dialog_title.xml | 0 .../app/src/main/res/layout/activity_main.xml | 35 ++ .../main/res/layout/activity_voice_note.xml | 20 + .../src/main}/res/layout/add_account_text.xml | 0 .../src/main}/res/layout/datetime_picker.xml | 0 .../src/main}/res/layout/dialog_edit_text.xml | 0 .../main/res/layout/fingerprint_dialog.xml | 52 ++ .../src/main}/res/layout/folder_list_item.xml | 0 .../app/src/main}/res/layout/note_edit.xml | 28 +- .../main}/res/layout/note_edit_list_item.xml | 0 .../app/src/main}/res/layout/note_item.xml | 11 +- .../app/src/main}/res/layout/note_list.xml | 16 +- .../res/layout/note_list_dropdown_menu.xml | 0 .../src/main}/res/layout/note_list_footer.xml | 0 .../src/main}/res/layout/settings_header.xml | 0 .../app/src/main}/res/layout/widget_2x.xml | 0 .../app/src/main}/res/layout/widget_4x.xml | 0 .../app/src/main}/res/menu/call_note_edit.xml | 0 .../src/main}/res/menu/call_record_folder.xml | 0 .../app/src/main}/res/menu/note_edit.xml | 0 .../app/src/main}/res/menu/note_list.xml | 0 .../src/main}/res/menu/note_list_dropdown.xml | 0 .../src/main}/res/menu/note_list_options.xml | 0 .../app/src/main}/res/menu/sub_folder.xml | 0 .../app/src/main}/res/raw-zh-rCN/introduction | 0 .../app/src/main}/res/raw/introduction | 0 .../src/main}/res/values-zh-rCN/arrays.xml | 0 .../src/main}/res/values-zh-rCN/strings.xml | 10 +- .../src/main}/res/values-zh-rTW/arrays.xml | 0 .../src/main}/res/values-zh-rTW/strings.xml | 8 + .../app/src/main/res/values/NoteTheme.xml | 10 + .../app/src/main}/res/values/arrays.xml | 0 .../app/src/main}/res/values/colors.xml | 0 .../app/src/main}/res/values/dimens.xml | 0 .../app/src/main}/res/values/strings.xml | 18 +- .../app/src/main}/res/values/styles.xml | 0 .../app/src/main}/res/xml/preferences.xml | 0 .../app/src/main}/res/xml/searchable.xml | 0 .../app/src/main}/res/xml/widget_2x_info.xml | 0 .../app/src/main}/res/xml/widget_4x_info.xml | 0 NotesMaster/build.gradle | 17 + NotesMaster/gradle.properties | 2 + .../gradle/wrapper/gradle-wrapper.properties | 7 + NotesMaster/gradlew | 185 +++++++ NotesMaster/gradlew.bat | 89 ++++ NotesMaster/import-summary.txt | 36 ++ NotesMaster/settings.gradle | 1 + README.md | 21 - 175 files changed, 2439 insertions(+), 962 deletions(-) delete mode 100644 Notes-master/.idea/.gitignore delete mode 100644 Notes-master/.idea/misc.xml delete mode 100644 Notes-master/.idea/modules.xml delete mode 100644 Notes-master/Notes-master.iml delete mode 100644 Notes-master/Notes-master/.gitignore delete mode 100644 Notes-master/Notes-master/NOTICE delete mode 100644 Notes-master/Notes-master/README delete mode 100644 Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png create mode 100644 NotesMaster/.gitignore create mode 100644 NotesMaster/README.md create mode 100644 NotesMaster/app/build.gradle rename {Notes-master/Notes-master => NotesMaster/app/src/main}/AndroidManifest.xml (75%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/data/Contact.java (94%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/data/Notes.java (92%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/data/NotesDatabaseHelper.java (55%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/data/NotesProvider.java (92%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/MetaData.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/Node.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/SqlData.java (98%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/SqlNote.java (98%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/Task.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/data/TaskList.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/exception/ActionFailureException.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/exception/NetworkFailureException.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/remote/GTaskASyncTask.java (96%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/remote/GTaskClient.java (84%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/remote/GTaskManager.java (99%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/gtask/remote/GTaskSyncService.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/model/Note.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/model/WorkingNote.java (90%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/tool/BackupUtils.java (99%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/tool/DataUtils.java (75%) create mode 100644 NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/tool/GTaskStringUtils.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/tool/ResourceParser.java (66%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/AlarmAlertActivity.java (61%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/AlarmInitReceiver.java (69%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/AlarmReceiver.java (83%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/DateTimePicker.java (86%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/DateTimePickerDialog.java (69%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/DropdownMenu.java (83%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/FoldersListAdapter.java (79%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NoteEditActivity.java (64%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NoteEditText.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NoteItemData.java (73%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NotesListActivity.java (67%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NotesListAdapter.java (50%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NotesListItem.java (69%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/ui/NotesPreferenceActivity.java (64%) create mode 100644 NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/widget/NoteWidgetProvider.java (97%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/widget/NoteWidgetProvider_2x.java (100%) rename {Notes-master/Notes-master/src => NotesMaster/app/src/main/java}/net/micode/notes/widget/NoteWidgetProvider_4x.java (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/color/primary_text_dark.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/color/secondary_text_dark.xml (100%) create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/add_node.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/bg_btn_set_color.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/bg_color_btn_mask.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/call_record.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/clock.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/delete.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/dropdown_icon.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_blue.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_green.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_red.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_title_blue.9.png (100%) create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/edit_title_green.9.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_title_red.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_title_white.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_title_yellow.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_white.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/edit_yellow.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/font_large.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/font_normal.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/font_size_selector_bg.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/font_small.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/font_super.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/icon_app.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_background.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_blue_down.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_blue_middle.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_blue_single.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_blue_up.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_folder.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_footer_bg.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_green_down.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_green_middle.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_green_single.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_green_up.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_red_down.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_red_middle.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_red_single.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_red_up.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_white_down.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_white_middle.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_white_single.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_white_up.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_yellow_down.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_yellow_middle.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_yellow_single.9.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/list_yellow_up.9.png (100%) create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/listtest.png create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/lock.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/menu_delete.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/menu_move.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/new_note_normal.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/new_note_pressed.png (100%) create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/note_edit_color_selector_panel.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/notification.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/search_result.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/selected.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/title_alert.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/title_bar_bg.9.png (100%) create mode 100644 NotesMaster/app/src/main/res/drawable-hdpi/unlock.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_2x_blue.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_2x_green.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_2x_red.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_2x_white.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_2x_yellow.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_4x_blue.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_4x_green.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_4x_red.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_4x_white.png (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable-hdpi/widget_4x_yellow.png (100%) create mode 100644 NotesMaster/app/src/main/res/drawable/ic_fp_40px.png rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/drawable/new_note.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/account_dialog_title.xml (100%) create mode 100644 NotesMaster/app/src/main/res/layout/activity_main.xml create mode 100644 NotesMaster/app/src/main/res/layout/activity_voice_note.xml rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/add_account_text.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/datetime_picker.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/dialog_edit_text.xml (100%) create mode 100644 NotesMaster/app/src/main/res/layout/fingerprint_dialog.xml rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/folder_list_item.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_edit.xml (93%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_edit_list_item.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_item.xml (94%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_list.xml (83%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_list_dropdown_menu.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/note_list_footer.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/settings_header.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/widget_2x.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/layout/widget_4x.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/call_note_edit.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/call_record_folder.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/note_edit.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/note_list.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/note_list_dropdown.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/note_list_options.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/menu/sub_folder.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/raw-zh-rCN/introduction (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/raw/introduction (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values-zh-rCN/arrays.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values-zh-rCN/strings.xml (92%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values-zh-rTW/arrays.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values-zh-rTW/strings.xml (93%) create mode 100644 NotesMaster/app/src/main/res/values/NoteTheme.xml rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values/arrays.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values/colors.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values/dimens.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values/strings.xml (89%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/values/styles.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/xml/preferences.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/xml/searchable.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/xml/widget_2x_info.xml (100%) rename {Notes-master/Notes-master => NotesMaster/app/src/main}/res/xml/widget_4x_info.xml (100%) create mode 100644 NotesMaster/build.gradle create mode 100644 NotesMaster/gradle.properties create mode 100644 NotesMaster/gradle/wrapper/gradle-wrapper.properties create mode 100644 NotesMaster/gradlew create mode 100644 NotesMaster/gradlew.bat create mode 100644 NotesMaster/import-summary.txt create mode 100644 NotesMaster/settings.gradle delete mode 100644 README.md diff --git a/Notes-master/.idea/.gitignore b/Notes-master/.idea/.gitignore deleted file mode 100644 index 35410ca..0000000 --- a/Notes-master/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml -# 基于编辑器的 HTTP 客户端请求 -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/Notes-master/.idea/misc.xml b/Notes-master/.idea/misc.xml deleted file mode 100644 index 639900d..0000000 --- a/Notes-master/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Notes-master/.idea/modules.xml b/Notes-master/.idea/modules.xml deleted file mode 100644 index 7800270..0000000 --- a/Notes-master/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Notes-master/Notes-master.iml b/Notes-master/Notes-master.iml deleted file mode 100644 index 0c84021..0000000 --- a/Notes-master/Notes-master.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Notes-master/Notes-master/.gitignore b/Notes-master/Notes-master/.gitignore deleted file mode 100644 index 7df8dff..0000000 --- a/Notes-master/Notes-master/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -# generated files -bin/ -gen/ - -# Local configuration file (sdk path, etc) -project.properties -.settings/ -.classpath -.project diff --git a/Notes-master/Notes-master/NOTICE b/Notes-master/Notes-master/NOTICE deleted file mode 100644 index 9a54521..0000000 --- a/Notes-master/Notes-master/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/Notes-master/Notes-master/README b/Notes-master/Notes-master/README deleted file mode 100644 index fc0d824..0000000 --- a/Notes-master/Notes-master/README +++ /dev/null @@ -1,23 +0,0 @@ -[中文] - -1. MiCode便签是小米便签的社区开源版,由MIUI团队(www.miui.com) 发起并贡献第一批代码,遵循NOTICE文件所描述的开源协议, - 今后为MiCode社区(www.micode.net) 拥有,并由社区发布和维护。 - -2. Bug反馈和跟踪,请访问Github, - https://github.com/MiCode/Notes/issues?sort=created&direction=desc&state=open - -3. 功能建议和综合讨论,请访问MiCode, - http://micode.net/forum.php?mod=forumdisplay&fid=38 - - -[English] - -1. MiCode Notes is open source edition of XM notepad, it's first initiated and sponsored by MIUI team (www.miui.com). - It's opened under license described by NOTICE file. It's owned by the MiCode community (www.micode.net). In future, - the MiCode community will release and maintain this project. - -2. Regarding issue tracking, please visit Github, - https://github.com/MiCode/Notes/issues?sort=created&direction=desc&state=open - -3. Regarding feature request and general discussion, please visit Micode forum, - http://micode.net/forum.php?mod=forumdisplay&fid=38 diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png b/Notes-master/Notes-master/res/drawable-hdpi/edit_title_green.9.png deleted file mode 100644 index 08d864470f5f087d740bb9c83b8e4aac505bc97c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5627 zcmVKLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z3n)oMK~#9!v|78)rAZAe+x;)gbs;7~LPA0U5hEee$#{sBcmQHTBqRbJfVUtcg@h22 zMcOBT1Zh|7Wth{p3G8zB+1-%+rP2Iz=DW1rc2&9hNM_>8_z{uJO!-ot{Y8uZ#Q*UF z;PK1I{qu7>79LPFs8%9G1nGvgz7ErGeyaG&ufMT=_WLhf^y~cVTaW$b zk2^ki<@f+1z;*`!m}=!D6Pbwwpd!eu?5Qdsg3N?KkQtM`Oh8R*F_Fj&m>KqCL(KqW z1>gZwMPwo}pi=iJ-oab;oj<9({Nii&(>EfL$_O6&@w+$v&sUH9H!`y_nF$eryH7oc zRHiFi0uil1A|L=nFk2sySj)N!Dq!vMuw@VdJOb_xRlyENq86VS$P9#hfH(24SMHDB zKGpQ6`@J818t?zj<3pr6T#s(jR}N+lC!3g;sGp88YhB8@QYDS>oQGS?o+U~m8D)hs&k(f6uM1qoEm zX=RShhThfQS-5XV*EGukQ?uO@0L&D&tOGHi%SL-gAp-PHRKsUq<6UBjtoB0S_7GaEQW@IFj=pp(-$*U3sCf$V@I1Bu!- zAmQ=fcTT1=5T4Tj**DKa8{$+I8F@%Vw0EbjXApC5mxcFpBfOxDJ%iJ1+Q~4}+7STZ zL=u*4-J^3?Lqud<*g!rwU9|=jF?anU;qLYSSH^X&zXKMiR+&U22eFvJv9`U-vP!SA zjEg`O0G8=IoQ>E}+zau~!(3-dO`l-S)Zp&5h{0?rsOuj-W4qUSL?)2!yP30qVEZ24 z=-X=1?lCvk!**{=VwnMuAqi2zP5jy!<@UPoru#}jc9Wr*j<}m(55_d+=$F7Yjmr<={#M77v1mHuzv-eoDX^*|9+5ttvXtq14V zfxHIyzCWW^-WjLrIsz$Rwy^hZy>NkU@6=j0C17TVmbz%{H7hAPtlQ7tdt;eFS{4j5 z>xCXkY?WfKh>Gk9pEDp@xLKH6S$|op%c^QofYHov-aM*gs7ZinL_(c5b&Kj#Nk!K^ zgDG6U8j%VuBZs;pa&!nOUPky}#Cl3j7TK_7t7}n5qMmYzE~(S_#lSg1@H%NUvI+Wz zJTCT9M41WSyEQUtIA_)yiRm$QDamQ&G%Q4>UkbA^nw&LiW+zE`#1@H~s*mWQO#O|A zL$hj6a~^nM}ESZ-q zC3CT~#B>G&;(6(krsi%c4jGv_@WyGz!w=bYgNj@@eX6dufn!cYAiUtrw@;H`L>2Xh z56qD)w6iGvJISiFMhU7t1M?{zl`}0x#1Pr`gCy(nN`@@*>SVcCi?vFPI})Z}m=Rbn zYkU$FX)2GgA*ea{o*EbwwXr#pR#iqH@}-$*C0LJl z_sTLW*lhGUca8ThTP){i$uND8J#NL*F0UyIwVL~+r${JxT|~5VR06%x0Q{1z|rM(N7 zbfdRf**G7O)1VyB?isQcAEz|0L3>(~2FuXxWjIn#Q^_6Q!aKN_?WRcLT<7lXm>xTV z4pg>q+S`Y`Xh=Ty!7+-SYFgW7WroiDR?J6+V^&$aV-o72YfjGPjQ0Gfc7kbH4DynWBq(lm#$h;a&(j!&1cc}m z<4(nsOw9>Y?{UkIF_#A_wXUa|63&0nM4axmoM0 zGfrKUcOw$oW@^Tn0o80&7#Cxz*m34ckvvAb=^4EkuI0L z(LG_kgR8o=>lwFb@tPPKzNpYh40=uF5jpc7E)$-EKsJnV3}cf9XvBa11dH6Dee8i_ zk<)-YRv0a*9M3pE)1+|*12zUJJdS>u37i_F7eLE`Th6{I^pOi{^FlF!ine^EG*zN; zWjZ3E=rfQw%I^3c&lUl9BQs`pJhP#6x$wnN<&YJ;EgM_+B(MQ4^Dw9gUfy~+<&i;O z!MnjKIv(IeCgcl5KVJ};kifIPpt5V^P$@G}MQ1AKbD8yUAFrCt3&fNcB<^u5p9u!% z{O>jy%@*a|*bGWF*Ma6W-;L>W3;VXu$g^a|lDG@^)6B{@QB%al(E4H<(S!RR1+N4qHP$79yvfi#Jjy&zdQMCgSYELxYqCZdbP+w4zQb*H7 zcb)_^Rg!1mo9N2$khp5&Yax6)IyGfa!l`DEE>*SNJz;c>iScDZ}Z zKzS&*YTc}`8rKMwV~qPnDA#a$T}Sg$QZ8~kWs^cxCxbqaG5;kaa*o#Ynhob1PjV<3 z39R)}PLk+M@bOeiI@CMoj5B?=algI$r+4D9M}xCm=3YIl2>_az0zpk7-PskubrE!| zg(?+4gK1~aS|jr)@8#tM5k5`MBW5z+S_WHHd<*D>Cf!HxkJsIZg$$_KkO2tMJuX8Ye==7X*>#&~p z3BedU6!!hqhw-UVO*vni=n3fliR)-$B=86=9weRV+|XaWxQBo-_}WT1YLA~`P$b7h zf1XGNfvTg&mnQzxX(jFR{CmD2FgtY!47008k58sQ{^&I#Kk4sV)buchjGmJKdTpcV z(77lI3pVx=#$E`{A)SOl`cDvXI*a<23bUe1}Oy^3o>%_wO - - - + + @@ -32,17 +32,36 @@ + + + + + + + + + + + + + + android:theme="@style/AppTheme.Base" + android:label="@string/app_name" + android:requestLegacyExternalStorage="true" + > + android:windowSoftInputMode="adjustPan" + > @@ -51,12 +70,15 @@ + android:theme="@style/Theme.AppCompat.Light" + > - + @@ -86,6 +108,7 @@ android:multiprocess="true" /> @@ -99,6 +122,7 @@ android:resource="@xml/widget_2x_info" /> @@ -113,7 +137,7 @@ android:resource="@xml/widget_4x_info" /> - + @@ -126,9 +150,8 @@ + android:theme="@android:style/Theme.Black" > - - + + + + Type : INTEGER (long)

*/ public static final String VERSION = "version"; + + public static final String LOCKED = "lock_type"; } public interface DataColumns { @@ -206,35 +214,35 @@ public class Notes { /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for + * Generic data column, the meaning is specific, used for * integer data type *

Type: INTEGER

*/ public static final String DATA1 = "data1"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for + * Generic data column, the meaning is specific, used for * integer data type *

Type: INTEGER

*/ public static final String DATA2 = "data2"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for + * Generic data column, the meaning is specific, used for * TEXT data type *

Type: TEXT

*/ public static final String DATA3 = "data3"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for + * Generic data column, the meaning is specific, used for * TEXT data type *

Type: TEXT

*/ public static final String DATA4 = "data4"; /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for + * Generic data column, the meaning is specific, used for * TEXT data type *

Type: TEXT

*/ diff --git a/Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java similarity index 55% rename from Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java rename to NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java index ffe5d57..7fb3222 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/data/NotesDatabaseHelper.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java @@ -28,7 +28,7 @@ import net.micode.notes.data.Notes.NoteColumns; public class NotesDatabaseHelper extends SQLiteOpenHelper { - private static final String DB_NAME = "note.db"; + private static final String DB_NAME = "note4.db"; private static final int DB_VERSION = 4; @@ -43,168 +43,169 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper { private static NotesDatabaseHelper mInstance; private static final String CREATE_NOTE_TABLE_SQL = - "CREATE TABLE " + TABLE.NOTE + "(" + - NoteColumns.ID + " INTEGER PRIMARY KEY," + - NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + - NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + - NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," + - NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," + - NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," + - NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" + - ")"; + "CREATE TABLE " + TABLE.NOTE + "(" + + NoteColumns.ID + " INTEGER PRIMARY KEY," + + NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + + NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + + NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," + + NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," + + NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.LOCKED + " TEXT NOT NULL DEFAULT '"+Notes.UNLOCKED+"'," + + NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," + + NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" + + ")"; private static final String CREATE_DATA_TABLE_SQL = - "CREATE TABLE " + TABLE.DATA + "(" + - DataColumns.ID + " INTEGER PRIMARY KEY," + - DataColumns.MIME_TYPE + " TEXT NOT NULL," + - DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," + - NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + - NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + - DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," + - DataColumns.DATA1 + " INTEGER," + - DataColumns.DATA2 + " INTEGER," + - DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," + - DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," + - DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" + - ")"; + "CREATE TABLE " + TABLE.DATA + "(" + + DataColumns.ID + " INTEGER PRIMARY KEY," + + DataColumns.MIME_TYPE + " TEXT NOT NULL," + + DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," + + NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + + NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," + + DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," + + DataColumns.DATA1 + " INTEGER," + + DataColumns.DATA2 + " INTEGER," + + DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," + + DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," + + DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" + + ")"; private static final String CREATE_DATA_NOTE_ID_INDEX_SQL = - "CREATE INDEX IF NOT EXISTS note_id_index ON " + - TABLE.DATA + "(" + DataColumns.NOTE_ID + ");"; + "CREATE INDEX IF NOT EXISTS note_id_index ON " + + TABLE.DATA + "(" + DataColumns.NOTE_ID + ");"; /** * Increase folder's note count when move note to the folder */ private static final String NOTE_INCREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER = - "CREATE TRIGGER increase_folder_count_on_update "+ - " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE + - " BEGIN " + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" + - " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" + - " END"; + "CREATE TRIGGER increase_folder_count_on_update "+ + " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE + + " BEGIN " + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" + + " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" + + " END"; /** * Decrease folder's note count when move note from folder */ private static final String NOTE_DECREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER = - "CREATE TRIGGER decrease_folder_count_on_update " + - " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE + - " BEGIN " + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" + - " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID + - " AND " + NoteColumns.NOTES_COUNT + ">0" + ";" + - " END"; + "CREATE TRIGGER decrease_folder_count_on_update " + + " AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE + + " BEGIN " + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" + + " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID + + " AND " + NoteColumns.NOTES_COUNT + ">0" + ";" + + " END"; /** * Increase folder's note count when insert new note to the folder */ private static final String NOTE_INCREASE_FOLDER_COUNT_ON_INSERT_TRIGGER = - "CREATE TRIGGER increase_folder_count_on_insert " + - " AFTER INSERT ON " + TABLE.NOTE + - " BEGIN " + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" + - " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" + - " END"; + "CREATE TRIGGER increase_folder_count_on_insert " + + " AFTER INSERT ON " + TABLE.NOTE + + " BEGIN " + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" + + " WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" + + " END"; /** * Decrease folder's note count when delete note from the folder */ private static final String NOTE_DECREASE_FOLDER_COUNT_ON_DELETE_TRIGGER = - "CREATE TRIGGER decrease_folder_count_on_delete " + - " AFTER DELETE ON " + TABLE.NOTE + - " BEGIN " + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" + - " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID + - " AND " + NoteColumns.NOTES_COUNT + ">0;" + - " END"; + "CREATE TRIGGER decrease_folder_count_on_delete " + + " AFTER DELETE ON " + TABLE.NOTE + + " BEGIN " + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" + + " WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID + + " AND " + NoteColumns.NOTES_COUNT + ">0;" + + " END"; /** * Update note's content when insert data with type {@link DataConstants#NOTE} */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_INSERT_TRIGGER = - "CREATE TRIGGER update_note_content_on_insert " + - " AFTER INSERT ON " + TABLE.DATA + - " WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + - " BEGIN" + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT + - " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" + - " END"; + "CREATE TRIGGER update_note_content_on_insert " + + " AFTER INSERT ON " + TABLE.DATA + + " WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + + " BEGIN" + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT + + " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" + + " END"; /** * Update note's content when data with {@link DataConstants#NOTE} type has changed */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_UPDATE_TRIGGER = - "CREATE TRIGGER update_note_content_on_update " + - " AFTER UPDATE ON " + TABLE.DATA + - " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + - " BEGIN" + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT + - " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" + - " END"; + "CREATE TRIGGER update_note_content_on_update " + + " AFTER UPDATE ON " + TABLE.DATA + + " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + + " BEGIN" + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT + + " WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" + + " END"; /** * Update note's content when data with {@link DataConstants#NOTE} type has deleted */ private static final String DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER = - "CREATE TRIGGER update_note_content_on_delete " + - " AFTER delete ON " + TABLE.DATA + - " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + - " BEGIN" + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.SNIPPET + "=''" + - " WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" + - " END"; + "CREATE TRIGGER update_note_content_on_delete " + + " AFTER delete ON " + TABLE.DATA + + " WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" + + " BEGIN" + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.SNIPPET + "=''" + + " WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" + + " END"; /** * Delete datas belong to note which has been deleted */ private static final String NOTE_DELETE_DATA_ON_DELETE_TRIGGER = - "CREATE TRIGGER delete_data_on_delete " + - " AFTER DELETE ON " + TABLE.NOTE + - " BEGIN" + - " DELETE FROM " + TABLE.DATA + - " WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" + - " END"; + "CREATE TRIGGER delete_data_on_delete " + + " AFTER DELETE ON " + TABLE.NOTE + + " BEGIN" + + " DELETE FROM " + TABLE.DATA + + " WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" + + " END"; /** * Delete notes belong to folder which has been deleted */ private static final String FOLDER_DELETE_NOTES_ON_DELETE_TRIGGER = - "CREATE TRIGGER folder_delete_notes_on_delete " + - " AFTER DELETE ON " + TABLE.NOTE + - " BEGIN" + - " DELETE FROM " + TABLE.NOTE + - " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + - " END"; + "CREATE TRIGGER folder_delete_notes_on_delete " + + " AFTER DELETE ON " + TABLE.NOTE + + " BEGIN" + + " DELETE FROM " + TABLE.NOTE + + " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + + " END"; /** * Move notes belong to folder which has been moved to trash folder */ private static final String FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER = - "CREATE TRIGGER folder_move_notes_on_trash " + - " AFTER UPDATE ON " + TABLE.NOTE + - " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + - " BEGIN" + - " UPDATE " + TABLE.NOTE + - " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + - " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + - " END"; + "CREATE TRIGGER folder_move_notes_on_trash " + + " AFTER UPDATE ON " + TABLE.NOTE + + " WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + + " BEGIN" + + " UPDATE " + TABLE.NOTE + + " SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER + + " WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" + + " END"; public NotesDatabaseHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); diff --git a/Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java similarity index 92% rename from Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java rename to NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java index edb0a60..71a1d47 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/data/NotesProvider.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/data/NotesProvider.java @@ -66,18 +66,18 @@ public class NotesProvider extends ContentProvider { * we will trim '\n' and white space in order to show more information. */ private static final String NOTES_SEARCH_PROJECTION = NoteColumns.ID + "," - + NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + "," - + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + "," - + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + "," - + R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + "," - + "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + "," - + "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA; + + NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + "," + + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + "," + + "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + "," + + R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + "," + + "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + "," + + "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA; private static String NOTES_SNIPPET_SEARCH_QUERY = "SELECT " + NOTES_SEARCH_PROJECTION - + " FROM " + TABLE.NOTE - + " WHERE " + NoteColumns.SNIPPET + " LIKE ?" - + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER - + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE; + + " FROM " + TABLE.NOTE + + " WHERE " + NoteColumns.SNIPPET + " LIKE ?" + + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE; @Override public boolean onCreate() { @@ -87,7 +87,7 @@ public class NotesProvider extends ContentProvider { @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, - String sortOrder) { + String sortOrder) { Cursor c = null; SQLiteDatabase db = mHelper.getReadableDatabase(); String id = null; diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/MetaData.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/MetaData.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/MetaData.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/MetaData.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/Node.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Node.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/Node.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Node.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java similarity index 98% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java index d3ec3be..2bf0273 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlData.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlData.java @@ -167,7 +167,7 @@ public class SqlData { Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, null, null); } else { result = mContentResolver.update(ContentUris.withAppendedId( - Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, + Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, " ? in (SELECT " + NoteColumns.ID + " FROM " + TABLE.NOTE + " WHERE " + NoteColumns.VERSION + "=?)", new String[] { String.valueOf(noteId), String.valueOf(version) diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java similarity index 98% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java index 79a4095..5d46d01 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/SqlNote.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java @@ -171,7 +171,7 @@ public class SqlNote { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, PROJECTION_NOTE, "(_id=?)", new String[] { - String.valueOf(id) + String.valueOf(id) }, null); if (c != null) { c.moveToNext(); @@ -206,7 +206,7 @@ public class SqlNote { try { c = mContentResolver.query(Notes.CONTENT_DATA_URI, SqlData.PROJECTION_DATA, "(note_id=?)", new String[] { - String.valueOf(mId) + String.valueOf(mId) }, null); if (c != null) { if (c.getCount() == 0) { @@ -473,11 +473,11 @@ public class SqlNote { if (!validateVersion) { result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "(" + NoteColumns.ID + "=?)", new String[] { - String.valueOf(mId) + String.valueOf(mId) }); } else { result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "(" - + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)", + + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)", new String[] { String.valueOf(mId), String.valueOf(mVersion) }); diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/Task.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Task.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/Task.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/Task.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/data/TaskList.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/data/TaskList.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/data/TaskList.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/data/TaskList.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/exception/ActionFailureException.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/exception/NetworkFailureException.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java similarity index 96% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..7abccfd 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -59,7 +59,7 @@ public class GTaskASyncTask extends AsyncTask { public void publishProgess(String message) { publishProgress(new String[] { - message + message }); } @@ -77,8 +77,7 @@ public class GTaskASyncTask extends AsyncTask { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, NotesListActivity.class), 0); } - notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, - pendingIntent); +// notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, pendingIntent); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java similarity index 84% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java index c67dfdf..199785f 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskClient.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java @@ -32,33 +32,28 @@ import net.micode.notes.gtask.exception.NetworkFailureException; import net.micode.notes.tool.GTaskStringUtils; import net.micode.notes.ui.NotesPreferenceActivity; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.cookie.Cookie; -import org.apache.http.impl.client.BasicCookieStore; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.message.BasicNameValuePair; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.params.HttpParams; -import org.apache.http.params.HttpProtocolParams; +import org.apache.hc.client5.http.ClientProtocolException; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.client5.http.cookie.BasicCookieStore; +import org.apache.hc.client5.http.cookie.Cookie; +import org.apache.hc.client5.http.cookie.CookieStore; +import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; +import org.apache.hc.client5.http.impl.classic.BasicHttpClientResponseHandler; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.protocol.HttpClientContext; +import org.apache.hc.core5.http.message.BasicNameValuePair; +import org.apache.hc.core5.util.Timeout; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.nio.charset.Charset; import java.util.LinkedList; import java.util.List; -import java.util.zip.GZIPInputStream; -import java.util.zip.Inflater; -import java.util.zip.InflaterInputStream; public class GTaskClient { @@ -72,7 +67,7 @@ public class GTaskClient { private static GTaskClient mInstance = null; - private DefaultHttpClient mHttpClient; + private CloseableHttpClient mHttpClient; private String mGetUrl; @@ -143,8 +138,8 @@ public class GTaskClient { int index = mAccount.name.indexOf('@') + 1; String suffix = mAccount.name.substring(index); url.append(suffix + "/"); - mGetUrl = url.toString() + "ig"; - mPostUrl = url.toString() + "r/ig"; + mGetUrl = url + "ig"; + mPostUrl = url + "r/ig"; if (tryToLoginGtask(activity, authToken)) { mLoggedin = true; @@ -226,25 +221,33 @@ public class GTaskClient { } private boolean loginGtask(String authToken) { + // 连接超时的毫秒数 int timeoutConnection = 10000; - int timeoutSocket = 15000; - HttpParams httpParameters = new BasicHttpParams(); - HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); - HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket); - mHttpClient = new DefaultHttpClient(httpParameters); - BasicCookieStore localBasicCookieStore = new BasicCookieStore(); - mHttpClient.setCookieStore(localBasicCookieStore); - HttpProtocolParams.setUseExpectContinue(mHttpClient.getParams(), false); + // 响应超时的毫秒数 + int timeoutResponse = 15000; + // 实例HttpClient对象 + mHttpClient= HttpClients.createDefault(); + // 设置请求配置 + RequestConfig requestConfig=RequestConfig.custom() + .setConnectionRequestTimeout(Timeout.ofMilliseconds(timeoutConnection)) + .setResponseTimeout(Timeout.ofMilliseconds(timeoutResponse)) + .build(); + // login gtask try { String loginUrl = mGetUrl + "?auth=" + authToken; - HttpGet httpGet = new HttpGet(loginUrl); - HttpResponse response = null; - response = mHttpClient.execute(httpGet); + // 创建Get请求 + HttpGet httpGet=new HttpGet(loginUrl); + httpGet.setConfig(requestConfig); + // 创建Cookie存储器 + CookieStore cookieStore=new BasicCookieStore(); + HttpClientContext httpClientContext=HttpClientContext.create(); + httpClientContext.setCookieStore(cookieStore); + String resString = mHttpClient.execute(httpGet, httpClientContext,new BasicHttpClientResponseHandler()); // get the cookie now - List cookies = mHttpClient.getCookieStore().getCookies(); + List cookies = cookieStore.getCookies(); boolean hasAuthCookie = false; for (Cookie cookie : cookies) { if (cookie.getName().contains("GTL")) { @@ -256,7 +259,6 @@ public class GTaskClient { } // get the client version - String resString = getResponseContent(response.getEntity()); String jsBegin = "_setup("; String jsEnd = ")}"; int begin = resString.indexOf(jsBegin); @@ -291,37 +293,6 @@ public class GTaskClient { return httpPost; } - private String getResponseContent(HttpEntity entity) throws IOException { - String contentEncoding = null; - if (entity.getContentEncoding() != null) { - contentEncoding = entity.getContentEncoding().getValue(); - Log.d(TAG, "encoding: " + contentEncoding); - } - - InputStream input = entity.getContent(); - if (contentEncoding != null && contentEncoding.equalsIgnoreCase("gzip")) { - input = new GZIPInputStream(entity.getContent()); - } else if (contentEncoding != null && contentEncoding.equalsIgnoreCase("deflate")) { - Inflater inflater = new Inflater(true); - input = new InflaterInputStream(entity.getContent(), inflater); - } - - try { - InputStreamReader isr = new InputStreamReader(input); - BufferedReader br = new BufferedReader(isr); - StringBuilder sb = new StringBuilder(); - - while (true) { - String buff = br.readLine(); - if (buff == null) { - return sb.toString(); - } - sb = sb.append(buff); - } - } finally { - input.close(); - } - } private JSONObject postRequest(JSONObject js) throws NetworkFailureException { if (!mLoggedin) { @@ -331,14 +302,13 @@ public class GTaskClient { HttpPost httpPost = createHttpPost(); try { - LinkedList list = new LinkedList(); + LinkedList list = new LinkedList<>(); list.add(new BasicNameValuePair("r", js.toString())); - UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, "UTF-8"); + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, Charset.forName("utf8")); httpPost.setEntity(entity); // execute the post - HttpResponse response = mHttpClient.execute(httpPost); - String jsString = getResponseContent(response.getEntity()); + String jsString = mHttpClient.execute(httpPost,new BasicHttpClientResponseHandler()); return new JSONObject(jsString); } catch (ClientProtocolException e) { @@ -517,11 +487,9 @@ public class GTaskClient { try { HttpGet httpGet = new HttpGet(mGetUrl); - HttpResponse response = null; - response = mHttpClient.execute(httpGet); // get the task list - String resString = getResponseContent(response.getEntity()); + String resString = mHttpClient.execute(httpGet,new BasicHttpClientResponseHandler()); String jsBegin = "_setup("; String jsEnd = ")}"; int begin = resString.indexOf(jsBegin); diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java similarity index 99% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java index d2b4082..73c80f0 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskManager.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java @@ -219,7 +219,7 @@ public class GTaskManager { if (name.startsWith(GTaskStringUtils.MIUI_FOLDER_PREFFIX) && !name.equals(GTaskStringUtils.MIUI_FOLDER_PREFFIX - + GTaskStringUtils.FOLDER_META)) { + + GTaskStringUtils.FOLDER_META)) { TaskList tasklist = new TaskList(); tasklist.setContentByRemoteJSON(object); mGTaskListHashMap.put(gid, tasklist); @@ -394,7 +394,7 @@ public class GTaskManager { try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, SqlNote.PROJECTION_NOTE, "(_id=?)", new String[] { - String.valueOf(Notes.ID_CALL_RECORD_FOLDER) + String.valueOf(Notes.ID_CALL_RECORD_FOLDER) }, null); if (c != null) { if (c.moveToNext()) { diff --git a/Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java b/NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/gtask/remote/GTaskSyncService.java rename to NotesMaster/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/model/Note.java b/NotesMaster/app/src/main/java/net/micode/notes/model/Note.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/model/Note.java rename to NotesMaster/app/src/main/java/net/micode/notes/model/Note.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java b/NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java similarity index 90% rename from Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java rename to NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java index be081e4..3560ace 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/model/WorkingNote.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/model/WorkingNote.java @@ -38,7 +38,7 @@ public class WorkingNote { // Note Id private long mNoteId; // Note content - private String mContent; + public String mContent; // Note mode private int mMode; @@ -60,6 +60,8 @@ public class WorkingNote { private boolean mIsDeleted; + private boolean mIsLocked; + private NoteSettingChangedListener mNoteSettingStatusListener; public static final String[] DATA_PROJECTION = new String[] { @@ -78,7 +80,8 @@ public class WorkingNote { NoteColumns.BG_COLOR_ID, NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, - NoteColumns.MODIFIED_DATE + NoteColumns.MODIFIED_DATE, + NoteColumns.LOCKED, }; private static final int DATA_ID_COLUMN = 0; @@ -101,6 +104,11 @@ public class WorkingNote { private static final int NOTE_MODIFIED_DATE_COLUMN = 5; + private static final int NOTE_LOCKED_COLUMN = 6; + + private static final String LOCKED = "locked"; + private static final String UNLOCKED = "unlocked"; + // New note construct private WorkingNote(Context context, long folderId) { mContext = context; @@ -137,6 +145,8 @@ public class WorkingNote { mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN); mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN); mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN); + + mIsLocked = !cursor.getString(NOTE_LOCKED_COLUMN).equals(UNLOCKED); } cursor.close(); } else { @@ -149,7 +159,7 @@ public class WorkingNote { private void loadNoteData() { Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { - String.valueOf(mNoteId) + String.valueOf(mNoteId) }, null); if (cursor != null) { @@ -175,7 +185,7 @@ public class WorkingNote { } public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId, - int widgetType, int defaultBgColorId) { + int widgetType, int defaultBgColorId) { WorkingNote note = new WorkingNote(context, folderId); note.setBgColorId(defaultBgColorId); note.setWidgetId(widgetId); @@ -217,12 +227,8 @@ public class WorkingNote { } private boolean isWorthSaving() { - if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent)) - || (existInDatabase() && !mNote.isLocalModified())) { - return false; - } else { - return true; - } + return !mIsDeleted && (existInDatabase() || !TextUtils.isEmpty(mContent)) + && (!existInDatabase() || mNote.isLocalModified()); } public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) { @@ -243,7 +249,7 @@ public class WorkingNote { mIsDeleted = mark; if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID && mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) { - mNoteSettingStatusListener.onWidgetChanged(); + mNoteSettingStatusListener.onWidgetChanged(); } } @@ -257,6 +263,17 @@ public class WorkingNote { } } + public void setLock(boolean lock) { + if (lock != mIsLocked) { + mIsLocked = lock; + if(lock){ + mNote.setNoteValue(NoteColumns.LOCKED, LOCKED); + }else { + mNote.setNoteValue(NoteColumns.LOCKED, UNLOCKED); + } + } + } + public void setCheckListMode(int mode) { if (mMode != mode) { if (mNoteSettingStatusListener != null) { @@ -295,7 +312,7 @@ public class WorkingNote { } public boolean hasClockAlert() { - return (mAlertDate > 0 ? true : false); + return mAlertDate > 0; } public String getContent() { @@ -342,6 +359,14 @@ public class WorkingNote { return mWidgetType; } + public boolean getIsLocked(){ + return mIsLocked; + } + + public void setIsLocked(boolean locked){ + mIsLocked = locked; + } + public interface NoteSettingChangedListener { /** * Called when the background color of current note has just changed @@ -365,4 +390,5 @@ public class WorkingNote { */ void onCheckListModeChanged(int oldMode, int newMode); } + } diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java similarity index 99% rename from Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java rename to NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java index 39f6ec4..c26472a 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/tool/BackupUtils.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/BackupUtils.java @@ -143,7 +143,7 @@ public class BackupUtils { // Query notes belong to this folder Cursor notesCursor = mContext.getContentResolver().query(Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, NoteColumns.PARENT_ID + "=?", new String[] { - folderId + folderId }, null); if (notesCursor != null) { @@ -168,7 +168,7 @@ public class BackupUtils { private void exportNoteToText(String noteId, PrintStream ps) { Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { - noteId + noteId }, null); if (dataCursor != null) { diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java similarity index 75% rename from Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java rename to NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java index 2a14982..81b6bcc 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/tool/DataUtils.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/DataUtils.java @@ -64,9 +64,7 @@ public class DataUtils { return false; } return true; - } catch (RemoteException e) { - Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); - } catch (OperationApplicationException e) { + } catch (RemoteException | OperationApplicationException e) { Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); } return false; @@ -81,7 +79,7 @@ public class DataUtils { } public static boolean batchMoveToFolder(ContentResolver resolver, HashSet ids, - long folderId) { + long folderId) { if (ids == null) { Log.d(TAG, "the ids is null"); return true; @@ -184,8 +182,8 @@ public class DataUtils { public static boolean checkVisibleFolderName(ContentResolver resolver, String name) { Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + - " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + - " AND " + NoteColumns.SNIPPET + "=?", + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.SNIPPET + "=?", new String[] { name }, null); boolean exist = false; if(cursor != null) { @@ -197,6 +195,22 @@ public class DataUtils { return exist; } + public static boolean checkFolderId(ContentResolver resolver, long id) { + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, + NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.ID + "=?", + new String[] { String.valueOf(id) }, null); + boolean exist = false; + if(cursor != null) { + if(cursor.getCount() > 0) { + exist = true; + } + cursor.close(); + } + return exist; + } + public static HashSet getFolderNoteWidget(ContentResolver resolver, long folderId) { Cursor c = resolver.query(Notes.CONTENT_NOTE_URI, new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE }, @@ -247,7 +261,7 @@ public class DataUtils { Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, new String [] { CallNote.NOTE_ID }, CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL(" - + CallNote.PHONE_NUMBER + ",?)", + + CallNote.PHONE_NUMBER + ",?)", new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber }, null); @@ -282,6 +296,73 @@ public class DataUtils { throw new IllegalArgumentException("Note is not found with id: " + noteId); } + public static long getTrashIdByName(ContentResolver resolver, String name) { + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, + new String [] { NoteColumns.ID }, + NoteColumns.SNIPPET + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER, + new String [] { name }, + null); + if (cursor != null) { + long id = 0; + if (cursor.moveToFirst()) { + id = cursor.getLong(0); + } + cursor.close(); + return id; + } + throw new IllegalArgumentException("getTrashIdByName is not found"); + } + + public static long getParentIdbyId(ContentResolver resolver,long id){ + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, + new String [] { NoteColumns.PARENT_ID }, + NoteColumns.ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER, + new String [] { String.valueOf(id) }, + null); + if (cursor != null) { + long pid = 0; + if (cursor.moveToFirst()) { + pid = cursor.getLong(0); + } + cursor.close(); + return pid; + } + throw new IllegalArgumentException("getParentIdbyId is not found"); + } + + public static HashSet getHasLockedByFolderId(ContentResolver resolver,long fid){ + HashSet sset = new HashSet<>(); + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, + new String [] { NoteColumns.LOCKED }, + NoteColumns.PARENT_ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_NOTE, + new String [] { String.valueOf(fid) }, + null); + if (cursor != null) { + if (cursor.moveToFirst()) { + do{ + sset.add(cursor.getString(0)); + } while (cursor.moveToNext()); + } + cursor.close(); + } + + Cursor cursor2 = resolver.query(Notes.CONTENT_NOTE_URI, + new String [] { NoteColumns.ID }, + NoteColumns.PARENT_ID + "=? AND "+NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER, + new String [] { String.valueOf(fid) }, + null); + if (cursor2 != null) { + if(cursor2.moveToFirst()){ + do{ + HashSet tmp = getHasLockedByFolderId(resolver,cursor2.getLong(0)); + sset.addAll(tmp); + } while (cursor2.moveToNext()); + } + cursor2.close(); + } + return sset; + } + public static String getFormattedSnippet(String snippet) { if (snippet != null) { snippet = snippet.trim(); diff --git a/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java new file mode 100644 index 0000000..1429829 --- /dev/null +++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/FingerprintDialogFragment.java @@ -0,0 +1,135 @@ +package net.micode.notes.tool; + +import android.annotation.TargetApi; +import android.app.DialogFragment; +import android.content.Context; +import android.hardware.fingerprint.FingerprintManager; +import android.os.Bundle; +import android.os.CancellationSignal; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.Nullable; + +import net.micode.notes.R; +import net.micode.notes.ui.NotesListActivity; + +import javax.crypto.Cipher; + +@TargetApi(23) +public class FingerprintDialogFragment extends DialogFragment { + + private FingerprintManager fingerprintManager; + + private CancellationSignal mCancellationSignal; + + private Cipher mCipher; + + private NotesListActivity mActivity; + + private TextView errorMsg; + + /** + * 标识是否是用户主动取消的认证。 + */ + private boolean isSelfCancelled; + + public void setCipher(Cipher cipher) { + mCipher = cipher; + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + mActivity = (NotesListActivity) getActivity(); + } + + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + fingerprintManager = getContext().getSystemService(FingerprintManager.class); + setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Material_Light_Dialog); + } + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { + View v = inflater.inflate(R.layout.fingerprint_dialog, container, false); + errorMsg = v.findViewById(R.id.error_msg); + TextView cancel = v.findViewById(R.id.cancel); + cancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dismiss(); + stopListening(); + } + }); + return v; + } + + @Override + public void onResume() { + super.onResume(); + // 开始指纹认证监听 + startListening(mCipher); + } + + @Override + public void onPause() { + super.onPause(); + // 停止指纹认证监听 + stopListening(); + } + + //监听认证成功与失败 + private void startListening(Cipher cipher) { + isSelfCancelled = false; + mCancellationSignal = new CancellationSignal(); + fingerprintManager.authenticate(new FingerprintManager.CryptoObject(cipher), mCancellationSignal, 0, new FingerprintManager.AuthenticationCallback() { + @Override + public void onAuthenticationError(int errorCode, CharSequence errString) { + if (!isSelfCancelled) { + errorMsg.setText(errString); + if (errorCode == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT) { + Toast.makeText(mActivity, errString, Toast.LENGTH_SHORT).show(); + dismiss(); + } + } + mActivity.onStopAuthenticated(); + } + + @Override + public void onAuthenticationHelp(int helpCode, CharSequence helpString) { + errorMsg.setText(helpString); + } + + @Override + public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { + Toast.makeText(mActivity, "指纹认证成功", Toast.LENGTH_SHORT).show(); + mActivity.onAuthenticated(); + dismiss(); +// mActivity.onAuthenticated();//认证成功后就可以写成功后的代码逻辑 + } + + @Override + public void onAuthenticationFailed() { + errorMsg.setText("指纹认证失败,请再试一次"); + } + }, null); + } + + private void stopListening() { + if (mCancellationSignal != null) { + mCancellationSignal.cancel(); + mCancellationSignal = null; + isSelfCancelled = true; + } + mActivity.onStopAuthenticated(); + } + +} diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/tool/GTaskStringUtils.java rename to NotesMaster/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java b/NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java similarity index 66% rename from Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java rename to NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java index 1ad3ad6..2d574c3 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/tool/ResourceParser.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/tool/ResourceParser.java @@ -30,7 +30,7 @@ public class ResourceParser { public static final int GREEN = 3; public static final int RED = 4; - public static final int BG_DEFAULT_COLOR = YELLOW; + public static final int BG_DEFAULT_COLOR = WHITE; public static final int TEXT_SMALL = 0; public static final int TEXT_MEDIUM = 1; @@ -41,19 +41,19 @@ public class ResourceParser { public static class NoteBgResources { private final static int [] BG_EDIT_RESOURCES = new int [] { - R.drawable.edit_yellow, - R.drawable.edit_blue, - R.drawable.edit_white, - R.drawable.edit_green, - R.drawable.edit_red + R.drawable.edit_yellow, + R.drawable.edit_blue, + R.drawable.edit_white, + R.drawable.edit_green, + R.drawable.edit_red }; private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] { - R.drawable.edit_title_yellow, - R.drawable.edit_title_blue, - R.drawable.edit_title_white, - R.drawable.edit_title_green, - R.drawable.edit_title_red + R.drawable.edit_title_yellow, + R.drawable.edit_title_blue, + R.drawable.edit_title_white, + R.drawable.edit_title_green, + R.drawable.edit_title_red }; public static int getNoteBgResource(int id) { @@ -76,35 +76,35 @@ public class ResourceParser { public static class NoteItemBgResources { private final static int [] BG_FIRST_RESOURCES = new int [] { - R.drawable.list_yellow_up, - R.drawable.list_blue_up, - R.drawable.list_white_up, - R.drawable.list_green_up, - R.drawable.list_red_up + R.drawable.list_yellow_up, + R.drawable.list_blue_up, + R.drawable.list_white_up, + R.drawable.list_green_up, + R.drawable.list_red_up }; private final static int [] BG_NORMAL_RESOURCES = new int [] { - R.drawable.list_yellow_middle, - R.drawable.list_blue_middle, - R.drawable.list_white_middle, - R.drawable.list_green_middle, - R.drawable.list_red_middle + R.drawable.list_yellow_middle, + R.drawable.list_blue_middle, + R.drawable.list_white_middle, + R.drawable.list_green_middle, + R.drawable.list_red_middle }; private final static int [] BG_LAST_RESOURCES = new int [] { - R.drawable.list_yellow_down, - R.drawable.list_blue_down, - R.drawable.list_white_down, - R.drawable.list_green_down, - R.drawable.list_red_down, + R.drawable.list_yellow_down, + R.drawable.list_blue_down, + R.drawable.list_white_down, + R.drawable.list_green_down, + R.drawable.list_red_down, }; private final static int [] BG_SINGLE_RESOURCES = new int [] { - R.drawable.list_yellow_single, - R.drawable.list_blue_single, - R.drawable.list_white_single, - R.drawable.list_green_single, - R.drawable.list_red_single + R.drawable.list_yellow_single, + R.drawable.list_blue_single, + R.drawable.list_white_single, + R.drawable.list_green_single, + R.drawable.list_red_single }; public static int getNoteBgFirstRes(int id) { @@ -125,41 +125,42 @@ public class ResourceParser { public static int getFolderBgRes() { return R.drawable.list_folder; +// return R.drawable.listtest; } } public static class WidgetBgResources { private final static int [] BG_2X_RESOURCES = new int [] { - R.drawable.widget_2x_yellow, - R.drawable.widget_2x_blue, - R.drawable.widget_2x_white, - R.drawable.widget_2x_green, - R.drawable.widget_2x_red, + R.drawable.widget_2x_yellow, + R.drawable.widget_2x_blue, + R.drawable.widget_2x_white, + R.drawable.widget_2x_green, + R.drawable.widget_2x_red, }; public static int getWidget2xBgResource(int id) { - return BG_2X_RESOURCES[id]; + return BG_2X_RESOURCES[2]; } private final static int [] BG_4X_RESOURCES = new int [] { - R.drawable.widget_4x_yellow, - R.drawable.widget_4x_blue, - R.drawable.widget_4x_white, - R.drawable.widget_4x_green, - R.drawable.widget_4x_red + R.drawable.widget_4x_yellow, + R.drawable.widget_4x_blue, + R.drawable.widget_4x_white, + R.drawable.widget_4x_green, + R.drawable.widget_4x_red }; public static int getWidget4xBgResource(int id) { - return BG_4X_RESOURCES[id]; + return BG_4X_RESOURCES[2]; } } public static class TextAppearanceResources { private final static int [] TEXTAPPEARANCE_RESOURCES = new int [] { - R.style.TextAppearanceNormal, - R.style.TextAppearanceMedium, - R.style.TextAppearanceLarge, - R.style.TextAppearanceSuper + R.style.TextAppearanceNormal, + R.style.TextAppearanceMedium, + R.style.TextAppearanceLarge, + R.style.TextAppearanceSuper }; public static int getTexAppearanceResource(int id) { diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java similarity index 61% rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java index 85723be..b71e250 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmAlertActivity.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java @@ -41,56 +41,75 @@ import java.io.IOException; public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener { - private long mNoteId; - private String mSnippet; + private long mNoteId;//文本在数据库存储中的ID号 + private String mSnippet;//闹钟提示时出现的文本片段 private static final int SNIPPET_PREW_MAX_LEN = 60; MediaPlayer mPlayer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + //Bundle类型的数据与Map类型的数据相似,都是以key-value的形式存储数据的 + //onsaveInstanceState方法是用来保存Activity的状态的 + //能从onCreate的参数savedInsanceState中获得状态数据 requestWindowFeature(Window.FEATURE_NO_TITLE); - + //界面显示——无标题 final Window win = getWindow(); win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); if (!isScreenOn()) { win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + //保持窗体点亮 | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON + //将窗体点亮 | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + //允许窗体点亮时锁屏 | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); + //在手机锁屏后如果到了闹钟提示时间,点亮屏幕 } Intent intent = getIntent(); try { - mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1)); + mNoteId = Long.parseLong(intent.getData().getPathSegments().get(1)); mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId); + //根据ID从数据库中获取标签的内容; + //getContentResolver()是实现数据共享,实例存储。 mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) : mSnippet; + //判断标签片段是否达到符合长度 } catch (IllegalArgumentException e) { e.printStackTrace(); return; } - + /*try + { + //代码区 + } + catch(Exception e){ + //异常处理 + } + 代码区如果有错误,就会返回所写异常的处理。*/ mPlayer = new MediaPlayer(); if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { - showActionDialog(); - playAlarmSound(); + showActionDialog();//弹出对话框 + playAlarmSound();//闹钟提示音激发 } else { - finish(); + finish();//完成闹钟动作 } } private boolean isScreenOn() { + //判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型 PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); return pm.isScreenOn(); } private void playAlarmSound() { + //闹钟提示音激发 Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM); - + //调用系统的铃声管理URI,得到闹钟提示音 int silentModeStreams = Settings.System.getInt(getContentResolver(), Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); @@ -101,12 +120,19 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD } try { mPlayer.setDataSource(this, url); + //方法:setDataSource(Context context, Uri uri) + //解释:无返回值,设置多媒体数据来源【根据 Uri】 mPlayer.prepare(); + //准备同步 mPlayer.setLooping(true); + //设置是否循环播放 mPlayer.start(); + //开始播放 } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); + //e.printStackTrace()函数功能是抛出异常, 还将显示出更深的调用信息; + //System.out.println(e),这个方法打印出异常,并且输出在哪里出现的异常; } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -121,37 +147,48 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD private void showActionDialog() { AlertDialog.Builder dialog = new AlertDialog.Builder(this); - dialog.setTitle(R.string.app_name); - dialog.setMessage(mSnippet); - dialog.setPositiveButton(R.string.notealert_ok, this); + //AlertDialog的构造方法全部是Protected的; + //所以不能直接通过new一个AlertDialog来创建出一个AlertDialog; + //要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法; + //如这里的dialog就是新建了一个AlertDialog; + dialog.setTitle(R.string.app_name);//为对话框设置标题 + dialog.setMessage(mSnippet);//为对话框设置内容 + dialog.setPositiveButton(R.string.notealert_ok, this);//给对话框添加"Yes"按钮 if (isScreenOn()) { dialog.setNegativeButton(R.string.notealert_enter, this); - } + }//对话框添加"No"按钮; dialog.show().setOnDismissListener(this); } public void onClick(DialogInterface dialog, int which) { - switch (which) { + switch (which) {//用which来选择click后下一步的操作 case DialogInterface.BUTTON_NEGATIVE: + //这是取消操作; Intent intent = new Intent(this, NoteEditActivity.class); + //实现两个类间的数据传输; intent.setAction(Intent.ACTION_VIEW); + //设置动作属性; intent.putExtra(Intent.EXTRA_UID, mNoteId); + //实现key-value对; + //EXTRA_UID为key;mNoteId为键; startActivity(intent); + //开始动作; break; default: + //这是确定操作; break; } } - public void onDismiss(DialogInterface dialog) { - stopAlarmSound(); - finish(); + public void onDismiss(DialogInterface dialog) {//忽略 + stopAlarmSound();//停止闹钟声音 + finish();//完成该动作 } private void stopAlarmSound() { if (mPlayer != null) { - mPlayer.stop(); - mPlayer.release(); + mPlayer.stop();//停止播放 + mPlayer.release();//释放MediaPlayer对象 mPlayer = null; } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java similarity index 69% rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java index f221202..bec850f 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmInitReceiver.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmInitReceiver.java @@ -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.app.AlarmManager; @@ -31,21 +15,25 @@ import net.micode.notes.data.Notes.NoteColumns; public class AlarmInitReceiver extends BroadcastReceiver { private static final String [] PROJECTION = new String [] { - NoteColumns.ID, - NoteColumns.ALERTED_DATE + NoteColumns.ID, + NoteColumns.ALERTED_DATE }; - + //对数据库的操作,调用标签ID和闹钟时间; private static final int COLUMN_ID = 0; private static final int COLUMN_ALERTED_DATE = 1; @Override public void onReceive(Context context, Intent intent) { long currentDate = System.currentTimeMillis(); + //System.currentTimeMillis()产生一个当前的毫秒; + //这个毫秒其实就是自1970年1月1日0时起的毫秒数; Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI, PROJECTION, NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE, new String[] { String.valueOf(currentDate) }, + //将long变量currentDate转化为字符串; null); + //Cursor在这里的作用是通过查找数据库中的标签内容,找到和当前系统时间相等的标签; if (c != null) { if (c.moveToFirst()) { @@ -53,7 +41,8 @@ public class AlarmInitReceiver extends BroadcastReceiver { long alertDate = c.getLong(COLUMN_ALERTED_DATE); Intent sender = new Intent(context, AlarmReceiver.class); sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID))); - PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0); + + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, PendingIntent.FLAG_IMMUTABLE); AlarmManager alermManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); alermManager.set(AlarmManager.RTC_WAKEUP, alertDate, pendingIntent); @@ -61,5 +50,8 @@ public class AlarmInitReceiver extends BroadcastReceiver { } c.close(); } + //然而通过网上查找资料发现,对于闹钟机制的启动,通常需要上面的几个步骤; + //如新建Intent、PendingIntent以及AlarmManager等; + //这里就是根据数据库里的闹钟时间创建一个闹钟机制; } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java similarity index 83% rename from Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java index 54e503b..cacce64 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/AlarmReceiver.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/AlarmReceiver.java @@ -24,7 +24,10 @@ public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { intent.setClass(context, AlarmAlertActivity.class); + //启动AlarmAlertActivity intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + //activity要存在于activity的栈中,而非activity的途径启动activity时必然不存在一个activity的栈 + //所以要新起一个栈装入启动的activity context.startActivity(intent); } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java similarity index 86% rename from Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java index 496b0cd..02227df 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePicker.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePicker.java @@ -30,8 +30,10 @@ import android.widget.NumberPicker; public class DateTimePicker extends FrameLayout { + //所有的子元素全部在屏幕的右上方 private static final boolean DEFAULT_ENABLE_STATE = true; + //初始化控件 private static final int HOURS_IN_HALF_DAY = 12; private static final int HOURS_IN_ALL_DAY = 24; private static final int DAYS_IN_ALL_WEEK = 7; @@ -46,10 +48,14 @@ public class DateTimePicker extends FrameLayout { private static final int AMPM_SPINNER_MIN_VAL = 0; private static final int AMPM_SPINNER_MAX_VAL = 1; + //NumberPicker是数字选择器 + //这里定义的四个变量全部是在设置闹钟时需要选择的变量(如日期、时、分、上午或者下午) private final NumberPicker mDateSpinner; private final NumberPicker mHourSpinner; private final NumberPicker mMinuteSpinner; private final NumberPicker mAmPmSpinner; + + //定义了Calendar类型的变量mDate,用于操作时间 private Calendar mDate; private String[] mDateDisplayValues = new String[DAYS_IN_ALL_WEEK]; @@ -66,46 +72,54 @@ public class DateTimePicker extends FrameLayout { private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() { @Override + //OnValueChangeListener,这是时间改变监听器,这里主要是对日期的监听 public void onValueChange(NumberPicker picker, int oldVal, int newVal) { mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal); + //将现在日期的值传递给mDate;updateDateControl是同步操作 updateDateControl(); onDateTimeChanged(); } }; + private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() { + //这里是对 小时(Hour) 的监听 @Override public void onValueChange(NumberPicker picker, int oldVal, int newVal) { boolean isDateChanged = false; - Calendar cal = Calendar.getInstance(); + Calendar cal = Calendar.getInstance(); //声明一个Calendar的变量cal,便于后续的操作 if (!mIs24HourView) { if (!mIsAm && oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY) { cal.setTimeInMillis(mDate.getTimeInMillis()); cal.add(Calendar.DAY_OF_YEAR, 1); isDateChanged = true; + //这里是对于12小时制时,晚上11点和12点交替时对日期的更改 } else if (mIsAm && oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) { cal.setTimeInMillis(mDate.getTimeInMillis()); cal.add(Calendar.DAY_OF_YEAR, -1); isDateChanged = true; } + //这里是对于12小时制时,晚上11点和12点交替时对日期的更改 if (oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY || oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) { mIsAm = !mIsAm; updateAmPmControl(); - } + }//这里是对于12小时制时,中午11点和12点交替时对AM和PM的更改 } else { if (oldVal == HOURS_IN_ALL_DAY - 1 && newVal == 0) { cal.setTimeInMillis(mDate.getTimeInMillis()); cal.add(Calendar.DAY_OF_YEAR, 1); isDateChanged = true; + //这里是对于24小时制时,晚上11点和12点交替时对日期的更改 } else if (oldVal == 0 && newVal == HOURS_IN_ALL_DAY - 1) { cal.setTimeInMillis(mDate.getTimeInMillis()); cal.add(Calendar.DAY_OF_YEAR, -1); isDateChanged = true; } - } - int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY); + } //这里是对于24小时制时,晚上11点和12点交替时对日期的更改 + int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY); //通过数字选择器对newHour的赋值 mDate.set(Calendar.HOUR_OF_DAY, newHour); + //通过数字选择器对newHour的赋值 onDateTimeChanged(); if (isDateChanged) { setCurrentYear(cal.get(Calendar.YEAR)); @@ -117,15 +131,19 @@ public class DateTimePicker extends FrameLayout { private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() { @Override + //这里是对 分钟(Minute)改变的监听 public void onValueChange(NumberPicker picker, int oldVal, int newVal) { int minValue = mMinuteSpinner.getMinValue(); int maxValue = mMinuteSpinner.getMaxValue(); int offset = 0; + //这里是对 分钟(Minute)改变的监听 if (oldVal == maxValue && newVal == minValue) { offset += 1; } else if (oldVal == minValue && newVal == maxValue) { offset -= 1; } + //如果原值为59,新值为0,则offset加1 + //如果原值为0,新值为59,则offset减1 if (offset != 0) { mDate.add(Calendar.HOUR_OF_DAY, offset); mHourSpinner.setValue(getCurrentHour()); @@ -146,6 +164,7 @@ public class DateTimePicker extends FrameLayout { private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() { @Override + //对AM和PM的监听 public void onValueChange(NumberPicker picker, int oldVal, int newVal) { mIsAm = !mIsAm; if (mIsAm) { @@ -160,24 +179,26 @@ public class DateTimePicker extends FrameLayout { public interface OnDateTimeChangedListener { void onDateTimeChanged(DateTimePicker view, int year, int month, - int dayOfMonth, int hourOfDay, int minute); + int dayOfMonth, int hourOfDay, int minute); } public DateTimePicker(Context context) { this(context, System.currentTimeMillis()); } - + //通过对数据库的访问,获取当前的系统时间 public DateTimePicker(Context context, long date) { this(context, date, DateFormat.is24HourFormat(context)); - } + }//上面函数的得到的是一个天文数字(1970至今的秒数),需要DateFormat将其变得有意义 public DateTimePicker(Context context, long date, boolean is24HourView) { - super(context); + super(context); //获取系统时间 mDate = Calendar.getInstance(); mInitialising = true; mIsAm = getCurrentHourOfDay() >= HOURS_IN_HALF_DAY; inflate(context, R.layout.datetime_picker, this); - + //如果当前Activity里用到别的layout,比如对话框layout + //还要设置这个layout上的其他组件的内容,就必须用inflate()方法先将对话框的layout找出来 + //然后再用findViewById()找到它上面的其它组件 mDateSpinner = (NumberPicker) findViewById(R.id.date); mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL); mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL); @@ -237,9 +258,10 @@ public class DateTimePicker extends FrameLayout { * * @return the current date in millis */ + public long getCurrentDateInTimeMillis() { return mDate.getTimeInMillis(); - } + }//实现函数——得到当前的秒数 /** * Set the current date @@ -251,7 +273,7 @@ public class DateTimePicker extends FrameLayout { cal.setTimeInMillis(date); setCurrentDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)); - } + }//实现函数功能——设置当前的时间,参数是date /** * Set the current date @@ -263,13 +285,13 @@ public class DateTimePicker extends FrameLayout { * @param minute The current minute */ public void setCurrentDate(int year, int month, - int dayOfMonth, int hourOfDay, int minute) { + int dayOfMonth, int hourOfDay, int minute) { setCurrentYear(year); setCurrentMonth(month); setCurrentDay(dayOfMonth); setCurrentHour(hourOfDay); setCurrentMinute(minute); - } + }//实现函数功能——设置当前的时间,参数是各详细的变量 /** * Get current year @@ -446,7 +468,7 @@ public class DateTimePicker extends FrameLayout { mDateSpinner.setDisplayedValues(mDateDisplayValues); mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2); mDateSpinner.invalidate(); - } + }// 对于星期几的算法 private void updateAmPmControl() { if (mIs24HourView) { @@ -456,7 +478,7 @@ public class DateTimePicker extends FrameLayout { mAmPmSpinner.setValue(index); mAmPmSpinner.setVisibility(View.VISIBLE); } - } + }// 对于星期几的算法 private void updateHourControl() { if (mIs24HourView) { @@ -466,7 +488,7 @@ public class DateTimePicker extends FrameLayout { mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW); mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW); } - } + }// 对于星期几的算法 /** * Set the callback that indicates the 'Set' button has been pressed. diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java similarity index 69% rename from Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java index 2c47ba4..cf41fd5 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/DateTimePickerDialog.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java @@ -31,10 +31,13 @@ import android.text.format.DateUtils; public class DateTimePickerDialog extends AlertDialog implements OnClickListener { - private Calendar mDate = Calendar.getInstance(); + private Calendar mDate = Calendar.getInstance(); //创建一个Calendar类型的变量 mDate,方便时间的操作 + private boolean mIs24HourView; - private OnDateTimeSetListener mOnDateTimeSetListener; + private OnDateTimeSetListener mOnDateTimeSetListener; //声明一个时间日期滚动选择控件 mOnDateTimeSetListener private DateTimePicker mDateTimePicker; + //DateTimePicker控件,控件一般用于让用户可以从日期列表中选择单个值。 + //运行时,单击控件边上的下拉箭头,会显示为两个部分:一个下拉列表,一个用于选择日期的 public interface OnDateTimeSetListener { void OnDateTimeSet(AlertDialog dialog, long date); @@ -42,25 +45,29 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener public DateTimePickerDialog(Context context, long date) { super(context); + //对该界面对话框的实例化 mDateTimePicker = new DateTimePicker(context); + //对该界面对话框的实例化 setView(mDateTimePicker); + //添加一个子视图 mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() { public void onDateTimeChanged(DateTimePicker view, int year, int month, - int dayOfMonth, int hourOfDay, int minute) { + int dayOfMonth, int hourOfDay, int minute) { mDate.set(Calendar.YEAR, year); mDate.set(Calendar.MONTH, month); mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth); mDate.set(Calendar.HOUR_OF_DAY, hourOfDay); mDate.set(Calendar.MINUTE, minute); + //将视图中的各选项设置为系统当前时间 updateTitle(mDate.getTimeInMillis()); } }); - mDate.setTimeInMillis(date); - mDate.set(Calendar.SECOND, 0); + mDate.setTimeInMillis(date); //得到系统时间 + mDate.set(Calendar.SECOND, 0);//将秒数设置为0 mDateTimePicker.setCurrentDate(mDate.getTimeInMillis()); setButton(context.getString(R.string.datetime_dialog_ok), this); - setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null); - set24HourView(DateFormat.is24HourFormat(this.getContext())); + setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null); //设置按钮 + set24HourView(DateFormat.is24HourFormat(this.getContext())); //时间标准化打印 updateTitle(mDate.getTimeInMillis()); } @@ -70,21 +77,20 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) { mOnDateTimeSetListener = callBack; - } + } //时间标准化打印 private void updateTitle(long date) { int flag = - DateUtils.FORMAT_SHOW_YEAR | - DateUtils.FORMAT_SHOW_DATE | - DateUtils.FORMAT_SHOW_TIME; + DateUtils.FORMAT_SHOW_YEAR | + DateUtils.FORMAT_SHOW_DATE | + DateUtils.FORMAT_SHOW_TIME; flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR; setTitle(DateUtils.formatDateTime(this.getContext(), date, flag)); - } + } //android开发中常见日期管理工具类(API)——DateUtils:按照上下午显示时间 public void onClick(DialogInterface arg0, int arg1) { if (mOnDateTimeSetListener != null) { mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis()); } - } - + }//第一个参数arg0是接收到点击事件的对话框 第二个参数arg1是该对话框上的按钮 } \ No newline at end of file diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java similarity index 83% rename from Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java index 613dc74..f2cc0e0 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/DropdownMenu.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/DropdownMenu.java @@ -29,15 +29,17 @@ import net.micode.notes.R; public class DropdownMenu { private Button mButton; - private PopupMenu mPopupMenu; + private PopupMenu mPopupMenu; //声明一个下拉菜单 private Menu mMenu; public DropdownMenu(Context context, Button button, int menuId) { mButton = button; - mButton.setBackgroundResource(R.drawable.dropdown_icon); + mButton.setBackgroundResource(R.drawable.dropdown_icon); //设置这个view的背景 mPopupMenu = new PopupMenu(context, mButton); mMenu = mPopupMenu.getMenu(); mPopupMenu.getMenuInflater().inflate(menuId, mMenu); + //MenuInflater是用来实例化Menu目录下的Menu布局文件 + //根据ID来确认menu的内容选项 mButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { mPopupMenu.show(); @@ -48,14 +50,14 @@ public class DropdownMenu { public void setOnDropdownMenuItemClickListener(OnMenuItemClickListener listener) { if (mPopupMenu != null) { mPopupMenu.setOnMenuItemClickListener(listener); - } + }//设置菜单的监听 } public MenuItem findItem(int id) { return mMenu.findItem(id); - } + }//对于菜单选项的初始化,根据索引搜索菜单需要的选项 public void setTitle(CharSequence title) { mButton.setText(title); - } + }//布局文件,设置标题 } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java similarity index 79% rename from Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java index 96b77da..dfb5f8f 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/FoldersListAdapter.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java @@ -30,10 +30,14 @@ import net.micode.notes.data.Notes.NoteColumns; public class FoldersListAdapter extends CursorAdapter { + //CursorAdapter是Cursor和ListView的接口 + //FoldersListAdapter继承了CursorAdapter的类 + //主要作用是便签数据库和用户的交互 + //这里就是用folder(文件夹)的形式展现给用户 public static final String [] PROJECTION = { - NoteColumns.ID, - NoteColumns.SNIPPET - }; + NoteColumns.ID, + NoteColumns.SNIPPET + };//调用数据库中便签的ID和片段 public static final int ID_COLUMN = 0; public static final int NAME_COLUMN = 1; @@ -41,12 +45,13 @@ public class FoldersListAdapter extends CursorAdapter { public FoldersListAdapter(Context context, Cursor c) { super(context, c); // TODO Auto-generated constructor stub - } + }//数据库操作 @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { + //ViewGroup是容器 return new FolderListItem(context); - } + }//创建一个文件夹,对于各文件夹中子标签的初始化 @Override public void bindView(View view, Context context, Cursor cursor) { @@ -55,20 +60,22 @@ public class FoldersListAdapter extends CursorAdapter { .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); ((FolderListItem) view).bind(folderName); } - } + }//将各个布局文件绑定起来 public String getFolderName(Context context, int position) { Cursor cursor = (Cursor) getItem(position); return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context .getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN); - } + }//根据数据库中标签的ID得到标签的各项内容 private class FolderListItem extends LinearLayout { private TextView mName; public FolderListItem(Context context) { super(context); + //操作数据库 inflate(context, R.layout.folder_list_item, this); + //根据布局文件的名字等信息将其找出来 mName = (TextView) findViewById(R.id.tv_folder_name); } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java similarity index 64% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java index 96a9ff8..dcfa201 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditActivity.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java @@ -16,25 +16,36 @@ package net.micode.notes.ui; -import android.app.Activity; +import android.Manifest; import android.app.AlarmManager; import android.app.AlertDialog; import android.app.PendingIntent; import android.app.SearchManager; import android.appwidget.AppWidgetManager; +import android.content.ContentResolver; import android.content.ContentUris; +import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Paint; +import android.net.Uri; import android.os.Bundle; +import android.os.Environment; import android.preference.PreferenceManager; +import android.provider.DocumentsContract; +import android.provider.MediaStore; +import android.text.Editable; import android.text.Spannable; import android.text.SpannableString; import android.text.TextUtils; import android.text.format.DateUtils; import android.text.style.BackgroundColorSpan; +import android.text.style.ImageSpan; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -47,11 +58,18 @@ import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; +import androidx.activity.result.ActivityResult; +import androidx.activity.result.ActivityResultCallback; +import androidx.activity.result.ActivityResultLauncher; +import androidx.activity.result.contract.ActivityResultContracts; +import androidx.appcompat.app.AppCompatActivity; + import net.micode.notes.R; import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.TextNote; @@ -65,6 +83,7 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener; import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_4x; +import java.io.FileNotFoundException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -72,8 +91,10 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -public class NoteEditActivity extends Activity implements OnClickListener, +public class NoteEditActivity extends AppCompatActivity implements OnClickListener, NoteSettingChangedListener, OnTextViewChangeListener { + //该类主要是针对标签的编辑 + //继承了系统内部许多和监听有关的类 private class HeadViewHolder { public TextView tvModified; @@ -82,8 +103,12 @@ public class NoteEditActivity extends Activity implements OnClickListener, public TextView tvAlertDate; public ImageView ibSetBgColor; - } + public ImageView ivLocked; + + public ImageView ivUnlocked; + } + //使用Map实现数据存储 private static final Map sBgSelectorBtnsMap = new HashMap(); static { sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW); @@ -91,6 +116,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, sBgSelectorBtnsMap.put(R.id.iv_bg_blue, ResourceParser.BLUE); sBgSelectorBtnsMap.put(R.id.iv_bg_green, ResourceParser.GREEN); sBgSelectorBtnsMap.put(R.id.iv_bg_white, ResourceParser.WHITE); + //put函数是将指定值和指定键相连 } private static final Map sBgSelectorSelectionMap = new HashMap(); @@ -100,6 +126,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, sBgSelectorSelectionMap.put(ResourceParser.BLUE, R.id.iv_bg_blue_select); sBgSelectorSelectionMap.put(ResourceParser.GREEN, R.id.iv_bg_green_select); sBgSelectorSelectionMap.put(ResourceParser.WHITE, R.id.iv_bg_white_select); + //put函数是将指定值和指定键相连 } private static final Map sFontSizeBtnsMap = new HashMap(); @@ -108,6 +135,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, sFontSizeBtnsMap.put(R.id.ll_font_small, ResourceParser.TEXT_SMALL); sFontSizeBtnsMap.put(R.id.ll_font_normal, ResourceParser.TEXT_MEDIUM); sFontSizeBtnsMap.put(R.id.ll_font_super, ResourceParser.TEXT_SUPER); + //put函数是将指定值和指定键相连 } private static final Map sFontSelectorSelectionMap = new HashMap(); @@ -116,26 +144,29 @@ public class NoteEditActivity extends Activity implements OnClickListener, sFontSelectorSelectionMap.put(ResourceParser.TEXT_SMALL, R.id.iv_small_select); sFontSelectorSelectionMap.put(ResourceParser.TEXT_MEDIUM, R.id.iv_medium_select); sFontSelectorSelectionMap.put(ResourceParser.TEXT_SUPER, R.id.iv_super_select); + //put函数是将指定值和指定键相连 } private static final String TAG = "NoteEditActivity"; private HeadViewHolder mNoteHeaderHolder; - private View mHeadViewPanel; + private View mHeadViewPanel; //私有化一个界面操作mHeadViewPanel,对表头的操作 - private View mNoteBgColorSelector; + private View mNoteBgColorSelector; //私有化一个界面操作mHeadViewPanel,对表头的操作 + private View mFontSizeSelector;//私有化一个界面操作mFontSizeSelector,对标签字体的操作 - private View mFontSizeSelector; - - private EditText mNoteEditor; + private EditText mNoteEditor; //声明编辑控件,对文本操作 private View mNoteEditorPanel; - - private WorkingNote mWorkingNote; + //私有化一个界面操作mNoteEditorPanel,文本编辑的控制板 + //private WorkingNote mWorkingNote; + private WorkingNote mWorkingNote; //对模板WorkingNote的初始化 private SharedPreferences mSharedPrefs; - private int mFontSizeId; + //私有化SharedPreferences的数据存储方式 + //它的本质是基于XML文件存储key-value键值对数据 + private int mFontSizeId; //用于操作字体的大小 private static final String PREFERENCE_FONT_SIZE = "pref_font_size"; @@ -144,15 +175,19 @@ public class NoteEditActivity extends Activity implements OnClickListener, public static final String TAG_CHECKED = String.valueOf('\u221A'); public static final String TAG_UNCHECKED = String.valueOf('\u25A1'); - private LinearLayout mEditTextList; - + private LinearLayout mEditTextList; //线性布局 private String mUserQuery; private Pattern mPattern; + private ImageButton mImageButton; // 添加图片按钮 + + private ActivityResultLauncher requestPermissionLauncher; //获取存储权限 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.note_edit); + //对数据库的访问操作 +// setContentView(R.layout.activity_main); if (savedInstanceState == null && !initActivityState(getIntent())) { finish(); @@ -176,7 +211,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, return; } Log.d(TAG, "Restoring from killed activity"); - } + }//为防止内存不足时程序的终止,在这里有一个保存现场的函数 } private boolean initActivityState(Intent intent) { @@ -188,7 +223,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) { long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0); mUserQuery = ""; - + //如果用户实例化标签时,系统并未给出标签ID /** * Starting from the searched result */ @@ -196,26 +231,33 @@ public class NoteEditActivity extends Activity implements OnClickListener, noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY); } - + //如果ID在数据库中未找到 if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) { Intent jump = new Intent(this, NotesListActivity.class); startActivity(jump); + //程序将跳转到上面声明的intent——jump showToast(R.string.error_note_not_exist); finish(); return false; - } else { + } + //ID在数据库中找到 + else { mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load note failed with note id" + noteId); + //打印出红色的错误信息 finish(); return false; } } + //setSoftInputMode——软键盘输入模式 getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); } else if(TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) { - // New note + // intent.getAction() + // 大多用于broadcast发送广播时给机制(intent)设置一个action,就是一个字符串 + // 用户可以通过receive(接受)intent,通过 getAction得到的字符串,来决定做什么 long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0); int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); @@ -223,7 +265,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, Notes.TYPE_WIDGET_INVALIDE); int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, ResourceParser.getDefaultBgId(this)); - + // intent.getInt(Long、String)Extra是对各变量的语法分析 // Parse call-record note String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0); @@ -240,7 +282,8 @@ public class NoteEditActivity extends Activity implements OnClickListener, finish(); return false; } - } else { + } //将电话号码与手机的号码簿相关 + else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); mWorkingNote.convertToCallNote(phoneNumber, callDate); @@ -248,7 +291,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } else { mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); - } + }//创建一个新的WorkingNote getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE @@ -269,8 +312,10 @@ public class NoteEditActivity extends Activity implements OnClickListener, } private void initNoteScreen() { + //对界面的初始化操作 mNoteEditor.setTextAppearance(this, TextAppearanceResources .getTexAppearanceResource(mFontSizeId)); + //设置外观 if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { switchToListMode(mWorkingNote.getContent()); } else { @@ -293,23 +338,35 @@ public class NoteEditActivity extends Activity implements OnClickListener, * is not ready */ showAlertHeader(); + //将有图片路径的位置转换为图片 + requestPermissionLauncher.launch(Manifest.permission.READ_MEDIA_IMAGES); } - + //设置闹钟的显示 private void showAlertHeader() { if (mWorkingNote.hasClockAlert()) { long time = System.currentTimeMillis(); if (time > mWorkingNote.getAlertDate()) { mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired); - } else { + } //如果系统时间大于了闹钟设置的时间,那么闹钟失效 + else { mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString( mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS)); } mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE); mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE); + //显示闹钟开启的图标 } else { mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE); mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE); - }; + } + if(mWorkingNote.getIsLocked()){ + mNoteHeaderHolder.ivUnlocked.setVisibility(View.GONE); + mNoteHeaderHolder.ivLocked.setVisibility(View.VISIBLE); + }else{ + mNoteHeaderHolder.ivUnlocked.setVisibility(View.VISIBLE); + mNoteHeaderHolder.ivLocked.setVisibility(View.GONE); + } + } @Override @@ -329,26 +386,29 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (!mWorkingNote.existInDatabase()) { saveNote(); } + //在创建一个新的标签时,先在数据库中匹配 + //如果不存在,那么先在数据库中存储 outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId()); Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState"); } @Override + //MotionEvent是对屏幕触控的传递机制 public boolean dispatchTouchEvent(MotionEvent ev) { if (mNoteBgColorSelector.getVisibility() == View.VISIBLE && !inRangeOfView(mNoteBgColorSelector, ev)) { mNoteBgColorSelector.setVisibility(View.GONE); return true; - } + }//颜色选择器在屏幕上可见 if (mFontSizeSelector.getVisibility() == View.VISIBLE && !inRangeOfView(mFontSizeSelector, ev)) { mFontSizeSelector.setVisibility(View.GONE); return true; - } + }//字体大小选择器在屏幕上可见 return super.dispatchTouchEvent(ev); } - + //对屏幕触控的坐标进行操作 private boolean inRangeOfView(View view, MotionEvent ev) { int []location = new int[2]; view.getLocationOnScreen(location); @@ -358,8 +418,9 @@ public class NoteEditActivity extends Activity implements OnClickListener, || ev.getX() > (x + view.getWidth()) || ev.getY() < y || ev.getY() > (y + view.getHeight())) { - return false; - } + //如果触控的位置超出了给定的范围,返回false + return false; + } return true; } @@ -371,19 +432,23 @@ public class NoteEditActivity extends Activity implements OnClickListener, mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color); mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this); + + mNoteHeaderHolder.ivLocked = (ImageView) findViewById(R.id.tv_locked); + mNoteHeaderHolder.ivUnlocked = (ImageView) findViewById(R.id.tv_unlocked); + mNoteEditor = (EditText) findViewById(R.id.note_edit_view); mNoteEditorPanel = findViewById(R.id.sv_note_edit); mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector); for (int id : sBgSelectorBtnsMap.keySet()) { ImageView iv = (ImageView) findViewById(id); iv.setOnClickListener(this); - } + }//对标签各项属性内容的初始化 mFontSizeSelector = findViewById(R.id.font_size_selector); for (int id : sFontSizeBtnsMap.keySet()) { View view = findViewById(id); view.setOnClickListener(this); - }; + };//对字体大小的选择 mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE); /** @@ -395,6 +460,13 @@ public class NoteEditActivity extends Activity implements OnClickListener, mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE; } mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list); + + // 获取读取存储权限 + requestPermissionLauncher=getrequestDataLauncher(); + // 初始化添加图片按钮 + mImageButton = (ImageButton) findViewById(R.id.add_img_btn); + ActivityResultLauncher intentActivityResultLauncher=getActivityResultLauncher(); + mImageButton.setOnClickListener(view -> onAddImage(intentActivityResultLauncher)); } @Override @@ -405,7 +477,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } clearSettingState(); } - + //和桌面小工具的同步 private void updateWidget() { Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) { @@ -418,7 +490,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { - mWorkingNote.getWidgetId() + mWorkingNote.getWidgetId() }); sendBroadcast(intent); @@ -430,7 +502,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (id == R.id.btn_set_bg_color) { mNoteBgColorSelector.setVisibility(View.VISIBLE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( - - View.VISIBLE); + View.VISIBLE); } else if (sBgSelectorBtnsMap.containsKey(id)) { findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( View.GONE); @@ -452,6 +524,20 @@ public class NoteEditActivity extends Activity implements OnClickListener, } } + public void onChangeLock(View v){ + int id = v.getId(); + switch (id){ + case R.id.tv_locked: + mWorkingNote.setLock(false); + break; + case R.id.tv_unlocked: + + mWorkingNote.setLock(true); + break; + } + showAlertHeader(); + } + @Override public void onBackPressed() { if(clearSettingState()) { @@ -480,8 +566,34 @@ public class NoteEditActivity extends Activity implements OnClickListener, mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); } +// @Override +// public boolean onCreateOptionsMenu(Menu menu){ +// if (isFinishing()) { +// return true; +// } +// clearSettingState(); +// menu.clear(); +// if (mWorkingNote.getFolderId() == Notes.ID_CALL_RECORD_FOLDER) { +// getMenuInflater().inflate(R.menu.call_note_edit, menu); +// } else { +// getMenuInflater().inflate(R.menu.note_edit, menu); +// } +// if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { +// menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_normal_mode); +// } else { +// menu.findItem(R.id.menu_list_mode).setTitle(R.string.menu_list_mode); +// } +// if (mWorkingNote.hasClockAlert()) { +// menu.findItem(R.id.menu_alert).setVisible(false); +// } else { +// menu.findItem(R.id.menu_delete_remind).setVisible(false); +// } +// return true; +// } + @Override public boolean onPrepareOptionsMenu(Menu menu) { +// getMenuInflater().inflate(R.menu.call_note_edit, menu); if (isFinishing()) { return true; } @@ -587,6 +699,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } private void deleteCurrentNote() { + saveNote(); if (mWorkingNote.existInDatabase()) { HashSet ids = new HashSet(); long id = mWorkingNote.getNoteId(); @@ -596,9 +709,9 @@ public class NoteEditActivity extends Activity implements OnClickListener, Log.d(TAG, "Wrong note id, should not happen"); } if (!isSyncMode()) { - if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) { - Log.e(TAG, "Delete Note error"); - } +// if (!DataUtils.batchDeleteNotes(getContentResolver(), ids)) { +// Log.e(TAG, "Delete Note error"); +// } } else { if (!DataUtils.batchMoveToFolder(getContentResolver(), ids, Notes.ID_TRASH_FOLER)) { Log.e(TAG, "Move notes to trash folder error, should not happens"); @@ -609,7 +722,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } private boolean isSyncMode() { - return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0; + return true; } public void onClockAlertChanged(long date, boolean set) { @@ -623,7 +736,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (mWorkingNote.getNoteId() > 0) { Intent intent = new Intent(this, AlarmReceiver.class); intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId())); - PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); + PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE)); showAlertHeader(); if(!set) { @@ -852,22 +965,265 @@ public class NoteEditActivity extends Activity implements OnClickListener, * should input something */ Log.e(TAG, "Send to desktop error"); - showToast(R.string.error_note_empty_for_send_to_desktop); + showToast(R.string.error_note_empty_for_send_to_desktop); //空便签直接报错 } } + /* + * 函数功能:编辑小图标的标题 + * 函数实现:如下注释 + */ private String makeShortcutIconTitle(String content) { content = content.replace(TAG_CHECKED, ""); content = content.replace(TAG_UNCHECKED, ""); return content.length() > SHORTCUT_ICON_TITLE_MAX_LEN ? content.substring(0, SHORTCUT_ICON_TITLE_MAX_LEN) : content; + //直接设置为content中的内容并返回,有勾选和未勾选2种 } + /* + * 函数功能:显示提示的视图 + * 函数实现:根据下标显示对应的提示 + */ private void showToast(int resId) { showToast(resId, Toast.LENGTH_SHORT); } + /* + * 函数功能:持续显示提示的视图 + * 函数实现:根据下标和持续的时间(duration)编辑提示视图并显示 + */ private void showToast(int resId, int duration) { Toast.makeText(this, resId, duration).show(); } + + /** + * @author: ClearDewy + * @date: 2023/3/9 11:20 + * @param: [android.content.Context, android.net.Uri] + * @return: java.lang.String + * @description:根据Url解析文件路径 + **/ + public static String getPathFromUri(final Context context, final Uri uri) { + if (uri == null) { + return null; + } + // 判斷是否為Android 4.4之後的版本 + if (DocumentsContract.isDocumentUri(context, uri)) { + // 如果是Android 4.4之後的版本,而且屬於文件URI + final String authority = uri.getAuthority(); + // 判斷Authority是否為本地端檔案所使用的 + if ("com.android.externalstorage.documents".equals(authority)) { + // 外部儲存空間 + final String docId = DocumentsContract.getDocumentId(uri); + final String[] divide = docId.split(":"); + final String type = divide[0]; + if ("primary".equals(type)) { + String path = Environment.getExternalStorageDirectory().getAbsolutePath().concat("/").concat(divide[1]); + return path; + } else { + String path = "/storage/".concat(type).concat("/").concat(divide[1]); + return path; + } + } else if ("com.android.providers.downloads.documents".equals(authority)) { + // 下載目錄 + final String docId = DocumentsContract.getDocumentId(uri); + if (docId.startsWith("raw:")) { + final String path = docId.replaceFirst("raw:", ""); + return path; + } + final Uri downloadUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(docId)); + String path = queryAbsolutePath(context, downloadUri); + return path; + } else if ("com.android.providers.media.documents".equals(authority)) { + // 圖片、影音檔案 + final String docId = DocumentsContract.getDocumentId(uri); + final String[] divide = docId.split(":"); + final String type = divide[0]; + Uri mediaUri = null; + if ("image".equals(type)) { + mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + } else if ("video".equals(type)) { + mediaUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; + } else if ("audio".equals(type)) { + mediaUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; + } else { + return null; + } + mediaUri = ContentUris.withAppendedId(mediaUri, Long.parseLong(divide[1])); + String path = queryAbsolutePath(context, mediaUri); + return path; + } + } else { + // 如果是一般的URI + final String scheme = uri.getScheme(); + String path = null; + if ("content".equals(scheme)) { + // 內容URI + path = queryAbsolutePath(context, uri); + } else if ("file".equals(scheme)) { + // 檔案URI + path = uri.getPath(); + } + return path; + } + return null; + } + + public static String queryAbsolutePath(final Context context, final Uri uri) { + final String[] projection = {MediaStore.MediaColumns.DATA}; + Cursor cursor = null; + try { + cursor = context.getContentResolver().query(uri, projection, null, null, null); + if (cursor != null && cursor.moveToFirst()) { + final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); + return cursor.getString(index); + } + } catch (final Exception ex) { + ex.printStackTrace(); + if (cursor != null) { + cursor.close(); + } + } + return null; + } + + private ActivityResultLauncher getActivityResultLauncher(){ + return registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback(){ + // 重写回调方法 + @Override + public void onActivityResult(ActivityResult result) { + if (result.getResultCode() != RESULT_OK) return; + ContentResolver resolver = getContentResolver(); + Uri originalUri = result.getData().getData(); //1.获得图片的真实路径 + Bitmap bitmap = null; + try { + bitmap = BitmapFactory.decodeStream(resolver.openInputStream(originalUri));//2.解码图片 + } catch (FileNotFoundException e) { + Log.d(TAG, "onActivityResult: get file_exception"); + e.printStackTrace(); + } + + if (bitmap != null) { + //3.根据Bitmap对象创建ImageSpan对象 + Log.d(TAG, "onActivityResult: bitmap is not null"); + ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap); + String path = getPathFromUri(NoteEditActivity.this, originalUri); + //4.使用[local][/local]将path括起来,用于之后方便识别图片路径在note中的位置 + String img_fragment = "" + path + ""; + //创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像 + SpannableString spannableString = new SpannableString(img_fragment); + spannableString.setSpan(imageSpan, 0, img_fragment.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + //5.将选择的图片追加到EditText中光标所在位置 + NoteEditText e = (NoteEditText) findViewById(R.id.note_edit_view); + int index = e.getSelectionStart(); //获取光标所在位置 + Log.d(TAG, "Index是: " + index); + Editable edit_text = e.getEditableText(); + edit_text.insert(index, spannableString); //将图片插入到光标所在位置 + + mWorkingNote.mContent = e.getText().toString(); + //6.把改动提交到数据库中,两个数据库表都要改的 + ContentResolver contentResolver = getContentResolver(); + ContentValues contentValues = new ContentValues(); + final long id = mWorkingNote.getNoteId(); + contentValues.put("snippet", mWorkingNote.mContent); + contentResolver.update(Uri.parse("content://micode_notes/note"), contentValues, "_id=?", new String[]{"" + id}); + ContentValues contentValues1 = new ContentValues(); + contentValues1.put("content", mWorkingNote.mContent); + contentResolver.update(Uri.parse("content://micode_notes/data"), contentValues1, "mime_type=? and note_id=?", new String[]{"vnd.android.cursor.item/text_note", "" + id}); + + } + } + }); + } + /** + * @author: ClearDewy + * @date: 2023/3/10 12:43 + * @param: [] + * @return: androidx.activity.result.ActivityResultLauncher + * @description:当API>=33时,申请读取存储授权 + **/ + private ActivityResultLauncher getrequestDataLauncher(){ + return registerForActivityResult(new ActivityResultContracts.RequestPermission(), result -> { + if (result){ + Log.d(TAG,"用户已授权"); + convertToImage(); + }else{ + Log.d(TAG,"用户取消授权"); + } + }); + } + + //路径字符串格式 转换为 图片image格式 + private void convertToImage() { + NoteEditText noteEditText = (NoteEditText) findViewById(R.id.note_edit_view); //获取当前的edit + Editable editable = noteEditText.getText();//1.获取text + String noteText = editable.toString(); //2.将note内容转换为字符串 + int length = editable.length(); //内容的长度 + //3.截取img片段 [local]+uri+[local],提取uri + for(int i = 0; i < length; i++) { + for(int j = i; j < length; j++) { + String img_fragment = noteText.substring(i, j+1); //img_fragment:关于图片路径的片段 + if(img_fragment.length() > 15 && img_fragment.endsWith("[/local]") && img_fragment.startsWith("[local]")){ + int limit = 7; //[local]为7个字符 + //[local][/local]共15个字符,剩下的为真正的path长度 + int len = img_fragment.length()-15; + //从[local]之后的len个字符就是path + String path = img_fragment.substring(limit,limit+len);//获取到了图片路径 + + + } + } + } + + for (int i = 0; i < length; i++) { + if (noteText.startsWith("", i)){ + for(int j=i+5;j< length;j++){ + if (noteText.substring(i,j+1).endsWith("")){ + Bitmap bitmap = null; + String path=noteText.substring(i+5,j-5); + Log.d(TAG, "图片的路径是:"+path); + try { + bitmap = BitmapFactory.decodeFile(path);//将图片路径解码为图片格式 + } catch (Exception e) { + e.printStackTrace(); + } + if(bitmap!=null){ //若图片存在 + Log.d(TAG, "图片不为null"); + ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap); + //4.创建一个SpannableString对象,以便插入用ImageSpan对象封装的图像 + String ss = "" + path + ""; + SpannableString spannableString = new SpannableString(ss); + //5.将指定的标记对象附加到文本的开始...结束范围 + spannableString.setSpan(imageSpan, 0, ss.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + Log.d(TAG, "Create spannable string success!"); + Editable edit_text = noteEditText.getEditableText(); + edit_text.delete(i,j-i+1); //6.删掉图片路径的文字 + edit_text.insert(i, spannableString); //7.在路径的起始位置插入图片 + + i=j;break; + } + + } + } + } + } + + + + } + + + + // 添加图片按钮点击时触发 + private void onAddImage(ActivityResultLauncher intentActivityResultLauncher){ + Intent imgIntent=new Intent(Intent.ACTION_GET_CONTENT); + //Category属性用于指定当前动作(Action)被执行的环境. + //CATEGORY_OPENABLE; 用来指示一个ACTION_GET_CONTENT的intent + imgIntent.addCategory(Intent.CATEGORY_OPENABLE); + imgIntent.setType("image/*"); + intentActivityResultLauncher.launch(imgIntent); + } + + } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditText.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditText.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteEditText.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteEditText.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java similarity index 73% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java index 0f5a878..d1cf2d2 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NoteItemData.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NoteItemData.java @@ -28,20 +28,22 @@ import net.micode.notes.tool.DataUtils; public class NoteItemData { static final String [] PROJECTION = new String [] { - NoteColumns.ID, - NoteColumns.ALERTED_DATE, - NoteColumns.BG_COLOR_ID, - NoteColumns.CREATED_DATE, - NoteColumns.HAS_ATTACHMENT, - NoteColumns.MODIFIED_DATE, - NoteColumns.NOTES_COUNT, - NoteColumns.PARENT_ID, - NoteColumns.SNIPPET, - NoteColumns.TYPE, - NoteColumns.WIDGET_ID, - NoteColumns.WIDGET_TYPE, + NoteColumns.ID, + NoteColumns.ALERTED_DATE, + NoteColumns.BG_COLOR_ID, + NoteColumns.CREATED_DATE, + NoteColumns.HAS_ATTACHMENT, + NoteColumns.MODIFIED_DATE, + NoteColumns.NOTES_COUNT, + NoteColumns.PARENT_ID, + NoteColumns.SNIPPET, + NoteColumns.TYPE, + NoteColumns.WIDGET_ID, + NoteColumns.WIDGET_TYPE, + NoteColumns.LOCKED }; + //常量标记和数据就不一一标记了,意义翻译基本就知道 private static final int ID_COLUMN = 0; private static final int ALERTED_DATE_COLUMN = 1; private static final int BG_COLOR_ID_COLUMN = 2; @@ -54,6 +56,10 @@ public class NoteItemData { private static final int TYPE_COLUMN = 9; private static final int WIDGET_ID_COLUMN = 10; private static final int WIDGET_TYPE_COLUMN = 11; + private static final int LOCKED_COLUMN = 12; + + private static final String LOCKED = "locked"; + private static final String UNLOCKED = "unlocked"; private long mId; private long mAlertDate; @@ -75,8 +81,10 @@ public class NoteItemData { private boolean mIsOnlyOneItem; private boolean mIsOneNoteFollowingFolder; private boolean mIsMultiNotesFollowingFolder; + //初始化NoteItemData,主要利用光标cursor获取的东西 + private boolean mIsLocked; - public NoteItemData(Context context, Cursor cursor) { + public NoteItemData(Context context, Cursor cursor) {//getxxx为转换格式 mId = cursor.getLong(ID_COLUMN); mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN); mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN); @@ -92,10 +100,12 @@ public class NoteItemData { mWidgetId = cursor.getInt(WIDGET_ID_COLUMN); mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN); - mPhoneNumber = ""; + mIsLocked = !cursor.getString(LOCKED_COLUMN).equals(UNLOCKED); + + mPhoneNumber = "";//getxxx为转换格式 if (mParentId == Notes.ID_CALL_RECORD_FOLDER) { mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId); - if (!TextUtils.isEmpty(mPhoneNumber)) { + if (!TextUtils.isEmpty(mPhoneNumber)) {//mphonenumber里有符合字符串,则用contart功能连接 mName = Contact.getContact(context, mPhoneNumber); if (mName == null) { mName = mPhoneNumber; @@ -108,26 +118,30 @@ public class NoteItemData { } checkPostion(cursor); } + //根据鼠标的位置设置标记,和位置 private void checkPostion(Cursor cursor) { + //初始化几个标记,cursor具体功能笔记中已提到,不一一叙述 mIsLastItem = cursor.isLast() ? true : false; mIsFirstItem = cursor.isFirst() ? true : false; mIsOnlyOneItem = (cursor.getCount() == 1); + //初始化“多重子文件”“单一子文件”2个标记 mIsMultiNotesFollowingFolder = false; mIsOneNoteFollowingFolder = false; - if (mType == Notes.TYPE_NOTE && !mIsFirstItem) { + //主要是设置上诉2标记 + if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {//若是note格式并且不是第一个元素 int position = cursor.getPosition(); - if (cursor.moveToPrevious()) { + if (cursor.moveToPrevious()) {//获取光标位置后看上一行 if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER - || cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) { + || cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {//若光标满足系统或note格式 if (cursor.getCount() > (position + 1)) { - mIsMultiNotesFollowingFolder = true; + mIsMultiNotesFollowingFolder = true;//若是数据行数大于但前位置+1则设置成正确 } else { - mIsOneNoteFollowingFolder = true; + mIsOneNoteFollowingFolder = true;//否则单一文件夹标记为true } } - if (!cursor.moveToNext()) { + if (!cursor.moveToNext()) {//若不能再往下走则报错 throw new IllegalStateException("cursor move to previous but can't move back"); } } @@ -214,6 +228,7 @@ public class NoteItemData { return (mAlertDate > 0); } + //若数据父id为保存至文件夹模式的id且满足电话号码单元不为空,则isCallRecord为true public boolean isCallRecord() { return (mParentId == Notes.ID_CALL_RECORD_FOLDER && !TextUtils.isEmpty(mPhoneNumber)); } @@ -221,4 +236,11 @@ public class NoteItemData { public static int getNoteType(Cursor cursor) { return cursor.getInt(TYPE_COLUMN); } + + public boolean getIsLocked(){ + return mIsLocked; + } + public void setIsLocked(boolean islocked){ + mIsLocked = islocked; + } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java similarity index 67% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java index e843aec..093a0d1 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListActivity.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListActivity.java @@ -16,9 +16,11 @@ package net.micode.notes.ui; +import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; +import android.app.KeyguardManager; import android.appwidget.AppWidgetManager; import android.content.AsyncQueryHandler; import android.content.ContentResolver; @@ -28,9 +30,13 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; +import android.hardware.fingerprint.FingerprintManager; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; +import android.security.keystore.KeyGenParameterSpec; +import android.security.keystore.KeyProperties; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -60,25 +66,27 @@ import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; +import androidx.appcompat.app.AppCompatActivity; + import net.micode.notes.R; import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.NoteColumns; import net.micode.notes.gtask.remote.GTaskSyncService; -import net.micode.notes.model.WorkingNote; import net.micode.notes.tool.BackupUtils; import net.micode.notes.tool.DataUtils; -import net.micode.notes.tool.ResourceParser; +import net.micode.notes.tool.FingerprintDialogFragment; import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute; import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_4x; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.security.KeyStore; import java.util.HashSet; -public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener { +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; + +public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener { private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0; private static final int FOLDER_LIST_QUERY_TOKEN = 1; @@ -89,6 +97,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private static final int MENU_FOLDER_CHANGE_NAME = 2; + private static final int MENU_FOLDER_MOVE_OUT = 3; + private static final String PREFERENCE_ADD_INTRODUCTION = "net.micode.notes.introduction"; private enum ListEditState { @@ -135,11 +145,25 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private final static int REQUEST_CODE_OPEN_NODE = 102; private final static int REQUEST_CODE_NEW_NODE = 103; + private static final String DEFAULT_KEY_NAME = "default_key"; + private static final int OPEN_NOTE = 0; + private static final int DELETE_NOTE = 1; + private static final int MOVE_NOTE = 2; + private static final int NONE_ACTION = -1; + KeyStore keyStore; + private NoteItemData mNoteDataItem; + private int mAuthenticatedType; + private long mAuthenticated_FOLDER; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.note_list); initResources(); + if (supportFingerprint()) { + initKey(); + } + /** * Insert an introduction when user firstly use this application @@ -160,47 +184,56 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private void setAppInfoFromRawRes() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); if (!sp.getBoolean(PREFERENCE_ADD_INTRODUCTION, false)) { - StringBuilder sb = new StringBuilder(); - InputStream in = null; - try { - in = getResources().openRawResource(R.raw.introduction); - if (in != null) { - InputStreamReader isr = new InputStreamReader(in); - BufferedReader br = new BufferedReader(isr); - char [] buf = new char[1024]; - int len = 0; - while ((len = br.read(buf)) > 0) { - sb.append(buf, 0, len); - } - } else { - Log.e(TAG, "Read introduction file error"); - return; - } - } catch (IOException e) { - e.printStackTrace(); - return; - } finally { - if(in != null) { - try { - in.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - 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()) { - sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit(); - } else { - Log.e(TAG, "Save introduction note error"); - return; + if(!DataUtils.checkFolderId(mContentResolver,Long.valueOf(Notes.ID_TRASH_FOLER)) && !DataUtils.checkVisibleFolderName(mContentResolver,this.getString(R.string.trash_name))){ + ContentValues values = new ContentValues(); + values.put(NoteColumns.SNIPPET, this.getString(R.string.trash_name)); + values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER); +// values.put(NoteColumns.ID, Notes.ID_TRASH_FOLER); + mContentResolver.insert(Notes.CONTENT_NOTE_URI, values); } +// StringBuilder sb = new StringBuilder(); +// InputStream in = null; +// try { +// in = getResources().openRawResource(R.raw.introduction); +// if (in != null) { +// InputStreamReader isr = new InputStreamReader(in); +// BufferedReader br = new BufferedReader(isr); +// char [] buf = new char[1024]; +// int len = 0; +// while ((len = br.read(buf)) > 0) { +// sb.append(buf, 0, len); +// } +// } else { +// Log.e(TAG, "Read introduction file error"); +// return; +// } +// } catch (IOException e) { +// e.printStackTrace(); +// return; +// } finally { +// if(in != null) { +// try { +// in.close(); +// } catch (IOException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } +// } +// +// 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()) { +// sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit(); +// } else { +// Log.e(TAG, "Save introduction note error"); +// return; +// } } + long id = DataUtils.getTrashIdByName(mContentResolver,this.getString(R.string.trash_name)); + Notes.setID_TRASH_FOLER((int)id); } @Override @@ -307,7 +340,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } public void onItemCheckedStateChanged(ActionMode mode, int position, long id, - boolean checked) { + boolean checked) { mNotesListAdapter.setCheckedItem(position, checked); updateMenu(); } @@ -325,14 +358,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt builder.setTitle(getString(R.string.alert_title_delete)); builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setMessage(getString(R.string.alert_message_delete_notes, - mNotesListAdapter.getSelectedCount())); + mNotesListAdapter.getSelectedCount())); builder.setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int which) { - batchDelete(); - } - }); + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int which) { + batchDelete(); + } + }); builder.setNegativeButton(android.R.string.cancel, null); builder.show(); break; @@ -413,7 +446,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt : NORMAL_SELECTION; mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null, Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] { - String.valueOf(mCurrentFolderId) + String.valueOf(mCurrentFolderId) }, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC"); } @@ -441,6 +474,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } + private void showFolderListMenu(Cursor cursor) { AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); builder.setTitle(R.string.menu_title_select_folder); @@ -448,14 +482,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt builder.setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { - DataUtils.batchMoveToFolder(mContentResolver, - mNotesListAdapter.getSelectedItemIds(), adapter.getItemId(which)); - Toast.makeText( - NotesListActivity.this, - getString(R.string.format_move_notes_to_folder, - mNotesListAdapter.getSelectedCount(), - adapter.getFolderName(NotesListActivity.this, which)), - Toast.LENGTH_SHORT).show(); + if(adapter.getItemId(which)==Notes.ID_TRASH_FOLER){ + Toast.makeText( + NotesListActivity.this, + R.string.forbidden_move_to_trash, + Toast.LENGTH_SHORT).show(); + }else{ + if(mNotesListAdapter.getHasLocked() && false){ + //not ready + initCipher(); + mAuthenticatedType = MOVE_NOTE; + }else { + DataUtils.batchMoveToFolder(mContentResolver, + mNotesListAdapter.getSelectedItemIds(), adapter.getItemId(which)); + Toast.makeText( + NotesListActivity.this, + getString(R.string.format_move_notes_to_folder, + mNotesListAdapter.getSelectedCount(), + adapter.getFolderName(NotesListActivity.this, which)), + Toast.LENGTH_SHORT).show(); + } + } mModeCallBack.finishActionMode(); } }); @@ -469,11 +516,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE); } - private void batchDelete() { + private void reallyBatchDelete(){ new AsyncTask>() { protected HashSet doInBackground(Void... unused) { HashSet widgets = mNotesListAdapter.getSelectedWidget(); - if (!isSyncMode()) { + HashSet folers = mNotesListAdapter.getSelectedFolderIds(); + if (folers.contains(new Long( Notes.ID_TRASH_FOLER))) { // if not synced, delete notes directly if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter .getSelectedItemIds())) { @@ -506,17 +554,22 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt }.execute(); } - private void deleteFolder(long folderId) { - if (folderId == Notes.ID_ROOT_FOLDER) { - Log.e(TAG, "Wrong folder id, should not happen " + folderId); - return; + private void batchDelete() { + if(ifHaveLocked()){ + initCipher(); + mAuthenticatedType = DELETE_NOTE; + }else { + reallyBatchDelete(); } + } + private void reallyDeleteFolder(long folderId){ HashSet ids = new HashSet(); + ids.add(folderId); HashSet widgets = DataUtils.getFolderNoteWidget(mContentResolver, folderId); - if (!isSyncMode()) { + if (DataUtils.getParentIdbyId(mContentResolver,folderId)==Notes.ID_TRASH_FOLER) { // if not synced, delete folder directly DataUtils.batchDeleteNotes(mContentResolver, ids); } else { @@ -533,38 +586,120 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } - private void openNode(NoteItemData data) { - Intent intent = new Intent(this, NoteEditActivity.class); - intent.setAction(Intent.ACTION_VIEW); - intent.putExtra(Intent.EXTRA_UID, data.getId()); - this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE); - } - private void openFolder(NoteItemData data) { - mCurrentFolderId = data.getId(); - startAsyncNotesListQuery(); - if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { - mState = ListEditState.CALL_RECORD_FOLDER; - mAddNewNote.setVisibility(View.GONE); - } else { - mState = ListEditState.SUB_FOLDER; + private void deleteFolder(long folderId) { + if (folderId == Notes.ID_ROOT_FOLDER) { + Log.e(TAG, "Wrong folder id, should not happen " + folderId); + return; } - if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { - mTitleBar.setText(R.string.call_record_folder_name); - } else { - mTitleBar.setText(data.getSnippet()); + if(folderId == Notes.ID_TRASH_FOLER){ + Toast.makeText( + NotesListActivity.this, + R.string.forbidden_delete_trash, + Toast.LENGTH_SHORT).show(); + return; + } + + if(DataUtils.getHasLockedByFolderId(mContentResolver,folderId).contains(Notes.LOCKED)){ + initCipher(); + mAuthenticatedType = MOVE_NOTE; + mAuthenticated_FOLDER = folderId; + }else { + reallyDeleteFolder(folderId); } - mTitleBar.setVisibility(View.VISIBLE); } - public void onClick(View v) { - switch (v.getId()) { - case R.id.btn_new_note: - createNewNote(); + private boolean ifHaveLocked(){ + return mNotesListAdapter.getHasLocked(); + } + + + private void openNode(NoteItemData data) { + if(!data.getIsLocked()){ + Intent intent = new Intent(this, NoteEditActivity.class); + intent.setAction(Intent.ACTION_VIEW); + intent.putExtra(Intent.EXTRA_UID, data.getId()); + this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE); + }else{ + this.openLockedNote(); + mNoteDataItem = data; + mAuthenticatedType = OPEN_NOTE; + } + } + + private void openLockedNote(){ + initCipher(); + } + + public void onAuthenticated() { + switch (mAuthenticatedType){ + case OPEN_NOTE: + switch (mNoteDataItem.getType()){ + case Notes.TYPE_FOLDER: + mCurrentFolderId = mNoteDataItem.getId(); + startAsyncNotesListQuery(); + if (mNoteDataItem.getId() == Notes.ID_CALL_RECORD_FOLDER) { + mState = ListEditState.CALL_RECORD_FOLDER; + mAddNewNote.setVisibility(View.GONE); + } else { + mState = ListEditState.SUB_FOLDER; + } + if (mNoteDataItem.getId() == Notes.ID_CALL_RECORD_FOLDER) { + mTitleBar.setText(R.string.call_record_folder_name); + } else { + mTitleBar.setText(mNoteDataItem.getSnippet()); + } + mTitleBar.setVisibility(View.VISIBLE); + break; + case Notes.TYPE_NOTE: + Intent intent = new Intent(this, NoteEditActivity.class); + intent.setAction(Intent.ACTION_VIEW); + intent.putExtra(Intent.EXTRA_UID, mNoteDataItem.getId()); + this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE); + break; + } break; - default: + case DELETE_NOTE: + reallyBatchDelete(); + break; + case MOVE_NOTE: + reallyDeleteFolder(mAuthenticated_FOLDER); break; } + mNoteDataItem = null; + mAuthenticated_FOLDER = -1; + mAuthenticatedType = NONE_ACTION; + } + + public void onStopAuthenticated() { + mNoteDataItem = null; + } + + private void openFolder(NoteItemData data) { + if(!data.getIsLocked()){ + mCurrentFolderId = data.getId(); + startAsyncNotesListQuery(); + if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { + mState = ListEditState.CALL_RECORD_FOLDER; + mAddNewNote.setVisibility(View.GONE); + } else { + mState = ListEditState.SUB_FOLDER; + } + if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { + mTitleBar.setText(R.string.call_record_folder_name); + } else { + mTitleBar.setText(data.getSnippet()); + } + mTitleBar.setVisibility(View.VISIBLE); + }else{ + this.openLockedNote(); + mNoteDataItem = data; + mAuthenticatedType = OPEN_NOTE; + } + } + + public void onClick(View v) { + createNewNote(); } private void showSoftInput() { @@ -586,8 +721,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt showSoftInput(); if (!create) { if (mFocusNoteDataItem != null) { - etName.setText(mFocusNoteDataItem.getSnippet()); - builder.setTitle(getString(R.string.menu_folder_change_name)); + if(mFocusNoteDataItem.getId()==(long)Notes.ID_TRASH_FOLER){ + Toast.makeText(this, R.string.forbidden_change_trash_name, Toast.LENGTH_SHORT).show(); + return; + }else{ + etName.setText(mFocusNoteDataItem.getSnippet()); + builder.setTitle(getString(R.string.menu_folder_change_name)); + } } else { Log.e(TAG, "The long click data item is null"); return; @@ -624,7 +764,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt values.put(NoteColumns.LOCAL_MODIFIED, 1); mContentResolver.update(Notes.CONTENT_NOTE_URI, values, NoteColumns.ID + "=?", new String[] { - String.valueOf(mFocusNoteDataItem.getId()) + String.valueOf(mFocusNoteDataItem.getId()) }); } } else if (!TextUtils.isEmpty(name)) { @@ -700,7 +840,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { - appWidgetId + appWidgetId }); sendBroadcast(intent); @@ -710,10 +850,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private final OnCreateContextMenuListener mFolderOnCreateContextMenuListener = new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (mFocusNoteDataItem != null) { - menu.setHeaderTitle(mFocusNoteDataItem.getSnippet()); - menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view); - menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete); - menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name); + if(mFocusNoteDataItem.getParentId()==Notes.ID_TRASH_FOLER){ + menu.setHeaderTitle(mFocusNoteDataItem.getSnippet()); + menu.add(0, MENU_FOLDER_MOVE_OUT, 0, R.string.menu_folder_move_out); + menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete); + }else { + menu.setHeaderTitle(mFocusNoteDataItem.getSnippet()); + menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view); + menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete); + menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name); + } } } }; @@ -732,31 +878,56 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt Log.e(TAG, "The long click data item is null"); return false; } - switch (item.getItemId()) { - case MENU_FOLDER_VIEW: - openFolder(mFocusNoteDataItem); - break; - case MENU_FOLDER_DELETE: - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setTitle(getString(R.string.alert_title_delete)); - builder.setIcon(android.R.drawable.ic_dialog_alert); - builder.setMessage(getString(R.string.alert_message_delete_folder)); - builder.setPositiveButton(android.R.string.ok, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - deleteFolder(mFocusNoteDataItem.getId()); - } - }); - builder.setNegativeButton(android.R.string.cancel, null); - builder.show(); - break; - case MENU_FOLDER_CHANGE_NAME: - showCreateOrModifyFolderDialog(false); - break; - default: - break; + if(mFocusNoteDataItem.getParentId()==Notes.ID_TRASH_FOLER){ + switch (item.getItemId()) { + case MENU_FOLDER_MOVE_OUT: + HashSet ids = new HashSet(); + ids.add(mFocusNoteDataItem.getId()); + DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_ROOT_FOLDER); + break; + case MENU_FOLDER_DELETE: + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(getString(R.string.alert_title_delete)); + builder.setIcon(android.R.drawable.ic_dialog_alert); + builder.setMessage(getString(R.string.alert_message_delete_folder)); + builder.setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + deleteFolder(mFocusNoteDataItem.getId()); + } + }); + builder.setNegativeButton(android.R.string.cancel, null); + builder.show(); + break; + default: + break; + } + }else { + switch (item.getItemId()) { + case MENU_FOLDER_VIEW: + openFolder(mFocusNoteDataItem); + break; + case MENU_FOLDER_DELETE: + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(getString(R.string.alert_title_delete)); + builder.setIcon(android.R.drawable.ic_dialog_alert); + builder.setMessage(getString(R.string.alert_message_delete_folder)); + builder.setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + deleteFolder(mFocusNoteDataItem.getId()); + } + }); + builder.setNegativeButton(android.R.string.cancel, null); + builder.show(); + break; + case MENU_FOLDER_CHANGE_NAME: + showCreateOrModifyFolderDialog(false); + break; + default: + break; + } } - return true; } @@ -806,7 +977,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt break; } case R.id.menu_new_note: { - createNewNote(); +// createNewNote(); break; } case R.id.menu_search: @@ -867,7 +1038,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } private boolean isSyncMode() { - return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0; + return true; } private void startPreferenceActivity() { @@ -918,9 +1089,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } private void startQueryDestinationFolders() { - String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?"; + String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>? AND "+ NoteColumns.ID + "<>?"; selection = (mState == ListEditState.NOTE_LIST) ? selection: - "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")"; + "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")"; mBackgroundQueryHandler.startQuery(FOLDER_LIST_QUERY_TOKEN, null, @@ -930,7 +1101,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER), - String.valueOf(mCurrentFolderId) + String.valueOf(mCurrentFolderId), + String.valueOf(Notes.ID_TRASH_FOLER) }, NoteColumns.MODIFIED_DATE + " DESC"); } @@ -951,4 +1123,68 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } return false; } + + + + public boolean supportFingerprint() { + if (Build.VERSION.SDK_INT < 23) { + Toast.makeText(this, "您的系统版本过低,不支持指纹功能", Toast.LENGTH_SHORT).show(); + return false; + } else { + KeyguardManager keyguardManager = getSystemService(KeyguardManager.class); + FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class); + if (!fingerprintManager.isHardwareDetected()) { + Toast.makeText(this, "您的手机不支持指纹功能", Toast.LENGTH_SHORT).show(); + return false; + } else if (!keyguardManager.isKeyguardSecure()) { + Toast.makeText(this, "您还未设置锁屏,请先设置锁屏并添加一个指纹", Toast.LENGTH_SHORT).show(); + return false; + } else if (!fingerprintManager.hasEnrolledFingerprints()) { + Toast.makeText(this, "您至少需要在系统设置中添加一个指纹", Toast.LENGTH_SHORT).show(); + return false; + } + } + return true; + } + + @TargetApi(23) + private void initKey() { + try { + keyStore = KeyStore.getInstance("AndroidKeyStore"); + keyStore.load(null); + KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore"); + KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder(DEFAULT_KEY_NAME, + KeyProperties.PURPOSE_ENCRYPT | + KeyProperties.PURPOSE_DECRYPT) + .setBlockModes(KeyProperties.BLOCK_MODE_CBC) + .setUserAuthenticationRequired(true) + .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7); + keyGenerator.init(builder.build()); + keyGenerator.generateKey(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @TargetApi(23) + private void initCipher() { + try { + SecretKey key = (SecretKey) keyStore.getKey(DEFAULT_KEY_NAME, null); + Cipher cipher = Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/" + + KeyProperties.BLOCK_MODE_CBC + "/" + + KeyProperties.ENCRYPTION_PADDING_PKCS7); + cipher.init(Cipher.ENCRYPT_MODE, key); + showFingerPrintDialog(cipher); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void showFingerPrintDialog(Cipher cipher) { + FingerprintDialogFragment fragment = new FingerprintDialogFragment(); + fragment.setCipher(cipher); + fragment.show(getFragmentManager(), "fingerprint"); + } + + } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java similarity index 50% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java index 51c9cb9..1135239 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListAdapter.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java @@ -30,54 +30,87 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; - +/* + * 功能:直译为便签表连接器,继承了CursorAdapter,它为cursor和ListView提供了连接的桥梁。 + * 所以NotesListAdapter实现的是鼠标和编辑便签链接的桥梁 + */ public class NotesListAdapter extends CursorAdapter { private static final String TAG = "NotesListAdapter"; private Context mContext; private HashMap mSelectedIndex; - private int mNotesCount; - private boolean mChoiceMode; + private int mNotesCount;//便签数 + private boolean mChoiceMode;//选择模式标记 + /* + * 桌面widget的属性,包括编号和类型 + */ public static class AppWidgetAttribute { public int widgetId; public int widgetType; }; + /* + * 函数功能:初始化便签链接器 + * 函数实现:根据传进来的内容设置相关变量 + */ public NotesListAdapter(Context context) { - super(context, null); - mSelectedIndex = new HashMap(); + super(context, null);//父类对象置空 + mSelectedIndex = new HashMap();//新建选项下标的hash表 mContext = context; mNotesCount = 0; } @Override + /* + * 函数功能:新建一个视图来存储光标所指向的数据 + * 函数实现:使用兄弟类NotesListItem新建一个项目选项 + */ public View newView(Context context, Cursor cursor, ViewGroup parent) { return new NotesListItem(context); } @Override + /* + * 函数功能:将已经存在的视图和鼠标指向的数据进行捆绑 + * 函数实现:如下注释 + */ public void bindView(View view, Context context, Cursor cursor) { - if (view instanceof NotesListItem) { + if (view instanceof NotesListItem) {//若view是NotesListItem的一个实例 NoteItemData itemData = new NoteItemData(context, cursor); ((NotesListItem) view).bind(context, itemData, mChoiceMode, - isSelectedItem(cursor.getPosition())); + isSelectedItem(cursor.getPosition()));//则新建一个项目选项并且用bind跟将view和鼠标,内容,便签数据捆绑在一起 } } + /* + * 函数功能:设置勾选框 + * 函数实现:如下注释 + */ public void setCheckedItem(final int position, final boolean checked) { - mSelectedIndex.put(position, checked); - notifyDataSetChanged(); + mSelectedIndex.put(position, checked);//根据定位和是否勾选设置下标 + notifyDataSetChanged();//在修改后刷新activity } + /* + * 函数功能:判断单选按钮是否勾选 + */ public boolean isInChoiceMode() { return mChoiceMode; } + /* + * 函数功能:设置单项选项框 + * 函数实现:重置下标并且根据参数mode设置选项 + */ public void setChoiceMode(boolean mode) { mSelectedIndex.clear(); mChoiceMode = mode; } + /* + * 函数功能:选择全部选项 + * 函数实现:如下注释 + */ public void selectAll(boolean checked) { Cursor cursor = getCursor(); for (int i = 0; i < getCount(); i++) { @@ -86,31 +119,60 @@ public class NotesListAdapter extends CursorAdapter { setCheckedItem(i, checked); } } - } + }//遍历所有光标可用的位置在判断为便签类型之后勾选单项框 } + /* + * 函数功能:建立选择项的下标列表 + * 函数实现:如下注释 + */ public HashSet getSelectedItemIds() { - HashSet itemSet = new HashSet(); - for (Integer position : mSelectedIndex.keySet()) { - if (mSelectedIndex.get(position) == true) { + HashSet itemSet = new HashSet();//建立hash表 + for (Integer position : mSelectedIndex.keySet()) {//遍历所有的关键 + if (mSelectedIndex.get(position) == true) {//若光标位置可用 Long id = getItemId(position); - if (id == Notes.ID_ROOT_FOLDER) { + if (id == Notes.ID_ROOT_FOLDER) {//原文件不需要添加 Log.d(TAG, "Wrong item id, should not happen"); } else { itemSet.add(id); - } + }//则将id该下标假如选项集合中 } } return itemSet; } - public HashSet getSelectedWidget() { - HashSet itemSet = new HashSet(); + + public HashSet getSelectedFolderIds() { + HashSet itemSet = new HashSet(); for (Integer position : mSelectedIndex.keySet()) { if (mSelectedIndex.get(position) == true) { Cursor c = (Cursor) getItem(position); if (c != null) { + NoteItemData item = new NoteItemData(mContext, c); + itemSet.add(item.getFolderId()); + /** + * Don't close cursor here, only the adapter could close it + */ + } else { + Log.e(TAG, "Invalid cursor"); + return null; + } + } + } + return itemSet; + } + + /* + * 函数功能:建立桌面Widget的选项表 + * 函数实现:如下注释 + */ + public HashSet getSelectedWidget() { + HashSet itemSet = new HashSet(); + for (Integer position : mSelectedIndex.keySet()) { + if (mSelectedIndex.get(position) == true) { + Cursor c = (Cursor) getItem(position);//以上4句和getSelectedItemIds一样,不再重复 + if (c != null) {//光标位置可用的话就建立新的Widget属性并编辑下标和类型,最后添加到选项集中 AppWidgetAttribute widget = new AppWidgetAttribute(); NoteItemData item = new NoteItemData(mContext, c); widget.widgetId = item.getWidgetId(); @@ -128,26 +190,57 @@ public class NotesListAdapter extends CursorAdapter { return itemSet; } + public boolean getHasLocked(){ + HashSet itemSet = new HashSet(); + for (Integer position : mSelectedIndex.keySet()) { + if (mSelectedIndex.get(position) == true) { + Cursor c = (Cursor) getItem(position); + if (c != null) { + NoteItemData item = new NoteItemData(mContext, c); + if(item.getIsLocked()){ + return true; + } + } else { + Log.e(TAG, "Invalid cursor"); + return true; + } + } + } + return false; + } + + /* + * 函数功能:获取选项个数 + * 函数实现:如下注释 + */ public int getSelectedCount() { - Collection values = mSelectedIndex.values(); + Collection values = mSelectedIndex.values();//首先获取选项下标的值 if (null == values) { return 0; } - Iterator iter = values.iterator(); + Iterator iter = values.iterator();//初始化叠加器 int count = 0; while (iter.hasNext()) { - if (true == iter.next()) { + if (true == iter.next()) {//若value值为真计数+1 count++; } } return count; } + /* + * 函数功能:判断是否全部选中 + * 函数实现:如下注释 + */ public boolean isAllSelected() { int checkedCount = getSelectedCount(); - return (checkedCount != 0 && checkedCount == mNotesCount); + return (checkedCount != 0 && checkedCount == mNotesCount);//获取选项数看是否等于便签的个数 } + /* + * 函数功能:判断是否为选项表 + * 函数实现:通过传递的下标来确定 + */ public boolean isSelectedItem(final int position) { if (null == mSelectedIndex.get(position)) { return false; @@ -156,29 +249,41 @@ public class NotesListAdapter extends CursorAdapter { } @Override + /* + * 函数功能:在activity内容发生局部变动的时候回调该函数计算便签的数量 + * 函数实现:如下注释 + */ protected void onContentChanged() { - super.onContentChanged(); + super.onContentChanged();//执行基类函数 calcNotesCount(); } @Override + /* + * 函数功能:在activity光标发生局部变动的时候回调该函数计算便签的数量 + */ public void changeCursor(Cursor cursor) { - super.changeCursor(cursor); + super.changeCursor(cursor);//执行基类函数 calcNotesCount(); } + /* + * 函数功能:计算便签数量 + * + */ private void calcNotesCount() { mNotesCount = 0; - for (int i = 0; i < getCount(); i++) { + for (int i = 0; i < getCount(); i++) {//获取总数同时遍历 Cursor c = (Cursor) getItem(i); if (c != null) { if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) { - mNotesCount++; + mNotesCount++; //若该位置不为空并且文本类型为便签就+1 } } else { Log.e(TAG, "Invalid cursor"); return; } + //否则报错 } } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java similarity index 69% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java index 1221e80..85d3481 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesListItem.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesListItem.java @@ -29,18 +29,21 @@ import net.micode.notes.data.Notes; import net.micode.notes.tool.DataUtils; import net.micode.notes.tool.ResourceParser.NoteItemBgResources; - +//创建便签列表项目选项 public class NotesListItem extends LinearLayout { - private ImageView mAlert; - private TextView mTitle; - private TextView mTime; + private ImageView mAlert;//闹钟图片 + private TextView mTitle;//标题 + private TextView mTime;//时间 private TextView mCallName; - private NoteItemData mItemData; - private CheckBox mCheckBox; + private NoteItemData mItemData;//标签数据 + private CheckBox mCheckBox;//打钩框 + + /*初始化基本信息*/ public NotesListItem(Context context) { - super(context); - inflate(context, R.layout.note_item, this); + super(context);//super()它的主要作用是调整调用父类构造函数的顺序 + inflate(context, R.layout.note_item, this);//Inflate可用于将一个xml中定义的布局控件找出来,这里的xml是r。layout + //findViewById用于从contentView中查找指定ID的View,转换出来的形式根据需要而定; mAlert = (ImageView) findViewById(R.id.iv_alert_icon); mTitle = (TextView) findViewById(R.id.tv_title); mTime = (TextView) findViewById(R.id.tv_time); @@ -48,19 +51,23 @@ public class NotesListItem extends LinearLayout { mCheckBox = (CheckBox) findViewById(android.R.id.checkbox); } + //根据data的属性对各个控件的属性的控制,主要是可见性Visibility,内容setText,格式setTextAppearance public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) { if (choiceMode && data.getType() == Notes.TYPE_NOTE) { - mCheckBox.setVisibility(View.VISIBLE); - mCheckBox.setChecked(checked); + mCheckBox.setVisibility(View.VISIBLE);//设置可见行为可见 + mCheckBox.setChecked(checked);//格子打钩 } else { mCheckBox.setVisibility(View.GONE); } mItemData = data; + //设置控件属性,一共三种情况,由data的id和父id是否与保存到文件夹的id一致来决定 if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { mCallName.setVisibility(View.GONE); mAlert.setVisibility(View.VISIBLE); + //设置该textview的style mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem); + //settext为设置内容 mTitle.setText(context.getString(R.string.call_record_folder_name) + context.getString(R.string.format_folder_files_count, data.getNotesCount())); mAlert.setImageResource(R.drawable.call_record); @@ -69,8 +76,9 @@ public class NotesListItem extends LinearLayout { mCallName.setText(data.getCallName()); mTitle.setTextAppearance(context,R.style.TextAppearanceSecondaryItem); mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet())); + //关于闹钟的设置 if (data.hasAlert()) { - mAlert.setImageResource(R.drawable.clock); + mAlert.setImageResource(R.drawable.clock);//图片来源的设置 mAlert.setVisibility(View.VISIBLE); } else { mAlert.setVisibility(View.GONE); @@ -78,40 +86,50 @@ public class NotesListItem extends LinearLayout { } else { mCallName.setVisibility(View.GONE); mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem); + //设置title格式 if (data.getType() == Notes.TYPE_FOLDER) { mTitle.setText(data.getSnippet() + context.getString(R.string.format_folder_files_count, - data.getNotesCount())); + data.getNotesCount())); mAlert.setVisibility(View.GONE); } else { mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet())); if (data.hasAlert()) { - mAlert.setImageResource(R.drawable.clock); + mAlert.setImageResource(R.drawable.clock);//设置图片来源 mAlert.setVisibility(View.VISIBLE); } else { mAlert.setVisibility(View.GONE); } } } + //设置内容,获取相关时间,从data里编辑的日期中获取 mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate())); setBackground(data); } + //根据data的文件属性来设置背景 private void setBackground(NoteItemData data) { int id = data.getBgColorId(); + //若是note型文件,则4种情况,对于4种不同情况的背景来源 +// setBackgroundResource(R.color.user_query_highlight); +// setBackgroundColor(0xFF888888); +// setX(500); +// setWeightSum((float)1); +// setw if (data.getType() == Notes.TYPE_NOTE) { if (data.isSingle() || data.isOneFollowingFolder()) { setBackgroundResource(NoteItemBgResources.getNoteBgSingleRes(id)); - } else if (data.isLast()) { + } else if (data.isLast()) {//是最后一个数据 setBackgroundResource(NoteItemBgResources.getNoteBgLastRes(id)); - } else if (data.isFirst() || data.isMultiFollowingFolder()) { + } else if (data.isFirst() || data.isMultiFollowingFolder()) {//是一个数据并有多个子文件夹 setBackgroundResource(NoteItemBgResources.getNoteBgFirstRes(id)); } else { setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(id)); } } else { + //若不是note直接调用文件夹的背景来源 setBackgroundResource(NoteItemBgResources.getFolderBgRes()); } } diff --git a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java similarity index 64% rename from Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java rename to NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java index 07c5f7e..5520104 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/ui/NotesPreferenceActivity.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java @@ -47,66 +47,79 @@ import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.NoteColumns; import net.micode.notes.gtask.remote.GTaskSyncService; - +/* + *该类功能:NotesPreferenceActivity,在小米便签中主要实现的是对背景颜色和字体大小的数据储存。 + * 继承了PreferenceActivity主要功能为对系统信息和配置进行自动保存的Activity + */ 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标记 @Override - protected void onCreate(Bundle icicle) { + /* + *函数功能:创建一个activity,在函数里要完成所有的正常静态设置 + *参数:Bundle icicle:存放了 activity 当前的状态 + *函数实现:如下注释 + */ + protected void onCreate(Bundle icicle) {//先执行父类的创建函数 super.onCreate(icicle); /* using the app icon for navigation */ getActionBar().setDisplayHomeAsUpEnabled(true); - - addPreferencesFromResource(R.xml.preferences); - mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY); + //给左上角图标的左边加上一个返回的图标 + 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); + registerReceiver(mReceiver, filter);//初始化同步组件 mOriAccounts = null; - View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null); - getListView().addHeaderView(header, null, true); + View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);//获取listvivew,ListView的作用:用于列出所有选择 + getListView().addHeaderView(header, null, true);//在listview组件上方添加其他组件 } @Override - protected void onResume() { + /* + * 函数功能:activity交互功能的实现,用于接受用户的输入 + * 函数实现:如下注释 + */ + protected void onResume() {//先执行父类 的交互实现 super.onResume(); // need to set sync account automatically if user has added a new // account - if (mHasAddedAccount) { - Account[] accounts = getGoogleAccounts(); - if (mOriAccounts != null && accounts.length > mOriAccounts.length) { + 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); + setSyncAccount(accountNew.name);//若是没有找到旧的账户,那么同步账号中就只添加新账户 break; } } @@ -114,109 +127,141 @@ public class NotesPreferenceActivity extends PreferenceActivity { } refreshUI(); + //刷新标签界面 } @Override + /* + * 函数功能:销毁一个activity + * 函数实现:如下注释 + */ protected void onDestroy() { if (mReceiver != null) { - unregisterReceiver(mReceiver); + unregisterReceiver(mReceiver);//注销接收器 } super.onDestroy(); + //执行父类的销毁动作 } + /* + * 函数功能:重新设置账户信息 + * 函数实现:如下注释 + */ private void loadAccountPreference() { mAccountCategory.removeAll(); - - Preference accountPref = new Preference(this); + //销毁所有的分组 + 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.setSummary(getString(R.string.preferences_account_summary));//设置首选项的大标题和小标题 accountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() { - public boolean onPreferenceClick(Preference preference) { + 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) + R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT) .show(); } return true; } }); - + //根据新建首选项编辑新的账户分组 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()) { + 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() { public void onClick(View v) { GTaskSyncService.startSync(NotesPreferenceActivity.this); + //若是不同步则设置按钮显示的文本为“立即同步”以及对应监听器 } }); } syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this))); - + //设置按键可用还是不可用 // set last sync time - if (GTaskSyncService.isSyncing()) { + // 设置最终同步时间 + if (GTaskSyncService.isSyncing()) {//若是在同步的情况下 lastSyncTimeView.setText(GTaskSyncService.getProgressString()); - lastSyncTimeView.setVisibility(View.VISIBLE); - } else { + 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); + 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)); + subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));//设置标题以及子标题的内容 dialogBuilder.setCustomTitle(titleView); - dialogBuilder.setPositiveButton(null, null); + dialogBuilder.setPositiveButton(null, null);//设置对话框的自定义标题,建立一个YES的按钮 Account[] accounts = getGoogleAccounts(); - String defAccount = getSyncAccountName(this); + String defAccount = getSyncAccountName(this);//获取同步账户信息 mOriAccounts = accounts; mHasAddedAccount = false; - if (accounts.length > 0) { + if (accounts.length > 0) {//若账户不为空 CharSequence[] items = new CharSequence[accounts.length]; final CharSequence[] itemMapping = items; int checkedItem = -1; @@ -224,83 +269,110 @@ 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, + 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); + dialogBuilder.setView(addAccountView);//给新加账户对话框设置自定义样式 - final AlertDialog dialog = dialogBuilder.show(); + final AlertDialog dialog = dialogBuilder.show(); //显示对话框 addAccountView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { - mHasAddedAccount = true; - Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS"); + mHasAddedAccount = true;//将新加账户的hash置true + Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");//建立网络建立组件 intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] { - "gmail-ls" + "gmail-ls" }); - startActivityForResult(intent, -1); + 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,用于显示几个命令时,即change,remove,cancel public void onClick(DialogInterface dialog, int which) { + //按键功能,由which来决定 if (which == 0) { + //进入账户选择对话框 showSelectAccountAlertDialog(); } else if (which == 1) { + //删除账户并且跟新便签界面 removeSyncAccount(); refreshUI(); } } }); dialogBuilder.show(); + //显示对话框 } + /* + *函数功能:获取谷歌账户 + *函数实现:通过账户管理器直接获取 + */ private Account[] getGoogleAccounts() { AccountManager accountManager = AccountManager.get(this); return accountManager.getAccountsByType("com.google"); } + /* + * 函数功能:设置同步账户 + * 函数实现:如下注释: + */ private void setSyncAccount(String account) { - if (!getSyncAccountName(this).equals(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 +383,32 @@ 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(); + 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,49 +419,73 @@ public class NotesPreferenceActivity extends PreferenceActivity { getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null); } }).start(); + //重置当地同步任务的信息 } + /* + * 函数功能:获取同步账户名称 + * 函数实现:通过共享的首选项里的信息直接获取 + */ public static String getSyncAccountName(Context context) { SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); } + /* + * 函数功能:设置最终同步的时间 + * 函数实现:如下注释 + */ public static void setLastSyncTime(Context context, long time) { SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = settings.edit(); + SharedPreferences.Editor editor = settings.edit();// 从共享首选项中找到相关账户并获取其编辑器 editor.putLong(PREFERENCE_LAST_SYNC_TIME, time); - editor.commit(); + editor.commit();//编辑最终同步时间并提交更新 } + /* + * 函数功能:获取最终同步时间 + * 函数实现:通过共享的首选项里的信息直接获取 + */ public static long getLastSyncTime(Context context) { SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0); } + /* + * 函数功能:接受同步信息 + * 函数实现:继承BroadcastReceiver + */ 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)); + //通过获取的数据在设置系统的状态 } } } + /* + * 函数功能:处理菜单的选项 + * 函数实现:如下注释 + * 参数:MenuItem菜单选项 + */ public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { + 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; + return true;//在主页情况下在创建连接组件intent,发出清空的信号并开始一个相应的activity default: return false; } diff --git a/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java b/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java new file mode 100644 index 0000000..1662f29 --- /dev/null +++ b/NotesMaster/app/src/main/java/net/micode/notes/ui/VoiceNoteActivity.java @@ -0,0 +1,47 @@ +package net.micode.notes.ui; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.speech.RecognizerIntent; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.Locale; + +public class VoiceNoteActivity extends Activity { + private static final int REQUEST_CODE_SPEECH_INPUT = 1000; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + startVoiceRecognition(); + } + + private void startVoiceRecognition() { + Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); + intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); + intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak now..."); + try { + startActivityForResult(intent, REQUEST_CODE_SPEECH_INPUT); + } catch (Exception e) { + Toast.makeText(this, "Speech recognition is not supported on this device.", Toast.LENGTH_SHORT).show(); + finish(); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == REQUEST_CODE_SPEECH_INPUT && resultCode == RESULT_OK && data != null) { + ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); + if (result != null && !result.isEmpty()) { + Intent intent = new Intent(); + intent.putExtra("recognizedText", result.get(0)); + setResult(RESULT_OK, intent); + } + } + finish(); + } +} diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java similarity index 97% rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java index ec6f819..2bdb5c2 100644 --- a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider.java +++ b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider.java @@ -34,9 +34,9 @@ import net.micode.notes.ui.NotesListActivity; public abstract class NoteWidgetProvider extends AppWidgetProvider { public static final String [] PROJECTION = new String [] { - NoteColumns.ID, - NoteColumns.BG_COLOR_ID, - NoteColumns.SNIPPET + NoteColumns.ID, + NoteColumns.BG_COLOR_ID, + NoteColumns.SNIPPET }; public static final int COLUMN_ID = 0; @@ -70,7 +70,7 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider { } private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds, - boolean privacyMode) { + boolean privacyMode) { for (int i = 0; i < appWidgetIds.length; i++) { if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) { int bgId = ResourceParser.getDefaultBgId(context); diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_2x.java rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_2x.java diff --git a/Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java b/NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java similarity index 100% rename from Notes-master/Notes-master/src/net/micode/notes/widget/NoteWidgetProvider_4x.java rename to NotesMaster/app/src/main/java/net/micode/notes/widget/NoteWidgetProvider_4x.java diff --git a/Notes-master/Notes-master/res/color/primary_text_dark.xml b/NotesMaster/app/src/main/res/color/primary_text_dark.xml similarity index 100% rename from Notes-master/Notes-master/res/color/primary_text_dark.xml rename to NotesMaster/app/src/main/res/color/primary_text_dark.xml diff --git a/Notes-master/Notes-master/res/color/secondary_text_dark.xml b/NotesMaster/app/src/main/res/color/secondary_text_dark.xml similarity index 100% rename from Notes-master/Notes-master/res/color/secondary_text_dark.xml rename to NotesMaster/app/src/main/res/color/secondary_text_dark.xml diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/add_node.png b/NotesMaster/app/src/main/res/drawable-hdpi/add_node.png new file mode 100644 index 0000000000000000000000000000000000000000..f122cfb070be3bed1cb7732e92e58d382cafebf4 GIT binary patch literal 2296 zcmVQd{GqLuq0zi zP8vj=Y7pvscA4yv1C(8L0T!cB10lVNmb(* zSFuB|E|pfJne+EyXV$Z;o!jp0%DVh;*l%Xfob&(xIp4X@5C9b$vLS_v>VZ|qy>*8P z8x-4+C}h1-%-8;sQ|xd@vU+}AZIO~*1ZXca_5j!ppc;T?MKb_=17L~>lK_7z1mCKt zFh2U|di+r-^`%l|(%7c&(sktrQqpV8sAq=A(13$sB1j_K6oM~nn)%m}0qsty9Hb&u zYPqm2hU3~7|Lo+K@{>Ti8_|9v7-TOy@cL+jGBx-QO1N#AD< z_)rLnd0`?z2)?3e^5p1X>~7Q!Dwtw*&Bl)mL!4!x3W$(O;i)&LsNB-2Zg3sW7|?~GO6^k#NHL5Qb0@spU2}y$H;(oA9+$Nv{*H#Uo!UP zTQUHON--xEgo*OF(VkCD3f%^^buDPq(`CIZ(Nd6eoEj8~Vopo~iK;5SW3Vq=n4MAPhS><>;`JZw(mP!zMe@;|ekbD^WC5>d>F zW2*eg*s%IuP!$7Htf6(OHknjD1EVsd3KuFRqF5RO^YOU(+~{EJUJ&&HQ%u*zSuiT$ z^vx=wSQ-Nrx-QN=``t@kHm9+3f(I9DywGACk&<4`ky+l#W;hyvQ263g)r&i7o=QF= z6n-~XoT#vr)cvhzUO(z#a~k_n?3X=vF+99;m>Kmst8Jk|01>|4x^>|@H$L2C0Kl>C zS@G3_P5)tu+GY7gHFpyjKd}G7ix=M6?x~(H#XkPHwv#35bCyO#6eHrv8y{{;+R0wK zvRNnM$)fdWsb1~iXA@5!^RwTVVx}ohdGI+Zipd;G%B(n%VY`q_Q}p=RFOa$JoDrJZ z^j%Wo72;Ik6RhF86BiO5SE^ik2+w>A!B&tG#~R!8-CjQMq}ZaaoUmPAOp3XcVlgRZ z-_UjCgd@*z6qAyU`*fMBnqo|Vl=K?%p;&8YvW6KgL96R(q!=;4jE2J<$)^#PV)OHA zlW%FPc8Xc|=I7PJ2um^3r22HCj>IxBTh|;O!-?G}<`%y|Y+u{=q@+XH_S@LG)0idn zJUMC!yl~-SQ!L{iMVp6*(0(^RxKfN6yL?N-`5O|aYt`d_mQ&0TCrX@c3o~}R>7cs( zfz)=ex1AnN5&~1q_?LYvdj-P2wtgpa=rKkX_53O^3GA__B~HEEa0W~%v<;aRCG88> zx!8dQIm?VV@(>~TFI#JpZ(O(LR>hXC?m6-BVfov6?W_PGf^mCPl;^Ys?gK?FUy4;$ zE}g#am|MYPoDl`?y;7-fuGCN4I)tSdJeZ{VD3LG4q))oVz>f!(;VI@!EAU)QC#1G? ziL7=b7tRsp=3-|$zW2YlN7|8wuI@Q)c1}A3AHCcH0NpKZyPaFMFLt0oekmC{$u0p( zjXX23y}puT4VVa1%=iKTm?4Q$V=gBKLxLcL;EC}OsIVtI&9mg3z8xvu- zN zyD*}{8IS=Xcm!c7R#CAux-?z3F6Lqt6-EMKDK^+w{tXclYn@_57DG{X15uq(JlJTyZ<_RaItLE=cgIJRH^MvIx;hWm^s)Yr$pBek2>cxtQ1!1DR+-OboYctul_~E>p+Qv40TQaHkN{RjX zrcnwJ0-wg?X4l9-Y$~7UUH8R;NK?CBy|AEOPA`oAVJ=f4D?VUK$ zuRW^Xve=~veh0u4(~ALs5d7YjEsGrv=j64e6xnE|uG#pZVTkk0sE#Vle1r%yswz*8 z4XYO;Ne>aev)b6I*DmVHSt;q&m2i#_{DG#)Q=@~i`%$HtS1;y=>syQ?ONMxh84Y%C zA6J=R)QDe5^&9RL7v_txr>I15g8?0;$EbB!EW%?pvRx_*_wV zq@uzY8tjYDAsBrkp;)mCVAV@WD7F@4B|eW6B=2J5FnVrCF4>@1K-r*}3;sVkFnq66 So=*(`00007i+{a)e(~thtKq@r z`TqOy{NnrZ)&2qh;(EQ0YpAi+ump5zW4aarsmK(bp$%u^E=vJVV!K^8S|F_ zJdMe|0yx`!F}}XI{}u3E0e!yz=X=ZToyoBlz!(4lNCHbxx<@buhs$FQ4lDu?0SuaZ z8n!VH*K_y?VwjDs?$h41?rgX_$>;vNGtjHyr?=0Bzh8D|T(}jhDUARUT0zrf@E zKj$CC^KAky`2w4s0qItcpj@a^LU`pY3B4WBV@9+aN-UL8hjvH$@( z0!}sqq_5I>v{q+tS8}9Ox1Ry9K%cDdFcKSv-psJB)-C8TWI!+_gPfC6i!Ky4r1|Ph z9XQDf=~R~eEJ7FCPaEjX-Eb6Ii-^st`)9s~6EdlSs+lxt77#IBj*N7ZcNF zvZuuXDB`wBG|(!%Ubr{29yljJ@?8Mn+!*tfBuw+M;aEmqOW)hOT^@JRn4R^s8JNKt zAoNY=oYx8t@0l6PC_ru_-9b>U}A1U5x2keI(c7Z5T1uF-gb~B@sfoIoEPHsAm&=dC!@a1tPDA2S9*G|h3jl@=T+DuqO#cKgbTLBs(W*nTJO`7 zR(vRDaYc0Q7?yx{Jf|1$*&d2xr4 zk$wPCu?SF?kBdio4{5|%JoP>_n1Jt(9F8K5`zfflwj{3pgk92Q5a;Tu}BP;&h1oAB#)kjIb$wJ zXG1m|1na0})inS+b*{!X-Zq!TwA1)}AwvS}^kme@T4lrFm`2D1<6(nY3E<2QNfCGx zQ*BMQu^YM&Z5J8DyxERuO^c12RY1W28BD;+gn@V+#-%-V5U1Fz(iQ@VY}9jOT%H5+7C8z9_L0O?NKjbCjp9WbSugxo(pIM17DV0XL>mZ zv>9-^44wr@J%;`QkmnZj%8Uc!`;dYIu|zzFz6ROLnh4n?iGg9Zx$x|54j@O?Q=;NvXd66e3yEJqZN6o8+RDHD0(XIvFHzJsc z2-LwJ9s@d9j^$eXNSU2IbYQYGrVR$y_4CK;`z-?yNS&J%2hxz_rLTP^D{$zM+E4qY=JR|EG#$(R;*XN zH%nyQ?8O?S9umtG9~3S#F{rnj8251p>Ht|=9W;K8!;u`+wray#ScfNTzk-MY>P`ZX z*b<|ih)zb0=^3_w1s^ZnGP$mWD3>LU9nXUE1e! z{4%0Vtc&2);wmEwX4a?gHF;F}Y|LQ&j)2)u@yi5G<4Zq24YP$w%VxhARsbDPk>X$# z5XSPuP2ibnTAvWw#u03h{a{m$S})GI?yc6KfcP>PXHe3Lwc$g*mK2BsaQ~+beA8QF ztTBxTr`A${aXU3Ir#4wnK(VuN&QUt_7y-qVb|A&DSAmthnE80`^|Q}n{A!8zej~NxxXM^?CsvM!J0xr1nE|Ze2NUNAXM> z4Mb1717|?6k6?lnKF7wB_SOg8!(WhWpwg?95!|*Fq5;KR_iO`|oV3$XUX5M*F>q(Z zvdNm+iWn0x>(ltC?&2{Jr!J%PeWV@?_=l{RSARBRX3#>c4EhEdvz$l^U zG@W(TkTOI5s{jB1 literal 0 HcmV?d00001 diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_red.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_red.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_red.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_red.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_white.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_white.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_white.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_white.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_title_yellow.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_title_yellow.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/edit_title_yellow.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_title_yellow.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_white.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_white.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/edit_white.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_white.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/edit_yellow.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/edit_yellow.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/edit_yellow.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/edit_yellow.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_large.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_large.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/font_large.png rename to NotesMaster/app/src/main/res/drawable-hdpi/font_large.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_normal.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_normal.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/font_normal.png rename to NotesMaster/app/src/main/res/drawable-hdpi/font_normal.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_size_selector_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_size_selector_bg.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/font_size_selector_bg.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/font_size_selector_bg.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_small.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_small.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/font_small.png rename to NotesMaster/app/src/main/res/drawable-hdpi/font_small.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/font_super.png b/NotesMaster/app/src/main/res/drawable-hdpi/font_super.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/font_super.png rename to NotesMaster/app/src/main/res/drawable-hdpi/font_super.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/icon_app.png b/NotesMaster/app/src/main/res/drawable-hdpi/icon_app.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/icon_app.png rename to NotesMaster/app/src/main/res/drawable-hdpi/icon_app.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_background.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_background.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_background.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_background.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_down.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_down.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_down.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_middle.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_middle.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_middle.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_single.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_single.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_single.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_blue_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_blue_up.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_blue_up.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_blue_up.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_folder.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_folder.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_folder.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_folder.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_footer_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_footer_bg.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_footer_bg.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_footer_bg.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_down.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_down.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_down.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_middle.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_middle.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_middle.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_single.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_single.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_single.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_green_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_green_up.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_green_up.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_green_up.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_down.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_down.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_down.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_middle.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_middle.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_middle.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_single.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_single.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_single.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_red_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_red_up.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_red_up.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_red_up.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_down.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_down.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_down.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_middle.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_middle.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_middle.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_single.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_single.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_single.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_white_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_white_up.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_white_up.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_white_up.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_down.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_down.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_down.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_down.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_middle.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_middle.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_middle.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_middle.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_single.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_single.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_single.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_single.9.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/list_yellow_up.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_up.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/list_yellow_up.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/list_yellow_up.9.png diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/listtest.png b/NotesMaster/app/src/main/res/drawable-hdpi/listtest.png new file mode 100644 index 0000000000000000000000000000000000000000..edd692a22e8e24a20b49d3d4081b8d805ba0361d GIT binary patch literal 2295 zcmVeh4bY)!^&fNe22#iTYK~#90?VZVv z97Pa@BeJ_^=~;RPTNoQ*8!T(MAeJ!_NF2Z%5JHGm;sFpBUVt~?eK`673>R)(kpLlq zkSqbV8P9ZgWpJoos%z`6%B;%BtoRP2>7}xB`7<&iD>DnP-FywQ5D@?X<$UA^xcaiB zAXxlSmQ*?>*H*o}6ZCW6jkQQbKt3uGGi_f~itIN_$ZD}_L(7zskqKlYk&S;03CSlLyp$sm4SM+D`)_>y>D#Zqa=X7Z zl|G8_m98fwjj z9BDArtwB$15Z3>mBiM%a|2 z#IOq*t%|CNd(_w< z)x=rtoGgcfp3 z(W2l4BJd)V5$wX#8;(bOk)vl=Ik(q}x7UQG`*R0?qr)y_;S*XlkrT0wEx~YnET^Fi zmnSQ76c{0LY{|9fGstd8Lm4hlHaiX8xy>>jEe8yqX00R7IR$|&IX4My$|sDcrWE1u zF|<6NfNPBSj`eZa%|dmjM2___boNa=nO2|w)}qJd$L0hgLTKud-mdT_)^0JQEUe?& z&WDJBX;H`}ccKUEdM2^hl5$Ep;$a6o!scWam@WTWBIBrz1!Xh#> zY)p6KavW!a@tOto7ae)25M$o=(Dbd=oi#j`H;=wN0ZH7mkq} zlfD!YvF*V^E>?zkMv-+ghL!D9&T-;I=C0@w07ALTR~skcOiGTXd5{^)aL6-_O}DS* zorIKKYU?kE(zQ}F-M*F=n8~bU*fia~j3R3x7;3xSB1geKST_g}ISLI>cSvV6?nNd!Z-g{Inz4==K)c9DSXjTM5wGFR^~n&B+h9gO_1woi-;r6_Y7>&#K*HMbLHpF6 zu$54z5$w;;c_T#ts6S60@;z&rllKmZtP63wF1nj=8LZ>2Nv?CTLeN@dy5Y&a924i- z)M(tev%d&#vn7ns>SPL99MV6!57 zQ4l8N%CTltvDn}eOiVgAY|GN5mY>R=9=o_7tT_{_Ep={m5FITC4o*eU+2BTmVHyD- zsG|5l#yS$TdAy{+2M#@N#X80(ostGh+yj^Mt~-b;?>{NW#o4zyX&)EyNt@XU^pShs zfZ*mFpX_1GL`3yh2-$+&5^&(AkaV>Gz04>*uc==sd~A2n9-mADgvq~x&Vp-wvNHf&pRi#Ce6c)KEQmQ zSJU5r{(N|2gs3Q*)J~B*VRkeZG*FYX!5R^#(e(TKKO7ysdwlg4L`W3c4z5LCwqA|N zl(CtgU`2CfTt?R834M3(r^`=YzjJ5r;NU=^9#3XAa`8B6lsWPOT6`2x$l$e`r}2OB zdhB;j5AMExbo;sC?rwj$yED6IiwFRkNE3ik3PbfR>yw-)l}XduEaeCQMAYj+A89h3 z9FK1h8M)f=AUcxQNUxHsGxs9q0IrP2%Oct?NX-wH*(P2uv}fl`0` z^6TlFr`yNJW33~l5a20A52LexAN=?GSf59F60NRELR{8_U&DFweu8(IPvJ!?#M9iF z+!e}kJdN(%|MAMRS5Jm}{hqowJG+=nc8F*^IeU2V_@5__&ZigCNYkp!Jq;|AH^t0v zbveh=R!I4dSw49A#rIx1xqao*R=*c%9nbwBfXeWeCHr4WfUk=8mQ z9TDlo7+tRqCJR-RLeY21D`Yw7R?d_)O1I8beh(AA){5!I%vbXg%Ne~AuW|Lm_4Pcz z0#`l2Y{KzU+7fx>wA7ldTT`v4Gn+_6L|QNQ_stb)J|q;SkbQr{L5Mb3T#`y^jdpSU zw-(bpWgn(qY$VOuIJC%csl1Z!73Q``u&Jz<&sQZ|KU>>~7!_Z;no#1>{{d=rWgY>O R+yd0|t#h?nO@(!8wVKje z=SVgH^g_D#Vlxr=R{$@;Xq8gunM}q_8bBtKag|c%Ay!_*c5LJeaFTag>*H;gQEPon z@-F1WdM0F@7POPR^gJ)MEx0e9=cPzq2A5-PPDsKnBHsmg$cY6Lg0(_@9?NWhilg0e zoKuoFm~YJy$s5OUPUDsX%bb|5Y*E?g7J!xHi3A7m2B1r_PO=W53*arz39;?7&;kIY zQmHJKMWz>*?Gkx6old9yKKbs-*t;UO{Vh5&#$=(CDh0f1Bv{gsL>+dlE`dafVEAm8 zl(n|t54x`VD}e)PYwcfkUi#8;%0UckZ9&Pw0sznDa`_>F10Rx7sq_HgSsXY6fLEcU z6QlbXKvCv4D?p$KwIXD{E~TKyEl3mH_-%qyGrtXTm@q*L8~RoJ4;$9*^f0b<^W` z8;LxQ#iPSrNPz#~N(LPGQW|jLaM$t>6YoAuq?)ZrrBd0=!^D?^KFvaG?DcWV4H!xM hJl9&^E{aTy`~habX<50tu~`5B002ovPDHLkV1h#PT!H`q literal 0 HcmV?d00001 diff --git a/Notes-master/Notes-master/res/drawable-hdpi/menu_delete.png b/NotesMaster/app/src/main/res/drawable-hdpi/menu_delete.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/menu_delete.png rename to NotesMaster/app/src/main/res/drawable-hdpi/menu_delete.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/menu_move.png b/NotesMaster/app/src/main/res/drawable-hdpi/menu_move.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/menu_move.png rename to NotesMaster/app/src/main/res/drawable-hdpi/menu_move.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/new_note_normal.png b/NotesMaster/app/src/main/res/drawable-hdpi/new_note_normal.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/new_note_normal.png rename to NotesMaster/app/src/main/res/drawable-hdpi/new_note_normal.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/new_note_pressed.png b/NotesMaster/app/src/main/res/drawable-hdpi/new_note_pressed.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/new_note_pressed.png rename to NotesMaster/app/src/main/res/drawable-hdpi/new_note_pressed.png diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png b/NotesMaster/app/src/main/res/drawable-hdpi/note_bk.png new file mode 100644 index 0000000000000000000000000000000000000000..61cf055ccafb1e8679de1bc44e5d05f77201f003 GIT binary patch literal 484 zcmeAS@N?(olHy`uVBq!ia0y~yVB7^{XK^qAN!L5fost!q`9LmFB6C>j?=8JZA>Ysoy#Ng@b K=d#Wzp$P!tj-34f literal 0 HcmV?d00001 diff --git a/Notes-master/Notes-master/res/drawable-hdpi/note_edit_color_selector_panel.png b/NotesMaster/app/src/main/res/drawable-hdpi/note_edit_color_selector_panel.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/note_edit_color_selector_panel.png rename to NotesMaster/app/src/main/res/drawable-hdpi/note_edit_color_selector_panel.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/notification.png b/NotesMaster/app/src/main/res/drawable-hdpi/notification.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/notification.png rename to NotesMaster/app/src/main/res/drawable-hdpi/notification.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/search_result.png b/NotesMaster/app/src/main/res/drawable-hdpi/search_result.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/search_result.png rename to NotesMaster/app/src/main/res/drawable-hdpi/search_result.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/selected.png b/NotesMaster/app/src/main/res/drawable-hdpi/selected.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/selected.png rename to NotesMaster/app/src/main/res/drawable-hdpi/selected.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/title_alert.png b/NotesMaster/app/src/main/res/drawable-hdpi/title_alert.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/title_alert.png rename to NotesMaster/app/src/main/res/drawable-hdpi/title_alert.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/title_bar_bg.9.png b/NotesMaster/app/src/main/res/drawable-hdpi/title_bar_bg.9.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/title_bar_bg.9.png rename to NotesMaster/app/src/main/res/drawable-hdpi/title_bar_bg.9.png diff --git a/NotesMaster/app/src/main/res/drawable-hdpi/unlock.png b/NotesMaster/app/src/main/res/drawable-hdpi/unlock.png new file mode 100644 index 0000000000000000000000000000000000000000..d4eb1a1fdb11504aa3dae5542067a79b29339529 GIT binary patch literal 754 zcmVsuU5j z%patnj+76GoIh}=tdPPf+*wpaa_LAZT+q-`*rq_B1Hz_Y?l>+NybuT(X(hP3o%iO= z?9MJ>X`bg5Mx)V@G3L-1vk%}IfP%d40%()`PO_o3z6^q(YwLTVWipu($r^wG0Ao1@ zBx{*WrnEA!=Xp7jrvOGN0385L02eZv@+|q?h~%l~dAVhy-UD!(aMmJO)mj%Tm5NHv zsZ=UTYh5H+1<*>&y%nEU;Licv#iLb9o#gX*$2Nd`KJO@{P7E{5zQ~CWFz()YrfB3eZ@~jEq1*Tmz%KwFJ6ac=! zzBB%2f;Fv!B|tY~Dw4sNC;tjGhSgO7+VW>_K@qOa1S4!nZIC>JGXmvgR1@Zl4OYTFDw*UYD07*qoM6N<$f+$s6H~;_u literal 0 HcmV?d00001 diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_blue.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_blue.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_blue.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_blue.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_green.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_green.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_green.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_green.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_red.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_red.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_red.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_red.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_white.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_white.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_white.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_white.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_2x_yellow.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_yellow.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_2x_yellow.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_2x_yellow.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_blue.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_blue.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_blue.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_blue.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_green.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_green.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_green.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_green.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_red.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_red.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_red.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_red.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_white.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_white.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_white.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_white.png diff --git a/Notes-master/Notes-master/res/drawable-hdpi/widget_4x_yellow.png b/NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_yellow.png similarity index 100% rename from Notes-master/Notes-master/res/drawable-hdpi/widget_4x_yellow.png rename to NotesMaster/app/src/main/res/drawable-hdpi/widget_4x_yellow.png diff --git a/NotesMaster/app/src/main/res/drawable/ic_fp_40px.png b/NotesMaster/app/src/main/res/drawable/ic_fp_40px.png new file mode 100644 index 0000000000000000000000000000000000000000..122f44257b1aa188955ab01e5bf71a5f079b1da5 GIT binary patch literal 4001 zcmZ`+X*d+z`yORq$19SAMkXZ7SjQU1l4O@bh_PjCgR+dV??i>NdxauD!>W=066X%!Ys~F{BJNb zp3iBgpM1`N-b4GoHUQ9&!FJ-zaL(xhEev!3wK&1Gb0UH;w73rdgnGT+28SR=ex}F42!>^Z6E+3b?N2)BNGi~uNEAnbmk<4cPVkkKme zi?Dt7c=Hs;Cx;j0GkvK7>%d`!UXK_fPa30w`BKyye-$Q`x<9kXAt+fGNv2$Q5A72~ zZZ#j|P>#`<$j@_^I3d390}%&}$Lcl7{VwlsWxx8JIF_43w&XS)YbI@+cwx=dB@|XX z5hNAF43JpRM;BubLTA4u*{vz_$eqRi)=lgv7$UaoAP&o#9VUKSwT72?>LU0pEQj`A zN0OsdmhQ;ZosnX#z&uIJq-%w3HKn7hpHQWF;CGP8d#t?+w$XB;X$^3qf4QyD2t-E` zBrX z_*;U?A&zbk=jvt?*r(-`RK|JpKanT9v&(RgohA!=tr;=pIm#nAdkhV&+NSjOLu+7+ zY>#$DRsaYT#hAtZk5!pX2!p2>2((ZjD#dtRV{#K(bF8YolG?Q#JQwctDfF0g#I9?QVA*PAg>(irq{XraS`YpW#K=73X2F*PPj1o~QBGqa<0} zFCaQxfJK^!@rL4JMK^+_4aU!Rr&n32LPTNf&=SA&lW0TDJ-kdkp(9FRiItU^;QvhR zrq@4`z3dAIiJx5x+3u(l3t%f76h(VSwZyA?HJgc@ktM6{10HQP=5ATR>5)t! z>S8`QRDt=K*HGC*8&d(=cfwg0z5c~MY6mShJR&(zn!Y3AL5Ylx=%e{>ysVc}=sf4=)hL_zrBiI6QXpytI)Cw*FrEj z&EYTF{1C4Y(LfJ;S?H3#=H%pnef}(BI^CfRas^mY+xBv0M3lDB!%`4&V%0+OTKxTP zVs|9HuqRyRLhI*BJy`c}PF}6m%H?*oHXP5Lh_*ed_zMY*++X>9a3~z8a+zigE+&>$ zI=SxtE`=X_%k-ul%1iQ~5|la1-+o|CEWKG+(u|Q=^M185a{pxhs>e39rg(elNV%f2 zwtE3M7O}NzbXuGJsqKAAY2l(z>t2G`jfK;hUXhcMBp5ar;O`cDi`!yNYG%ekP!Xl> zq_q>0$A#=3%@bh;Y-?~KuH7!)a@|keu%#YNi*!G4Q|$=3u>6=_J8Ozd1QdRvy3THd`FUfZ#GZ9Cx!Kme6ob$cGrx8z&HPjoo{Kh7JLJ;e(bD#WDNT=<-P~Z^O z-zdUVhpjL?sQbf~m?79jB^K#{^W8?7?2|)+k()!3|YDGV?hQlzN~^ z?p?{(L~4fm_ii;ZVk^-;_pFm5JH9hESZ5(~0VG~?g+Gy-k2tLDX|kKvZ15V(78{lQ zSj>rC#k)sVIv)+@(xOQX7Kfx4I~-uJVL!~(4>sAV!`wN}jmq%GOXl>4nx+^Z#Xxub z!h1HN+&)_|v8{be@9_{9{tT=(Jr(+SnMX2f{vNw|SUnxX7dvzovEZuZKiXlu>fZtj zn|m~dgo{I?6Ca%AR>`OquUTThSf~0SMwxD(99K5xV7gHXV?O~p2EknTy0fc;4>Y@u zl$HGlP5J6QPkSFm;>ndY@1(+3Qz==rr@B4M>{@(Q?gm@ zku)c%)<}lP@KZ5?^^F~b<{JfzT|F5-T^L7waZ=oX9kDe)F<^KN7}u9jQh@IB{(D*< zm;E8RiddTMe`?KU+p^Ab0U^hEN^W>ZJIH2}xWx7=g2WqMk724RI+7?DV{L?V5gtxwDcp>^wH)w?t;i=9f7L?hopsj zNi+eEYkgfZTSvDiX2X=ZW>FXCR7kEup<8;m)2U?RqTwINt8?$#+PtFl7-XHJ4#Ec} zyX{gXc^S__nCVMOLW6inXf;prrprMZf<`%-ST*v1H_f}8V%=_0YT@5HZe89zK$9Ci zyLy*mpTBbqkDu%p{_9Hkryo&E+>6XL5~$>jSR2VzV}1huO-VpH2Dd+6aD42v$AP@2 z$jiIu`r*(q%~?0Ge(h^U&VTB!+SVnv+9DbHO=zIecP77Uk8NJ2^+R`)+?D)}^JpYHMTvGX@TQ(o8~GXYnF0q+25XRvhgI!fk8Gze;f$p$!jg6 z?U|!QqZEX7qg>e-Ad^z1`s^NGkL^R|8-BV5FeHrqe1UUC4@zJ8@~K?;pJuypfr7^A z?7)Meh&ENj9N1pwz)FQNxE}Wsx8mu|KTwqJ8;&n^_SDGNJWLu9O}Gx~*qfSuC`%0D zL<)2jk9Twj<4%>qN*T^1r@0>LA5F*$&C`v3e@-Sa^W1Kl91>PZTb3k6xwmlETv7`r zI~)3N?7-79w2*Fu!>^&M$sTK)Th2#W-_>`zRiz8595~Ho*ehwL-r*@PU+fViMLS8Q zeCc$vyO)Z= zDxlOiWw&{D;~5-&ohSPx>}7gr}N9_oflc@N!2BzHA3UB zi7bz}F6i+cb=&<4&44NP>W23018F{3;Pc;tA$B`k2Gftpo1kKu=Q!8a?E?7_+CE1$ zn&cx5rF!>06Z+oCrG=ZaaUwoHvI8q-xcw;kYFJM2{zZr(u!>=>z_KJ6^y?h60&%%6 zI~IuU2d$fLoo)g12g`&BMZwbbP9t{i<>E*5NRIgMB4gDd#mhzgWukelheYL(F_pND zh{KD(-uJ}u4+nLA!;>?ybsAD;*4D{}^u}weS0+E&ps&YxbZ`HLSueLn5sLFw9d>h@ z~Faza8)9xvz+JOIqS7!B%7El5h;JSZ_)dtK7M^& zav_-?_}CaJ@z`Xai3n_JY`OW3NaPJ{#W>3WX<-dE@QN>R|}e~ELiGy-pH6c0}sTEeh5?aba7MNE+S^q5g0&Sobs2woCN zN+ogwwgz}C25jz7D$uVa!x200Ox!LIUB#z$3Z(hM@35GN6d9Y@+oTeYRp{}QinLbb*kP7nZ%XDLZf0C!qBC7&7D2K9f>>ma}y*b2(20 z&UJW4_PPI2-n$Bs^a>rc<`e}eX3iqUNb*x(U4cg5yT zX=_Gq7J|V*IhFIeR5V)b=Ok_4%ErS6F={AgWJ{E~Mefl2XSvIs4-`eDwXAKU)_0D5 zH`YDpFh*ulwL#-YBID2>r=fO6d1*~+{U;UWmw@I;FoCS-7pzIzJ*vc$dj9H7Z@)iN znV;J`t58egR^DfX&ewVa0=n$xUu$dRTI=B*>#Lcj?ci_3`;?{1H%%=#=!0K7gQt#K z{y*ARY?hgMwTg!0y_K5A1%*;?`Vp|o1`-bX^Is+-9x-jY-CwP4uBA85Zoi9s)(j4B z%E3ETWqIu^vdFOOT7v7dgHOC<8%SE%CqF?kE_4N=w$`PKJ8_EOpvfSw04br*u*aBJ z7G6D3`O&j+Q`CVRpobI=THRPPp40!;<@fAVU*CP4>i2RB$=4=VfG6-Y>wA3U#N~fG z2_I`a(&3QgMn0Z6$ydfk@2dvkNI7RS8*^(#OC;H~e9ZjKlK=ArLi`OJ^rCNFqpv+b zqhGEpJQH8$L@1gQGcvcetV)gVpfq{tNwCrcGo)H~qEt?Wg`;J1gb}xl&pT4FAU$}H zt8Dk8w`8~_kmImO$u^0y&MR&vU!vhu3(=k$Cbn;aTq_+cl+Ba1McdXz-o0K#rzL_dBR5k literal 0 HcmV?d00001 diff --git a/Notes-master/Notes-master/res/drawable/new_note.xml b/NotesMaster/app/src/main/res/drawable/new_note.xml similarity index 100% rename from Notes-master/Notes-master/res/drawable/new_note.xml rename to NotesMaster/app/src/main/res/drawable/new_note.xml diff --git a/Notes-master/Notes-master/res/layout/account_dialog_title.xml b/NotesMaster/app/src/main/res/layout/account_dialog_title.xml similarity index 100% rename from Notes-master/Notes-master/res/layout/account_dialog_title.xml rename to NotesMaster/app/src/main/res/layout/account_dialog_title.xml diff --git a/NotesMaster/app/src/main/res/layout/activity_main.xml b/NotesMaster/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..d5f2e7e --- /dev/null +++ b/NotesMaster/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,35 @@ + + + + + +