diff --git a/doc/ui包解析.docx b/doc/ui包解析.docx new file mode 100644 index 00000000..4342c584 Binary files /dev/null and b/doc/ui包解析.docx differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_0/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_0/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_0/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_1/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_1/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_1/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_2/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_2/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_2/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_3/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_3/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_3/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_4/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_4/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_4/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_5/graph.bin b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_5/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debug/out/currentProject/jar_6d0ab88516da0327d26fa9577517adff11f6527d4d72cadc3c35ea0cb5a99197_bucket_5/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_0/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_0/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_0/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_1/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_1/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_1/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_2/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_2/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_2/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_3/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_3/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_3/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_4/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_4/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_4/graph.bin differ diff --git a/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_5/graph.bin b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_5/graph.bin new file mode 100644 index 00000000..601f245f Binary files /dev/null and b/src/app/build/intermediates/desugar_graph/debugAndroidTest/out/currentProject/jar_568b4b06535b2fbe7434c288e7a3a0a71a523e7549127061f65d1299ed8643fd_bucket_5/graph.bin differ diff --git a/src/app/build/intermediates/project_dex_archive/debugAndroidTest/out/9beb0e8a81eac172d79c8e543de1eecc1ee027841815a239df7ee9481370a50b_0.jar b/src/app/build/intermediates/project_dex_archive/debugAndroidTest/out/9beb0e8a81eac172d79c8e543de1eecc1ee027841815a239df7ee9481370a50b_0.jar new file mode 100644 index 00000000..7f0912b6 Binary files /dev/null and b/src/app/build/intermediates/project_dex_archive/debugAndroidTest/out/9beb0e8a81eac172d79c8e543de1eecc1ee027841815a239df7ee9481370a50b_0.jar differ diff --git a/src/app/build/outputs/apk/debug/app-debug.apk b/src/app/build/outputs/apk/debug/app-debug.apk new file mode 100644 index 00000000..8f26b5bb Binary files /dev/null and b/src/app/build/outputs/apk/debug/app-debug.apk differ diff --git a/src/app/build/outputs/apk/debug/output-metadata.json b/src/app/build/outputs/apk/debug/output-metadata.json new file mode 100644 index 00000000..b2231b9c --- /dev/null +++ b/src/app/build/outputs/apk/debug/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "net.micode.notes", + "variantName": "debug", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 1, + "versionName": "0.1", + "outputFile": "app-debug.apk" + } + ], + "elementType": "File" +} \ No newline at end of file diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ActionFailureException.class.uniqueId63 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ActionFailureException.class.uniqueId63 new file mode 100644 index 00000000..1a059cea Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ActionFailureException.class.uniqueId63 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId1 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId1 new file mode 100644 index 00000000..98353eb0 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId1 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId3 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId3 new file mode 100644 index 00000000..a1d202d1 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId3 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmReceiver.class.uniqueId46 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmReceiver.class.uniqueId46 new file mode 100644 index 00000000..a41b7758 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmReceiver.class.uniqueId46 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId18 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId18 new file mode 100644 index 00000000..63e7f9cb Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId18 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId19 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId19 new file mode 100644 index 00000000..6a867376 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId19 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId71 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId71 new file mode 100644 index 00000000..a7948fd1 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId71 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId67 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId67 new file mode 100644 index 00000000..6af32006 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId67 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId44 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId44 new file mode 100644 index 00000000..fad34429 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId44 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId39 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId39 new file mode 100644 index 00000000..023f716f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId39 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$1.class.uniqueId64 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$1.class.uniqueId64 new file mode 100644 index 00000000..a98e2d49 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$1.class.uniqueId64 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId24 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId24 new file mode 100644 index 00000000..f73069cb Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId24 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId28 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId28 new file mode 100644 index 00000000..2836e847 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId28 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId54 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId54 new file mode 100644 index 00000000..7be3b8a5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId54 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId17 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId17 new file mode 100644 index 00000000..ac1834cc Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId17 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService$1.class.uniqueId27 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService$1.class.uniqueId27 new file mode 100644 index 00000000..f246eb87 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService$1.class.uniqueId27 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService.class.uniqueId23 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService.class.uniqueId23 new file mode 100644 index 00000000..18da491b Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskSyncService.class.uniqueId23 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/MetaData.class.uniqueId8 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/MetaData.class.uniqueId8 new file mode 100644 index 00000000..20ff3f7a Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/MetaData.class.uniqueId8 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NetworkFailureException.class.uniqueId65 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NetworkFailureException.class.uniqueId65 new file mode 100644 index 00000000..75665c2f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NetworkFailureException.class.uniqueId65 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Node.class.uniqueId16 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Node.class.uniqueId16 new file mode 100644 index 00000000..5236c5e6 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Node.class.uniqueId16 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId4 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId4 new file mode 100644 index 00000000..c40e9450 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId4 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId41 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId41 new file mode 100644 index 00000000..d2041ccf Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId41 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId59 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId59 new file mode 100644 index 00000000..5416cd38 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId59 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId57 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId57 new file mode 100644 index 00000000..bb9f7862 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId57 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId30 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId30 new file mode 100644 index 00000000..961f2f41 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId30 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId52 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId52 new file mode 100644 index 00000000..8e1f0bf9 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId52 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId10 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId10 new file mode 100644 index 00000000..7d0a456f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId10 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId75 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId75 new file mode 100644 index 00000000..771aa912 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId75 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId32 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId32 new file mode 100644 index 00000000..a00281f2 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId32 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId48 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId48 new file mode 100644 index 00000000..043e4101 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId48 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId69 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId69 new file mode 100644 index 00000000..ee3fd402 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId69 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId35 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId35 new file mode 100644 index 00000000..42394b73 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId35 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId36 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId36 new file mode 100644 index 00000000..569dbdc1 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId36 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId7 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId7 new file mode 100644 index 00000000..76ef96eb Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId7 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId43 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId43 new file mode 100644 index 00000000..36c8d495 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId43 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId62 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId62 new file mode 100644 index 00000000..42461a28 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId62 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId56 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId56 new file mode 100644 index 00000000..413745e5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId56 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId49 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId49 new file mode 100644 index 00000000..64fe9eb5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId49 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId47 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId47 new file mode 100644 index 00000000..0b075b48 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId47 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId33 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId33 new file mode 100644 index 00000000..7e8ab9f4 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId33 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId70 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId70 new file mode 100644 index 00000000..555e10f9 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId70 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId15 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId15 new file mode 100644 index 00000000..bfbf76c8 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId15 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId37 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId37 new file mode 100644 index 00000000..625b466c Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId37 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId58 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId58 new file mode 100644 index 00000000..7890ee47 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId58 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId34 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId34 new file mode 100644 index 00000000..d19e80b7 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId34 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId53 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId53 new file mode 100644 index 00000000..6735d583 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId53 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId73 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId73 new file mode 100644 index 00000000..3c9d9a98 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId73 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId11 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId11 new file mode 100644 index 00000000..43a75ab4 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId11 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId68 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId68 new file mode 100644 index 00000000..3774a290 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId68 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId38 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId38 new file mode 100644 index 00000000..016c842c Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId38 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId14 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId14 new file mode 100644 index 00000000..b30291e1 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId14 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId55 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId55 new file mode 100644 index 00000000..b87dc796 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId55 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId29 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId29 new file mode 100644 index 00000000..2e5d866f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId29 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId50 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId50 new file mode 100644 index 00000000..a736f9af Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId50 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId6 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId6 new file mode 100644 index 00000000..055d4a4b Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId6 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId42 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId42 new file mode 100644 index 00000000..2bdb58bc Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId42 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter.class.uniqueId13 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter.class.uniqueId13 new file mode 100644 index 00000000..5e432e90 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter.class.uniqueId13 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId61 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId61 new file mode 100644 index 00000000..45968346 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId61 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId66 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId66 new file mode 100644 index 00000000..362fa059 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId66 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId45 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId45 new file mode 100644 index 00000000..85232285 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId45 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId22 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId22 new file mode 100644 index 00000000..d91bc851 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId22 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId74 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId74 new file mode 100644 index 00000000..99c7a64f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId74 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId26 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId26 new file mode 100644 index 00000000..17e4d3bb Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId26 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId51 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId51 new file mode 100644 index 00000000..7b800360 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId51 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$7.class.uniqueId72 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$7.class.uniqueId72 new file mode 100644 index 00000000..d9abeb93 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$7.class.uniqueId72 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId20 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId20 new file mode 100644 index 00000000..39e534ac Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId20 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId21 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId21 new file mode 100644 index 00000000..eb938cfd Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId21 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId2 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId2 new file mode 100644 index 00000000..0937be27 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId2 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId40 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId40 new file mode 100644 index 00000000..1d3de0ea Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId40 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId25 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId25 new file mode 100644 index 00000000..099f3bac Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId25 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId12 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId12 new file mode 100644 index 00000000..2783ae32 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId12 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId60 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId60 new file mode 100644 index 00000000..5aaf1d4e Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId60 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId31 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId31 new file mode 100644 index 00000000..359609e5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId31 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId0 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId0 new file mode 100644 index 00000000..15f1f775 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId0 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId5 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId5 new file mode 100644 index 00000000..df71afc5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId5 differ diff --git a/src/app/src/main/java/net/micode/notes/data/Notes.java b/src/app/src/main/java/net/micode/notes/data/Notes.java index 148fcc6a..095bffba 100644 --- a/src/app/src/main/java/net/micode/notes/data/Notes.java +++ b/src/app/src/main/java/net/micode/notes/data/Notes.java @@ -114,4 +114,4 @@ public class Notes { public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note"; // 内容项类型,表示单个电话笔记的数据项类型 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); // 数据集的URI,用于访问电话笔记数据集 } -} \ No newline at end of file +} diff --git a/src/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java b/src/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java index 79a4095e..473d9a5e 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java +++ b/src/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java @@ -37,7 +37,7 @@ import org.json.JSONObject; import java.util.ArrayList; - +//数据库便签数据类,方法包括读取数据、获取数据库中便签数据、设置便签内容、提交便签数据到数据库 public class SqlNote { private static final String TAG = SqlNote.class.getSimpleName(); @@ -185,7 +185,7 @@ public class SqlNote { } } - private void loadFromCursor(Cursor c) { + private void loadFromCursor(Cursor c) { //将数据从指针载入数据库 mId = c.getLong(ID_COLUMN); mAlertDate = c.getLong(ALERTED_DATE_COLUMN); mBgColorId = c.getInt(BG_COLOR_ID_COLUMN); diff --git a/src/app/src/main/java/net/micode/notes/gtask/data/Task.java b/src/app/src/main/java/net/micode/notes/gtask/data/Task.java index 6a19454d..f8ae1cb4 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/data/Task.java +++ b/src/app/src/main/java/net/micode/notes/gtask/data/Task.java @@ -31,7 +31,7 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; - +//在Node类的基础上扩展Task类 public class Task extends Node { private static final String TAG = Task.class.getSimpleName(); @@ -43,7 +43,7 @@ public class Task extends Node { private Task mPriorSibling; - private TaskList mParent; + private TaskList mParent; //所在任务列表的指针 public Task() { super(); diff --git a/src/app/src/main/java/net/micode/notes/gtask/data/TaskList.java b/src/app/src/main/java/net/micode/notes/gtask/data/TaskList.java index 4ea21c5b..b1ccd72d 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/data/TaskList.java +++ b/src/app/src/main/java/net/micode/notes/gtask/data/TaskList.java @@ -29,13 +29,13 @@ import org.json.JSONObject; import java.util.ArrayList; - +//在Node类的基础上扩展TaskList类 public class TaskList extends Node { private static final String TAG = TaskList.class.getSimpleName(); private int mIndex; - private ArrayList mChildren; + private ArrayList mChildren; //子任务列表 public TaskList() { super(); @@ -43,6 +43,7 @@ public class TaskList extends Node { mIndex = 1; } + public JSONObject getCreateAction(int actionId) { JSONObject js = new JSONObject(); diff --git a/src/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java b/src/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java index 15504be9..a6ddec66 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java +++ b/src/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java @@ -16,6 +16,7 @@ package net.micode.notes.gtask.exception; +//动作失败异常类 public class ActionFailureException extends RuntimeException { private static final long serialVersionUID = 4425249765923293627L; diff --git a/src/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java b/src/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java index b08cfb1d..970281e9 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java +++ b/src/app/src/main/java/net/micode/notes/gtask/exception/NetworkFailureException.java @@ -16,6 +16,7 @@ package net.micode.notes.gtask.exception; +//网络失败异常类 public class NetworkFailureException extends Exception { private static final long serialVersionUID = 2107610287180234136L; diff --git a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index 3f3c3584..3f3f728d 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -29,6 +29,13 @@ import net.micode.notes.ui.NotesListActivity; import net.micode.notes.ui.NotesPreferenceActivity; +/*异步操作类,实现GTask的异步操作过程 + * 主要方法: + * private void showNotification(int tickerId, String content) 向用户提示当前同步的状态,是一个用于交互的方法 + * protected Integer doInBackground(Void... unused) 此方法在后台线程执行,完成任务的主要工作,通常需要较长的时间 + * protected void onProgressUpdate(String... progress) 可以使用进度条增加用户体验度。 此方法在主线程执行,用于显示任务执行的进度。 + * protected void onPostExecute(Integer result) 相当于Handler 处理UI的方式,在这里面可以使用在doInBackground 得到的结果处理操作UI + */ public class GTaskASyncTask extends AsyncTask { private static int GTASK_SYNC_NOTIFICATION_ID = 5234235; @@ -55,7 +62,7 @@ public class GTaskASyncTask extends AsyncTask { public void cancelSync() { mTaskManager.cancelSync(); - } + } //取消同步 public void publishProgess(String message) { publishProgress(new String[] { @@ -63,6 +70,7 @@ public class GTaskASyncTask extends AsyncTask { }); } + //向用户提示当前同步的状态 private void showNotification(int tickerId, String content) { Notification notification = new Notification(R.drawable.notification, mContext .getString(tickerId), System.currentTimeMillis()); @@ -77,7 +85,8 @@ 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); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } diff --git a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java index c67dfdf3..ed55077c 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java +++ b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java @@ -60,7 +60,7 @@ import java.util.zip.GZIPInputStream; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; - +//客户端,实现GTASK的登录操作,进行GTASK任务的创建,创建任务列表,从网络上获取任务和任务列表的内容 public class GTaskClient { private static final String TAG = GTaskClient.class.getSimpleName(); @@ -102,7 +102,7 @@ public class GTaskClient { mUpdateArray = null; } - public static synchronized GTaskClient getInstance() { + public static synchronized GTaskClient getInstance() { //实例化 if (mInstance == null) { mInstance = new GTaskClient(); } diff --git a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java index d2b4082b..9c6396f2 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java +++ b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java @@ -47,7 +47,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; - +//同步任务的管理类,提供本地和远端的同步任务 public class GTaskManager { private static final String TAG = GTaskManager.class.getSimpleName(); @@ -90,7 +90,7 @@ public class GTaskManager { private GTaskManager() { mSyncing = false; mCancelled = false; - mGTaskListHashMap = new HashMap(); + mGTaskListHashMap = new HashMap(); //泛型:HashMap 对象,其中键的类型是 String,值的类型是 TaskList mGTaskHashMap = new HashMap(); mMetaHashMap = new HashMap(); mMetaList = null; @@ -99,7 +99,7 @@ public class GTaskManager { mNidToGid = new HashMap(); } - public static synchronized GTaskManager getInstance() { + public static synchronized GTaskManager getInstance() { //多线程下实例化一个对象 if (mInstance == null) { mInstance = new GTaskManager(); } @@ -111,6 +111,7 @@ public class GTaskManager { mActivity = activity; } + //实现了本地和远端的同步操作 public int sync(Context context, GTaskASyncTask asyncTask) { if (mSyncing) { Log.d(TAG, "Sync is in progress"); @@ -128,7 +129,7 @@ public class GTaskManager { mNidToGid.clear(); try { - GTaskClient client = GTaskClient.getInstance(); + GTaskClient client = GTaskClient.getInstance(); //创建一个客户机实例 client.resetUpdateArray(); // login google task @@ -140,7 +141,7 @@ public class GTaskManager { // get the task list from google asyncTask.publishProgess(mContext.getString(R.string.sync_progress_init_list)); - initGTaskList(); + initGTaskList(); //获取远端list变为本地list // do content sync work asyncTask.publishProgess(mContext.getString(R.string.sync_progress_syncing)); @@ -247,6 +248,7 @@ public class GTaskManager { } } + //本地内容同步操作 private void syncContent() throws NetworkFailureException { int syncType; Cursor c = null; diff --git a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java index 6ed7303f..266aaf7d 100644 --- a/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java +++ b/src/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java @@ -23,6 +23,7 @@ import android.content.Intent; import android.os.Bundle; import android.os.IBinder; +//提供同步服务,发送广播(后台) public class GTaskSyncService extends Service { public final static String ACTION_STRING_NAME = "sync_action_type"; @@ -42,28 +43,11 @@ public class GTaskSyncService extends Service { private static String mSyncProgress = ""; + //开始同步工作 private void startSync() { - /* -这段 Java 代码定义了一个名为 `startSync()` 的方法。以下是对该方法的解释: -1. 首先,代码判断变量`mSyncTask`是否为空。在该方法执行之前, -变量 `mSyncTask` 可能已经被初始化,因此只有在变量为空时才需要 -创建新的 `GTaskASyncTask` 实例。 -2. 如果变量 `mSyncTask` 为空,代码将创建一个名为 `GTaskASyncTask` 的异步任务, -并传入一个匿名的 `OnCompleteListener` 参数。 -3. 在匿名的 `OnCompleteListener` 中,`onComplete()` 方法将执行3个操作: - - 将 `mSyncTask` 设置为 `null` - - 调用 `sendBroadcast("")` 方法,该方法发送一个空字符串广播 - - 调用 `stopSelf()` 方法,该方法将会调用当前服务的 `onDestroy()` 方法 - 以进行清理工作 -4. 在匿名 `OnCompleteListener` 创建之后,代码调用 `sendBroadcast("")` 方法, -该方法发送一个空字符串广播。发送该广播的原因可以是用于更新 UI、存储一些信息等。 -5. 最后,代码调用 `mSyncTask.execute();` 方法,启动异步任务。 -综上,`startSync()` 方法的功能是创建并执行一项异步任务, -任务执行完成后会发送一个广播并结束当前服务。 - */ if (mSyncTask == null) { mSyncTask = new GTaskASyncTask(this, new GTaskASyncTask.OnCompleteListener() { - public void onComplete() { + public void onComplete() { //定义完成的接口 mSyncTask = null; sendBroadcast(""); stopSelf(); diff --git a/src/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java b/src/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java index 2c47ba41..c4b49c36 100644 --- a/src/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java +++ b/src/app/src/main/java/net/micode/notes/ui/DateTimePickerDialog.java @@ -29,23 +29,24 @@ import android.content.DialogInterface.OnClickListener; import android.text.format.DateFormat; import android.text.format.DateUtils; +//设置提醒时间的对话框界面 public class DateTimePickerDialog extends AlertDialog implements OnClickListener { private Calendar mDate = Calendar.getInstance(); private boolean mIs24HourView; private OnDateTimeSetListener mOnDateTimeSetListener; - private DateTimePicker mDateTimePicker; + private DateTimePicker mDateTimePicker; //时间提醒部件 - public interface OnDateTimeSetListener { + public interface OnDateTimeSetListener { //定义接口,在NoteEditActivity中被使用 void OnDateTimeSet(AlertDialog dialog, long date); } - public DateTimePickerDialog(Context context, long date) { + 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, + public void onDateTimeChanged(DateTimePicker view, int year, int month, //设置date int dayOfMonth, int hourOfDay, int minute) { mDate.set(Calendar.YEAR, year); mDate.set(Calendar.MONTH, month); @@ -55,10 +56,10 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener updateTitle(mDate.getTimeInMillis()); } }); - mDate.setTimeInMillis(date); + mDate.setTimeInMillis(date); //获取时间 mDate.set(Calendar.SECOND, 0); mDateTimePicker.setCurrentDate(mDate.getTimeInMillis()); - setButton(context.getString(R.string.datetime_dialog_ok), this); + setButton(context.getString(R.string.datetime_dialog_ok), this); //两个按键 setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null); set24HourView(DateFormat.is24HourFormat(this.getContext())); updateTitle(mDate.getTimeInMillis()); @@ -72,7 +73,7 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener mOnDateTimeSetListener = callBack; } - private void updateTitle(long date) { + private void updateTitle(long date) { //android开发中常见日期管理工具类(API)——DateUtils:按照上下午显示时间 int flag = DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_DATE | @@ -81,7 +82,7 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener setTitle(DateUtils.formatDateTime(this.getContext(), date, flag)); } - public void onClick(DialogInterface arg0, int arg1) { + public void onClick(DialogInterface arg0, int arg1) { //实现点击监听,arg1是对话框上的按钮 if (mOnDateTimeSetListener != null) { mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis()); } diff --git a/src/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java b/src/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java index 96b77da2..6f47a6c8 100644 --- a/src/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java +++ b/src/app/src/main/java/net/micode/notes/ui/FoldersListAdapter.java @@ -28,18 +28,18 @@ import net.micode.notes.R; import net.micode.notes.data.Notes; import net.micode.notes.data.Notes.NoteColumns; - -public class FoldersListAdapter extends CursorAdapter { +//文件夹列表连接数据库 +public class FoldersListAdapter extends CursorAdapter { //用文件夹的形式展示给用户 public static final String [] PROJECTION = { NoteColumns.ID, NoteColumns.SNIPPET }; public static final int ID_COLUMN = 0; - public static final int NAME_COLUMN = 1; + public static final int NAME_COLUMN = 1;// public FoldersListAdapter(Context context, Cursor c) { - super(context, c); + super(context, c); //父类构造函数 // TODO Auto-generated constructor stub } @@ -68,8 +68,8 @@ public class FoldersListAdapter extends CursorAdapter { public FolderListItem(Context context) { super(context); - inflate(context, R.layout.folder_list_item, this); - mName = (TextView) findViewById(R.id.tv_folder_name); + inflate(context, R.layout.folder_list_item, this); //操作数据库 + mName = (TextView) findViewById(R.id.tv_folder_name); //找出对应的内容 } public void bind(String name) { diff --git a/src/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java b/src/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java index ca810866..97a44840 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java +++ b/src/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java @@ -71,7 +71,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -//便签编辑有关的活动,实现了 OnClickListener(处理点击事件)、NoteSettingChangedListener(监测便签设置的变动) 和 OnTextViewChangeListener(监测便签编辑的变动) 接口, + public class NoteEditActivity extends Activity implements OnClickListener, NoteSettingChangedListener, OnTextViewChangeListener { private class HeadViewHolder { @@ -132,7 +132,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, private View mNoteEditorPanel; - private WorkingNote mWorkingNote; //记录当前正在工作的便签 + private WorkingNote mWorkingNote; private SharedPreferences mSharedPrefs; private int mFontSizeId; @@ -165,13 +165,18 @@ public class NoteEditActivity extends Activity implements OnClickListener, * Current activity may be killed when the memory is low. Once it is killed, for another time * user load this activity, we should restore the former state */ + @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); + // 恢复之前保存的状态 if (savedInstanceState != null && savedInstanceState.containsKey(Intent.EXTRA_UID)) { + // 构建一个带有 ACTION_VIEW 的 Intent,并传递之前保存的笔记id Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(Intent.EXTRA_UID, savedInstanceState.getLong(Intent.EXTRA_UID)); + // 初始化Activity的工作状态 if (!initActivityState(intent)) { + // 如果初始化失败,则结束当前Activity finish(); return; } @@ -179,32 +184,29 @@ public class NoteEditActivity extends Activity implements OnClickListener, } } - //依据intent参数传递的Action采取动作 private boolean initActivityState(Intent intent) { - /** - * If the user specified the {@link Intent#ACTION_VIEW} but not provided with id, - * then jump to the NotesListActivity - */ + // 初始化工作状态 mWorkingNote = null; if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) { + // 如果用户指定了ACTION_VIEW但没有提供id,则跳转到NotesListActivity long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0); mUserQuery = ""; - - /** - * Starting from the searched result - */ + + // 从搜索结果开始 if (intent.hasExtra(SearchManager.EXTRA_DATA_KEY)) { noteId = Long.parseLong(intent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY); } - + if (!DataUtils.visibleInNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) { + // 如果数据库中不存在指定的笔记,则跳转到NotesListActivity并显示错误信息 Intent jump = new Intent(this, NotesListActivity.class); startActivity(jump); showToast(R.string.error_note_not_exist); finish(); return false; } else { + // 加载指定id的笔记 mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load note failed with note id" + noteId); @@ -216,7 +218,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, 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 + // 新建笔记 long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0); int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); @@ -224,8 +226,8 @@ public class NoteEditActivity extends Activity implements OnClickListener, Notes.TYPE_WIDGET_INVALIDE); int bgResId = intent.getIntExtra(Notes.INTENT_EXTRA_BACKGROUND_ID, ResourceParser.getDefaultBgId(this)); - - // Parse call-record note + + // 解析来电记录笔记 String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); long callDate = intent.getLongExtra(Notes.INTENT_EXTRA_CALL_DATE, 0); if (callDate != 0 && phoneNumber != null) { @@ -235,6 +237,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, long noteId = 0; if ((noteId = DataUtils.getNoteIdByPhoneNumberAndCallDate(getContentResolver(), phoneNumber, callDate)) > 0) { + // 加载指定id的来电记录笔记 mWorkingNote = WorkingNote.load(this, noteId); if (mWorkingNote == null) { Log.e(TAG, "load call note failed with note id" + noteId); @@ -242,309 +245,443 @@ public class NoteEditActivity extends Activity implements OnClickListener, return false; } } else { + // 创建空的来电记录笔记并转换为来电记录 mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); mWorkingNote.convertToCallNote(phoneNumber, callDate); } } else { + // 创建空的笔记 mWorkingNote = WorkingNote.createEmptyNote(this, folderId, widgetId, widgetType, bgResId); } - + getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); } else { + // 如果Intent没有指定操作,则不应该支持该Intent,记录错误并关闭当前Activity Log.e(TAG, "Intent not specified action, should not support"); finish(); return false; } + // 设置工作状态改变监听器并返回true表示初始化成功 mWorkingNote.setOnSettingStatusChangedListener(this); return true; } - @Override - protected void onResume() { - super.onResume(); - initNoteScreen(); +@Override +protected void onResume() { + super.onResume(); + initNoteScreen(); // 初始化笔记界面 +} + +private void initNoteScreen() { + // 设置笔记编辑器的文本外观 + mNoteEditor.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); + + // 根据工作笔记的模式进行不同的处理 + if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { + // 如果是清单模式,将编辑器切换到清单模式 + switchToListMode(mWorkingNote.getContent()); + } else { + // 如果不是清单模式,将编辑器的文本设置为工作笔记的内容 + mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery)); + // 将光标设置在文本末尾 + mNoteEditor.setSelection(mNoteEditor.getText().length()); } - private void initNoteScreen() { - mNoteEditor.setTextAppearance(this, TextAppearanceResources - .getTexAppearanceResource(mFontSizeId)); - if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { - switchToListMode(mWorkingNote.getContent()); + // 隐藏背景选择器中当前选中的项 + for (Integer id : sBgSelectorSelectionMap.keySet()) { + findViewById(sBgSelectorSelectionMap.get(id)).setVisibility(View.GONE); + } + + // 设置标题栏的背景资源 + mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); + // 设置笔记编辑区域的背景颜色 + mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId()); + + // 设置笔记的修改日期 + mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this, + mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE + | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME + | DateUtils.FORMAT_SHOW_YEAR)); + + /** + * TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker + * is not ready + */ + showAlertHeader(); // 显示提醒信息(如果有) +} + +private void showAlertHeader() { + // 如果工作笔记设置了提醒 + if (mWorkingNote.hasClockAlert()) { + long time = System.currentTimeMillis(); + if (time > mWorkingNote.getAlertDate()) { + // 如果提醒时间已过期,显示"提醒已过期" + mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired); } else { - mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery)); - mNoteEditor.setSelection(mNoteEditor.getText().length()); - } - for (Integer id : sBgSelectorSelectionMap.keySet()) { - findViewById(sBgSelectorSelectionMap.get(id)).setVisibility(View.GONE); + // 否则,显示距提醒时间的相对时间 + mNoteHeaderHolder.tvAlertDate.setText(DateUtils.getRelativeTimeSpanString( + mWorkingNote.getAlertDate(), time, DateUtils.MINUTE_IN_MILLIS)); } - mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); - mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId()); + // 显示提醒时间文本和提醒图标 + mNoteHeaderHolder.tvAlertDate.setVisibility(View.VISIBLE); + mNoteHeaderHolder.ivAlertIcon.setVisibility(View.VISIBLE); + } else { + // 如果工作笔记没有设置提醒,隐藏提醒时间文本和提醒图标 + mNoteHeaderHolder.tvAlertDate.setVisibility(View.GONE); + mNoteHeaderHolder.ivAlertIcon.setVisibility(View.GONE); + }; +} - mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this, - mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE - | DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME - | DateUtils.FORMAT_SHOW_YEAR)); - /** - * TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker - * is not ready - */ - showAlertHeader(); - } - private void showAlertHeader() { - if (mWorkingNote.hasClockAlert()) { - long time = System.currentTimeMillis(); - if (time > mWorkingNote.getAlertDate()) { - mNoteHeaderHolder.tvAlertDate.setText(R.string.note_alert_expired); - } 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); - }; - } +@Override +protected void onNewIntent(Intent intent) { + super.onNewIntent(intent); + initActivityState(intent); +} - @Override - protected void onNewIntent(Intent intent) { - super.onNewIntent(intent); - initActivityState(intent); +@Override +protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + + /** + * 如果编辑的笔记尚未在数据库中存在(没有ID),我们先保存它以生成一个ID。 + * 如果正在编辑的笔记不值得保存,则没有ID等同于创建新的笔记。 + */ + if (!mWorkingNote.existInDatabase()) { + saveNote(); } + + outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId()); + Log.d(TAG, "保存正在编辑的笔记ID:" + mWorkingNote.getNoteId() + ",onSaveInstanceState"); +} - @Override - protected void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - /** - * For new note without note id, we should firstly save it to - * generate a id. If the editing note is not worth saving, there - * is no id which is equivalent to create new note - */ - if (!mWorkingNote.existInDatabase()) { - saveNote(); - } - outState.putLong(Intent.EXTRA_UID, mWorkingNote.getNoteId()); - Log.d(TAG, "Save working note id: " + mWorkingNote.getNoteId() + " onSaveInstanceState"); +@Override +public boolean dispatchTouchEvent(MotionEvent ev) { + // 如果笔记背景颜色选择器可见,并且触摸事件的位置不在选择器内,隐藏选择器并返回true + if (mNoteBgColorSelector.getVisibility() == View.VISIBLE + && !inRangeOfView(mNoteBgColorSelector, ev)) { + mNoteBgColorSelector.setVisibility(View.GONE); + return true; } - @Override - 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); - int x = location[0]; - int y = location[1]; - if (ev.getX() < x - || ev.getX() > (x + view.getWidth()) - || ev.getY() < y - || ev.getY() > (y + view.getHeight())) { - return false; - } + // 如果字体大小选择器可见,并且触摸事件的位置不在选择器内,隐藏选择器并返回true + if (mFontSizeSelector.getVisibility() == View.VISIBLE + && !inRangeOfView(mFontSizeSelector, ev)) { + mFontSizeSelector.setVisibility(View.GONE); return true; } + + // 如果触摸事件位置没有被处理,则调用父类的dispatchTouchEvent方法处理事件 + return super.dispatchTouchEvent(ev); +} - private void initResources() { - mHeadViewPanel = findViewById(R.id.note_title); - mNoteHeaderHolder = new HeadViewHolder(); - mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date); - mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon); - mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); - mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color); - mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this); - 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); - } +/** + * 检查触摸事件的位置是否在给定View内部 + * + * @param view 要检查的View + * @param ev 触摸事件 + * @return 触摸事件位置是否在View内部 + */ +private boolean inRangeOfView(View view, MotionEvent ev) { + int[] location = new int[2]; + view.getLocationOnScreen(location); + int x = location[0]; + int y = location[1]; + + // 如果触摸事件的位置超出了View的边界,则返回false + if (ev.getX() < x + || ev.getX() > (x + view.getWidth()) + || ev.getY() < y + || ev.getY() > (y + view.getHeight())) { + return false; + } + + return true; +} - 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); - /** - * HACKME: Fix bug of store the resource id in shared preference. - * The id may larger than the length of resources, in this case, - * return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE} - */ - if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) { - mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE; - } - mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list); +private void initResources() { + // 初始化控件和资源 + + // 获取布局中的note_title并赋值给mHeadViewPanel + mHeadViewPanel = findViewById(R.id.note_title); + + // 创建HeadViewHolder实例 + mNoteHeaderHolder = new HeadViewHolder(); + // 获取布局中的tv_modified_date并赋值给mNoteHeaderHolder中的tvModified + mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date); + // 获取布局中的iv_alert_icon并赋值给mNoteHeaderHolder中的ivAlertIcon + mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon); + // 获取布局中的tv_alert_date并赋值给mNoteHeaderHolder中的tvAlertDate + mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); + // 获取布局中的btn_set_bg_color并赋值给mNoteHeaderHolder中的ibSetBgColor + mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color); + // 设置ibSetBgColor的点击事件监听器为当前Activity(this) + mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this); + + // 获取布局中的note_edit_view并赋值给mNoteEditor + mNoteEditor = (EditText) findViewById(R.id.note_edit_view); + // 获取布局中的sv_note_edit并赋值给mNoteEditorPanel + mNoteEditorPanel = findViewById(R.id.sv_note_edit); + + // 获取布局中的note_bg_color_selector并赋值给mNoteBgColorSelector + mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector); + // 遍历sBgSelectorBtnsMap中的按钮ID,并为每个按钮设置点击事件监听器为当前Activity(this) + for (int id : sBgSelectorBtnsMap.keySet()) { + ImageView iv = (ImageView) findViewById(id); + iv.setOnClickListener(this); } - @Override - protected void onPause() { - super.onPause(); - if(saveNote()) { - Log.d(TAG, "Note data was saved with length:" + mWorkingNote.getContent().length()); - } - clearSettingState(); + // 获取布局中的font_size_selector并赋值给mFontSizeSelector + mFontSizeSelector = findViewById(R.id.font_size_selector); + // 遍历sFontSizeBtnsMap中的按钮ID,并为每个按钮设置点击事件监听器为当前Activity(this) + for (int id : sFontSizeBtnsMap.keySet()) { + View view = findViewById(id); + view.setOnClickListener(this); + }; + + // 获取默认的SharedPreferences实例 + mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + // 从SharedPreferences中获取设置的字体大小ID,默认值为ResourceParser.BG_DEFAULT_FONT_SIZE + mFontSizeId = mSharedPrefs.getInt(PREFERENCE_FONT_SIZE, ResourceParser.BG_DEFAULT_FONT_SIZE); + /** + * HACKME: 修复存储资源ID的共享偏好的bug。 + * ID可能大于资源的长度,在这种情况下, + * 将其设置为ResourceParser.BG_DEFAULT_FONT_SIZE。 + */ + if(mFontSizeId >= TextAppearanceResources.getResourcesSize()) { + mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE; } - private void updateWidget() { - Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); - if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) { - intent.setClass(this, NoteWidgetProvider_2x.class); - } else if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_4X) { - intent.setClass(this, NoteWidgetProvider_4x.class); - } else { - Log.e(TAG, "Unspported widget type"); - return; - } + // 获取布局中的note_edit_list并赋值给mEditTextList + mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list); +} - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { - mWorkingNote.getWidgetId() - }); +@Override +protected void onPause() { + super.onPause(); + // 当Activity暂停时,保存笔记数据并输出日志 + if(saveNote()) { + Log.d(TAG, "Note data was saved with length:" + mWorkingNote.getContent().length()); + } + // 清除设置状态 + clearSettingState(); +} - sendBroadcast(intent); - setResult(RESULT_OK, intent); - } - - public void onClick(View v) { - int id = v.getId(); - if (id == R.id.btn_set_bg_color) { - mNoteBgColorSelector.setVisibility(View.VISIBLE); - findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( - - View.VISIBLE); - } else if (sBgSelectorBtnsMap.containsKey(id)) { - findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( - View.GONE); - mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id)); - mNoteBgColorSelector.setVisibility(View.GONE); - } else if (sFontSizeBtnsMap.containsKey(id)) { - findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.GONE); - mFontSizeId = sFontSizeBtnsMap.get(id); - mSharedPrefs.edit().putInt(PREFERENCE_FONT_SIZE, mFontSizeId).commit(); - findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE); - if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { - getWorkingText(); - switchToListMode(mWorkingNote.getContent()); - } else { - mNoteEditor.setTextAppearance(this, - TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); - } - mFontSizeSelector.setVisibility(View.GONE); - } +private void updateWidget() { + // 更新小部件 + + // 创建一个更新小部件的意图 + Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); + + // 根据工作笔记的小部件类型设置相应的小部件提供者类 + if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_2X) { + intent.setClass(this, NoteWidgetProvider_2x.class); + } else if (mWorkingNote.getWidgetType() == Notes.TYPE_WIDGET_4X) { + intent.setClass(this, NoteWidgetProvider_4x.class); + } else { + // 不支持的小部件类型,输出错误日志并返回 + Log.e(TAG, "Unspported widget type"); + return; } - @Override - public void onBackPressed() { - if(clearSettingState()) { - return; - } + // 将工作笔记的小部件ID作为额外数据放入意图中 + intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { + mWorkingNote.getWidgetId() + }); - saveNote(); - super.onBackPressed(); - } + // 发送广播来更新小部件 + sendBroadcast(intent); + setResult(RESULT_OK, intent); +} - private boolean clearSettingState() { - if (mNoteBgColorSelector.getVisibility() == View.VISIBLE) { - mNoteBgColorSelector.setVisibility(View.GONE); - return true; - } else if (mFontSizeSelector.getVisibility() == View.VISIBLE) { - mFontSizeSelector.setVisibility(View.GONE); - return true; +public void onClick(View v) { + // 获取当前点击的控件的ID + int id = v.getId(); + if (id == R.id.btn_set_bg_color) { + // 如果点击的是设置背景颜色的按钮 + // 显示背景颜色选择器 + mNoteBgColorSelector.setVisibility(View.VISIBLE); + // 显示当前工作笔记背景颜色的选择项 + findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.VISIBLE); + } else if (sBgSelectorBtnsMap.containsKey(id)) { + // 如果点击的是背景颜色选择器中的一个按钮 + // 隐藏当前工作笔记背景颜色的选择项 + findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE); + // 设置新的背景颜色ID给工作笔记 + mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id)); + // 隐藏背景颜色选择器 + mNoteBgColorSelector.setVisibility(View.GONE); + } else if (sFontSizeBtnsMap.containsKey(id)) { + // 如果点击的是字体大小选择器中的一个按钮 + // 隐藏当前字体大小的选择项 + findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.GONE); + // 设置新的字体大小ID + mFontSizeId = sFontSizeBtnsMap.get(id); + // 将新的字体大小ID保存到SharedPreferences中 + mSharedPrefs.edit().putInt(PREFERENCE_FONT_SIZE, mFontSizeId).commit(); + // 显示新的字体大小的选择项 + findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE); + if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { + // 如果工作笔记是待办事项模式 + // 获取当前工作文本 + getWorkingText(); + // 切换到待办事项模式 + switchToListMode(mWorkingNote.getContent()); + } else { + // 如果工作笔记不是待办事项模式 + // 设置文本编辑框的文本样式为选择的字体大小 + mNoteEditor.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); } - return false; + // 隐藏字体大小选择器 + mFontSizeSelector.setVisibility(View.GONE); } +} - public void onBackgroundColorChanged() { - findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( - View.VISIBLE); - mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId()); - mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); +@Override +public void onBackPressed() { + // 当返回按钮按下时 + if (clearSettingState()) { + // 如果当前状态是设置状态,清除设置状态并返回 + return; } - @Override - public boolean onPrepareOptionsMenu(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); - } + // 保存工作笔记 + saveNote(); + super.onBackPressed(); +} + +private boolean clearSettingState() { + // 清除设置状态方法 + if (mNoteBgColorSelector.getVisibility() == View.VISIBLE) { + // 如果背景颜色选择器可见 + // 隐藏背景颜色选择器 + mNoteBgColorSelector.setVisibility(View.GONE); + return true; + } else if (mFontSizeSelector.getVisibility() == View.VISIBLE) { + // 如果字体大小选择器可见 + // 隐藏字体大小选择器 + mFontSizeSelector.setVisibility(View.GONE); return true; } - //实现便签的各种功能 - @Override - public boolean onOptionsItemSelected(MenuItem item) { - int itemId = item.getItemId(); - if (itemId == R.id.menu_new_note) { - createNewNote(); //新建便签 - } else if (itemId == R.id.menu_delete) { //删除便签 - AlertDialog.Builder builder = new AlertDialog.Builder(this); //创建一个 AlertDialog.Builder 对象,用于构建对话框 - builder.setTitle(getString(R.string.alert_title_delete)); - builder.setIcon(android.R.drawable.ic_dialog_alert); - builder.setMessage(getString(R.string.alert_message_delete_note)); - builder.setPositiveButton(android.R.string.ok, //点击ok则删除该便签 - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - deleteCurrentNote(); - finish(); - } - }); - builder.setNegativeButton(android.R.string.cancel, null); - builder.show(); - } else if (itemId == R.id.menu_font_size) { //设置字体大小 - mFontSizeSelector.setVisibility(View.VISIBLE); - findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE); - } else if (itemId == R.id.menu_list_mode) { - mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0 ? - TextNote.MODE_CHECK_LIST : 0); - } else if (itemId == R.id.menu_share) { //分享 - getWorkingText(); - sendTo(this, mWorkingNote.getContent()); - } else if (itemId == R.id.menu_send_to_desktop) { //发送到桌面 - sendToDesktop(); - } else if (itemId == R.id.menu_alert) { //设置提醒 - setReminder(); - } else if (itemId == R.id.menu_delete_remind) { - mWorkingNote.setAlertDate(0, false); - } + return false; +} + +public void onBackgroundColorChanged() { + // 根据当前工作笔记的背景颜色ID显示相应的选择项 + findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.VISIBLE); + // 设置工作笔记编辑面板的背景颜色为当前工作笔记的背景颜色资源ID + mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId()); + // 设置工作笔记标题栏的背景颜色为当前工作笔记的标题背景资源ID + mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId()); +} + +@Override +public boolean onPrepareOptionsMenu(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 onOptionsItemSelected(MenuItem item) { + int itemId = item.getItemId(); + if (itemId == R.id.menu_new_note) { + // 当点击菜单项“新建笔记”时 + createNewNote(); + } else if (itemId == R.id.menu_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_note)); + builder.setPositiveButton(android.R.string.ok, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + // 确认删除工作笔记,删除并结束当前活动 + deleteCurrentNote(); + finish(); + } + }); + builder.setNegativeButton(android.R.string.cancel, null); + builder.show(); + } else if (itemId == R.id.menu_font_size) { + // 当点击菜单项“字体大小”时 + // 显示字体大小选择器,并根据当前字体大小ID显示相应的选择项 + mFontSizeSelector.setVisibility(View.VISIBLE); + findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE); + } else if (itemId == R.id.menu_list_mode) { + // 当点击菜单项“模式切换”时 + // 切换工作笔记的待办事项模式 + mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0 ? + TextNote.MODE_CHECK_LIST : 0); + } else if (itemId == R.id.menu_share) { + // 当点击菜单项“分享”时 + // 获取当前工作文本并进行分享 + getWorkingText(); + sendTo(this, mWorkingNote.getContent()); + } else if (itemId == R.id.menu_send_to_desktop) { + // 当点击菜单项“发送到桌面”时 + sendToDesktop(); + } else if (itemId == R.id.menu_alert) { + // 当点击菜单项“提醒”时 + // 设置闹钟提醒 + setReminder(); + } else if (itemId == R.id.menu_delete_remind) { + // 当点击菜单项“删除提醒”时 + // 清除工作笔记的提醒日期和提醒标志 + mWorkingNote.setAlertDate(0, false); + } + return true; +} private void setReminder() { +/* + * 这段 Java 代码实现了一个名为 `setReminder()` 的方法,用于设置笔记的提醒功能。以下是对该方法的解释: +1. 首先,创建一个 `DateTimePickerDialog` 对象 `d`,用于显示日期时间选择对话框。 +2. 通过传递 System.currentTimeMillis() 方法的返回值,设置初始日期时间选择为当前时间。 +3. 将一个匿名的 `OnDateTimeSetListener` 实例设置给 `d`,用于在用户选择日期时间后响应事件。 +4. 在 `OnDateTimeSet` 方法中,获取用户选择的日期时间, +并通过调用 `mWorkingNote` 对象的 `setAlertDate()` 方法设置笔记的提醒日期时间。 +5. 最后,通过调用 `d` 对象的 `show()` 方法,显示日期时间选择对话框。 +综上,该方法实现了通过日期时间选择对话框设置笔记提醒功能的功能,用户能够通过该对话框选择想要提醒的日期时间点。 +在用户选择日期时间后,将所选日期时间点保存到 `mWorkingNote` 对象中,以实现笔记的提醒功能。 + */ DateTimePickerDialog d = new DateTimePickerDialog(this, System.currentTimeMillis()); d.setOnDateTimeSetListener(new OnDateTimeSetListener() { public void OnDateTimeSet(AlertDialog dialog, long date) { @@ -559,13 +696,23 @@ public class NoteEditActivity extends Activity implements OnClickListener, * and {@text/plain} type */ private void sendTo(Context context, String info) { + /* +这是一个名为 `sendTo()` 的私有方法,用于发送信息。 +该方法接受两个参数,一个是上下文(`context`),一个是要发送的信息(`info`)。 +方法的具体步骤如下: +1. 创建一个 `Intent` 对象,使用 `Intent.ACTION_SEND` 动作。这表示我们要发送数据。 +2. 使用 `intent.putExtra()` 方法将要发送的文本数据添加到 `Intent` 中。 +键为 `Intent.EXTRA_TEXT`,值为 `info`,即要发送的信息内容。 +3. 使用 `intent.setType()` 方法指定发送的数据类型为纯文本("text/plain")。 +4. 调用 `context.startActivity(intent)` 启动该意图,从而触发系统选择合适的应用程序来处理发送操作。 + */ + Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_TEXT, info); intent.setType("text/plain"); context.startActivity(intent); } - //创建新的便签函数 private void createNewNote() { // Firstly, save current editing notes saveNote(); @@ -575,9 +722,18 @@ public class NoteEditActivity extends Activity implements OnClickListener, Intent intent = new Intent(this, NoteEditActivity.class); intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mWorkingNote.getFolderId()); - startActivity(intent); + startActivity(intent);/* + 这段代码是一个方法 `createNewNote()` 的实现。下面是对代码的解释: +1. 首先,调用 `saveNote()` 方法保存当前正在编辑的笔记。 +2. 为了安全起见,在开始新的笔记之前,调用 `finish()` 方法关闭当前的 Activity。 +3. 创建一个新的 `Intent` 对象,将目标 Activity 设置为 `NoteEditActivity`(笔记编辑界面)。 +4. 使用 `Intent.ACTION_INSERT_OR_EDIT` 设置操作,表示是插入或编辑操作。 +5. 使用 `intent.putExtra()` 将当前笔记所属的文件夹的 ID 作为附加数据传递给 `NoteEditActivity`。 +6. 最后,调用 `startActivity(intent)` 启动 `NoteEditActivity`。 +这将打开一个新的笔记编辑界面,并根据传递的附加数据进行相应的操作。 + */ } - //删除当前工作的便签 + private void deleteCurrentNote() { if (mWorkingNote.existInDatabase()) { HashSet ids = new HashSet(); @@ -597,184 +753,259 @@ public class NoteEditActivity extends Activity implements OnClickListener, } } } - mWorkingNote.markDeleted(true); //标记删除 + mWorkingNote.markDeleted(true); +/* + * 这段代码是一个方法 `deleteCurrentNote()` 的实现。下面是对代码的解释: +1. 首先,检查 `mWorkingNote` 是否存在于数据库中,即当前的笔记是否已经保存在数据库中。 +2. 如果存在于数据库中,创建一个 `HashSet` 集合 `ids`,用于存储需要删除的笔记的 ID。 +3. 获取当前笔记的 ID,并将其添加到 `ids` 集合中。 +4. 检查当前笔记的 ID 是否等于 `Notes.ID_ROOT_FOLDER`,如果不是,将其添加到 `ids` 集合中。 +5. 如果不是处于同步模式下(`isSyncMode()` 返回 `false`), +则调用 `DataUtils.batchDeleteNotes()` 方法批量删除数据库中的笔记。如果删除失败,打印错误日志信息。 +6. 如果处于同步模式下,调用 `DataUtils.batchMoveToFolder()` 方法 +将笔记批量移动到垃圾箱。如果移动失败,打印错误日志信息。 +7. 调用 `mWorkingNote.markDeleted(true)` 方法,将当前笔记标记为已删除。 +这段代码的作用是将当前的笔记标记为已删除,并根据不同的条件执行相应的操作: +如果不是同步模式,则删除数据库中的笔记;如果是同步模式,则将笔记移动到垃圾箱。 + */ } - private boolean isSyncMode() { - return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0; - } +// 判断是否为同步模式 +private boolean isSyncMode() { + return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0; +} - public void onClockAlertChanged(long date, boolean set) { - /** - * User could set clock to an unsaved note, so before setting the - * alert clock, we should save the note first - */ - if (!mWorkingNote.existInDatabase()) { - saveNote(); - } - 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); - AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE)); - showAlertHeader(); - if(!set) { - alarmManager.cancel(pendingIntent); - } else { - alarmManager.set(AlarmManager.RTC_WAKEUP, date, pendingIntent); - } +// 当闹钟提醒设置改变时的处理 +public void onClockAlertChanged(long date, boolean set) { + // 如果当前工作笔记不存在于数据库中,则保存笔记 + if (!mWorkingNote.existInDatabase()) { + saveNote(); + } + // 如果工作笔记的ID大于0,则继续处理 + if (mWorkingNote.getNoteId() > 0) { + // 创建AlarmReceiver的Intent + Intent intent = new Intent(this, AlarmReceiver.class); + intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId())); + // 创建用于广播的PendingIntent + PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); + // 获取AlarmManager实例 + AlarmManager alarmManager = ((AlarmManager) getSystemService(ALARM_SERVICE)); + // 显示提醒标题 + showAlertHeader(); + // 根据set参数判断是否设置或取消闹钟提醒 + if(!set) { + alarmManager.cancel(pendingIntent); // 取消闹钟提醒 } else { - /** - * There is the condition that user has input nothing (the note is - * not worthy saving), we have no note id, remind the user that he - * should input something - */ - Log.e(TAG, "Clock alert setting error"); - showToast(R.string.error_note_empty_for_clock); + alarmManager.set(AlarmManager.RTC_WAKEUP, date, pendingIntent); // 设置闹钟提醒 } + } else { + // 如果工作笔记ID小于等于0,记录错误并显示提示 + Log.e(TAG, "Clock alert setting error"); + showToast(R.string.error_note_empty_for_clock); + } +} + +// 当小部件改变时的处理 +public void onWidgetChanged() { + updateWidget(); // 更新小部件 +} + +// 当文本编辑框内容删除时的处理 +public void onEditTextDelete(int index, String text) { + int childCount = mEditTextList.getChildCount(); + // 如果子View数量为1,则直接返回 + if (childCount == 1) { + return; } - public void onWidgetChanged() { - updateWidget(); + // 重新设置剩余编辑框的索引 + for (int i = index + 1; i < childCount; i++) { + ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)).setIndex(i - 1); } - public void onEditTextDelete(int index, String text) { - int childCount = mEditTextList.getChildCount(); - if (childCount == 1) { - return; - } + // 移除指定位置的编辑框 + mEditTextList.removeViewAt(index); + NoteEditText edit = null; + // 获取上一个编辑框,如果是第一个则获取第一个编辑框 + if(index == 0) { + edit = (NoteEditText) mEditTextList.getChildAt(0).findViewById(R.id.et_edit_text); + } else { + edit = (NoteEditText) mEditTextList.getChildAt(index - 1).findViewById(R.id.et_edit_text); + } + int length = edit.length(); + // 在编辑框末尾添加指定文本 + edit.append(text); + edit.requestFocus(); + edit.setSelection(length); // 设置光标位置 +} - for (int i = index + 1; i < childCount; i++) { - ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) - .setIndex(i - 1); - } +public void onEditTextEnter(int index, String text) { + /** + * 如果索引超出 mEditTextList 的范围,应该不会发生,进行调试检查 + */ + if(index > mEditTextList.getChildCount()) { + Log.e(TAG, "Index out of mEditTextList boundrary, should not happen"); + } - mEditTextList.removeViewAt(index); - NoteEditText edit = null; - if(index == 0) { - edit = (NoteEditText) mEditTextList.getChildAt(0).findViewById( - R.id.et_edit_text); - } else { - edit = (NoteEditText) mEditTextList.getChildAt(index - 1).findViewById( - R.id.et_edit_text); - } - int length = edit.length(); - edit.append(text); - edit.requestFocus(); - edit.setSelection(length); + // 创建新的编辑框视图并添加到 mEditTextList 中指定的位置 + View view = getListItem(text, index); + mEditTextList.addView(view, index); + NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); + edit.requestFocus(); + edit.setSelection(0); + for (int i = index + 1; i < mEditTextList.getChildCount(); i++) { + ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) + .setIndex(i); } +} - public void onEditTextEnter(int index, String text) { - /** - * Should not happen, check for debug - */ - if(index > mEditTextList.getChildCount()) { - Log.e(TAG, "Index out of mEditTextList boundrary, should not happen"); +// 切换到列表模式的处理方法 +private void switchToListMode(String text) { + // 移除所有的编辑框视图 + mEditTextList.removeAllViews(); + // 将文本按换行符分割成字符串数组 + String[] items = text.split("\n"); + int index = 0; + for (String item : items) { + // 如果项不为空,则创建对应的编辑框视图并添加到 mEditTextList 中 + if(!TextUtils.isEmpty(item)) { + mEditTextList.addView(getListItem(item, index)); + index++; } + } + // 添加一个空的编辑框以便用户继续添加新项 + mEditTextList.addView(getListItem("", index)); + mEditTextList.getChildAt(index).findViewById(R.id.et_edit_text).requestFocus(); + + // 隐藏笔记编辑视图,显示编辑框列表视图 + mNoteEditor.setVisibility(View.GONE); + mEditTextList.setVisibility(View.VISIBLE); +} - View view = getListItem(text, index); - mEditTextList.addView(view, index); - NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); - edit.requestFocus(); - edit.setSelection(0); - for (int i = index + 1; i < mEditTextList.getChildCount(); i++) { - ((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) - .setIndex(i); +// 获取包含用户查询结果高亮的 Spannable 对象 +private Spannable getHighlightQueryResult(String fullText, String userQuery) { + SpannableString spannable = new SpannableString(fullText == null ? "" : fullText); + if (!TextUtils.isEmpty(userQuery)) { + mPattern = Pattern.compile(userQuery); + Matcher m = mPattern.matcher(fullText); + int start = 0; + while (m.find(start)) { + // 对匹配到的文本进行高亮处理 + spannable.setSpan( + new BackgroundColorSpan(this.getResources().getColor( + R.color.user_query_highlight)), m.start(), m.end(), + Spannable.SPAN_INCLUSIVE_EXCLUSIVE); + start = m.end(); } } + return spannable; +} - private void switchToListMode(String text) { - mEditTextList.removeAllViews(); - String[] items = text.split("\n"); - int index = 0; - for (String item : items) { - if(!TextUtils.isEmpty(item)) { - mEditTextList.addView(getListItem(item, index)); - index++; - } - } - mEditTextList.addView(getListItem("", index)); - mEditTextList.getChildAt(index).findViewById(R.id.et_edit_text).requestFocus(); - - mNoteEditor.setVisibility(View.GONE); - mEditTextList.setVisibility(View.VISIBLE); - } - - private Spannable getHighlightQueryResult(String fullText, String userQuery) { - SpannableString spannable = new SpannableString(fullText == null ? "" : fullText); - if (!TextUtils.isEmpty(userQuery)) { - mPattern = Pattern.compile(userQuery); - Matcher m = mPattern.matcher(fullText); - int start = 0; - while (m.find(start)) { - spannable.setSpan( - new BackgroundColorSpan(this.getResources().getColor( - R.color.user_query_highlight)), m.start(), m.end(), - Spannable.SPAN_INCLUSIVE_EXCLUSIVE); - start = m.end(); +/** + * 通过传入的内容和索引,获取包含编辑框和复选框的列表项视图 + * @param item 列表项内容 + * @param index 列表项索引 + * @return 列表项视图 + */ +private View getListItem(String item, int index) { + // 加载列表项布局 + View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null); + final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); + // 设置文本外观 + edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); + CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item)); + // 设置复选框选中状态变化时的监听器 + cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + // 文本加上删除线 + edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); + } else { + // 取消文本删除线 + edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); } } - return spannable; - } - - private View getListItem(String item, int index) { - View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null); - final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); - edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); - CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item)); - cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (isChecked) { - edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); - } else { - edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); - } - } - }); + }); + + if (item.startsWith(TAG_CHECKED)) { + // 如果列表项以 "checked" 标识开头,则设置复选框选中状态,设置文本删除线,并去掉标识字符串 + cb.setChecked(true); + edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); + item = item.substring(TAG_CHECKED.length(), item.length()).trim(); + } else if (item.startsWith(TAG_UNCHECKED)) { + // 如果列表项以 "unchecked" 标识开头,则设置复选框未选中状态,取消文本删除线,并去掉标识字符串 + cb.setChecked(false); + edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); + item = item.substring(TAG_UNCHECKED.length(), item.length()).trim(); + } - if (item.startsWith(TAG_CHECKED)) { - cb.setChecked(true); - edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); - item = item.substring(TAG_CHECKED.length(), item.length()).trim(); - } else if (item.startsWith(TAG_UNCHECKED)) { - cb.setChecked(false); - edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); - item = item.substring(TAG_UNCHECKED.length(), item.length()).trim(); - } + edit.setOnTextViewChangeListener(this); + edit.setIndex(index); + // 设置文本,并将用户查询结果高亮显示 + edit.setText(getHighlightQueryResult(item, mUserQuery)); + return view; +} - edit.setOnTextViewChangeListener(this); - edit.setIndex(index); - edit.setText(getHighlightQueryResult(item, mUserQuery)); - return view; +/** + * 当文本内容改变时的回调方法 + * @param index 列表项索引 + * @param hasText 是否有文本内容 + */ +public void onTextChange(int index, boolean hasText) { + if (index >= mEditTextList.getChildCount()) { + Log.e(TAG, "Wrong index, should not happen"); + return; } - - public void onTextChange(int index, boolean hasText) { - if (index >= mEditTextList.getChildCount()) { - Log.e(TAG, "Wrong index, should not happen"); - return; - } - if(hasText) { - mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.VISIBLE); - } else { - mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE); - } + if(hasText) { + // 如果有文本内容,则显示复选框 + mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.VISIBLE); + } else { + // 如果没有文本内容,则隐藏复选框 + mEditTextList.getChildAt(index).findViewById(R.id.cb_edit_item).setVisibility(View.GONE); } +} - public void onCheckListModeChanged(int oldMode, int newMode) { - if (newMode == TextNote.MODE_CHECK_LIST) { - switchToListMode(mNoteEditor.getText().toString()); - } else { - if (!getWorkingText()) { - mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ", - "")); - } - mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery)); - mEditTextList.setVisibility(View.GONE); - mNoteEditor.setVisibility(View.VISIBLE); +/** + * 当待办事项模式变化时的回调方法 + * @param oldMode 旧的待办事项模式 + * @param newMode 新的待办事项模式 + */ +public void onCheckListModeChanged(int oldMode, int newMode) { + if (newMode == TextNote.MODE_CHECK_LIST) { + // 如果新的模式是待办事项列表模式,则切换到列表模式 + switchToListMode(mNoteEditor.getText().toString()); + } else { + if (!getWorkingText()) { + // 如果工作文本为空,并且未保存的文本中包含 "unchecked" 标识,则将其移除 + mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ", "")); } + // 设置编辑框内容,并将用户查询结果高亮显示 + mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery)); + // 隐藏编辑框列表视图,显示笔记编辑视图 + mEditTextList.setVisibility(View.GONE); + mNoteEditor.setVisibility(View.VISIBLE); } +} private boolean getWorkingText() { +/* +这是一个名为 `getWorkingText()` 的私有方法,返回一个布尔值。 +该方法的作用是获取工作文本,具体步骤如下: +1. 首先,检查 `mWorkingNote` 对象的 `CheckListMode` +是否为 `TextNote.MODE_CHECK_LIST`。如果是,则进入列表模式的处理逻辑。 +2. 创建一个 `StringBuilder` 对象 `sb`,用于拼接文本。 +3. 遍历 `mEditTextList` 中的子视图(可能是多个文本编辑框): + - 获取子视图中的 `NoteEditText` 对象,用于获取文本内容。 + - 如果 `edit.getText()` 不为空,表示该文本框有输入内容。 + - 如果相应的复选框 `CheckBox` 被选中(`isChecked()` 返回 `true`), + 将文本设为已选中状态,并向 `sb` 添加标记 `TAG_CHECKED`,文本内容,以及换行符。 + 同时将 `hasChecked` 设为 `true`。 + - 否则,将文本设为未选中状态,并向 `sb` 添加标记 `TAG_UNCHECKED`,文本内容,以及换行符。 +4. 将拼接好的文本 `sb.toString()` 设为 `mWorkingNote` 的工作文本。 +5. 如果 `mWorkingNote` 的 `CheckListMode` 不是 `TextNote.MODE_CHECK_LIST`, +即非列表模式,则将 `mNoteEditor` 的文本内容设为 `mWorkingNote` 的工作文本。 +6. 返回 `hasChecked`,该布尔值表示是否存在已选中的文本项。 + */ boolean hasChecked = false; if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { StringBuilder sb = new StringBuilder(); @@ -796,7 +1027,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } return hasChecked; } - //保存便签 + private boolean saveNote() { getWorkingText(); boolean saved = mWorkingNote.saveNote(); @@ -815,9 +1046,24 @@ public class NoteEditActivity extends Activity implements OnClickListener, private void sendToDesktop() { /** - * Before send message to home, we should make sure that current - * editing note is exists in databases. So, for new note, firstly - * save it +这段代码实现了一个名为 `sendToDesktop()` 的方法,用于将当前编辑的笔记发送到桌面上。 +以下是对该方法的解释: +1. 首先,检查当前编辑的笔记 `mWorkingNote` 是否存在于数据库中。 +如果笔记在数据库中不存在(即为新笔记),则调用 `saveNote()` 方法保存笔记。 +2. 如果当前编辑的笔记已经存在于数据库中(即为已有的笔记),执行以下操作: + - 创建一个 `Intent` 对象 `sender`。 + - 创建一个 `Intent` 对象 `shortcutIntent`,指定其启动目标为 `NoteEditActivity` 类。 + - 为 `shortcutIntent` 指定动作 `Intent.ACTION_VIEW`,表示要进行查看操作。 + - 通过 `putExtra()` 方法向 `shortcutIntent` 传递附加信息,包括笔记的唯一标识符(`NoteId`)。 + - 通过 `sender.putExtra()` 方法向 `sender` 传递附加信息,包括快捷方式的意图(`shortcutIntent`)、 + 快捷方式的名称、快捷方式的图标资源和重复安装的标志等。 + - 通过设置 `sender` 的动作为 `"com.android.launcher.action.INSTALL_SHORTCUT"`,表示要安装快捷方式。 + - 调用 `showToast()` 方法显示一个消息提示框,提示用户笔记已进入桌面。 + - 调用 `sendBroadcast()` 方法发送广播,通知系统安装快捷方式。 +3. 如果当前编辑的笔记不存在(即为没有输入内容的空笔记), +则记录一个错误日志并调用 `showToast()` 方法显示一个错误提示框,提醒用户输入内容。 +4. 方法执行结束。 +综上,该方法的功能是将当前编辑的笔记发送到桌面上,并根据笔记的状态进行相应的处理,如保存新笔记、创建快捷方式等。 */ if (!mWorkingNote.existInDatabase()) { saveNote(); @@ -849,17 +1095,21 @@ public class NoteEditActivity extends Activity implements OnClickListener, } 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; + // 如果内容的长度超过了指定的最大长度,则返回内容的子字符串,否则返回原始内容 + return content.length() > SHORTCUT_ICON_TITLE_MAX_LEN ? content.substring(0, SHORTCUT_ICON_TITLE_MAX_LEN) : content; } - + private void showToast(int resId) { + // 显示一个短持续时间的Toast消息,消息内容为给定的资源ID的字符串 showToast(resId, Toast.LENGTH_SHORT); } - + private void showToast(int resId, int duration) { + // 显示一个具有自定义持续时间的Toast消息,消息内容为给定的资源ID的字符串 + // Toast消息在当前的上下文中显示 Toast.makeText(this, resId, duration).show(); } } diff --git a/src/app/src/main/java/net/micode/notes/ui/NoteEditText.java b/src/app/src/main/java/net/micode/notes/ui/NoteEditText.java index 54244dcb..dd7c3430 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NoteEditText.java +++ b/src/app/src/main/java/net/micode/notes/ui/NoteEditText.java @@ -101,82 +101,82 @@ public class NoteEditText extends EditText { @Override public boolean onTouchEvent(MotionEvent event) { - // 当用户触摸屏幕时执行以下操作 + // ûĻʱִ² switch (event.getAction()) { case MotionEvent.ACTION_DOWN: - // 获取触摸点的坐标 + // ȡ int x = (int) event.getX(); int y = (int) event.getY(); - // 调整坐标,考虑到文本框的内边距和滚动偏移 + // ꣬ǵıڱ߾͹ƫ x -= getTotalPaddingLeft(); y -= getTotalPaddingTop(); x += getScrollX(); y += getScrollY(); - // 获取布局信息,并确定触摸点所在的行和水平偏移位置 + // ȡϢȷڵкˮƽƫλ Layout layout = getLayout(); int line = layout.getLineForVertical(y); int off = layout.getOffsetForHorizontal(line, x); - // 选中文本中特定偏移位置的字符 + // ѡıضƫλõַ Selection.setSelection(getText(), off); break; } - // 继续处理触摸事件 + // ¼ return super.onTouchEvent(event); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - // 按键按下时执行以下操作 + // ʱִ² switch (keyCode) { case KeyEvent.KEYCODE_ENTER: - // 如果存在文本变化监听器,则返回false,否则执行默认操作 + // ı仯򷵻falseִĬϲ if (mOnTextViewChangeListener != null) { return false; } break; case KeyEvent.KEYCODE_DEL: - // 记录删除操作前的光标位置 + // ¼ɾǰĹλ mSelectionStartBeforeDelete = getSelectionStart(); break; default: break; } - // 继续处理按键事件 + // ¼ return super.onKeyDown(keyCode, event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { - // 按键释放时执行以下操作 + // ͷʱִ² switch(keyCode) { case KeyEvent.KEYCODE_DEL: if (mOnTextViewChangeListener != null) { - // 如果存在文本变化监听器,并且删除操作前光标位置为0,则调用相应的方法,并返回true + // ı仯ɾǰλΪ0Ӧķtrue if (0 == mSelectionStartBeforeDelete && mIndex != 0) { mOnTextViewChangeListener.onEditTextDelete(mIndex, getText().toString()); return true; } } else { - // 如果不存在文本变化监听器,则记录日志 + // ı仯¼־ Log.d(TAG, "OnTextViewChangeListener was not set"); } break; case KeyEvent.KEYCODE_ENTER: if (mOnTextViewChangeListener != null) { - // 如果存在文本变化监听器,则获取光标位置和文本内容,并调用相应的方法 + // ı仯ȡλúıݣӦķ int selectionStart = getSelectionStart(); String text = getText().subSequence(selectionStart, length()).toString(); setText(getText().subSequence(0, selectionStart)); mOnTextViewChangeListener.onEditTextEnter(mIndex + 1, text); } else { - // 如果不存在文本变化监听器,则记录日志 + // ı仯¼־ Log.d(TAG, "OnTextViewChangeListener was not set"); } break; default: break; } - // 继续处理按键事件 + // ¼ return super.onKeyUp(keyCode, event); } @@ -188,16 +188,16 @@ public class NoteEditText extends EditText { @Override protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { if (mOnTextViewChangeListener != null) { - // 检查文本内容是否为空 + // ıǷΪ if (!focused && TextUtils.isEmpty(getText())) { - // 当焦点失去且文本为空时,调用回调函数通知文本发生变化 + // ʧȥıΪʱûص֪ͨı仯 mOnTextViewChangeListener.onTextChange(mIndex, false); } else { - // 当焦点改变或文本不为空时,调用回调函数通知文本发生变化 + // ııΪʱûص֪ͨı仯 mOnTextViewChangeListener.onTextChange(mIndex, true); } } - // 调用父类的方法,处理焦点改变事件 + // øķı¼ super.onFocusChanged(focused, direction, previouslyFocusedRect); } @@ -210,11 +210,11 @@ protected void onCreateContextMenu(ContextMenu menu) { int min = Math.min(selStart, selEnd); int max = Math.max(selStart, selEnd); - // 获取选中文本中的 URLSpan 对象 + // ȡѡıе URLSpan final URLSpan[] urls = ((Spanned) getText()).getSpans(min, max, URLSpan.class); if (urls.length == 1) { int defaultResId = 0; - // 根据 URL 的 schema 查找对应的默认资源 ID + // URL schema ҶӦĬԴ ID for(String schema: sSchemaActionResMap.keySet()) { if(urls[0].getURL().indexOf(schema) >= 0) { defaultResId = sSchemaActionResMap.get(schema); @@ -226,18 +226,18 @@ protected void onCreateContextMenu(ContextMenu menu) { defaultResId = R.string.note_link_other; } - // 向上下文菜单添加选项,并设置点击监听器 + // IJ˵ѡõ menu.add(0, 0, 0, defaultResId).setOnMenuItemClickListener( new OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { - // 执行跳转到新 Intent 的操作 + // ִת Intent IJ urls[0].onClick(NoteEditText.this); return true; } }); } } - // 调用父类的方法,创建右键菜单 + // øķҼ˵ super.onCreateContextMenu(menu); } } diff --git a/src/app/src/main/java/net/micode/notes/ui/NotesListItem.java b/src/app/src/main/java/net/micode/notes/ui/NotesListItem.java index 369c9880..036ac696 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NotesListItem.java +++ b/src/app/src/main/java/net/micode/notes/ui/NotesListItem.java @@ -48,9 +48,9 @@ public class NotesListItem extends LinearLayout { mCheckBox = (CheckBox) findViewById(android.R.id.checkbox); } - // 绑定数据到列表项 + // ݵб 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); @@ -58,9 +58,9 @@ public class NotesListItem extends LinearLayout { mCheckBox.setVisibility(View.GONE); } - mItemData = data; // 将数据保存在类成员变量中 + mItemData = data; // ݱԱ - // 根据不同的数据类型和属性设置视图的可见性,文本内容和图像资源 + // ݲͬͺͼĿɼԣıݺͼԴ if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { mCallName.setVisibility(View.GONE); mAlert.setVisibility(View.VISIBLE); @@ -98,13 +98,13 @@ public class NotesListItem extends LinearLayout { } } - // 设置时间文本为相对时间格式 + // ʱıΪʱʽ mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate())); - setBackground(data); // 设置背景 + setBackground(data); // ñ } - // 根据数据类型和属性设置背景 + // ͺñ private void setBackground(NoteItemData data) { int id = data.getBgColorId(); if (data.getType() == Notes.TYPE_NOTE) { diff --git a/src/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java b/src/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java index ef66eadc..9a6af0c9 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java +++ b/src/app/src/main/java/net/micode/notes/ui/NotesPreferenceActivity.java @@ -73,10 +73,10 @@ public class NotesPreferenceActivity extends PreferenceActivity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); - /* 设置显示返回箭头 */ + /* ʾؼͷ */ getActionBar().setDisplayHomeAsUpEnabled(true); - /* 从 XML 文件加载偏好设置 */ + /* XML ļƫ */ addPreferencesFromResource(R.xml.preferences); mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY); mReceiver = new GTaskReceiver(); @@ -93,7 +93,7 @@ public class NotesPreferenceActivity extends PreferenceActivity { protected void onResume() { super.onResume(); - // 需要在用户添加新帐户后自动设置同步帐户 + // ҪûʻԶͬʻ if (mHasAddedAccount) { Account[] accounts = getGoogleAccounts(); if (mOriAccounts != null && accounts.length > mOriAccounts.length) { @@ -124,7 +124,7 @@ public class NotesPreferenceActivity extends PreferenceActivity { super.onDestroy(); } - /* 加载帐户偏好设置 */ + /* ʻƫ */ private void loadAccountPreference() { mAccountCategory.removeAll(); @@ -136,10 +136,10 @@ public class NotesPreferenceActivity extends PreferenceActivity { public boolean onPreferenceClick(Preference preference) { if (!GTaskSyncService.isSyncing()) { if (TextUtils.isEmpty(defaultAccount)) { - // 第一次设置帐户 + // һʻ showSelectAccountAlertDialog(); } else { - // 如果帐户已经设置,需要提示用户风险 + // ʻѾãҪʾû showChangeAccountConfirmAlertDialog(); } } else { @@ -154,15 +154,15 @@ public class NotesPreferenceActivity extends PreferenceActivity { mAccountCategory.addPreference(accountPref); } -// 加载同步按钮 +// ͬť private void loadSyncButton() { - // 获取同步按钮和上次同步时间视图 + // ȡͬťϴͬʱͼ Button syncButton = (Button) findViewById(R.id.preference_sync_button); TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview); - // 设置按钮状态 + // ðť״̬ if (GTaskSyncService.isSyncing()) { - // 如果正在同步,则显示取消同步按钮,并设置点击监听器取消同步 + // ͬʾȡͬťõȡͬ syncButton.setText(getString(R.string.preferences_button_sync_cancel)); syncButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -170,7 +170,7 @@ private void loadSyncButton() { } }); } else { - // 如果未在同步,则显示立即同步按钮,并设置点击监听器开始同步 + // δͬʾͬťõʼͬ syncButton.setText(getString(R.string.preferences_button_sync_immediately)); syncButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -178,16 +178,16 @@ private void loadSyncButton() { } }); } - // 根据是否存在同步帐户来设置按钮是否可用 + // ǷͬʻðťǷ syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this))); - // 设置上次同步时间 + // ϴͬʱ if (GTaskSyncService.isSyncing()) { - // 如果正在同步,则显示同步进度,并设置视图可见 + // ͬʾͬȣͼɼ lastSyncTimeView.setText(GTaskSyncService.getProgressString()); lastSyncTimeView.setVisibility(View.VISIBLE); } else { - // 如果未在同步,则获取上次同步时间并显示在视图中 + // δͬȡϴͬʱ䲢ʾͼ long lastSyncTime = getLastSyncTime(this); if (lastSyncTime != 0) { lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time, @@ -195,49 +195,49 @@ private void loadSyncButton() { lastSyncTime))); lastSyncTimeView.setVisibility(View.VISIBLE); } else { - // 如果没有上次同步时间,则隐藏视图 + // ûϴͬʱ䣬ͼ lastSyncTimeView.setVisibility(View.GONE); } } } -// 刷新用户界面 +// ˢû private void refreshUI() { - // 加载帐户偏好设置 + // ʻƫ loadAccountPreference(); - // 加载同步按钮 + // ͬť loadSyncButton(); } private void showSelectAccountAlertDialog() { - // 创建一个AlertDialog.Builder对象 + // һAlertDialog.Builder AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); - // 填充自定义布局,用作对话框标题 + // Զ岼֣Ի View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null); - // 设置对话框标题和副标题文本 + // öԻ͸ı TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title); titleTextView.setText(getString(R.string.preferences_dialog_select_account_title)); TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle); subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips)); - // 设置自定义标题视图 + // Զͼ dialogBuilder.setCustomTitle(titleView); - // 禁用对话框的确认按钮 + // öԻȷϰť dialogBuilder.setPositiveButton(null, null); - // 获取Google帐户数组和默认帐户 + // ȡGoogleʻĬʻ Account[] accounts = getGoogleAccounts(); String defAccount = getSyncAccountName(this); - // 保存原始帐户数组并设置添加账户的标志 + // ԭʼʻ鲢˻ı־ mOriAccounts = accounts; mHasAddedAccount = false; if (accounts.length > 0) { - // 创建一个字符序列数组来存储帐户名,并找到选中项的索引 + // һַ洢ʻҵѡ CharSequence[] items = new CharSequence[accounts.length]; final CharSequence[] itemMapping = items; int checkedItem = -1; @@ -248,7 +248,7 @@ private void showSelectAccountAlertDialog() { } items[index++] = account.name; } - // 设置单选项列表,其中帐户名为选项文本,checkedItem为默认选中项 + // õѡбʻΪѡıcheckedItemΪĬѡ dialogBuilder.setSingleChoiceItems(items, checkedItem, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -259,17 +259,17 @@ private void showSelectAccountAlertDialog() { }); } - // 填充自定义布局,用作添加账户的视图 + // Զ岼֣˻ͼ View addAccountView = LayoutInflater.from(this).inflate(R.layout.add_account_text, null); dialogBuilder.setView(addAccountView); - // 显示对话框 + // ʾԻ final AlertDialog dialog = dialogBuilder.show(); - // 单击添加账户视图时触发 + // ˻ͼʱ addAccountView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mHasAddedAccount = true; - // 打开系统添加账户设置界面 + // ϵͳ˻ý Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS"); intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] { "gmail-ls" @@ -281,10 +281,10 @@ private void showSelectAccountAlertDialog() { } private void showChangeAccountConfirmAlertDialog() { - // 创建一个AlertDialog.Builder对象 + // һAlertDialog.Builder 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))); @@ -292,7 +292,7 @@ private void showChangeAccountConfirmAlertDialog() { 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), @@ -312,32 +312,32 @@ private void showChangeAccountConfirmAlertDialog() { } private Account[] getGoogleAccounts() { - // 获取账户管理器实例 + // ȡ˻ʵ AccountManager accountManager = AccountManager.get(this); - // 返回所有com.google类型的账户 + // com.google͵˻ return accountManager.getAccountsByType("com.google"); } private void setSyncAccount(String account) { - // 如果当前同步账户与设置的账户不同 + // ǰͬ˻õ˻ͬ if (!getSyncAccountName(this).equals(account)) { - // 获取SharedPreferences实例 + // ȡSharedPreferencesʵ SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - // 获取SharedPreferences编辑器 + // ȡSharedPreferences༭ SharedPreferences.Editor editor = settings.edit(); - // 如果账户不为null,设置同步账户名称 + // ˻Ϊnullͬ˻ if (account != null) { editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account); } else { - // 否则清空同步账户名称 + // ͬ˻ editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); } editor.commit(); - // 清空上次同步时间 + // ϴͬʱ setLastSyncTime(this, 0); - // 清空本地gtask相关信息 + // ձgtaskϢ new Thread(new Runnable() { public void run() { ContentValues values = new ContentValues(); @@ -347,7 +347,7 @@ private void setSyncAccount(String account) { } }).start(); - // 显示Toast提示设置成功 + // ʾToastʾóɹ Toast.makeText(NotesPreferenceActivity.this, getString(R.string.preferences_toast_success_set_accout, account), Toast.LENGTH_SHORT).show(); @@ -355,21 +355,21 @@ private void setSyncAccount(String account) { } private void removeSyncAccount() { - // 获取SharedPreferences实例 + // ȡSharedPreferencesʵ SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - // 获取SharedPreferences编辑器 + // ȡSharedPreferences༭ 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(); - // 清空本地gtask相关信息 + // ձgtaskϢ new Thread(new Runnable() { public void run() { ContentValues values = new ContentValues(); @@ -381,29 +381,29 @@ private void removeSyncAccount() { } public static String getSyncAccountName(Context context) { - // 获取SharedPreferences实例 + // ȡSharedPreferencesʵ 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实例 + // ȡSharedPreferencesʵ SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - // 获取SharedPreferences编辑器 + // ȡSharedPreferences༭ SharedPreferences.Editor editor = settings.edit(); - // 设置上次同步时间 + // ϴͬʱ editor.putLong(PREFERENCE_LAST_SYNC_TIME, time); editor.commit(); } public static long getLastSyncTime(Context context) { - // 获取SharedPreferences实例 + // ȡSharedPreferencesʵ SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - // 返回上次同步时间 + // ϴͬʱ return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0); } @@ -411,12 +411,12 @@ private class GTaskReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - // 刷新UI界面 + // ˢUI refreshUI(); - // 如果正在同步任务 + // ͬ if (intent.getBooleanExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_IS_SYNCING, false)) { TextView syncStatus = (TextView) findViewById(R.id.prefenerece_sync_status_textview); - // 设置同步状态文本信息 + // ͬ״̬ıϢ syncStatus.setText(intent.getStringExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_PROGRESS_MSG)); } } @@ -427,7 +427,7 @@ public boolean onOptionsItemSelected(MenuItem item) { case android.R.id.home: Intent intent = new Intent(this, NotesListActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - // 返回到主页面 + // صҳ startActivity(intent); return true; default: