diff --git a/src/app/build/intermediates/compile_app_classes_jar/debug/classes.jar b/src/app/build/intermediates/compile_app_classes_jar/debug/classes.jar index 2455c6bd..0d702100 100644 Binary files a/src/app/build/intermediates/compile_app_classes_jar/debug/classes.jar and b/src/app/build/intermediates/compile_app_classes_jar/debug/classes.jar differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService$1.class index f246eb87..e3981f2a 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService.class index 18da491b..046324a7 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/remote/GTaskSyncService.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class index c40e9450..05202b9d 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class index d2041ccf..3a687440 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class index df71afc5..a23580d2 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class index 63e7f9cb..bb993409 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class index 6a867376..7b6cdd4f 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class index 6af32006..5a5386f1 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$1.class index 5416cd38..d8407fc7 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$2.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$2.class index bb9f7862..1372673e 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$2.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$2.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$3.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$3.class index 961f2f41..ac3e1c57 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$3.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity$3.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity.class index 7d0a456f..7f5e3510 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditActivity.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText$1.class index 2040186e..15c7a9c0 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText.class index 3a19d3b0..ee9a86c1 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NoteEditText.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$1.class index f1ba2200..00800378 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$2.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$2.class index 76c0c9de..b0069b0c 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$2.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$2.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$3.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$3.class index 0fd69770..4902bcb9 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$3.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$3.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$4.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$4.class index 04686521..a588f420 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$4.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$4.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$5.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$5.class index 54fa5723..e5ccbce8 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$5.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$5.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$6.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$6.class index 062ecb51..e86fb561 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$6.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$6.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$7.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$7.class index c2178731..b8b128bd 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$7.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$7.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$8.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$8.class index d3dbb603..422f8e22 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$8.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$8.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$9.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$9.class index 8f0a21b4..f3f92f74 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$9.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$9.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$BackgroundQueryHandler.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$BackgroundQueryHandler.class index 127437ff..e8d00387 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$BackgroundQueryHandler.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$BackgroundQueryHandler.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$1.class index 3981f169..7978c300 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$2.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$2.class index 99e161f8..a0469f27 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$2.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback$2.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback.class index f249e333..720b2852 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$ModeCallback.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$NewNoteOnTouchListener.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$NewNoteOnTouchListener.class index 81f06d33..57091a78 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$NewNoteOnTouchListener.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$NewNoteOnTouchListener.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$OnListItemClickListener.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$OnListItemClickListener.class index 3d4e8b10..54153aa3 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$OnListItemClickListener.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity$OnListItemClickListener.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity.class index 83dc6c88..bc253a69 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListActivity.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListAdapter.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListAdapter.class index 5e432e90..a6d885ca 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListAdapter.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListAdapter.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListItem.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListItem.class index 45968346..8777b108 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListItem.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesListItem.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$1.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$1.class index 362fa059..046edf1b 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$1.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$1.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$2.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$2.class index 85232285..d0e88bba 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$2.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$2.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$3.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$3.class index d91bc851..15153eb8 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$3.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$3.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$4.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$4.class index 99c7a64f..3439eb90 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$4.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$4.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$5.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$5.class index 17e4d3bb..de07b650 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$5.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$5.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$6.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$6.class index 7b800360..55f86ace 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$6.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$6.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$7.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$7.class index d9abeb93..959e2f99 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$7.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$7.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$8.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$8.class index 39e534ac..9809acc5 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$8.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$8.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$GTaskReceiver.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$GTaskReceiver.class index eb938cfd..ce7d2739 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$GTaskReceiver.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity$GTaskReceiver.class differ diff --git a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity.class b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity.class index 0937be27..a31b31cb 100644 Binary files a/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity.class and b/src/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/NotesPreferenceActivity.class differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId60 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId27 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId60 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId27 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId44 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId44 new file mode 100644 index 00000000..98353eb0 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmAlertActivity.class.uniqueId44 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId14 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId14 deleted file mode 100644 index a1d202d1..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AlarmInitReceiver.class.uniqueId14 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId40 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId5 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId40 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils$TextExport.class.uniqueId5 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId47 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId11 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId47 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/BackupUtils.class.uniqueId11 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId42 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId42 deleted file mode 100644 index a7948fd1..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Contact.class.uniqueId42 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId51 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId14 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId51 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId14 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId39 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId39 new file mode 100644 index 00000000..5a5386f1 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/DataUtils.class.uniqueId39 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId24 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId24 deleted file mode 100644 index fad34429..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter$FolderListItem.class.uniqueId24 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId29 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId29 deleted file mode 100644 index 023f716f..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/FoldersListAdapter.class.uniqueId29 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId4 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId6 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId4 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask$OnCompleteListener.class.uniqueId6 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId19 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId17 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId19 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskASyncTask.class.uniqueId17 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId29 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId29 new file mode 100644 index 00000000..7be3b8a5 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskClient.class.uniqueId29 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId63 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId30 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId63 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId30 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId47 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId47 new file mode 100644 index 00000000..ac1834cc Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GTaskManager.class.uniqueId47 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId15 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId10 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId15 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note$NoteData.class.uniqueId10 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId53 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId16 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId53 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Note.class.uniqueId16 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId41 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId36 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId41 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId36 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId6 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId6 new file mode 100644 index 00000000..5416cd38 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$1.class.uniqueId6 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId6 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId3 similarity index 87% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId6 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId3 index bb9f7862..6efe55fe 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId6 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId3 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId8 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId8 new file mode 100644 index 00000000..6efe55fe Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$2.class.uniqueId8 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId25 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId21 similarity index 83% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId25 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId21 index 961f2f41..f8758f37 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId25 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId21 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId22 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId22 new file mode 100644 index 00000000..f8758f37 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$3.class.uniqueId22 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId66 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId32 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId66 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId32 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId49 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId49 new file mode 100644 index 00000000..8e1f0bf9 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity$HeadViewHolder.class.uniqueId49 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId3 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId0 similarity index 91% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId3 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId0 index 7d0a456f..c7af5e52 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId3 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId0 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId5 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId5 new file mode 100644 index 00000000..c7af5e52 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditActivity.class.uniqueId5 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$1.class.uniqueId13 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$1.class.uniqueId13 new file mode 100644 index 00000000..2040186e Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$1.class.uniqueId13 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$OnTextViewChangeListener.class.uniqueId50 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$OnTextViewChangeListener.class.uniqueId50 new file mode 100644 index 00000000..9874f47b Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText$OnTextViewChangeListener.class.uniqueId50 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText.class.uniqueId27 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText.class.uniqueId27 new file mode 100644 index 00000000..3a19d3b0 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteEditText.class.uniqueId27 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId27 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId23 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId27 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId23 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId24 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId24 new file mode 100644 index 00000000..771aa912 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteItemData.class.uniqueId24 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId18 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId16 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId18 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider.class.uniqueId16 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId55 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId55 deleted file mode 100644 index 043e4101..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_2x.class.uniqueId55 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId52 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId52 deleted file mode 100644 index ee3fd402..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NoteWidgetProvider_4x.class.uniqueId52 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId39 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId39 deleted file mode 100644 index 42394b73..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$CallNote.class.uniqueId39 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId7 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId7 deleted file mode 100644 index 569dbdc1..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataColumns.class.uniqueId7 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId49 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId49 deleted file mode 100644 index 76ef96eb..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$DataConstants.class.uniqueId49 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId11 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId11 deleted file mode 100644 index 36c8d495..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$NoteColumns.class.uniqueId11 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId50 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId50 deleted file mode 100644 index 42461a28..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes$TextNote.class.uniqueId50 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId36 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId36 deleted file mode 100644 index 413745e5..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Notes.class.uniqueId36 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId32 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId32 deleted file mode 100644 index 64fe9eb5..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper$TABLE.class.uniqueId32 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId43 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId43 deleted file mode 100644 index 0b075b48..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesDatabaseHelper.class.uniqueId43 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId9 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId10 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId9 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId10 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId7 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId7 new file mode 100644 index 00000000..f1ba2200 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$1.class.uniqueId7 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId56 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId20 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId56 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId20 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId41 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId41 new file mode 100644 index 00000000..76c0c9de Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$2.class.uniqueId41 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId35 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId1 similarity index 85% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId35 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId1 index 0fd69770..ae5d23bc 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId35 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId1 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId31 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId31 new file mode 100644 index 00000000..ae5d23bc Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$3.class.uniqueId31 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId20 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId15 similarity index 92% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId20 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId15 index 04686521..62b7e431 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId20 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId15 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId18 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId18 new file mode 100644 index 00000000..62b7e431 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$4.class.uniqueId18 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId61 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId28 similarity index 83% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId61 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId28 index 54fa5723..0c3614ba 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId61 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId28 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId45 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId45 new file mode 100644 index 00000000..0c3614ba Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$5.class.uniqueId45 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId44 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId37 similarity index 90% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId44 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId37 index 062ecb51..708e26c4 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId44 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId37 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId9 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId9 new file mode 100644 index 00000000..708e26c4 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$6.class.uniqueId9 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId38 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId35 similarity index 88% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId38 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId35 index c2178731..3adfefed 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId38 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId35 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId4 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId4 new file mode 100644 index 00000000..3adfefed Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$7.class.uniqueId4 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId64 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId31 similarity index 82% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId64 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId31 index d3dbb603..003aae65 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId64 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId31 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId48 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId48 new file mode 100644 index 00000000..003aae65 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$8.class.uniqueId48 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId16 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId13 similarity index 88% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId16 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId13 index 8f0a21b4..e7be3591 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId16 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId13 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId14 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId14 new file mode 100644 index 00000000..e7be3591 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$9.class.uniqueId14 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId30 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId25 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId30 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId25 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId26 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId26 new file mode 100644 index 00000000..127437ff Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$BackgroundQueryHandler.class.uniqueId26 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId28 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId24 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId28 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId24 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId25 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId25 new file mode 100644 index 00000000..2edab7b3 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ListEditState.class.uniqueId25 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId62 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId29 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId62 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId29 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId46 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId46 new file mode 100644 index 00000000..3981f169 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$1.class.uniqueId46 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId21 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId17 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId21 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId17 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId19 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId19 new file mode 100644 index 00000000..99e161f8 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback$2.class.uniqueId19 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId5 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId2 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId5 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId2 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId7 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId7 new file mode 100644 index 00000000..f249e333 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$ModeCallback.class.uniqueId7 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId22 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId18 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId22 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId18 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId20 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId20 new file mode 100644 index 00000000..81f06d33 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$NewNoteOnTouchListener.class.uniqueId20 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId54 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId19 similarity index 92% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId54 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId19 index 3d4e8b10..c8bc735d 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId54 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId19 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId40 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId40 new file mode 100644 index 00000000..c8bc735d Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity$OnListItemClickListener.class.uniqueId40 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId10 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId11 similarity index 92% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId10 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId11 index 83dc6c88..8dc90586 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId10 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId11 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId8 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId8 new file mode 100644 index 00000000..8dc90586 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListActivity.class.uniqueId8 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId67 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId51 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId67 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter$AppWidgetAttribute.class.uniqueId51 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.uniqueId12 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter.class.uniqueId13 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListAdapter.class.uniqueId12 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId26 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId22 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId26 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId22 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId23 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId23 new file mode 100644 index 00000000..45968346 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesListItem.class.uniqueId23 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId57 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId42 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId57 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$1.class.uniqueId42 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId33 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId30 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId33 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$2.class.uniqueId30 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId17 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId15 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId17 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$3.class.uniqueId15 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId58 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId43 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId58 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$4.class.uniqueId43 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId37 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId33 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId37 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$5.class.uniqueId33 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId23 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId21 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId23 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$6.class.uniqueId21 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId46 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId38 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId46 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$8.class.uniqueId38 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId2 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId3 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId2 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity$GTaskReceiver.class.uniqueId3 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId8 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId9 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId8 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesPreferenceActivity.class.uniqueId9 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId65 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId65 deleted file mode 100644 index 1d3de0ea..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/NotesProvider.class.uniqueId65 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteBgResources.class.uniqueId34 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteBgResources.class.uniqueId34 new file mode 100644 index 00000000..84e57a4f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteBgResources.class.uniqueId34 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteItemBgResources.class.uniqueId2 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteItemBgResources.class.uniqueId2 new file mode 100644 index 00000000..8805a063 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$NoteItemBgResources.class.uniqueId2 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$TextAppearanceResources.class.uniqueId32 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$TextAppearanceResources.class.uniqueId32 new file mode 100644 index 00000000..7f2eb75f Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$TextAppearanceResources.class.uniqueId32 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$WidgetBgResources.class.uniqueId4 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$WidgetBgResources.class.uniqueId4 new file mode 100644 index 00000000..b4ec3bab Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser$WidgetBgResources.class.uniqueId4 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser.class.uniqueId28 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser.class.uniqueId28 new file mode 100644 index 00000000..f2e1b626 Binary files /dev/null and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ResourceParser.class.uniqueId28 differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId31 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId31 deleted file mode 100644 index 099f3bac..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlData.class.uniqueId31 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId34 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId34 deleted file mode 100644 index 2783ae32..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/SqlNote.class.uniqueId34 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId45 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId45 deleted file mode 100644 index 5aaf1d4e..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/Task.class.uniqueId45 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId12 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId12 deleted file mode 100644 index 359609e5..00000000 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TaskList.class.uniqueId12 and /dev/null differ diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId59 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId26 similarity index 100% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId59 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote$NoteSettingChangedListener.class.uniqueId26 diff --git a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId48 b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId12 similarity index 73% rename from src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId48 rename to src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId12 index df71afc5..a23580d2 100644 Binary files a/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId48 and b/src/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WorkingNote.class.uniqueId12 differ diff --git a/src/app/src/main/java/net/micode/notes/model/Note.java b/src/app/src/main/java/net/micode/notes/model/Note.java index 6706cf67..d5f62a16 100644 --- a/src/app/src/main/java/net/micode/notes/model/Note.java +++ b/src/app/src/main/java/net/micode/notes/model/Note.java @@ -13,6 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* +主要是进行以便签为单位的操作 +什么是final类? +Java中有一些类,如String,Math等,就是final类的典型例子。 +虽然在Java编程中并不经常使用final类和final方法,但它们有着与众不同的特点, +即final类不能被继承,不能被覆盖,以及final类在执行速度方面比一般类快。 + */ + package net.micode.notes.model; import android.content.ContentProviderOperation; @@ -41,8 +49,15 @@ public class Note { /** * Create a new note id for adding a new note to databases */ + /** + * 从数据库获取一个新的便签 ID。 + * + * @param context 应用程序的上下文。 + * @param folderId 将要创建便签的文件夹 ID。 + * @return 新创建的便签 ID。 + */ public static synchronized long getNewNoteId(Context context, long folderId) { - // Create a new note in the database + // 在数据库中创建一个新的便签 ContentValues values = new ContentValues(); long createdTime = System.currentTimeMillis(); values.put(NoteColumns.CREATED_DATE, createdTime); @@ -56,20 +71,30 @@ public class Note { try { noteId = Long.valueOf(uri.getPathSegments().get(1)); } catch (NumberFormatException e) { - Log.e(TAG, "Get note id error :" + e.toString()); + Log.e(TAG, "获取便签 ID 出错:" + e.toString()); noteId = 0; } if (noteId == -1) { - throw new IllegalStateException("Wrong note id:" + noteId); + throw new IllegalStateException("错误的便签 ID:" + noteId); } return noteId; } + /** + * 便签类的构造方法。 + * 初始化 mNoteDiffValues 和 mNoteData。 + */ public Note() { mNoteDiffValues = new ContentValues(); mNoteData = new NoteData(); } + /** + * 用于设置便签数值的方法。 + * + * @param key 要设置的数值的键。 + * @param value 要设置的数值。 + */ public void setNoteValue(String key, String value) { mNoteDiffValues.put(key, value); mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1); @@ -100,36 +125,44 @@ public class Note { return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified(); } + + + public boolean syncNote(Context context, long noteId) { + // 检查传入的noteId是否合法,如果不合法则抛出异常 if (noteId <= 0) { throw new IllegalArgumentException("Wrong note id:" + noteId); } - + + // 检查当前笔记是否有本地修改的内容,如果没有则直接返回true if (!isLocalModified()) { return true; } - - /** - * In theory, once data changed, the note should be updated on {@link NoteColumns#LOCAL_MODIFIED} and - * {@link NoteColumns#MODIFIED_DATE}. For data safety, though update note fails, we also update the - * note data info - */ + + // 使用ContentResolver的update方法更新指定noteId的笔记数据,如果返回值为0,则表示更新失败 if (context.getContentResolver().update( ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), mNoteDiffValues, null, null) == 0) { Log.e(TAG, "Update note error, should not happen"); - // Do not return, fall through + // 如果更新笔记失败,记录错误日志,但不立即返回,而是继续执行后面的逻辑 } + + // 清空mNoteDiffValues,表示已经将本地修改的内容同步到了设备数据库 mNoteDiffValues.clear(); - + + // 检查NoteData对象是否有本地修改的内容,如果有则将修改的内容推送到设备数据库中,如果返回值为null表示推送失败,则返回false if (mNoteData.isLocalModified() && (mNoteData.pushIntoContentResolver(context, noteId) == null)) { return false; } - + + // 如果同步操作成功,则返回true return true; } + + + private class NoteData { private long mTextDataId; @@ -179,22 +212,29 @@ public class Note { } Uri pushIntoContentResolver(Context context, long noteId) { - /** - * Check for safety - */ + // 检查传入的noteId是否合法,如果不合法则抛出异常 if (noteId <= 0) { throw new IllegalArgumentException("Wrong note id:" + noteId); } - + + // 创建一个操作列表,用于存储要执行的ContentProvider操作 ArrayList operationList = new ArrayList(); ContentProviderOperation.Builder builder = null; - + + // 如果mTextDataValues中有内容,则进行处理 if(mTextDataValues.size() > 0) { + // 设置mTextDataValues中的NOTE_ID字段为传入的noteId mTextDataValues.put(DataColumns.NOTE_ID, noteId); + + // 判断mTextDataId是否为0,如果为0说明是新创建的文本数据,需要执行插入操作 if (mTextDataId == 0) { + // 设置mTextDataValues中的MIME_TYPE字段为TextNote的内容类型 mTextDataValues.put(DataColumns.MIME_TYPE, TextNote.CONTENT_ITEM_TYPE); - Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI, - mTextDataValues); + + // 使用ContentResolver的insert方法将mTextDataValues插入到设备数据库中,并获取插入的记录的Uri + Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI, mTextDataValues); + + // 解析uri中的pathSegments获取插入的记录的ID,并将其设置为mTextDataId try { setTextDataId(Long.valueOf(uri.getPathSegments().get(1))); } catch (NumberFormatException e) { @@ -203,14 +243,18 @@ public class Note { return null; } } else { + // 如果mTextDataId不为0,说明是已存在的文本数据,需要执行更新操作 builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId( Notes.CONTENT_DATA_URI, mTextDataId)); builder.withValues(mTextDataValues); operationList.add(builder.build()); } + + // 清空mTextDataValues,表示mTextDataValues的内容已经处理完成 mTextDataValues.clear(); } - + + // 如果mCallDataValues中有内容,则进行处理(处理逻辑与上述的文本数据类似) if(mCallDataValues.size() > 0) { mCallDataValues.put(DataColumns.NOTE_ID, noteId); if (mCallDataId == 0) { @@ -232,11 +276,17 @@ public class Note { } mCallDataValues.clear(); } - + + // 如果操作列表中有操作,则执行applyBatch方法将操作应用到设备数据库中 if (operationList.size() > 0) { try { + // 使用ContentResolver的applyBatch方法将操作应用到设备数据库中,并获取操作结果 ContentProviderResult[] results = context.getContentResolver().applyBatch( Notes.AUTHORITY, operationList); + + // 根据操作结果确定返回值 + // 如果结果为null、长度为0或第一个结果为null,则返回null + // 否则返回指定noteId的笔记的Uri return (results == null || results.length == 0 || results[0] == null) ? null : ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId); } catch (RemoteException e) { @@ -247,6 +297,8 @@ public class Note { return null; } } + + // 如果操作列表为空,则直接返回null return null; } } diff --git a/src/app/src/main/java/net/micode/notes/model/WorkingNote.java b/src/app/src/main/java/net/micode/notes/model/WorkingNote.java index 76d2c129..06119892 100644 --- a/src/app/src/main/java/net/micode/notes/model/WorkingNote.java +++ b/src/app/src/main/java/net/micode/notes/model/WorkingNote.java @@ -124,46 +124,52 @@ public class WorkingNote { loadNote(); } + /** + * 加载笔记数据 + */ private void loadNote() { Cursor cursor = mContext.getContentResolver().query( ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null, null, null); - + if (cursor != null) { if (cursor.moveToFirst()) { - mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN); - mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN); - mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN); - mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN); - mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN); - mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN); + mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN); // 获取笔记所属文件夹 ID + mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN); // 获取笔记背景颜色 ID + mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN); // 获取笔记小部件 ID + mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN); // 获取笔记小部件类型 + mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN); // 获取笔记提醒日期 + mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN); // 获取笔记修改日期 } cursor.close(); } else { Log.e(TAG, "No note with id:" + mNoteId); throw new IllegalArgumentException("Unable to find note with id " + mNoteId); } - loadNoteData(); + loadNoteData(); // 加载笔记数据 } - + + /** + * 加载笔记的具体数据 + */ private void loadNoteData() { Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { String.valueOf(mNoteId) }, null); - + if (cursor != null) { if (cursor.moveToFirst()) { do { - String type = cursor.getString(DATA_MIME_TYPE_COLUMN); + String type = cursor.getString(DATA_MIME_TYPE_COLUMN); // 获取数据类型 if (DataConstants.NOTE.equals(type)) { - mContent = cursor.getString(DATA_CONTENT_COLUMN); - mMode = cursor.getInt(DATA_MODE_COLUMN); - mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN)); + mContent = cursor.getString(DATA_CONTENT_COLUMN); // 获取笔记文本内容 + mMode = cursor.getInt(DATA_MODE_COLUMN); // 获取笔记模式 + mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN)); // 设置笔记文本数据 ID } else if (DataConstants.CALL_NOTE.equals(type)) { - mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN)); + mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN)); // 设置通话数据 ID } else { - Log.d(TAG, "Wrong note type with type:" + type); + Log.d(TAG, "Wrong note type with type:" + type); // 记录错误的数据类型 } } while (cursor.moveToNext()); } @@ -174,59 +180,90 @@ public class WorkingNote { } } + /** + * 创建一个空的笔记对象 + * + * @param context 上下文对象 + * @param folderId 笔记所属文件夹 ID + * @param widgetId 笔记小部件 ID + * @param widgetType 笔记小部件类型 + * @param defaultBgColorId 默认背景颜色 ID + * @return 创建的空白笔记对象 + */ public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId, int widgetType, int defaultBgColorId) { - WorkingNote note = new WorkingNote(context, folderId); - note.setBgColorId(defaultBgColorId); - note.setWidgetId(widgetId); - note.setWidgetType(widgetType); + WorkingNote note = new WorkingNote(context, folderId); // 创建一个工作笔记对象 + note.setBgColorId(defaultBgColorId); // 设置默认背景颜色 ID + note.setWidgetId(widgetId); // 设置小部件 ID + note.setWidgetType(widgetType); // 设置小部件类型 return note; } - + + /** + * 根据 ID 从数据库加载笔记对象 + * + * @param context 上下文对象 + * @param id 笔记 ID + * @return 加载的笔记对象 + */ public static WorkingNote load(Context context, long id) { - return new WorkingNote(context, id, 0); + return new WorkingNote(context, id, 0); // 根据 ID 创建工作笔记对象 } - + + /** + * 保存笔记对象到数据库 + * + * @return 保存是否成功 + */ public synchronized boolean saveNote() { if (isWorthSaving()) { - if (!existInDatabase()) { + if (!existInDatabase()) { // 如果笔记不存在于数据库中 if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) { Log.e(TAG, "Create new note fail with id:" + mNoteId); - return false; + return false; // 创建新笔记失败 } } - - mNote.syncNote(mContext, mNoteId); - - /** - * Update widget content if there exist any widget of this note - */ + mNote.syncNote(mContext, mNoteId); // 同步笔记到数据库 if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID && mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) { - mNoteSettingStatusListener.onWidgetChanged(); + mNoteSettingStatusListener.onWidgetChanged(); // 更新小部件状态 } - return true; + return true; // 保存成功 } else { - return false; + return false; // 未值得保存,保存失败 } } + /** + * 检查笔记是否存在于数据库中 + * @return 笔记是否存在于数据库中 + */ public boolean existInDatabase() { return mNoteId > 0; } - + + /** + * 检查笔记是否值得保存 + * 笔记不值得保存的情况包括:已被标记删除、(不存在于数据库且内容为空)、(存在于数据库且没有本地修改) + * @return 笔记是否值得保存 + */ private boolean isWorthSaving() { if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent)) || (existInDatabase() && !mNote.isLocalModified())) { - return false; + return false; // 不值得保存 } else { - return true; + return true; // 值得保存 } } - + + /** + * 设置笔记设置状态改变监听器 + * + * @param l 笔记设置状态改变监听器 + */ public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) { - mNoteSettingStatusListener = l; + mNoteSettingStatusListener = l; // 设置笔记设置状态改变监听器 } public void setAlertDate(long date, boolean set) { @@ -316,31 +353,45 @@ public class WorkingNote { } } + /** + * 设置小部件类型 + * @param type 小部件类型 + */ public void setWidgetType(int type) { if (type != mWidgetType) { mWidgetType = type; - mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType)); + mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType)); // 设置笔记值中的小部件类型 } } - + /** + * 设置小部件 ID + * @param id 小部件 ID + */ public void setWidgetId(int id) { if (id != mWidgetId) { mWidgetId = id; - mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId)); + mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId)); // 设置笔记值中的小部件 ID } } - + /** + * 设置工作文本 + * @param text 文本内容 + */ public void setWorkingText(String text) { if (!TextUtils.equals(mContent, text)) { mContent = text; - mNote.setTextData(DataColumns.CONTENT, mContent); + mNote.setTextData(DataColumns.CONTENT, mContent); // 设置笔记的文本数据 } } - + /** + * 转换为通话记录类型的笔记 + * @param phoneNumber 电话号码 + * @param callDate 通话日期 + */ public void convertToCallNote(String phoneNumber, long callDate) { - mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate)); - mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber); - mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER)); + mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate)); // 设置通话数据中的通话日期 + mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber); // 设置通话数据中的电话号码 + mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER)); // 设置笔记值中的父文件夹 ID } public boolean hasClockAlert() { diff --git a/src/app/src/main/java/net/micode/notes/tool/BackupUtils.java b/src/app/src/main/java/net/micode/notes/tool/BackupUtils.java index 39f6ec47..0267be12 100644 --- a/src/app/src/main/java/net/micode/notes/tool/BackupUtils.java +++ b/src/app/src/main/java/net/micode/notes/tool/BackupUtils.java @@ -140,24 +140,28 @@ public class BackupUtils { * Export the folder identified by folder id to text */ private void exportFolderToText(String folderId, PrintStream ps) { - // Query notes belong to this folder + // 查询属于该文件夹的笔记 Cursor notesCursor = mContext.getContentResolver().query(Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, NoteColumns.PARENT_ID + "=?", new String[] { - folderId + folderId }, null); - + + // 如果notesCursor不为null,则进行处理 if (notesCursor != null) { + // 如果notesCursor中有数据,则继续循环处理每个笔记 if (notesCursor.moveToFirst()) { do { - // Print note's last modified date + // 打印笔记的最后修改日期 ps.println(String.format(getFormat(FORMAT_NOTE_DATE), DateFormat.format( mContext.getString(R.string.format_datetime_mdhm), notesCursor.getLong(NOTE_COLUMN_MODIFIED_DATE)))); - // Query data belong to this note + // 查询属于该笔记的数据 String noteId = notesCursor.getString(NOTE_COLUMN_ID); exportNoteToText(noteId, ps); } while (notesCursor.moveToNext()); } + + // 关闭notesCursor notesCursor.close(); } } @@ -166,46 +170,55 @@ public class BackupUtils { * Export note identified by id to a print stream */ private void exportNoteToText(String noteId, PrintStream ps) { + // 查询属于该笔记的数据 Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { - noteId + noteId }, null); - + + // 如果dataCursor不为null,则进行处理 if (dataCursor != null) { + // 如果dataCursor中有数据,则继续循环处理每个数据项 if (dataCursor.moveToFirst()) { do { + // 获取数据的mimeType String mimeType = dataCursor.getString(DATA_COLUMN_MIME_TYPE); if (DataConstants.CALL_NOTE.equals(mimeType)) { - // Print phone number + // 如果是电话笔记,则打印电话号码、通话日期和通话位置 String phoneNumber = dataCursor.getString(DATA_COLUMN_PHONE_NUMBER); long callDate = dataCursor.getLong(DATA_COLUMN_CALL_DATE); String location = dataCursor.getString(DATA_COLUMN_CONTENT); - + + // 如果电话号码不为空,则打印电话号码 if (!TextUtils.isEmpty(phoneNumber)) { ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), phoneNumber)); } - // Print call date + // 打印通话日期 ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), DateFormat .format(mContext.getString(R.string.format_datetime_mdhm), callDate))); - // Print call attachment location + // 如果通话位置不为空,则打印通话位置 if (!TextUtils.isEmpty(location)) { ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), location)); } } else if (DataConstants.NOTE.equals(mimeType)) { + // 如果是普通笔记,则打印内容 String content = dataCursor.getString(DATA_COLUMN_CONTENT); if (!TextUtils.isEmpty(content)) { ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), content)); } } - } while (dataCursor.moveToNext()); + } while (dataCursor.moveToNext()); // 移动到下一行继续处理 } + + // 关闭dataCursor dataCursor.close(); } - // print a line separator between note + + // 打印一个行分隔符来分割每个笔记的内容 try { ps.write(new byte[] { Character.LINE_SEPARATOR, Character.LETTER_NUMBER @@ -219,126 +232,175 @@ public class BackupUtils { * Note will be exported as text which is user readable */ public int exportToText() { + // 检查外部存储是否可用 if (!externalStorageAvailable()) { Log.d(TAG, "Media was not mounted"); return STATE_SD_CARD_UNMOUONTED; } - + + // 获取导出到文本的PrintStream对象 PrintStream ps = getExportToTextPrintStream(); if (ps == null) { Log.e(TAG, "get print stream error"); return STATE_SYSTEM_ERROR; } - // First export folder and its notes + + // 首先导出文件夹及其内部的笔记 Cursor folderCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, "(" + NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + ") OR " + NoteColumns.ID + "=" + Notes.ID_CALL_RECORD_FOLDER, null, null); - + + // 如果folderCursor不为null,则进行处理 if (folderCursor != null) { + // 如果folderCursor中有数据,则继续循环处理每个文件夹 if (folderCursor.moveToFirst()) { do { - // Print folder's name + // 打印文件夹的名称 String folderName = ""; if(folderCursor.getLong(NOTE_COLUMN_ID) == Notes.ID_CALL_RECORD_FOLDER) { folderName = mContext.getString(R.string.call_record_folder_name); } else { folderName = folderCursor.getString(NOTE_COLUMN_SNIPPET); } + // 如果文件夹名称不为空,则打印文件夹名称 if (!TextUtils.isEmpty(folderName)) { ps.println(String.format(getFormat(FORMAT_FOLDER_NAME), folderName)); } String folderId = folderCursor.getString(NOTE_COLUMN_ID); + // 导出文件夹及其内部的笔记 exportFolderToText(folderId, ps); - } while (folderCursor.moveToNext()); + } while (folderCursor.moveToNext()); // 移动到下一行继续处理 } + // 关闭folderCursor folderCursor.close(); } - - // Export notes in root's folder + + // 导出根文件夹下的笔记 Cursor noteCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, NoteColumns.TYPE + "=" + +Notes.TYPE_NOTE + " AND " + NoteColumns.PARENT_ID + "=0", null, null); - + + // 如果noteCursor不为null,则进行处理 if (noteCursor != null) { + // 如果noteCursor中有数据,则继续循环处理每个笔记 if (noteCursor.moveToFirst()) { do { + // 打印笔记的修改日期 ps.println(String.format(getFormat(FORMAT_NOTE_DATE), DateFormat.format( mContext.getString(R.string.format_datetime_mdhm), noteCursor.getLong(NOTE_COLUMN_MODIFIED_DATE)))); - // Query data belong to this note + // 查询属于该笔记的数据,并导出为文本 String noteId = noteCursor.getString(NOTE_COLUMN_ID); exportNoteToText(noteId, ps); - } while (noteCursor.moveToNext()); + } while (noteCursor.moveToNext()); // 移动到下一行继续处理 } + // 关闭noteCursor noteCursor.close(); } + // 关闭PrintStream ps.close(); - + return STATE_SUCCESS; - } + } /** * Get a print stream pointed to the file {@generateExportedTextFile} */ - private PrintStream getExportToTextPrintStream() { - File file = generateFileMountedOnSDcard(mContext, R.string.file_path, - R.string.file_name_txt_format); - if (file == null) { - Log.e(TAG, "create file to exported failed"); - return null; - } - mFileName = file.getName(); - mFileDirectory = mContext.getString(R.string.file_path); - PrintStream ps = null; - try { - FileOutputStream fos = new FileOutputStream(file); - ps = new PrintStream(fos); - } catch (FileNotFoundException e) { - e.printStackTrace(); - return null; - } catch (NullPointerException e) { - e.printStackTrace(); - return null; - } - return ps; - } +/** + * 获取用于导出文本的PrintStream对象 + * @return 如果成功获取PrintStream对象,则返回该对象;如果获取过程中出现错误,则返回null + */ +private PrintStream getExportToTextPrintStream() { + // 调用generateFileMountedOnSDcard方法生成一个文件对象 + File file = generateFileMountedOnSDcard(mContext, R.string.file_path, R.string.file_name_txt_format); + // 如果生成的文件对象为空,记录错误并返回null + if (file == null) { + Log.e(TAG, "create file to exported failed"); + return null; + } + + // 保存生成的文件名和文件路径到成员变量 + mFileName = file.getName(); + mFileDirectory = mContext.getString(R.string.file_path); + + PrintStream ps = null; + try { + // 创建文件输出流,并将其封装为PrintStream对象 + FileOutputStream fos = new FileOutputStream(file); + ps = new PrintStream(fos); + } catch (FileNotFoundException e) { + // 捕获FileNotFoundException,记录错误并返回null + e.printStackTrace(); + return null; + } catch (NullPointerException e) { + // 捕获NullPointerException,记录错误并返回null + e.printStackTrace(); + return null; + } + // 返回创建的PrintStream对象,如果在过程中出现其他问题则返回null + return ps; +} } /** * Generate the text file to store imported data */ - private static File generateFileMountedOnSDcard(Context context, int filePathResId, int fileNameFormatResId) { - StringBuilder sb = new StringBuilder(); - sb.append(Environment.getExternalStorageDirectory()); - sb.append(context.getString(filePathResId)); - File filedir = new File(sb.toString()); - sb.append(context.getString( - fileNameFormatResId, - DateFormat.format(context.getString(R.string.format_date_ymd), - System.currentTimeMillis()))); - File file = new File(sb.toString()); - - try { - if (!filedir.exists()) { - filedir.mkdir(); - } - if (!file.exists()) { - file.createNewFile(); - } - return file; - } catch (SecurityException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); +/** + * 在SD卡上生成一个文件对象 + * @param context 上下文对象 + * @param filePathResId 文件路径的资源ID + * @param fileNameFormatResId 文件名格式的资源ID + * @return 如果成功生成文件对象,则返回该对象;如果生成过程中出现错误,则返回null + */ +private static File generateFileMountedOnSDcard(Context context, int filePathResId, int fileNameFormatResId) { + // 创建一个StringBuilder对象,用于拼接文件路径和文件名 + StringBuilder sb = new StringBuilder(); + + // 获取SD卡的根目录,并将其添加到StringBuilder中 + sb.append(Environment.getExternalStorageDirectory()); + + // 从资源中获取文件路径,并将其添加到StringBuilder中 + sb.append(context.getString(filePathResId)); + + // 根据文件名格式资源ID和当前时间生成文件名,并将其添加到StringBuilder中 + sb.append(context.getString(fileNameFormatResId, DateFormat.format(context.getString(R.string.format_date_ymd), + System.currentTimeMillis()))); + + // 根据StringBuilder中的路径创建一个文件夹对象 + File filedir = new File(sb.toString()); + + // 根据StringBuilder中的完整路径创建一个文件对象 + File file = new File(sb.toString()); + + try { + // 如果文件夹不存在,则创建文件夹 + if (!filedir.exists()) { + filedir.mkdir(); } - - return null; + + // 如果文件不存在,则创建文件 + if (!file.exists()) { + file.createNewFile(); + } + + // 返回生成的文件对象 + return file; + } catch (SecurityException e) { + // 捕获SecurityException异常,打印异常信息 + e.printStackTrace(); + } catch (IOException e) { + // 捕获IOException异常,打印异常信息 + e.printStackTrace(); } + + // 返回null表示生成文件过程中出现了错误 + return null; +} } diff --git a/src/app/src/main/java/net/micode/notes/tool/DataUtils.java b/src/app/src/main/java/net/micode/notes/tool/DataUtils.java index 2a14982e..86d6c254 100644 --- a/src/app/src/main/java/net/micode/notes/tool/DataUtils.java +++ b/src/app/src/main/java/net/micode/notes/tool/DataUtils.java @@ -37,259 +37,382 @@ import java.util.HashSet; public class DataUtils { public static final String TAG = "DataUtils"; - public static boolean batchDeleteNotes(ContentResolver resolver, HashSet ids) { - if (ids == null) { - Log.d(TAG, "the ids is null"); - return true; - } - if (ids.size() == 0) { - Log.d(TAG, "no id is in the hashset"); - return true; - } - - ArrayList operationList = new ArrayList(); - for (long id : ids) { - if(id == Notes.ID_ROOT_FOLDER) { - Log.e(TAG, "Don't delete system folder root"); - continue; - } - ContentProviderOperation.Builder builder = ContentProviderOperation - .newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); - operationList.add(builder.build()); - } - try { - ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); - if (results == null || results.length == 0 || results[0] == null) { - Log.d(TAG, "delete notes failed, ids:" + ids.toString()); - return false; - } - return true; - } catch (RemoteException e) { - Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); - } catch (OperationApplicationException e) { - Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); - } - return false; +/** + * 批量删除便签 + * @param resolver 内容解析器 + * @param ids 待删除便签的ID集合 + * @return 如果删除成功删除所有指定的便签,则返回true;否则返回false + */ +public static boolean batchDeleteNotes(ContentResolver resolver, HashSet ids) { + if (ids == null) { + // 如果ids为null,记录调试信息并返回true + Log.d(TAG, "the ids is null"); + return true; } - - public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) { - ContentValues values = new ContentValues(); - values.put(NoteColumns.PARENT_ID, desFolderId); - values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId); - values.put(NoteColumns.LOCAL_MODIFIED, 1); - resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null); + if (ids.size() == 0) { + // 如果ids集合为空,记录调试信息并返回true + Log.d(TAG, "no id is in the hashset"); + return true; } - public static boolean batchMoveToFolder(ContentResolver resolver, HashSet ids, - long folderId) { - if (ids == null) { - Log.d(TAG, "the ids is null"); - return true; - } + ArrayList operationList = new ArrayList(); - ArrayList operationList = new ArrayList(); - for (long id : ids) { - ContentProviderOperation.Builder builder = ContentProviderOperation - .newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); - builder.withValue(NoteColumns.PARENT_ID, folderId); - builder.withValue(NoteColumns.LOCAL_MODIFIED, 1); - operationList.add(builder.build()); + // 遍历待删除的便签ID集合 + for (long id : ids) { + if(id == Notes.ID_ROOT_FOLDER) { + // 如果当前ID为系统文件夹根目录的ID,记录错误信息并跳过 + Log.e(TAG, "Don't delete system folder root"); + continue; } - - try { - ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); - if (results == null || results.length == 0 || results[0] == null) { - Log.d(TAG, "delete notes failed, ids:" + ids.toString()); - return false; - } - return true; - } catch (RemoteException e) { - Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); - } catch (OperationApplicationException e) { - Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); + // 创建一个ContentProviderOperation.Builder用于构建删除指定ID的操作 + ContentProviderOperation.Builder builder = ContentProviderOperation.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); + // 将操作添加到操作列表中 + operationList.add(builder.build()); + } + try { + // 应用操作列表中的所有操作来批量删除便签 + ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); + if (results == null || results.length == 0 || results[0] == null) { + // 如果删除操作失败,记录错误信息并返回false + Log.d(TAG, "delete notes failed, ids:" + ids.toString()); + return false; } - return false; + // 删除操作成功完成,返回true + return true; + } catch (RemoteException e) { + // 捕获RemoteException异常,记录错误信息 + Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); + } catch (OperationApplicationException e) { + // 捕获OperationApplicationException异常,记录错误信息 + Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); } + // 出现异常情况,返回false + return false; +} - /** - * Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}} - */ - public static int getUserFolderCount(ContentResolver resolver) { - Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI, - new String[] { "COUNT(*)" }, - NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?", - new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)}, - null); +/** + * 将指定 id 的笔记移动到指定文件夹中 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param id 要移动的笔记的 ID + * @param srcFolderId 源文件夹的 ID + * @param desFolderId 目标文件夹的 ID + */ +public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) { + // 创建包含要更新的内容的 ContentValues 对象 + ContentValues values = new ContentValues(); + values.put(NoteColumns.PARENT_ID, desFolderId); // 将笔记的父文件夹 ID 设置为目标文件夹的 ID + values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId); // 设置笔记的原始父文件夹 ID 为源文件夹的 ID + values.put(NoteColumns.LOCAL_MODIFIED, 1); // 标记笔记已在本地修改 + // 使用 ContentResolver 执行更新操作 + resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null); +} - int count = 0; - if(cursor != null) { - if(cursor.moveToFirst()) { - try { - count = cursor.getInt(0); - } catch (IndexOutOfBoundsException e) { - Log.e(TAG, "get folder count failed:" + e.toString()); - } finally { - cursor.close(); - } - } - } - return count; +/** + * 批量将笔记移动到指定文件夹 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param ids 要移动的笔记的 ID 集合 + * @param folderId 目标文件夹的 ID + * @return 操作是否成功的布尔值,true 表示成功,false 表示失败 + */ +public static boolean batchMoveToFolder(ContentResolver resolver, HashSet ids, long folderId) { + if (ids == null) { + Log.d(TAG, "the ids is null"); + return true; } - public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) { - Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), - null, - NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER, - new String [] {String.valueOf(type)}, - null); + // 创建存储 ContentProviderOperation 的列表 + ArrayList operationList = new ArrayList(); + for (long id : ids) { + // 创建一个更新操作的 Builder + ContentProviderOperation.Builder builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); + builder.withValue(NoteColumns.PARENT_ID, folderId); // 设置笔记的父文件夹 ID 为目标文件夹的 ID + builder.withValue(NoteColumns.LOCAL_MODIFIED, 1); // 标记笔记已在本地修改 + operationList.add(builder.build()); // 将操作加入列表 + } - boolean exist = false; - if (cursor != null) { - if (cursor.getCount() > 0) { - exist = true; - } - cursor.close(); + try { + // 应用批量操作并获取结果 + ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); + if (results == null || results.length == 0 || results[0] == null) { + Log.d(TAG, "delete notes failed, ids:" + ids.toString()); + return false; } - return exist; + return true; + } catch (RemoteException e) { + Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); + } catch (OperationApplicationException e) { + Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); } + return false; +} +/** + * 获取所有用户文件夹的数量,不包括系统文件夹 {@link Notes#TYPE_SYSTEM} + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @return 用户文件夹的数量 + */ +public static int getUserFolderCount(ContentResolver resolver) { + // 查询数据库获取用户文件夹的数量 + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, + new String[] { "COUNT(*)" }, + NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?", + new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)}, + null); - public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) { - Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), - null, null, null, null); - - boolean exist = false; - if (cursor != null) { - if (cursor.getCount() > 0) { - exist = true; + int count = 0; + if (cursor != null) { + if (cursor.moveToFirst()) { + try { + count = cursor.getInt(0); + } catch (IndexOutOfBoundsException e) { + Log.e(TAG, "get folder count failed:" + e.toString()); + } finally { + cursor.close(); } - cursor.close(); } - return exist; } + return count; +} - public static boolean existInDataDatabase(ContentResolver resolver, long dataId) { - Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId), - null, null, null, null); +/** + * 判断笔记是否在笔记数据库中可见 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param noteId 笔记的 ID + * @param type 笔记的类型 + * @return 笔记是否可见的布尔值,true 表示可见,false 表示不可见 + */ +public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) { + // 查询数据库判断笔记是否可见 + Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), + null, + NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER, + new String[] { String.valueOf(type) }, + null); - boolean exist = false; - if (cursor != null) { - if (cursor.getCount() > 0) { - exist = true; - } - cursor.close(); + boolean exist = false; + if (cursor != null) { + if (cursor.getCount() > 0) { + exist = true; } - return exist; + cursor.close(); } + return exist; +} - public static boolean checkVisibleFolderName(ContentResolver resolver, String name) { - Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, - NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + - " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + - " AND " + NoteColumns.SNIPPET + "=?", - new String[] { name }, null); - boolean exist = false; - if(cursor != null) { - if(cursor.getCount() > 0) { - exist = true; - } - cursor.close(); +/** + * 检查给定笔记 ID 对应的笔记是否存在于笔记数据库中 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param noteId 待查询的笔记 ID + * @return 笔记是否存在于数据库中的布尔值,true 表示存在,false 表示不存在 + */ +public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) { + // 使用ContentResolver对象进行查询 + Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), + null, null, null, null); + + boolean exist = false; + // 检查结果集是否为空 + if (cursor != null) { + if (cursor.getCount() > 0) { + exist = true; } - return exist; + // 关闭数据库查询结果游标 + cursor.close(); } + return exist; +} - public static HashSet getFolderNoteWidget(ContentResolver resolver, long folderId) { - Cursor c = resolver.query(Notes.CONTENT_NOTE_URI, - new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE }, - NoteColumns.PARENT_ID + "=?", - new String[] { String.valueOf(folderId) }, - null); +/** + * 检查给定数据 ID 对应的数据是否存在于数据数据库中 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param dataId 待查询的数据 ID + * @return 数据是否存在于数据库中的布尔值,true 表示存在,false 表示不存在 + */ +public static boolean existInDataDatabase(ContentResolver resolver, long dataId) { + // 使用ContentResolver对象进行查询 + Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId), + null, null, null, null); - HashSet set = null; - if (c != null) { - if (c.moveToFirst()) { - set = new HashSet(); - do { - try { - AppWidgetAttribute widget = new AppWidgetAttribute(); - widget.widgetId = c.getInt(0); - widget.widgetType = c.getInt(1); - set.add(widget); - } catch (IndexOutOfBoundsException e) { - Log.e(TAG, e.toString()); - } - } while (c.moveToNext()); - } - c.close(); + boolean exist = false; + // 检查结果集是否为空 + if (cursor != null) { + if (cursor.getCount() > 0) { + exist = true; } - return set; + // 关闭数据库查询结果游标 + cursor.close(); } + return exist; +} - public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) { - Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, - new String [] { CallNote.PHONE_NUMBER }, - CallNote.NOTE_ID + "=? AND " + CallNote.MIME_TYPE + "=?", - new String [] { String.valueOf(noteId), CallNote.CONTENT_ITEM_TYPE }, - null); - - if (cursor != null && cursor.moveToFirst()) { - try { - return cursor.getString(0); - } catch (IndexOutOfBoundsException e) { - Log.e(TAG, "Get call number fails " + e.toString()); - } finally { - cursor.close(); - } +/** + * 检查给定文件夹名称是否存在于笔记数据库中 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param name 待查询的文件夹名称 + * @return 文件夹名称是否存在于数据库中的布尔值,true 表示存在,false 表示不存在 + */ +public static boolean checkVisibleFolderName(ContentResolver resolver, String name) { + // 使用ContentResolver对象进行查询 + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, + NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.SNIPPET + "=?", + new String[] { name }, null); + boolean exist = false; + // 检查结果集是否为空 + if(cursor != null) { + if(cursor.getCount() > 0) { + exist = true; } - return ""; + // 关闭数据库查询结果游标 + cursor.close(); } + return exist; +} - public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) { - Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, - new String [] { CallNote.NOTE_ID }, - CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL(" - + CallNote.PHONE_NUMBER + ",?)", - new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber }, - null); +/** + * 获取指定文件夹下的小部件属性集合 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param folderId 待查询的文件夹 ID + * @return 包含小部件属性的 HashSet,如果查询结果为空则返回 null + */ +public static HashSet getFolderNoteWidget(ContentResolver resolver, long folderId) { + // 使用ContentResolver对象进行查询 + Cursor c = resolver.query(Notes.CONTENT_NOTE_URI, + new String[] {NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE}, + NoteColumns.PARENT_ID + "=?", + new String[] {String.valueOf(folderId)}, + null); - if (cursor != null) { - if (cursor.moveToFirst()) { + HashSet set = null; + if (c != null) { + if (c.moveToFirst()) { + set = new HashSet<>(); + do { try { - return cursor.getLong(0); + AppWidgetAttribute widget = new AppWidgetAttribute(); + widget.widgetId = c.getInt(0); + widget.widgetType = c.getInt(1); + set.add(widget); } catch (IndexOutOfBoundsException e) { - Log.e(TAG, "Get call note id fails " + e.toString()); + Log.e(TAG, e.toString()); } - } - cursor.close(); + } while (c.moveToNext()); } - return 0; + c.close(); } + return set; +} - public static String getSnippetById(ContentResolver resolver, long noteId) { - Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, - new String [] { NoteColumns.SNIPPET }, - NoteColumns.ID + "=?", - new String [] { String.valueOf(noteId)}, - null); +/** + * 根据笔记 ID 获取对应的通话号码 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param noteId 待查询的笔记 ID + * @return 笔记对应的通话号码,如果查询失败则返回空字符串 + */ +public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) { + Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, + new String[] {CallNote.PHONE_NUMBER}, + CallNote.NOTE_ID + "=? AND " + CallNote.MIME_TYPE + "=?", + new String[] {String.valueOf(noteId), CallNote.CONTENT_ITEM_TYPE}, + null); - if (cursor != null) { - String snippet = ""; - if (cursor.moveToFirst()) { - snippet = cursor.getString(0); - } + if (cursor != null && cursor.moveToFirst()) { + try { + return cursor.getString(0); + } catch (IndexOutOfBoundsException e) { + Log.e(TAG, "Get call number fails " + e.toString()); + } finally { cursor.close(); - return snippet; } - throw new IllegalArgumentException("Note is not found with id: " + noteId); } + return ""; +} + +/** + * 根据通话号码和通话日期获取对应的笔记 ID + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param phoneNumber 待查询的通话号码 + * @param callDate 通话日期 + * @return 笔记 ID,如果查询失败则返回 0 + */ +/** + * 根据通话号码和通话日期获取对应的笔记 ID + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param phoneNumber 待查询的通话号码 + * @param callDate 通话日期 + * @return 笔记 ID,如果查询失败则返回 0 + */ +public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) { + Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, + new String[] {CallNote.NOTE_ID}, + CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL(" + + CallNote.PHONE_NUMBER + ",?)", + new String[] {String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber}, + null); - public static String getFormattedSnippet(String snippet) { - if (snippet != null) { - snippet = snippet.trim(); - int index = snippet.indexOf('\n'); - if (index != -1) { - snippet = snippet.substring(0, index); + if (cursor != null) { + if (cursor.moveToFirst()) { + try { + return cursor.getLong(0); + } catch (IndexOutOfBoundsException e) { + Log.e(TAG, "Get call note id fails " + e.toString()); } } + cursor.close(); + } + return 0; +} + +/** + * 根据笔记 ID获取对应的摘要信息 + * + * @param resolver ContentResolver 对象,用于访问应用程序数据 + * @param noteId 待查询的笔记 ID + * @return 笔记对应的摘要信息,如果查询失败则抛出 IllegalArgumentException + */ +public static String getSnippetById(ContentResolver resolver, long noteId) { + Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, + new String [] { NoteColumns.SNIPPET }, + NoteColumns.ID + "=?", + new String [] { String.valueOf(noteId)}, + null); + + if (cursor != null) { + String snippet = ""; + if (cursor.moveToFirst()) { + snippet = cursor.getString(0); + } + cursor.close(); return snippet; } + throw new IllegalArgumentException("Note is not found with id: " + noteId); +} + +/** + * 格式化摘要信息,只保留第一行内容并去除前后空格 + * + * @param snippet 待格式化的摘要信息 + * @return 格式化后的摘要信息 + */ +public static String getFormattedSnippet(String snippet) { + if (snippet != null) { + snippet = snippet.trim(); + int index = snippet.indexOf('\n'); + if (index != -1) { + snippet = snippet.substring(0, index); + } + } + return snippet; +} } 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 556b2f75..ca810866 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; @@ -179,6 +179,7 @@ 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, @@ -430,7 +431,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (id == R.id.btn_set_bg_color) { mNoteBgColorSelector.setVisibility(View.VISIBLE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( - View.VISIBLE); + - View.VISIBLE); } else if (sBgSelectorBtnsMap.containsKey(id)) { findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility( View.GONE); @@ -504,18 +505,18 @@ public class NoteEditActivity extends Activity implements OnClickListener, } 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); + 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, + builder.setPositiveButton(android.R.string.ok, //点击ok则删除该便签 new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { deleteCurrentNote(); @@ -524,18 +525,18 @@ public class NoteEditActivity extends Activity implements OnClickListener, }); builder.setNegativeButton(android.R.string.cancel, null); builder.show(); - } else if (itemId == R.id.menu_font_size) { + } 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) { + } else if (itemId == R.id.menu_share) { //分享 getWorkingText(); sendTo(this, mWorkingNote.getContent()); - } else if (itemId == R.id.menu_send_to_desktop) { + } else if (itemId == R.id.menu_send_to_desktop) { //发送到桌面 sendToDesktop(); - } else if (itemId == R.id.menu_alert) { + } else if (itemId == R.id.menu_alert) { //设置提醒 setReminder(); } else if (itemId == R.id.menu_delete_remind) { mWorkingNote.setAlertDate(0, false); @@ -544,17 +545,6 @@ public class NoteEditActivity extends Activity implements OnClickListener, } 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) { @@ -569,23 +559,13 @@ 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(); @@ -595,18 +575,9 @@ 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);/* - 这段代码是一个方法 `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`。 -这将打开一个新的笔记编辑界面,并根据传递的附加数据进行相应的操作。 - */ + startActivity(intent); } - + //删除当前工作的便签 private void deleteCurrentNote() { if (mWorkingNote.existInDatabase()) { HashSet ids = new HashSet(); @@ -626,21 +597,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } } } - 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)` 方法,将当前笔记标记为已删除。 -这段代码的作用是将当前的笔记标记为已删除,并根据不同的条件执行相应的操作: -如果不是同步模式,则删除数据库中的笔记;如果是同步模式,则将笔记移动到垃圾箱。 - */ + mWorkingNote.markDeleted(true); //标记删除 } private boolean isSyncMode() { @@ -818,24 +775,6 @@ public class NoteEditActivity extends Activity implements OnClickListener, } 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(); @@ -857,7 +796,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, } return hasChecked; } - + //保存便签 private boolean saveNote() { getWorkingText(); boolean saved = mWorkingNote.saveNote(); @@ -876,24 +815,9 @@ public class NoteEditActivity extends Activity implements OnClickListener, private void sendToDesktop() { /** -这段代码实现了一个名为 `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. 方法执行结束。 -综上,该方法的功能是将当前编辑的笔记发送到桌面上,并根据笔记的状态进行相应的处理,如保存新笔记、创建快捷方式等。 + * Before send message to home, we should make sure that current + * editing note is exists in databases. So, for new note, firstly + * save it */ if (!mWorkingNote.existInDatabase()) { saveNote(); 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 2afe2a89..54244dcb 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,117 +101,143 @@ 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,否则执行默认操作 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 if (0 == mSelectionStartBeforeDelete && mIndex != 0) { mOnTextViewChangeListener.onEditTextDelete(mIndex, getText().toString()); return true; } } else { - Log.d(TAG, "OnTextViewChangeListener was not seted"); + // 如果不存在文本变化监听器,则记录日志 + 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 seted"); + // 如果不存在文本变化监听器,则记录日志 + Log.d(TAG, "OnTextViewChangeListener was not set"); } break; default: break; } + // 继续处理按键事件 return super.onKeyUp(keyCode, event); } - @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); - } + + + + + +@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); } + // 调用父类的方法,处理焦点改变事件 + super.onFocusChanged(focused, direction, previouslyFocusedRect); +} - @Override - protected void onCreateContextMenu(ContextMenu menu) { - if (getText() instanceof Spanned) { - int selStart = getSelectionStart(); - int selEnd = getSelectionEnd(); - - int min = Math.min(selStart, selEnd); - int max = Math.max(selStart, selEnd); - - final URLSpan[] urls = ((Spanned) getText()).getSpans(min, max, URLSpan.class); - if (urls.length == 1) { - int defaultResId = 0; - for(String schema: sSchemaActionResMap.keySet()) { - if(urls[0].getURL().indexOf(schema) >= 0) { - defaultResId = sSchemaActionResMap.get(schema); - break; - } - } - - if (defaultResId == 0) { - defaultResId = R.string.note_link_other; +@Override +protected void onCreateContextMenu(ContextMenu menu) { + if (getText() instanceof Spanned) { + int selStart = getSelectionStart(); + int selEnd = getSelectionEnd(); + + int min = Math.min(selStart, selEnd); + int max = Math.max(selStart, selEnd); + + // 获取选中文本中的 URLSpan 对象 + final URLSpan[] urls = ((Spanned) getText()).getSpans(min, max, URLSpan.class); + if (urls.length == 1) { + int defaultResId = 0; + // 根据 URL 的 schema 查找对应的默认资源 ID + for(String schema: sSchemaActionResMap.keySet()) { + if(urls[0].getURL().indexOf(schema) >= 0) { + defaultResId = sSchemaActionResMap.get(schema); + break; } + } - menu.add(0, 0, 0, defaultResId).setOnMenuItemClickListener( - new OnMenuItemClickListener() { - public boolean onMenuItemClick(MenuItem item) { - // goto a new intent - urls[0].onClick(NoteEditText.this); - return true; - } - }); + if (defaultResId == 0) { + defaultResId = R.string.note_link_other; } + + // 向上下文菜单添加选项,并设置点击监听器 + menu.add(0, 0, 0, defaultResId).setOnMenuItemClickListener( + new OnMenuItemClickListener() { + public boolean onMenuItemClick(MenuItem item) { + // 执行跳转到新 Intent 的操作 + urls[0].onClick(NoteEditText.this); + return true; + } + }); } - super.onCreateContextMenu(menu); } + // 调用父类的方法,创建右键菜单 + super.onCreateContextMenu(menu); +} } diff --git a/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java b/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java index 58bf94d1..1b416558 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java +++ b/src/app/src/main/java/net/micode/notes/ui/NotesListActivity.java @@ -149,30 +149,41 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { + // 检查返回结果是否为成功,并且请求码是打开或新建节点的请求码 if (resultCode == RESULT_OK && (requestCode == REQUEST_CODE_OPEN_NODE || requestCode == REQUEST_CODE_NEW_NODE)) { + // 清空列表适配器的游标 mNotesListAdapter.changeCursor(null); } else { + // 调用父类的方法,处理返回结果 super.onActivityResult(requestCode, resultCode, data); } } - + private void setAppInfoFromRawRes() { + // 获取默认的 SharedPreference 对象 SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); if (!sp.getBoolean(PREFERENCE_ADD_INTRODUCTION, false)) { + // 创建一个 StringBuilder 对象来存储从文件中读取的内容 StringBuilder sb = new StringBuilder(); InputStream in = null; try { - in = getResources().openRawResource(R.raw.introduction); + // 打开 raw 文件夹下的 introduction 资源文件 + in = getResources().openRawResource(R.raw.introduction); if (in != null) { + // 创建 InputStreamReader 对象读取输入流 InputStreamReader isr = new InputStreamReader(in); + // 创建 BufferedReader 对象读取字符流 BufferedReader br = new BufferedReader(isr); - char [] buf = new char[1024]; + // 创建字符数组缓冲区 + char[] buf = new char[1024]; int len = 0; + // 读取字符流内容并追加到 StringBuilder 中 while ((len = br.read(buf)) > 0) { sb.append(buf, 0, len); } } else { + // 发生错误时打印错误信息 Log.e(TAG, "Read introduction file error"); return; } @@ -180,111 +191,127 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt e.printStackTrace(); return; } finally { - if(in != null) { + if (in != null) { try { in.close(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } } - + + // 创建一个空的 WorkingNote 对象 WorkingNote note = WorkingNote.createEmptyNote(this, Notes.ID_ROOT_FOLDER, AppWidgetManager.INVALID_APPWIDGET_ID, Notes.TYPE_WIDGET_INVALIDE, ResourceParser.RED); + // 设置 WorkingNote 对象的文本内容为从文件中读取的内容 note.setWorkingText(sb.toString()); + // 保存 WorkingNote,并将其设置为已加入介绍的标志位 if (note.saveNote()) { sp.edit().putBoolean(PREFERENCE_ADD_INTRODUCTION, true).commit(); } else { + // 发生错误时打印错误信息 Log.e(TAG, "Save introduction note error"); return; } } } - @Override - protected void onStart() { - super.onStart(); - startAsyncNotesListQuery(); - } - private void initResources() { - mContentResolver = this.getContentResolver(); - mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver()); - mCurrentFolderId = Notes.ID_ROOT_FOLDER; - mNotesListView = (ListView) findViewById(R.id.notes_list); - mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null), - null, false); - mNotesListView.setOnItemClickListener(new OnListItemClickListener()); - mNotesListView.setOnItemLongClickListener(this); - mNotesListAdapter = new NotesListAdapter(this); - mNotesListView.setAdapter(mNotesListAdapter); - mAddNewNote = (Button) findViewById(R.id.btn_new_note); - mAddNewNote.setOnClickListener(this); - mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener()); - mDispatch = false; - mDispatchY = 0; - mOriginY = 0; - mTitleBar = (TextView) findViewById(R.id.tv_title_bar); - mState = ListEditState.NOTE_LIST; - mModeCallBack = new ModeCallback(); - } - private class ModeCallback implements ListView.MultiChoiceModeListener, OnMenuItemClickListener { - private DropdownMenu mDropDownMenu; - private ActionMode mActionMode; - private MenuItem mMoveMenu; - - public boolean onCreateActionMode(ActionMode mode, Menu menu) { - getMenuInflater().inflate(R.menu.note_list_options, menu); - menu.findItem(R.id.delete).setOnMenuItemClickListener(this); - mMoveMenu = menu.findItem(R.id.move); - if (mFocusNoteDataItem.getParentId() == Notes.ID_CALL_RECORD_FOLDER - || DataUtils.getUserFolderCount(mContentResolver) == 0) { - mMoveMenu.setVisible(false); - } else { - mMoveMenu.setVisible(true); - mMoveMenu.setOnMenuItemClickListener(this); - } - mActionMode = mode; - mNotesListAdapter.setChoiceMode(true); - mNotesListView.setLongClickable(false); - mAddNewNote.setVisibility(View.GONE); +@Override +protected void onStart() { + super.onStart(); + startAsyncNotesListQuery(); // 在活动启动时开始异步笔记列表查询 +} - View customView = LayoutInflater.from(NotesListActivity.this).inflate( - R.layout.note_list_dropdown_menu, null); - mode.setCustomView(customView); - mDropDownMenu = new DropdownMenu(NotesListActivity.this, - (Button) customView.findViewById(R.id.selection_menu), - R.menu.note_list_dropdown); - mDropDownMenu.setOnDropdownMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){ - public boolean onMenuItemClick(MenuItem item) { - mNotesListAdapter.selectAll(!mNotesListAdapter.isAllSelected()); - updateMenu(); - return true; - } +/** + * 初始化资源 + */ +private void initResources() { + mContentResolver = this.getContentResolver(); // 获取内容解析器 + mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver()); // 初始化后台查询处理器 + mCurrentFolderId = Notes.ID_ROOT_FOLDER; // 设置当前文件夹 ID 为根文件夹 ID + mNotesListView = (ListView) findViewById(R.id.notes_list); // 获取笔记列表视图 + mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null), null, false); // 为笔记列表添加底部视图 + mNotesListView.setOnItemClickListener(new OnListItemClickListener()); // 设置笔记列表项点击监听器 + mNotesListView.setOnItemLongClickListener(this); // 设置笔记列表项长按监听器 + mNotesListAdapter = new NotesListAdapter(this); // 初始化笔记列表适配器 + mNotesListView.setAdapter(mNotesListAdapter); // 设置笔记列表适配器 + mAddNewNote = (Button) findViewById(R.id.btn_new_note); // 获取新建笔记按钮 + mAddNewNote.setOnClickListener(this); // 设置新建笔记按钮点击监听器 + mAddNewNote.setOnTouchListener(new NewNoteOnTouchListener()); // 设置新建笔记按钮触摸监听器 + mDispatch = false; + mDispatchY = 0; + mOriginY = 0; + mTitleBar = (TextView) findViewById(R.id.tv_title_bar); // 获取标题栏文本视图 + mState = ListEditState.NOTE_LIST; // 设置列表编辑状态为笔记列表状态 + mModeCallBack = new ModeCallback(); // 初始化模式回调 +} - }); - return true; +/** + * 模式回调类,实现列表多选模式监听器和菜单项点击监听器 + */ +private class ModeCallback implements ListView.MultiChoiceModeListener, OnMenuItemClickListener { + private DropdownMenu mDropDownMenu; // 下拉菜单 + private ActionMode mActionMode; // 操作模式 + private MenuItem mMoveMenu; // 移动菜单项 + + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + getMenuInflater().inflate(R.menu.note_list_options, menu); // 填充菜单项 + menu.findItem(R.id.delete).setOnMenuItemClickListener(this); // 设置删除菜单项点击监听器 + mMoveMenu = menu.findItem(R.id.move); // 查找移动菜单项 + if (mFocusNoteDataItem.getParentId() == Notes.ID_CALL_RECORD_FOLDER + || DataUtils.getUserFolderCount(mContentResolver) == 0) { + mMoveMenu.setVisible(false); // 如果当前笔记所属文件夹为通话记录文件夹或用户文件夹数量为 0,则隐藏移动菜单项 + } else { + mMoveMenu.setVisible(true); // 否则显示移动菜单项,并设置点击监听器 + mMoveMenu.setOnMenuItemClickListener(this); } + mActionMode = mode; // 保存操作模式对象 + mNotesListAdapter.setChoiceMode(true); // 设置笔记列表适配器选择模式为多选 + mNotesListView.setLongClickable(false); // 设置笔记列表不可长按 + mAddNewNote.setVisibility(View.GONE); // 隐藏新建笔记按钮 + + View customView = LayoutInflater.from(NotesListActivity.this).inflate( + R.layout.note_list_dropdown_menu, null); // 创建自定义视图 + mode.setCustomView(customView); // 设置操作模式的自定义视图 + mDropDownMenu = new DropdownMenu(NotesListActivity.this, + (Button) customView.findViewById(R.id.selection_menu), + R.menu.note_list_dropdown); // 初始化下拉菜单 + mDropDownMenu.setOnDropdownMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){ + public boolean onMenuItemClick(MenuItem item) { + mNotesListAdapter.selectAll(!mNotesListAdapter.isAllSelected()); // 选择或取消选择所有笔记并更新菜单 + updateMenu(); // 更新菜单 + return true; + } + }); + return true; + } - private void updateMenu() { - int selectedCount = mNotesListAdapter.getSelectedCount(); - // Update dropdown menu - String format = getResources().getString(R.string.menu_select_title, selectedCount); - mDropDownMenu.setTitle(format); - MenuItem item = mDropDownMenu.findItem(R.id.action_select_all); - if (item != null) { - if (mNotesListAdapter.isAllSelected()) { - item.setChecked(true); - item.setTitle(R.string.menu_deselect_all); - } else { - item.setChecked(false); - item.setTitle(R.string.menu_select_all); - } + private void updateMenu() { + int selectedCount = mNotesListAdapter.getSelectedCount(); + // 获取选择的数量 + + // 更新下拉菜单的标题 + String format = getResources().getString(R.string.menu_select_title, selectedCount); + mDropDownMenu.setTitle(format); + + // 找到菜单项 action_select_all + MenuItem item = mDropDownMenu.findItem(R.id.action_select_all); + if (item != null) { + // 如果所有的项目都被选择 + if (mNotesListAdapter.isAllSelected()) { + // 设置菜单项为选中状态,并更新标题为 "取消全选" + item.setChecked(true); + item.setTitle(R.string.menu_deselect_all); + } else { + // 设置菜单项为非选中状态,并更新标题为 "全选" + item.setChecked(false); + item.setTitle(R.string.menu_select_all); } } + } public boolean onPrepareActionMode(ActionMode mode, Menu menu) { // TODO Auto-generated method stub @@ -313,33 +340,40 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } public boolean onMenuItemClick(MenuItem item) { + // 如果没有选择任何项,则显示一个提示消息,并返回true表示处理了菜单项的点击事件 if (mNotesListAdapter.getSelectedCount() == 0) { Toast.makeText(NotesListActivity.this, getString(R.string.menu_select_none), Toast.LENGTH_SHORT).show(); return true; } - + int itemId = item.getItemId(); if (itemId == R.id.delete) { + // 创建一个警告对话框以确认删除操作 AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.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_notes, mNotesListAdapter.getSelectedCount())); + // 设置对话框的“确定”按钮点击事件 builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int which) { + public void onClick(DialogInterface dialog, int which) { + // 执行批量删除操作 batchDelete(); } }); + // 设置对话框的“取消”按钮点击事件 builder.setNegativeButton(android.R.string.cancel, null); builder.show(); } else if (itemId == R.id.move) { + // 启动查询目标文件夹的操作 startQueryDestinationFolders(); } else { + // 对于其他菜单项的点击事件,直接返回false表示未处理 return false; } + // 返回true表示已处理菜单项的点击事件 return true; } } @@ -356,20 +390,13 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt int eventY = start + (int) event.getY(); /** * Minus TitleBar's height + * 减去标题栏的高度,适应子文件夹状态 */ if (mState == ListEditState.SUB_FOLDER) { eventY -= mTitleBar.getHeight(); start -= mTitleBar.getHeight(); } - /** - * HACKME:When click the transparent part of "New Note" button, dispatch - * the event to the list view behind this button. The transparent part of - * "New Note" button could be expressed by formula y=-0.12x+94(Unit:pixel) - * and the line top of the button. The coordinate based on left of the "New - * Note" button. The 94 represents maximum height of the transparent part. - * Notice that, if the background of the button changes, the formula should - * also change. This is very bad, just for the UI designer's strong requirement. - */ + // 计算是否在可触摸区域内 if (event.getY() < (event.getX() * (-0.12) + 94)) { View view = mNotesListView.getChildAt(mNotesListView.getChildCount() - 1 - mNotesListView.getFooterViewsCount()); @@ -403,31 +430,35 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } return false; } - }; private void startAsyncNotesListQuery() { String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION : NORMAL_SELECTION; + + // 开始异步查询数据库 mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null, Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] { String.valueOf(mCurrentFolderId) }, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC"); } - + + // 后台异步查询处理器 private final class BackgroundQueryHandler extends AsyncQueryHandler { public BackgroundQueryHandler(ContentResolver contentResolver) { super(contentResolver); } - + @Override protected void onQueryComplete(int token, Object cookie, Cursor cursor) { switch (token) { case FOLDER_NOTE_LIST_QUERY_TOKEN: + // 查询完成后更新数据适配器 mNotesListAdapter.changeCursor(cursor); break; case FOLDER_LIST_QUERY_TOKEN: if (cursor != null && cursor.getCount() > 0) { + // 查询到文件夹数据后显示文件夹列表菜单 showFolderListMenu(cursor); } else { Log.e(TAG, "Query folder failed"); @@ -438,14 +469,17 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt } } } - + + // 显示文件夹列表菜单 private void showFolderListMenu(Cursor cursor) { AlertDialog.Builder builder = new AlertDialog.Builder(NotesListActivity.this); builder.setTitle(R.string.menu_title_select_folder); + final FoldersListAdapter adapter = new FoldersListAdapter(this, cursor); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { - + public void onClick(DialogInterface dialog, int which) { + // 将选中的笔记移动到所选的文件夹 DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter.getSelectedItemIds(), adapter.getItemId(which)); Toast.makeText( @@ -457,52 +491,67 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt mModeCallBack.finishActionMode(); } }); + builder.show(); } - + + // 创建新的笔记 private void createNewNote() { Intent intent = new Intent(this, NoteEditActivity.class); intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId); + + // 启动NoteEditActivity以创建新的笔记 this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE); } - private void batchDelete() { - new AsyncTask>() { - protected HashSet doInBackground(Void... unused) { - HashSet widgets = mNotesListAdapter.getSelectedWidget(); - if (!isSyncMode()) { - // if not synced, delete notes directly - if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter - .getSelectedItemIds())) { - } else { - Log.e(TAG, "Delete notes error, should not happens"); - } +/** + * 批量删除笔记操作 + */ +private void batchDelete() { + new AsyncTask>() { + /** + * 在后台执行操作 + */ + protected HashSet doInBackground(Void... unused) { + // 获取选中的小部件 + HashSet widgets = mNotesListAdapter.getSelectedWidget(); + if (!isSyncMode()) { + // 如果未同步,则直接删除笔记 + if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter.getSelectedItemIds())) { + // 删除成功 } else { - // in sync mode, we'll move the deleted note into the trash - // folder - if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter - .getSelectedItemIds(), Notes.ID_TRASH_FOLER)) { - Log.e(TAG, "Move notes to trash folder error, should not happens"); - } + Log.e(TAG, "Delete notes error, should not happens"); + } + } else { + // 在同步模式下,将已删除的笔记移动到回收站文件夹 + if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter.getSelectedItemIds(), + Notes.ID_TRASH_FOLER)) { + Log.e(TAG, "Move notes to trash folder error, should not happens"); } - return widgets; } + return widgets; + } - @Override - protected void onPostExecute(HashSet widgets) { - if (widgets != null) { - for (AppWidgetAttribute widget : widgets) { - if (widget.widgetId != AppWidgetManager.INVALID_APPWIDGET_ID - && widget.widgetType != Notes.TYPE_WIDGET_INVALIDE) { - updateWidget(widget.widgetId, widget.widgetType); - } + /** + * 在操作完成后更新小部件 + */ + @Override + protected void onPostExecute(HashSet widgets) { + if (widgets != null) { + // 更新与这些小部件相关联的小部件 + for (AppWidgetAttribute widget : widgets) { + if (widget.widgetId != AppWidgetManager.INVALID_APPWIDGET_ID + && widget.widgetType != Notes.TYPE_WIDGET_INVALIDE) { + updateWidget(widget.widgetId, widget.widgetType); } } - mModeCallBack.finishActionMode(); } - }.execute(); - } + // 完成操作模式 + mModeCallBack.finishActionMode(); + } + }.execute(); +} private void deleteFolder(long folderId) { /* @@ -624,130 +673,137 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt return; } } else { - etName.setText(""); - builder.setTitle(this.getString(R.string.menu_create_folder)); + Log.e(TAG, "The long click data item is null"); // 如果长按的数据项为空,则记录错误日志并返回 + return; } + } else { + etName.setText(""); // 清空文件夹名 + builder.setTitle(this.getString(R.string.menu_create_folder)); // 设置对话框标题为创建文件夹 + } - builder.setPositiveButton(android.R.string.ok, null); - builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - hideSoftInput(etName); + builder.setPositiveButton(android.R.string.ok, null); // 设置确认按钮 + builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + hideSoftInput(etName); // 隐藏软键盘 + } + }); + + final Dialog dialog = builder.setView(view).show(); // 显示对话框 + final Button positive = (Button)dialog.findViewById(android.R.id.button1); // 获取确认按钮 + positive.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + hideSoftInput(etName); // 隐藏软键盘 + String name = etName.getText().toString(); // 获取输入的文件夹名 + if (DataUtils.checkVisibleFolderName(mContentResolver, name)) { + Toast.makeText(NotesListActivity.this, getString(R.string.folder_exist, name), + Toast.LENGTH_LONG).show(); // 如果文件夹名已存在,显示提示信息 + etName.setSelection(0, etName.length()); // 选择输入的文件夹名 + return; // 结束操作 } - }); - - final Dialog dialog = builder.setView(view).show(); - final Button positive = (Button)dialog.findViewById(android.R.id.button1); - positive.setOnClickListener(new OnClickListener() { - public void onClick(View v) { - hideSoftInput(etName); - String name = etName.getText().toString(); - if (DataUtils.checkVisibleFolderName(mContentResolver, name)) { - Toast.makeText(NotesListActivity.this, getString(R.string.folder_exist, name), - Toast.LENGTH_LONG).show(); - etName.setSelection(0, etName.length()); - return; - } - if (!create) { - if (!TextUtils.isEmpty(name)) { - ContentValues values = new ContentValues(); - values.put(NoteColumns.SNIPPET, name); - values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER); - values.put(NoteColumns.LOCAL_MODIFIED, 1); - mContentResolver.update(Notes.CONTENT_NOTE_URI, values, NoteColumns.ID - + "=?", new String[] { - String.valueOf(mFocusNoteDataItem.getId()) - }); - } - } else if (!TextUtils.isEmpty(name)) { + if (!create) { + if (!TextUtils.isEmpty(name)) { // 如果文件夹名不为空 ContentValues values = new ContentValues(); - values.put(NoteColumns.SNIPPET, name); - values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER); - mContentResolver.insert(Notes.CONTENT_NOTE_URI, values); + values.put(NoteColumns.SNIPPET, name); // 设置文件夹名 + values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER); // 设置类型为文件夹 + values.put(NoteColumns.LOCAL_MODIFIED, 1); // 设置本地修改标志为1 + mContentResolver.update(Notes.CONTENT_NOTE_URI, values, NoteColumns.ID + + "=?", new String[] { + String.valueOf(mFocusNoteDataItem.getId()) // 根据文件夹id更新数据库中的文件夹名 + }); } - dialog.dismiss(); + } else if (!TextUtils.isEmpty(name)) { // 如果文件夹名不为空 + ContentValues values = new ContentValues(); + values.put(NoteColumns.SNIPPET, name); // 设置文件夹名 + values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER); // 设置类型为文件夹 + mContentResolver.insert(Notes.CONTENT_NOTE_URI, values); // 插入数据库创建新的文件夹 } - }); - - if (TextUtils.isEmpty(etName.getText())) { - positive.setEnabled(false); + dialog.dismiss(); // 关闭对话框 } - /** - * When the name edit text is null, disable the positive button - */ - etName.addTextChangedListener(new TextWatcher() { - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - // TODO Auto-generated method stub + }); - } + if (TextUtils.isEmpty(etName.getText())) { + positive.setEnabled(false); // 如果文件夹名为空,禁用确认按钮 + } + etName.addTextChangedListener(new TextWatcher() { + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } - public void onTextChanged(CharSequence s, int start, int before, int count) { - if (TextUtils.isEmpty(etName.getText())) { - positive.setEnabled(false); - } else { - positive.setEnabled(true); - } + public void onTextChanged(CharSequence s, int start, int before, int count) { + if (TextUtils.isEmpty(etName.getText())) { + positive.setEnabled(false); // 如果文件夹名为空,禁用确认按钮 + } else { + positive.setEnabled(true); // 如果文件夹名不为空,启用确认按钮 } + } - public void afterTextChanged(Editable s) { - // TODO Auto-generated method stub + public void afterTextChanged(Editable s) { + } + }); +} - } - }); +@Override +public void onBackPressed() { + // 处理返回键事件 + switch (mState) { + case SUB_FOLDER: + // 如果当前状态为子文件夹列表状态 + mCurrentFolderId = Notes.ID_ROOT_FOLDER; + mState = ListEditState.NOTE_LIST; + startAsyncNotesListQuery(); + mTitleBar.setVisibility(View.GONE); + break; + case CALL_RECORD_FOLDER: + // 如果当前状态为通话记录文件夹状态 + mCurrentFolderId = Notes.ID_ROOT_FOLDER; + mState = ListEditState.NOTE_LIST; + mAddNewNote.setVisibility(View.VISIBLE); + mTitleBar.setVisibility(View.GONE); + startAsyncNotesListQuery(); + break; + case NOTE_LIST: + // 如果当前状态为笔记列表状态,则调用父类的返回键处理方法 + super.onBackPressed(); + break; + default: + break; } +} - @Override - public void onBackPressed() { - switch (mState) { - case SUB_FOLDER: - mCurrentFolderId = Notes.ID_ROOT_FOLDER; - mState = ListEditState.NOTE_LIST; - startAsyncNotesListQuery(); - mTitleBar.setVisibility(View.GONE); - break; - case CALL_RECORD_FOLDER: - mCurrentFolderId = Notes.ID_ROOT_FOLDER; - mState = ListEditState.NOTE_LIST; - mAddNewNote.setVisibility(View.VISIBLE); - mTitleBar.setVisibility(View.GONE); - startAsyncNotesListQuery(); - break; - case NOTE_LIST: - super.onBackPressed(); - break; - default: - break; - } +/** + * 更新小部件 + * @param appWidgetId 小部件id + * @param appWidgetType 小部件类型 + */ +private void updateWidget(int appWidgetId, int appWidgetType) { + Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); + if (appWidgetType == Notes.TYPE_WIDGET_2X) { + intent.setClass(this, NoteWidgetProvider_2x.class); // 设置小部件Provider为2x类型 + } else if (appWidgetType == Notes.TYPE_WIDGET_4X) { + intent.setClass(this, NoteWidgetProvider_4x.class); // 设置小部件Provider为4x类型 + } else { + Log.e(TAG, "Unspported widget type"); // 记录错误日志并返回 + return; } - private void updateWidget(int appWidgetId, int appWidgetType) { - Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE); - if (appWidgetType == Notes.TYPE_WIDGET_2X) { - intent.setClass(this, NoteWidgetProvider_2x.class); - } else if (appWidgetType == Notes.TYPE_WIDGET_4X) { - intent.setClass(this, NoteWidgetProvider_4x.class); - } else { - Log.e(TAG, "Unspported widget type"); - return; - } - - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] { - appWidgetId - }); + intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {appWidgetId}); // 设置小部件id - sendBroadcast(intent); - setResult(RESULT_OK, intent); - } + sendBroadcast(intent); // 发送广播通知小部件更新 + setResult(RESULT_OK, intent); +} - private final OnCreateContextMenuListener mFolderOnCreateContextMenuListener = new OnCreateContextMenuListener() { - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { - if (mFocusNoteDataItem != null) { - menu.setHeaderTitle(mFocusNoteDataItem.getSnippet()); - menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view); - menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete); - menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name); - } +/** + * 文件夹长按菜单创建监听器 + */ +private final OnCreateContextMenuListener mFolderOnCreateContextMenuListener = new OnCreateContextMenuListener() { + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { + if (mFocusNoteDataItem != null) { + menu.setHeaderTitle(mFocusNoteDataItem.getSnippet()); // 设置菜单标题为文件夹名 + menu.add(0, MENU_FOLDER_VIEW, 0, R.string.menu_folder_view); // 添加查看文件夹菜单项 + menu.add(0, MENU_FOLDER_DELETE, 0, R.string.menu_folder_delete); // 添加删除文件夹菜单项 + menu.add(0, MENU_FOLDER_CHANGE_NAME, 0, R.string.menu_folder_change_name); // 添加修改文件夹名菜单项 } - }; + } +}; @Override public void onContextMenuClosed(Menu menu) { @@ -768,6 +824,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt openFolder(mFocusNoteDataItem); break; case MENU_FOLDER_DELETE: + // 创建对话框确认删除文件夹 AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.alert_title_delete)); builder.setIcon(android.R.drawable.ic_dialog_alert); @@ -782,21 +839,22 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt builder.show(); break; case MENU_FOLDER_CHANGE_NAME: + // 显示创建或修改文件夹的对话框 showCreateOrModifyFolderDialog(false); break; default: break; } - + return true; } - + @Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear(); if (mState == ListEditState.NOTE_LIST) { getMenuInflater().inflate(R.menu.note_list, menu); - // set sync or sync_cancel + // 设置同步或取消同步菜单项的标题 menu.findItem(R.id.menu_sync).setTitle( GTaskSyncService.isSyncing() ? R.string.menu_sync_cancel : R.string.menu_sync); } else if (mState == ListEditState.SUB_FOLDER) { @@ -955,79 +1013,91 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt from.startActivityIfNeeded(intent, -1); } - private class OnListItemClickListener implements OnItemClickListener { +// 创建一个内部类 OnListItemClickListener,实现了 OnItemClickListener 接口,用于处理列表项的单击事件 +private class OnListItemClickListener implements OnItemClickListener { - public void onItemClick(AdapterView parent, View view, int position, long id) { - if (view instanceof NotesListItem) { - NoteItemData item = ((NotesListItem) view).getItemData(); - if (mNotesListAdapter.isInChoiceMode()) { - if (item.getType() == Notes.TYPE_NOTE) { - position = position - mNotesListView.getHeaderViewsCount(); - mModeCallBack.onItemCheckedStateChanged(null, position, id, - !mNotesListAdapter.isSelectedItem(position)); - } - return; + public void onItemClick(AdapterView parent, View view, int position, long id) { + if (view instanceof NotesListItem) { + // 获取被点击的列表项的数据 + NoteItemData item = ((NotesListItem) view).getItemData(); + if (mNotesListAdapter.isInChoiceMode()) { + // 如果列表处于多选模式,则改变选中状态 + if (item.getType() == Notes.TYPE_NOTE) { + position = position - mNotesListView.getHeaderViewsCount(); + mModeCallBack.onItemCheckedStateChanged(null, position, id, + !mNotesListAdapter.isSelectedItem(position)); } + return; + } - switch (mState) { - case NOTE_LIST: - if (item.getType() == Notes.TYPE_FOLDER - || item.getType() == Notes.TYPE_SYSTEM) { - openFolder(item); - } else if (item.getType() == Notes.TYPE_NOTE) { - openNode(item); - } else { - Log.e(TAG, "Wrong note type in NOTE_LIST"); - } - break; - case SUB_FOLDER: - case CALL_RECORD_FOLDER: - if (item.getType() == Notes.TYPE_NOTE) { - openNode(item); - } else { - Log.e(TAG, "Wrong note type in SUB_FOLDER"); - } - break; - default: - break; - } + // 根据当前的状态和被点击的列表项的类型执行相应的操作 + switch (mState) { + case NOTE_LIST: + // 在笔记列表状态下,如果被点击的列表项是文件夹或系统项,则打开文件夹;如果是笔记项,则打开笔记 + if (item.getType() == Notes.TYPE_FOLDER + || item.getType() == Notes.TYPE_SYSTEM) { + openFolder(item); + } else if (item.getType() == Notes.TYPE_NOTE) { + openNode(item); + } else { + Log.e(TAG, "Wrong note type in NOTE_LIST"); + } + break; + case SUB_FOLDER: + case CALL_RECORD_FOLDER: + // 在子文件夹列表状态或通话记录文件夹状态下,如果被点击的列表项是笔记项,则打开笔记 + if (item.getType() == Notes.TYPE_NOTE) { + openNode(item); + } else { + Log.e(TAG, "Wrong note type in SUB_FOLDER"); + } + break; + default: + break; } } - } - private void startQueryDestinationFolders() { - String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?"; - selection = (mState == ListEditState.NOTE_LIST) ? selection: - "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")"; - - mBackgroundQueryHandler.startQuery(FOLDER_LIST_QUERY_TOKEN, - null, - Notes.CONTENT_NOTE_URI, - FoldersListAdapter.PROJECTION, - selection, - new String[] { - String.valueOf(Notes.TYPE_FOLDER), - String.valueOf(Notes.ID_TRASH_FOLER), - String.valueOf(mCurrentFolderId) - }, - NoteColumns.MODIFIED_DATE + " DESC"); - } +} - public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { - if (view instanceof NotesListItem) { - mFocusNoteDataItem = ((NotesListItem) view).getItemData(); - if (mFocusNoteDataItem.getType() == Notes.TYPE_NOTE && !mNotesListAdapter.isInChoiceMode()) { - if (mNotesListView.startActionMode(mModeCallBack) != null) { - mModeCallBack.onItemCheckedStateChanged(null, position, id, true); - mNotesListView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); - } else { - Log.e(TAG, "startActionMode fails"); - } - } else if (mFocusNoteDataItem.getType() == Notes.TYPE_FOLDER) { - mNotesListView.setOnCreateContextMenuListener(mFolderOnCreateContextMenuListener); +// 开始查询目标文件夹 +private void startQueryDestinationFolders() { + String selection = NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>? AND " + NoteColumns.ID + "<>?"; + selection = (mState == ListEditState.NOTE_LIST) ? selection: + "(" + selection + ") OR (" + NoteColumns.ID + "=" + Notes.ID_ROOT_FOLDER + ")"; + + // 使用 BackgroundQueryHandler 发起查询 + mBackgroundQueryHandler.startQuery(FOLDER_LIST_QUERY_TOKEN, + null, + Notes.CONTENT_NOTE_URI, + FoldersListAdapter.PROJECTION, + selection, + new String[] { + String.valueOf(Notes.TYPE_FOLDER), + String.valueOf(Notes.ID_TRASH_FOLER), + String.valueOf(mCurrentFolderId) + }, + NoteColumns.MODIFIED_DATE + " DESC"); +} + +public boolean onItemLongClick(AdapterView parent, View view, int position, long id) { + if (view instanceof NotesListItem) { + // 获取长按的列表项的数据 + mFocusNoteDataItem = ((NotesListItem) view).getItemData(); + if (mFocusNoteDataItem.getType() == Notes.TYPE_NOTE && !mNotesListAdapter.isInChoiceMode()) { + // 如果长按的列表项是笔记项,并且当前不是多选模式,则启动 ActionMode 多选模式 + if (mNotesListView.startActionMode(mModeCallBack) != null) { + // 改变选中状态,并触发长按振动反馈 + mModeCallBack.onItemCheckedStateChanged(null, position, id, true); + mNotesListView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + } else { + Log.e(TAG, "startActionMode fails"); } + } else if (mFocusNoteDataItem.getType() == Notes.TYPE_FOLDER) { + // 如果长按的列表项是文件夹,则设置菜单创建监听器为文件夹菜单监听器 + mNotesListView.setOnCreateContextMenuListener(mFolderOnCreateContextMenuListener); } - return false; } + return false; +} } diff --git a/src/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java b/src/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java index 51c9cb98..72a73d9a 100644 --- a/src/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java +++ b/src/app/src/main/java/net/micode/notes/ui/NotesListAdapter.java @@ -91,33 +91,44 @@ public class NotesListAdapter extends CursorAdapter { public HashSet getSelectedItemIds() { HashSet itemSet = new HashSet(); + // 遍历选中项的位置集合 for (Integer position : mSelectedIndex.keySet()) { + // 如果选中状态为 true if (mSelectedIndex.get(position) == true) { + // 获取该位置对应的项的 ID Long id = getItemId(position); + // 如果 ID 为根文件夹的 ID,则输出错误日志 if (id == Notes.ID_ROOT_FOLDER) { Log.d(TAG, "Wrong item id, should not happen"); } else { + // 将 ID 添加到集合中 itemSet.add(id); } } } - + return itemSet; } - + public HashSet getSelectedWidget() { HashSet itemSet = new HashSet(); + // 遍历选中项的位置集合 for (Integer position : mSelectedIndex.keySet()) { + // 如果选中状态为 true if (mSelectedIndex.get(position) == true) { + // 获取该位置对应的项的 Cursor Cursor c = (Cursor) getItem(position); + // 如果 Cursor 不为空 if (c != null) { AppWidgetAttribute widget = new AppWidgetAttribute(); NoteItemData item = new NoteItemData(mContext, c); + // 从项的数据中获取 Widget 的 ID 和类型 widget.widgetId = item.getWidgetId(); widget.widgetType = item.getWidgetType(); + // 将 Widget 添加到集合中 itemSet.add(widget); /** - * Don't close cursor here, only the adapter could close it + * 不要在这里关闭 Cursor,只有适配器可以关闭它 */ } else { Log.e(TAG, "Invalid cursor"); @@ -127,14 +138,16 @@ public class NotesListAdapter extends CursorAdapter { } return itemSet; } - + public int getSelectedCount() { Collection values = mSelectedIndex.values(); + // 如果选中项集合为 null,则返回 0 if (null == values) { return 0; } Iterator iter = values.iterator(); int count = 0; + // 遍历选中项的值集合,统计选中项的数量并返回 while (iter.hasNext()) { if (true == iter.next()) { count++; @@ -169,13 +182,21 @@ public class NotesListAdapter extends CursorAdapter { private void calcNotesCount() { mNotesCount = 0; + + // 循环遍历每一个项目 for (int i = 0; i < getCount(); i++) { + // 获取当前项对应的Cursor对象 Cursor c = (Cursor) getItem(i); + + // 检查当前Cursor对象是否有效 if (c != null) { + // 检查当前笔记的类型是否为普通笔记 if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) { + // 增加笔记计数 mNotesCount++; } } else { + // 打印错误日志并返回 Log.e(TAG, "Invalid cursor"); return; } 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 1221e808..369c9880 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 @@ -47,27 +47,31 @@ public class NotesListItem extends LinearLayout { mCallName = (TextView) findViewById(R.id.tv_name); 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); } else { mCheckBox.setVisibility(View.GONE); } - - mItemData = data; + + mItemData = data; // 将数据保存在类成员变量中 + + // 根据不同的数据类型和属性设置视图的可见性,文本内容和图像资源 if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { mCallName.setVisibility(View.GONE); mAlert.setVisibility(View.VISIBLE); mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem); mTitle.setText(context.getString(R.string.call_record_folder_name) - + context.getString(R.string.format_folder_files_count, data.getNotesCount())); + + context.getString(R.string.format_folder_files_count, data.getNotesCount())); mAlert.setImageResource(R.drawable.call_record); } else if (data.getParentId() == Notes.ID_CALL_RECORD_FOLDER) { mCallName.setVisibility(View.VISIBLE); mCallName.setText(data.getCallName()); - mTitle.setTextAppearance(context,R.style.TextAppearanceSecondaryItem); + mTitle.setTextAppearance(context, R.style.TextAppearanceSecondaryItem); mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet())); if (data.hasAlert()) { mAlert.setImageResource(R.drawable.clock); @@ -78,11 +82,10 @@ public class NotesListItem extends LinearLayout { } else { mCallName.setVisibility(View.GONE); mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem); - + if (data.getType() == Notes.TYPE_FOLDER) { mTitle.setText(data.getSnippet() - + context.getString(R.string.format_folder_files_count, - data.getNotesCount())); + + context.getString(R.string.format_folder_files_count, data.getNotesCount())); mAlert.setVisibility(View.GONE); } else { mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet())); @@ -94,11 +97,14 @@ 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 07c5f7ec..ef66eadc 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 @@ -72,28 +72,28 @@ public class NotesPreferenceActivity extends PreferenceActivity { @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); - - /* using the app icon for navigation */ + + /* 设置显示返回箭头 */ getActionBar().setDisplayHomeAsUpEnabled(true); - + + /* 从 XML 文件加载偏好设置 */ addPreferencesFromResource(R.xml.preferences); mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY); mReceiver = new GTaskReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME); registerReceiver(mReceiver, filter); - + mOriAccounts = null; View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null); getListView().addHeaderView(header, null, true); } - + @Override protected void onResume() { super.onResume(); - - // need to set sync account automatically if user has added a new - // account + + // 需要在用户添加新帐户后自动设置同步帐户 if (mHasAddedAccount) { Account[] accounts = getGoogleAccounts(); if (mOriAccounts != null && accounts.length > mOriAccounts.length) { @@ -112,10 +112,10 @@ public class NotesPreferenceActivity extends PreferenceActivity { } } } - + refreshUI(); } - + @Override protected void onDestroy() { if (mReceiver != null) { @@ -123,10 +123,11 @@ public class NotesPreferenceActivity extends PreferenceActivity { } super.onDestroy(); } - + + /* 加载帐户偏好设置 */ private void loadAccountPreference() { mAccountCategory.removeAll(); - + Preference accountPref = new Preference(this); final String defaultAccount = getSyncAccountName(this); accountPref.setTitle(getString(R.string.preferences_account_title)); @@ -135,11 +136,10 @@ public class NotesPreferenceActivity extends PreferenceActivity { public boolean onPreferenceClick(Preference preference) { if (!GTaskSyncService.isSyncing()) { if (TextUtils.isEmpty(defaultAccount)) { - // the first time to set account + // 第一次设置帐户 showSelectAccountAlertDialog(); } else { - // if the account has already been set, we need to promp - // user about the risk + // 如果帐户已经设置,需要提示用户风险 showChangeAccountConfirmAlertDialog(); } } else { @@ -150,186 +150,194 @@ public class NotesPreferenceActivity extends PreferenceActivity { return true; } }); - + mAccountCategory.addPreference(accountPref); } - private void loadSyncButton() { - Button syncButton = (Button) findViewById(R.id.preference_sync_button); - TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview); - - // set button state - if (GTaskSyncService.isSyncing()) { - syncButton.setText(getString(R.string.preferences_button_sync_cancel)); - syncButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - GTaskSyncService.cancelSync(NotesPreferenceActivity.this); - } - }); - } else { - syncButton.setText(getString(R.string.preferences_button_sync_immediately)); - syncButton.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - GTaskSyncService.startSync(NotesPreferenceActivity.this); - } - }); - } - syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this))); - - // set last sync time - if (GTaskSyncService.isSyncing()) { - lastSyncTimeView.setText(GTaskSyncService.getProgressString()); +// 加载同步按钮 +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) { + GTaskSyncService.cancelSync(NotesPreferenceActivity.this); + } + }); + } else { + // 如果未在同步,则显示立即同步按钮,并设置点击监听器开始同步 + syncButton.setText(getString(R.string.preferences_button_sync_immediately)); + syncButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + GTaskSyncService.startSync(NotesPreferenceActivity.this); + } + }); + } + // 根据是否存在同步帐户来设置按钮是否可用 + syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this))); + + // 设置上次同步时间 + if (GTaskSyncService.isSyncing()) { + // 如果正在同步,则显示同步进度,并设置视图可见 + lastSyncTimeView.setText(GTaskSyncService.getProgressString()); + lastSyncTimeView.setVisibility(View.VISIBLE); + } else { + // 如果未在同步,则获取上次同步时间并显示在视图中 + long lastSyncTime = getLastSyncTime(this); + if (lastSyncTime != 0) { + lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time, + DateFormat.format(getString(R.string.preferences_last_sync_time_format), + lastSyncTime))); lastSyncTimeView.setVisibility(View.VISIBLE); } else { - long lastSyncTime = getLastSyncTime(this); - if (lastSyncTime != 0) { - lastSyncTimeView.setText(getString(R.string.preferences_last_sync_time, - DateFormat.format(getString(R.string.preferences_last_sync_time_format), - lastSyncTime))); - lastSyncTimeView.setVisibility(View.VISIBLE); - } else { - lastSyncTimeView.setVisibility(View.GONE); - } + // 如果没有上次同步时间,则隐藏视图 + lastSyncTimeView.setVisibility(View.GONE); } } +} - private void refreshUI() { - loadAccountPreference(); - loadSyncButton(); - } - - private void showSelectAccountAlertDialog() { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); - - View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null); - TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title); - titleTextView.setText(getString(R.string.preferences_dialog_select_account_title)); - TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle); - subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips)); - - dialogBuilder.setCustomTitle(titleView); - dialogBuilder.setPositiveButton(null, null); - - Account[] accounts = getGoogleAccounts(); - String defAccount = getSyncAccountName(this); - - mOriAccounts = accounts; - mHasAddedAccount = false; +// 刷新用户界面 +private void refreshUI() { + // 加载帐户偏好设置 + loadAccountPreference(); + // 加载同步按钮 + loadSyncButton(); +} - if (accounts.length > 0) { - CharSequence[] items = new CharSequence[accounts.length]; - final CharSequence[] itemMapping = items; - int checkedItem = -1; - int index = 0; - for (Account account : accounts) { - if (TextUtils.equals(account.name, defAccount)) { - checkedItem = index; - } - items[index++] = account.name; +private void showSelectAccountAlertDialog() { + // 创建一个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帐户数组和默认帐户 + 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; + int index = 0; + for (Account account : accounts) { + if (TextUtils.equals(account.name, defAccount)) { + checkedItem = index; } - dialogBuilder.setSingleChoiceItems(items, checkedItem, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - setSyncAccount(itemMapping[which].toString()); - dialog.dismiss(); - refreshUI(); - } - }); + items[index++] = account.name; } - - 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" + // 设置单选项列表,其中帐户名为选项文本,checkedItem为默认选中项 + dialogBuilder.setSingleChoiceItems(items, checkedItem, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + setSyncAccount(itemMapping[which].toString()); + dialog.dismiss(); + refreshUI(); + } }); - startActivityForResult(intent, -1); - dialog.dismiss(); - } - }); - } - - private void showChangeAccountConfirmAlertDialog() { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); - - View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null); - TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title); - titleTextView.setText(getString(R.string.preferences_dialog_change_account_title, - getSyncAccountName(this))); - TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle); - subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg)); - dialogBuilder.setCustomTitle(titleView); - - CharSequence[] menuItemArray = new CharSequence[] { - getString(R.string.preferences_menu_change_account), - getString(R.string.preferences_menu_remove_account), - getString(R.string.preferences_menu_cancel) - }; - dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - if (which == 0) { - showSelectAccountAlertDialog(); - } else if (which == 1) { - removeSyncAccount(); - refreshUI(); - } - } - }); - dialogBuilder.show(); } - private Account[] getGoogleAccounts() { - AccountManager accountManager = AccountManager.get(this); - return accountManager.getAccountsByType("com.google"); - } + // 填充自定义布局,用作添加账户的视图 + 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" + }); + startActivityForResult(intent, -1); + dialog.dismiss(); + } + }); +} - private void setSyncAccount(String account) { - if (!getSyncAccountName(this).equals(account)) { - SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = settings.edit(); - if (account != null) { - editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account); - } else { - editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); +private void showChangeAccountConfirmAlertDialog() { + // 创建一个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))); + TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle); + subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg)); + dialogBuilder.setCustomTitle(titleView); + + // 设置对话框的选项菜单 + CharSequence[] menuItemArray = new CharSequence[] { + getString(R.string.preferences_menu_change_account), + getString(R.string.preferences_menu_remove_account), + getString(R.string.preferences_menu_cancel) + }; + dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + if (which == 0) { + showSelectAccountAlertDialog(); + } else if (which == 1) { + removeSyncAccount(); + refreshUI(); } - editor.commit(); - - // clean up last sync time - setLastSyncTime(this, 0); - - // clean up local gtask related info - new Thread(new Runnable() { - public void run() { - ContentValues values = new ContentValues(); - values.put(NoteColumns.GTASK_ID, ""); - values.put(NoteColumns.SYNC_ID, 0); - getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null); - } - }).start(); - - Toast.makeText(NotesPreferenceActivity.this, - getString(R.string.preferences_toast_success_set_accout, account), - Toast.LENGTH_SHORT).show(); } - } + }); + dialogBuilder.show(); +} - private void removeSyncAccount() { +private Account[] getGoogleAccounts() { + // 获取账户管理器实例 + AccountManager accountManager = AccountManager.get(this); + // 返回所有com.google类型的账户 + return accountManager.getAccountsByType("com.google"); +} + +private void setSyncAccount(String account) { + // 如果当前同步账户与设置的账户不同 + if (!getSyncAccountName(this).equals(account)) { + // 获取SharedPreferences实例 SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); + // 获取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); + // 如果账户不为null,设置同步账户名称 + if (account != null) { + editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account); + } else { + // 否则清空同步账户名称 + editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); } editor.commit(); - // clean up local gtask related info + // 清空上次同步时间 + setLastSyncTime(this, 0); + + // 清空本地gtask相关信息 new Thread(new Runnable() { public void run() { ContentValues values = new ContentValues(); @@ -338,51 +346,92 @@ public class NotesPreferenceActivity extends PreferenceActivity { getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null); } }).start(); - } - public static String getSyncAccountName(Context context) { - SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, - Context.MODE_PRIVATE); - return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); + // 显示Toast提示设置成功 + Toast.makeText(NotesPreferenceActivity.this, + getString(R.string.preferences_toast_success_set_accout, account), + Toast.LENGTH_SHORT).show(); } +} - public static void setLastSyncTime(Context context, long time) { - SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, - Context.MODE_PRIVATE); - SharedPreferences.Editor editor = settings.edit(); - editor.putLong(PREFERENCE_LAST_SYNC_TIME, time); - editor.commit(); +private void removeSyncAccount() { + // 获取SharedPreferences实例 + SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); + // 获取SharedPreferences编辑器 + SharedPreferences.Editor editor = settings.edit(); + // 如果包含同步账户名称信息,移除 + if (settings.contains(PREFERENCE_SYNC_ACCOUNT_NAME)) { + editor.remove(PREFERENCE_SYNC_ACCOUNT_NAME); } - - public static long getLastSyncTime(Context context) { - SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, - Context.MODE_PRIVATE); - return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0); + // 如果包含上次同步时间信息,移除 + if (settings.contains(PREFERENCE_LAST_SYNC_TIME)) { + editor.remove(PREFERENCE_LAST_SYNC_TIME); } + editor.commit(); + + // 清空本地gtask相关信息 + new Thread(new Runnable() { + public void run() { + ContentValues values = new ContentValues(); + values.put(NoteColumns.GTASK_ID, ""); + values.put(NoteColumns.SYNC_ID, 0); + getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null); + } + }).start(); +} - private class GTaskReceiver extends BroadcastReceiver { +public static String getSyncAccountName(Context context) { + // 获取SharedPreferences实例 + SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, + Context.MODE_PRIVATE); + // 返回同步账户名称 + return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, ""); +} - @Override - public void onReceive(Context context, Intent intent) { - 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)); - } +public static void setLastSyncTime(Context context, long time) { + // 获取SharedPreferences实例 + SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, + Context.MODE_PRIVATE); + // 获取SharedPreferences编辑器 + SharedPreferences.Editor editor = settings.edit(); + // 设置上次同步时间 + editor.putLong(PREFERENCE_LAST_SYNC_TIME, time); + editor.commit(); +} +public static long getLastSyncTime(Context context) { + // 获取SharedPreferences实例 + SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME, + Context.MODE_PRIVATE); + // 返回上次同步时间 + return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0); +} + +private class GTaskReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + // 刷新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)); } } +} - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case android.R.id.home: - Intent intent = new Intent(this, NotesListActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - startActivity(intent); - return true; - default: - return false; - } +public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + Intent intent = new Intent(this, NotesListActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + // 返回到主页面 + startActivity(intent); + return true; + default: + return false; } } +}