diff --git a/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.bin b/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.bin index 9804210..f33b577 100644 Binary files a/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.bin and b/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.bin differ diff --git a/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.lock b/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.lock index bdc5799..c62a5d7 100644 Binary files a/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.lock and b/src/Notes-master2/.gradle/7.5/executionHistory/executionHistory.lock differ diff --git a/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.bin b/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.bin index 6cc812c..6d97dbe 100644 Binary files a/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.bin and b/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.bin differ diff --git a/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.lock b/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.lock index 790b09c..c76608b 100644 Binary files a/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.lock and b/src/Notes-master2/.gradle/7.5/fileHashes/fileHashes.lock differ diff --git a/src/Notes-master2/.gradle/7.5/fileHashes/resourceHashesCache.bin b/src/Notes-master2/.gradle/7.5/fileHashes/resourceHashesCache.bin index 3739e74..a8b946b 100644 Binary files a/src/Notes-master2/.gradle/7.5/fileHashes/resourceHashesCache.bin and b/src/Notes-master2/.gradle/7.5/fileHashes/resourceHashesCache.bin differ diff --git a/src/Notes-master2/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/src/Notes-master2/.gradle/buildOutputCleanup/buildOutputCleanup.lock index c8b7ebf..7260fc1 100644 Binary files a/src/Notes-master2/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/src/Notes-master2/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/src/Notes-master2/.gradle/file-system.probe b/src/Notes-master2/.gradle/file-system.probe index 55f4025..94041de 100644 Binary files a/src/Notes-master2/.gradle/file-system.probe and b/src/Notes-master2/.gradle/file-system.probe differ diff --git a/src/Notes-master2/app/build/intermediates/apk/debug/app-debug.apk b/src/Notes-master2/app/build/intermediates/apk/debug/app-debug.apk index e0d00ba..3e9fc40 100644 Binary files a/src/Notes-master2/app/build/intermediates/apk/debug/app-debug.apk and b/src/Notes-master2/app/build/intermediates/apk/debug/app-debug.apk differ diff --git a/src/Notes-master2/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex b/src/Notes-master2/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex index d9fa1a0..0ff513a 100644 Binary files a/src/Notes-master2/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex and b/src/Notes-master2/app/build/intermediates/dex/debug/mergeDexDebug/classes.dex differ diff --git a/src/Notes-master2/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt b/src/Notes-master2/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt index 3b3b5a8..6874b10 100644 --- a/src/Notes-master2/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt +++ b/src/Notes-master2/app/build/intermediates/incremental/packageDebug/tmp/debug/dex-renamer-state.txt @@ -1,4 +1,4 @@ -#Fri Apr 28 08:58:42 CST 2023 +#Thu May 11 22:45:40 CST 2023 base.0=D\:\\Notes-master2\\Notes-master2\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex renamed.0=classes.dex path.0=classes.dex diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/MetaData.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/MetaData.class index 2319eaf..eca9199 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/MetaData.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/MetaData.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/Node.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/Node.class index d2dcfb5..514074f 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/Node.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/Node.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlData.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlData.class index c61d69f..bf7a892 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlData.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlData.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlNote.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlNote.class index 26c68fb..677aaf6 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlNote.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/SqlNote.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/TaskList.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/TaskList.class index 69ac9b5..d3a8b8b 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/TaskList.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/gtask/data/TaskList.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class index 30318fc..54b4705 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note$NoteData.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class index bbbea2e..08b4a42 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/Note.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class index e9f5b68..2081cb7 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/model/WorkingNote.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class index bfb671c..598be80 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils$TextExport.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class index ed4ac8e..726f0ad 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/BackupUtils.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class index fc1d9a2..d222d9c 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/DataUtils.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteBgResources.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteBgResources.class index f1053bc..1c858f0 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteBgResources.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteBgResources.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteItemBgResources.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteItemBgResources.class index 34b5c02..bdd8fad 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteItemBgResources.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$NoteItemBgResources.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$TextAppearanceResources.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$TextAppearanceResources.class index 1714fc2..7a79e8d 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$TextAppearanceResources.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$TextAppearanceResources.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$WidgetBgResources.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$WidgetBgResources.class index 595f36d..37af0ea 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$WidgetBgResources.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser$WidgetBgResources.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser.class index 7ded6f4..acad64a 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/tool/ResourceParser.class differ diff --git a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/AlarmAlertActivity.class b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/AlarmAlertActivity.class index 79598f6..1616418 100644 Binary files a/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/AlarmAlertActivity.class and b/src/Notes-master2/app/build/intermediates/javac/debug/classes/net/micode/notes/ui/AlarmAlertActivity.class differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/MetaData.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/MetaData.dex index edca6c2..16073f3 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/MetaData.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/MetaData.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/Node.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/Node.dex index 43fbb95..e2aafce 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/Node.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/Node.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlData.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlData.dex index 7043e40..4675daa 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlData.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlData.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlNote.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlNote.dex index 86f3bdd..7954c6b 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlNote.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/SqlNote.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/TaskList.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/TaskList.dex index 8fa92ab..d8273f7 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/TaskList.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/gtask/data/TaskList.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note$NoteData.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note$NoteData.dex index 7d8a2cc..05a36a1 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note$NoteData.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note$NoteData.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note.dex index f34ea10..6ecba7c 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/Note.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/WorkingNote.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/WorkingNote.dex index 802d1f8..9e69b03 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/WorkingNote.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/model/WorkingNote.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils$TextExport.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils$TextExport.dex index 705f56a..bb1cbd0 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils$TextExport.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils$TextExport.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils.dex index d9823b2..eb9e5c6 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/BackupUtils.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/DataUtils.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/DataUtils.dex index 7c5f9b2..5098df7 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/DataUtils.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/DataUtils.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteBgResources.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteBgResources.dex index 86f7f9f..fcc4db8 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteBgResources.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteBgResources.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteItemBgResources.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteItemBgResources.dex index ef2fe6c..b8cdf6d 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteItemBgResources.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$NoteItemBgResources.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$TextAppearanceResources.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$TextAppearanceResources.dex index a49e587..11de48d 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$TextAppearanceResources.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$TextAppearanceResources.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$WidgetBgResources.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$WidgetBgResources.dex index 296ff56..1afa26b 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$WidgetBgResources.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser$WidgetBgResources.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser.dex index 602aad6..5d5bd6a 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/tool/ResourceParser.dex differ diff --git a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/ui/AlarmAlertActivity.dex b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/ui/AlarmAlertActivity.dex index 88ac5a9..7097508 100644 Binary files a/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/ui/AlarmAlertActivity.dex and b/src/Notes-master2/app/build/intermediates/project_dex_archive/debug/out/net/micode/notes/ui/AlarmAlertActivity.dex differ diff --git a/src/Notes-master2/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin b/src/Notes-master2/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin index 611a48b..fbd3125 100644 Binary files a/src/Notes-master2/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin and b/src/Notes-master2/app/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin differ diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/data/NotesProvider.java b/src/Notes-master2/app/src/main/java/net/micode/notes/data/NotesProvider.java index a5cf316..0b0eab8 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/data/NotesProvider.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/data/NotesProvider.java @@ -191,7 +191,7 @@ public class NotesProvider extends ContentProvider { return ContentUris.withAppendedId(uri, insertedId); } - + // 删除一个uri @Override public int delete(Uri uri, String selection, String[] selectionArgs) { int count = 0; @@ -237,7 +237,7 @@ public class NotesProvider extends ContentProvider { } return count; } - + // 更新一个uri @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { int count = 0; @@ -277,11 +277,11 @@ public class NotesProvider extends ContentProvider { } return count; } - + // 将字符串解析成规定格式 private String parseSelection(String selection) { return (!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : ""); } - + //增加一个noteVersion private void increaseNoteVersion(long id, String selection, String[] selectionArgs) { StringBuilder sql = new StringBuilder(120); sql.append("UPDATE "); diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/MetaData.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/MetaData.java index 3a2050b..71c71cd 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/MetaData.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/MetaData.java @@ -26,29 +26,52 @@ import org.json.JSONObject; public class MetaData extends Task { + /* + * 功能描述:得到类的简写名称存入字符串TAG中 + * 实现过程:调用getSimpleName ()函数 + */ private final static String TAG = MetaData.class.getSimpleName(); - private String mRelatedGid = null; - - public void setMeta(String gid, JSONObject metaInfo) { + /* + * 功能描述:设置数据,即生成元数据库 + * 实现过程:调用JSONObject库函数put (),Task类中的setNotes ()和setName ()函数 + * 参数注解: + */ + public void setMeta(String gid, JSONObject metaInfo) + { + //对函数块进行注释 try { metaInfo.put(GTaskStringUtils.META_HEAD_GTASK_ID, gid); + /* + * 将这对键值放入metaInfo这个jsonobject对象中 + */ } catch (JSONException e) { Log.e(TAG, "failed to put related gid"); + /* + * 输出错误信息 + */ } setNotes(metaInfo.toString()); setName(GTaskStringUtils.META_NOTE_NAME); } - + /* + * 功能描述:获取相关联的Gid + */ public String getRelatedGid() { return mRelatedGid; } - + /* + * 功能描述:判断当前数据是否为空,若为空则返回真即值得保存 + */ @Override public boolean isWorthSaving() { return getNotes() != null; } - + /* + * 功能描述:使用远程json数据对象设置元数据内容 + * 实现过程:调用父类Task中的setContentByRemoteJSON ()函数,并 + * 参数注解: + */ @Override public void setContentByRemoteJSON(JSONObject js) { super.setContentByRemoteJSON(js); @@ -58,25 +81,44 @@ public class MetaData extends Task { mRelatedGid = metaInfo.getString(GTaskStringUtils.META_HEAD_GTASK_ID); } catch (JSONException e) { Log.w(TAG, "failed to get related gid"); + /* + * 输出警告信息 + */ mRelatedGid = null; } } } - + /* + * 功能描述:使用本地json数据对象设置元数据内容,一般不会用到,若用到,则抛出异常 + */ @Override public void setContentByLocalJSON(JSONObject js) { // this function should not be called throw new IllegalAccessError("MetaData:setContentByLocalJSON should not be called"); + /* + * 传递非法参数异常 + */ } + /* + * 功能描述:从元数据内容中获取本地json对象,一般不会用到,若用到,则抛出异常 + */ @Override public JSONObject getLocalJSONFromContent() { throw new IllegalAccessError("MetaData:getLocalJSONFromContent should not be called"); + /* + * 传递非法参数异常 + */ } - + /* + * 功能描述:获取同步动作状态,一般不会用到,若用到,则抛出异常 + */ @Override public int getSyncAction(Cursor c) { throw new IllegalAccessError("MetaData:getSyncAction should not be called"); + /* + * 传递非法参数异常 + */ } } diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Node.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Node.java index 63950e0..2702c3e 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Node.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Node.java @@ -21,31 +21,32 @@ import android.database.Cursor; import org.json.JSONObject; public abstract class Node { - public static final int SYNC_ACTION_NONE = 0; + //定义了各种用于表征同步状态的常量 + public static final int SYNC_ACTION_NONE = 0;// 本地和云端都无可更新内容(即本地和云端内容一致) - public static final int SYNC_ACTION_ADD_REMOTE = 1; + public static final int SYNC_ACTION_ADD_REMOTE = 1;// 需要在远程云端增加内容 - public static final int SYNC_ACTION_ADD_LOCAL = 2; + public static final int SYNC_ACTION_ADD_LOCAL = 2;// 需要在本地增加内容 - public static final int SYNC_ACTION_DEL_REMOTE = 3; + public static final int SYNC_ACTION_DEL_REMOTE = 3;// 需要在远程云端删除内容 - public static final int SYNC_ACTION_DEL_LOCAL = 4; + public static final int SYNC_ACTION_DEL_LOCAL = 4;// 需要在本地删除内容 - public static final int SYNC_ACTION_UPDATE_REMOTE = 5; + public static final int SYNC_ACTION_UPDATE_REMOTE = 5;// 需要将本地内容更新到远程云端 - public static final int SYNC_ACTION_UPDATE_LOCAL = 6; + public static final int SYNC_ACTION_UPDATE_LOCAL = 6;// 需要将远程云端内容更新到本地 - public static final int SYNC_ACTION_UPDATE_CONFLICT = 7; + public static final int SYNC_ACTION_UPDATE_CONFLICT = 7;// 同步出现冲突 - public static final int SYNC_ACTION_ERROR = 8; + public static final int SYNC_ACTION_ERROR = 8;// 同步出现错误 private String mGid; private String mName; - private long mLastModified; + private long mLastModified;//记录最后一次修改时间 - private boolean mDeleted; + private boolean mDeleted;//表征是否被删除 public Node() { mGid = null; diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlData.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlData.java index d3ec3be..05f9044 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlData.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlData.java @@ -36,15 +36,28 @@ import org.json.JSONObject; public class SqlData { + /* + * 功能描述:得到类的简写名称存入字符串TAG中 + * 实现过程:调用getSimpleName ()函数 + */ private static final String TAG = SqlData.class.getSimpleName(); - private static final int INVALID_ID = -99999; + private static final int INVALID_ID = -99999;//为mDataId置初始值-99999 + + /** + * 来自Notes类中定义的DataColumn中的一些常量 + */ + + // 集合了interface DataColumns中所有SF常量 public static final String[] PROJECTION_DATA = new String[] { DataColumns.ID, DataColumns.MIME_TYPE, DataColumns.CONTENT, DataColumns.DATA1, DataColumns.DATA3 }; + /** + * 以下五个变量作为sql表中5列的编号 + */ public static final int DATA_ID_COLUMN = 0; public static final int DATA_MIME_TYPE_COLUMN = 1; @@ -56,7 +69,7 @@ public class SqlData { public static final int DATA_CONTENT_DATA_3_COLUMN = 4; private ContentResolver mContentResolver; - + //判断是否直接用Content生成,是为true,否则为false private boolean mIsCreate; private long mDataId; @@ -71,10 +84,17 @@ public class SqlData { private ContentValues mDiffDataValues; + /* + * 功能描述:构造函数,用于初始化数据 + * 参数注解:mContentResolver用于获取ContentProvider提供的数据 + * 参数注解: mIsCreate表征当前数据是用哪种方式创建(两种构造函数的参数不同) + * 参数注解: + + */ public SqlData(Context context) { mContentResolver = context.getContentResolver(); mIsCreate = true; - mDataId = INVALID_ID; + mDataId = INVALID_ID;//mDataId置初始值-99999 mDataMimeType = DataConstants.NOTE; mDataContent = ""; mDataContentData1 = 0; @@ -82,6 +102,13 @@ public class SqlData { mDiffDataValues = new ContentValues(); } + + /* + * 功能描述:构造函数,初始化数据 + * 参数注解:mContentResolver用于获取ContentProvider提供的数据 + * 参数注解: mIsCreate表征当前数据是用哪种方式创建(两种构造函数的参数不同) + * 参数注解: + */ public SqlData(Context context, Cursor c) { mContentResolver = context.getContentResolver(); mIsCreate = false; @@ -89,6 +116,11 @@ public class SqlData { mDiffDataValues = new ContentValues(); } + /* + * 功能描述:从光标处加载数据 + * 从当前的光标处将五列的数据加载到该类的对象 + * Made By CuiCan + */ private void loadFromCursor(Cursor c) { mDataId = c.getLong(DATA_ID_COLUMN); mDataMimeType = c.getString(DATA_MIME_TYPE_COLUMN); @@ -97,7 +129,13 @@ public class SqlData { mDataContentData3 = c.getString(DATA_CONTENT_DATA_3_COLUMN); } + + /* + * 功能描述:设置用于共享的数据,并提供异常抛出与处理机制 + * 参数注解: + */ public void setContent(JSONObject js) throws JSONException { + //如果传入的JSONObject对象中有DataColumns.ID这一项,则设置,否则设为INVALID_ID long dataId = js.has(DataColumns.ID) ? js.getLong(DataColumns.ID) : INVALID_ID; if (mIsCreate || mDataId != dataId) { mDiffDataValues.put(DataColumns.ID, dataId); @@ -130,11 +168,17 @@ public class SqlData { mDataContentData3 = dataContentData3; } + + /* + * 功能描述:获取共享的数据内容,并提供异常抛出与处理机制 + * 参数注解: + */ public JSONObject getContent() throws JSONException { if (mIsCreate) { Log.e(TAG, "it seems that we haven't created this in database yet"); return null; } + //创建JSONObject对象。并将相关数据放入其中,并返回。 JSONObject js = new JSONObject(); js.put(DataColumns.ID, mDataId); js.put(DataColumns.MIME_TYPE, mDataMimeType); @@ -144,6 +188,10 @@ public class SqlData { return js; } + /* + * 功能描述:commit函数用于把当前造作所做的修改保存到数据库 + * 参数注解: + */ public void commit(long noteId, boolean validateVersion, long version) { if (mIsCreate) { @@ -167,7 +215,7 @@ public class SqlData { Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, null, null); } else { result = mContentResolver.update(ContentUris.withAppendedId( - Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, + Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, " ? in (SELECT " + NoteColumns.ID + " FROM " + TABLE.NOTE + " WHERE " + NoteColumns.VERSION + "=?)", new String[] { String.valueOf(noteId), String.valueOf(version) @@ -183,6 +231,11 @@ public class SqlData { mIsCreate = false; } + /* + * 功能描述:获取当前id + * 实现过程: + * 参数注解: + */ public long getId() { return mDataId; } diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java index 79a4095..fce8154 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java @@ -39,10 +39,14 @@ import java.util.ArrayList; public class SqlNote { + /* + * 功能描述:得到类的简写名称存入字符串TAG中 + * 实现过程:调用getSimpleName ()函数 + */ private static final String TAG = SqlNote.class.getSimpleName(); private static final int INVALID_ID = -99999; - + // 集合了interface NoteColumns中所有SF常量(17个) public static final String[] PROJECTION_NOTE = new String[] { NoteColumns.ID, NoteColumns.ALERTED_DATE, NoteColumns.BG_COLOR_ID, NoteColumns.CREATED_DATE, NoteColumns.HAS_ATTACHMENT, NoteColumns.MODIFIED_DATE, @@ -52,6 +56,7 @@ public class SqlNote { NoteColumns.VERSION }; + //以下设置17个列的编号 public static final int ID_COLUMN = 0; public static final int ALERTED_DATE_COLUMN = 1; @@ -86,6 +91,7 @@ public class SqlNote { public static final int VERSION_COLUMN = 16; + //一下定义了17个内部的变量,其中12个可以由content中获得,5个需要初始化为0或者new private Context mContext; private ContentResolver mContentResolver; @@ -122,6 +128,12 @@ public class SqlNote { private ArrayList mDataList; + /* + * 功能描述:构造函数 + * 参数注解: mIsCreate用于标示构造方式 + * 参数注解: + */ + //构造函数只有context,对所有的变量进行初始化 public SqlNote(Context context) { mContext = context; mContentResolver = context.getContentResolver(); @@ -129,9 +141,9 @@ public class SqlNote { mId = INVALID_ID; mAlertDate = 0; mBgColorId = ResourceParser.getDefaultBgId(context); - mCreatedDate = System.currentTimeMillis(); + mCreatedDate = System.currentTimeMillis();//调用系统函数获得创建时间 mHasAttachment = 0; - mModifiedDate = System.currentTimeMillis(); + mModifiedDate = System.currentTimeMillis();//最后一次修改时间初始化为创建时间 mParentId = 0; mSnippet = ""; mType = Notes.TYPE_NOTE; @@ -143,17 +155,31 @@ public class SqlNote { mDataList = new ArrayList(); } + + /* + * 功能描述:构造函数 + * 参数注解: mIsCreate用于标示构造方式 + * 参数注解: + */ + //构造函数有context和一个数据库的cursor,多数变量通过cursor指向的一条记录直接进行初始化 public SqlNote(Context context, Cursor c) { mContext = context; mContentResolver = context.getContentResolver(); mIsCreate = false; loadFromCursor(c); mDataList = new ArrayList(); + // if (mType == Notes.TYPE_NOTE) loadDataContent(); mDiffNoteValues = new ContentValues(); } + + /* + * 功能描述:构造函数 + * 参数注解: mIsCreate用于标示构造方式 + * 参数注解: + */ public SqlNote(Context context, long id) { mContext = context; mContentResolver = context.getContentResolver(); @@ -166,16 +192,20 @@ public class SqlNote { } + /* + * 功能描述:通过id从光标处加载数据 + */ private void loadFromCursor(long id) { Cursor c = null; try { c = mContentResolver.query(Notes.CONTENT_NOTE_URI, PROJECTION_NOTE, "(_id=?)", new String[] { - String.valueOf(id) - }, null); + String.valueOf(id) + }, null);//通过id获得对应的ContentResolver中的cursor if (c != null) { c.moveToNext(); - loadFromCursor(c); + loadFromCursor(c);//然后加载数据进行初始化,这样函数 + //SqlNote(Context context, long id)与SqlNote(Context context, long id)的实现方式基本相同 } else { Log.w(TAG, "loadFromCursor: cursor = null"); } @@ -185,7 +215,11 @@ public class SqlNote { } } + /* + * 功能描述:通过游标从光标处加载数据 + */ private void loadFromCursor(Cursor c) { + //直接从一条记录中的获得以下变量的初始值 mId = c.getLong(ID_COLUMN); mAlertDate = c.getLong(ALERTED_DATE_COLUMN); mBgColorId = c.getInt(BG_COLOR_ID_COLUMN); @@ -200,13 +234,17 @@ public class SqlNote { mVersion = c.getLong(VERSION_COLUMN); } + /* + * 功能描述:通过content机制获取共享数据并加载到数据库当前游标处 + * 参数注解: + */ private void loadDataContent() { Cursor c = null; mDataList.clear(); try { c = mContentResolver.query(Notes.CONTENT_DATA_URI, SqlData.PROJECTION_DATA, "(note_id=?)", new String[] { - String.valueOf(mId) + String.valueOf(mId) }, null); if (c != null) { if (c.getCount() == 0) { @@ -226,6 +264,10 @@ public class SqlNote { } } + /* + * 功能描述:设置通过content机制用于共享的数据信息 + * 参数注解: + */ public boolean setContent(JSONObject js) { try { JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE); @@ -267,7 +309,6 @@ public class SqlNote { mDiffNoteValues.put(NoteColumns.BG_COLOR_ID, bgColorId); } mBgColorId = bgColorId; - long createDate = note.has(NoteColumns.CREATED_DATE) ? note .getLong(NoteColumns.CREATED_DATE) : System.currentTimeMillis(); if (mIsCreate || mCreatedDate != createDate) { @@ -359,6 +400,10 @@ public class SqlNote { return true; } + /* + * 功能描述:获取content机制提供的数据并加载到note中 + * 参数注解: + */ public JSONObject getContent() { try { JSONObject js = new JSONObject(); @@ -369,7 +414,7 @@ public class SqlNote { } JSONObject note = new JSONObject(); - if (mType == Notes.TYPE_NOTE) { + if (mType == Notes.TYPE_NOTE) {//类型为note时 note.put(NoteColumns.ID, mId); note.put(NoteColumns.ALERTED_DATE, mAlertDate); note.put(NoteColumns.BG_COLOR_ID, mBgColorId); @@ -392,7 +437,7 @@ public class SqlNote { } } js.put(GTaskStringUtils.META_HEAD_DATA, dataArray); - } else if (mType == Notes.TYPE_FOLDER || mType == Notes.TYPE_SYSTEM) { + } else if (mType == Notes.TYPE_FOLDER || mType == Notes.TYPE_SYSTEM) {//类型为文件夹或者 note.put(NoteColumns.ID, mId); note.put(NoteColumns.TYPE, mType); note.put(NoteColumns.SNIPPET, mSnippet); @@ -407,39 +452,75 @@ public class SqlNote { return null; } + /* + * 功能描述:给当前id设置父id + * 参数注解: + */ public void setParentId(long id) { mParentId = id; mDiffNoteValues.put(NoteColumns.PARENT_ID, id); } + /* + * 功能描述:给当前id设置Gtaskid + * 参数注解: + */ public void setGtaskId(String gid) { mDiffNoteValues.put(NoteColumns.GTASK_ID, gid); } + /* + * 功能描述:给当前id设置同步id + * 参数注解: + */ public void setSyncId(long syncId) { mDiffNoteValues.put(NoteColumns.SYNC_ID, syncId); } + /* + * 功能描述:初始化本地修改,即撤销所有当前修改 + * 参数注解: + */ public void resetLocalModified() { mDiffNoteValues.put(NoteColumns.LOCAL_MODIFIED, 0); } + /* + * 功能描述:获得当前id + * 参数注解: + */ public long getId() { return mId; } + /* + * 功能描述:获得当前id的父id + * 参数注解: + */ public long getParentId() { return mParentId; } + /* + * 功能描述:获取小片段即用于显示的部分便签内容 + * 参数注解: + */ public String getSnippet() { return mSnippet; } + /* + * 功能描述:判断是否为便签类型 + * 参数注解: + */ public boolean isNoteType() { return mType == Notes.TYPE_NOTE; } + /* + * 功能描述:commit函数用于把当前造作所做的修改保存到数据库 + * 参数注解: + */ public void commit(boolean validateVersion) { if (mIsCreate) { if (mId == INVALID_ID && mDiffNoteValues.containsKey(NoteColumns.ID)) { @@ -458,7 +539,7 @@ public class SqlNote { } if (mType == Notes.TYPE_NOTE) { - for (SqlData sqlData : mDataList) { + for (SqlData sqlData : mDataList) {//直接使用sqldata中的实现 sqlData.commit(mId, false, -1); } } @@ -470,14 +551,14 @@ public class SqlNote { if (mDiffNoteValues.size() > 0) { mVersion ++; int result = 0; - if (!validateVersion) { + if (!validateVersion) {//构造字符串 result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "(" + NoteColumns.ID + "=?)", new String[] { - String.valueOf(mId) + String.valueOf(mId) }); } else { result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "(" - + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)", + + NoteColumns.ID + "=?) AND (" + NoteColumns.VERSION + "<=?)", new String[] { String.valueOf(mId), String.valueOf(mVersion) }); diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Task.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Task.java index 6a19454..72068a0 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Task.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/Task.java @@ -35,22 +35,22 @@ import org.json.JSONObject; public class Task extends Node { private static final String TAG = Task.class.getSimpleName(); - private boolean mCompleted; + private boolean mCompleted;//是否完成 private String mNotes; - private JSONObject mMetaInfo; + private JSONObject mMetaInfo;//将在实例中存储数据的类型 - private Task mPriorSibling; + private Task mPriorSibling;//对应的优先兄弟Task的指针(待完善) - private TaskList mParent; + private TaskList mParent;//所在的任务列表的指针 public Task() { super(); mCompleted = false; mNotes = null; - mPriorSibling = null; - mParent = null; + mPriorSibling = null;//TaskList中当前Task前面的Task的指针 + mParent = null;//当前Task所在的TaskList mMetaInfo = null; } diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/TaskList.java b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/TaskList.java index 4ea21c5..a2bf5a4 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/TaskList.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/gtask/data/TaskList.java @@ -35,14 +35,17 @@ public class TaskList extends Node { private int mIndex; - private ArrayList mChildren; + private ArrayList mChildren;//类中主要的保存数据的单元,用来实现一个以Task为元素的ArrayList public TaskList() { super(); mChildren = new ArrayList(); mIndex = 1; } - + /* (non-Javadoc) + * @see net.micode.notes.gtask.data.Node#getCreateAction(int) + * 生成并返回一个包含了一定数据的JSONObject实体 + */ public JSONObject getCreateAction(int actionId) { JSONObject js = new JSONObject(); @@ -73,7 +76,10 @@ public class TaskList extends Node { return js; } - + /* (non-Javadoc) + * @see net.micode.notes.gtask.data.Node#getUpdateAction(int) + * 生成并返回一个包含了一定数据的JSONObject实体 + */ public JSONObject getUpdateAction(int actionId) { JSONObject js = new JSONObject(); @@ -215,11 +221,19 @@ public class TaskList extends Node { return SYNC_ACTION_ERROR; } - + /** + * @return + * 功能:获得TaskList的大小,即mChildren的大小 + */ public int getChildTaskCount() { return mChildren.size(); } + /** + * @param task + * @return 返回值为是否成功添加任务。 + * 功能:在当前任务表末尾添加新的任务。 + */ public boolean addChildTask(Task task) { boolean ret = false; if (task != null && !mChildren.contains(task)) { @@ -233,7 +247,12 @@ public class TaskList extends Node { } return ret; } - + /** + * @param task + * @param index + * @return + * 功能:在当前任务表的指定位置添加新的任务。 + */ public boolean addChildTask(Task task, int index) { if (index < 0 || index > mChildren.size()) { Log.e(TAG, "add child task: invalid index"); @@ -259,7 +278,11 @@ public class TaskList extends Node { return true; } - + /** + * @param task + * @return 返回删除是否成功 + * 功能:删除TaskList中的一个Task + */ public boolean removeChildTask(Task task) { boolean ret = false; int index = mChildren.indexOf(task); @@ -280,7 +303,12 @@ public class TaskList extends Node { } return ret; } - + /** + * @param task + * @param index + * @return + * 功能:将当前TaskList中含有的某个Task移到index位置 + */ public boolean moveChildTask(Task task, int index) { if (index < 0 || index >= mChildren.size()) { @@ -298,7 +326,11 @@ public class TaskList extends Node { return true; return (removeChildTask(task) && addChildTask(task, index)); } - + /** + * @param gid + * @return返回寻找结果 + * 功能:按gid寻找Task + */ public Task findChildTaskByGid(String gid) { for (int i = 0; i < mChildren.size(); i++) { Task t = mChildren.get(i); @@ -320,7 +352,11 @@ public class TaskList extends Node { } return mChildren.get(index); } - + /** + * @param gid + * @return + * 功能:返回指定gid的Task + */ public Task getChilTaskByGid(String gid) { for (Task task : mChildren) { if (task.getGid().equals(gid)) diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/model/Note.java b/src/Notes-master2/app/src/main/java/net/micode/notes/model/Note.java index 6706cf6..42f4222 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/model/Note.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/model/Note.java @@ -51,7 +51,8 @@ public class Note { values.put(NoteColumns.LOCAL_MODIFIED, 1); values.put(NoteColumns.PARENT_ID, folderId); Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values); - + //ContentResolver()主要是实现外部应用对ContentProvider中的数据 + //进行添加、删除、修改和查询操作 long noteId = 0; try { noteId = Long.valueOf(uri.getPathSegments().get(1)); @@ -68,37 +69,37 @@ public class Note { public Note() { mNoteDiffValues = new ContentValues(); mNoteData = new NoteData(); - } + }//定义两个变量用来存储便签的数据,一个是存储便签属性、一个是存储便签内容 public void setNoteValue(String key, String value) { mNoteDiffValues.put(key, value); mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1); mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis()); - } + }//设置数据库表格的标签属性数据 public void setTextData(String key, String value) { mNoteData.setTextData(key, value); - } + }//设置数据库表格的标签文本内容的数据 public void setTextDataId(long id) { mNoteData.setTextDataId(id); - } + }//设置文本数据的ID public long getTextDataId() { return mNoteData.mTextDataId; - } + }//得到文本数据的ID public void setCallDataId(long id) { mNoteData.setCallDataId(id); - } + }//设置电话号码数据的ID public void setCallData(String key, String value) { mNoteData.setCallData(key, value); - } + }//得到电话号码数据的ID public boolean isLocalModified() { return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified(); - } + }//判断是否是本地修改 public boolean syncNote(Context context, long noteId) { if (noteId <= 0) { @@ -128,16 +129,16 @@ public class Note { } return true; - } + }//判断数据是否同步 - private class NoteData { + private class NoteData {//定义一个基本的便签内容的数据类,主要包含文本数据和电话号码数据 private long mTextDataId; - private ContentValues mTextDataValues; + private ContentValues mTextDataValues;//文本数据 private long mCallDataId; - private ContentValues mCallDataValues; + private ContentValues mCallDataValues;//电话号码数据 private static final String TAG = "NoteData"; @@ -147,7 +148,7 @@ public class Note { mTextDataId = 0; mCallDataId = 0; } - + //下面是上述几个函数的具体实现 boolean isLocalModified() { return mTextDataValues.size() > 0 || mCallDataValues.size() > 0; } @@ -184,10 +185,10 @@ public class Note { */ if (noteId <= 0) { throw new IllegalArgumentException("Wrong note id:" + noteId); - } + }//判断数据是否合法 ArrayList operationList = new ArrayList(); - ContentProviderOperation.Builder builder = null; + ContentProviderOperation.Builder builder = null;//数据库的操作列表 if(mTextDataValues.size() > 0) { mTextDataValues.put(DataColumns.NOTE_ID, noteId); @@ -209,7 +210,7 @@ public class Note { operationList.add(builder.build()); } mTextDataValues.clear(); - } + }//把文本数据存入DataColumns if(mCallDataValues.size() > 0) { mCallDataValues.put(DataColumns.NOTE_ID, noteId); @@ -231,7 +232,7 @@ public class Note { operationList.add(builder.build()); } mCallDataValues.clear(); - } + }//把电话号码数据存入DataColumns if (operationList.size() > 0) { try { @@ -246,7 +247,7 @@ public class Note { Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage())); return null; } - } + }//存储过程中的异常处理 return null; } } diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/model/WorkingNote.java b/src/Notes-master2/app/src/main/java/net/micode/notes/model/WorkingNote.java index be081e4..e086c1a 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/model/WorkingNote.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/model/WorkingNote.java @@ -43,17 +43,11 @@ public class WorkingNote { private int mMode; private long mAlertDate; - private long mModifiedDate; - private int mBgColorId; - private int mWidgetId; - private int mWidgetType; - private long mFolderId; - private Context mContext; private static final String TAG = "WorkingNote"; @@ -62,6 +56,7 @@ public class WorkingNote { private NoteSettingChangedListener mNoteSettingStatusListener; + // 声明 DATA_PROJECTION字符串数组 public static final String[] DATA_PROJECTION = new String[] { DataColumns.ID, DataColumns.CONTENT, @@ -72,6 +67,7 @@ public class WorkingNote { DataColumns.DATA4, }; + // 声明 NOTE_PROJECTION字符串数组 public static final String[] NOTE_PROJECTION = new String[] { NoteColumns.PARENT_ID, NoteColumns.ALERTED_DATE, @@ -82,27 +78,18 @@ public class WorkingNote { }; private static final int DATA_ID_COLUMN = 0; - private static final int DATA_CONTENT_COLUMN = 1; - private static final int DATA_MIME_TYPE_COLUMN = 2; - private static final int DATA_MODE_COLUMN = 3; - private static final int NOTE_PARENT_ID_COLUMN = 0; - private static final int NOTE_ALERTED_DATE_COLUMN = 1; - private static final int NOTE_BG_COLOR_ID_COLUMN = 2; - private static final int NOTE_WIDGET_ID_COLUMN = 3; - private static final int NOTE_WIDGET_TYPE_COLUMN = 4; - private static final int NOTE_MODIFIED_DATE_COLUMN = 5; // New note construct - private WorkingNote(Context context, long folderId) { + public WorkingNote(Context context, long folderId) { mContext = context; mAlertDate = 0; mModifiedDate = System.currentTimeMillis(); @@ -114,6 +101,7 @@ public class WorkingNote { mWidgetType = Notes.TYPE_WIDGET_INVALIDE; } + // WorkingNote的构造函数 // Existing note construct private WorkingNote(Context context, long noteId, long folderId) { mContext = context; @@ -124,11 +112,14 @@ public class WorkingNote { loadNote(); } + // 加载Note + // 通过数据库调用query函数找到第一个条目 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); @@ -139,6 +130,7 @@ public class WorkingNote { 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); @@ -146,14 +138,16 @@ public class WorkingNote { loadNoteData(); } + // 加载NoteData private void loadNoteData() { Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { - String.valueOf(mNoteId) + String.valueOf(mNoteId) }, null); if (cursor != null) { - if (cursor.moveToFirst()) { + // 查到信息不为空 + if (cursor.moveToFirst()) { // 查看第一项是否存在 do { String type = cursor.getString(DATA_MIME_TYPE_COLUMN); if (DataConstants.NOTE.equals(type)) { @@ -165,7 +159,7 @@ public class WorkingNote { } else { Log.d(TAG, "Wrong note type with type:" + type); } - } while (cursor.moveToNext()); + } while (cursor.moveToNext());//查阅所有项,直到为空 } cursor.close(); } else { @@ -174,9 +168,12 @@ public class WorkingNote { } } + // 创建空的Note + // 传参:context,文件夹id,widget,背景颜色 public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId, - int widgetType, int defaultBgColorId) { + int widgetType, int defaultBgColorId) { WorkingNote note = new WorkingNote(context, folderId); + // 设定相关属性 note.setBgColorId(defaultBgColorId); note.setWidgetId(widgetId); note.setWidgetType(widgetType); @@ -187,9 +184,10 @@ public class WorkingNote { return new WorkingNote(context, id, 0); } + // 保存Note public synchronized boolean saveNote() { - if (isWorthSaving()) { - if (!existInDatabase()) { + if (isWorthSaving()) { //是否值得保存 + if (!existInDatabase()) { // 是否存在数据库中 if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) { Log.e(TAG, "Create new note fail with id:" + mNoteId); return false; @@ -212,11 +210,14 @@ public class WorkingNote { } } + // 是否在数据库中存在 public boolean existInDatabase() { return mNoteId > 0; } + // 是否值得保存 private boolean isWorthSaving() { + // 被删除,或(不在数据库中 内容为空),或 本地已保存过 if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent)) || (existInDatabase() && !mNote.isLocalModified())) { return false; @@ -225,10 +226,14 @@ public class WorkingNote { } } + + // 设置mNoteSettingStatusListener public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) { mNoteSettingStatusListener = l; } + // 设置AlertDate + // 若 mAlertDate与data不同,则更改mAlertDate并设定NoteValue public void setAlertDate(long date, boolean set) { if (date != mAlertDate) { mAlertDate = date; @@ -239,16 +244,20 @@ public class WorkingNote { } } + // 设定删除标记 public void markDeleted(boolean mark) { + // 设定标记 mIsDeleted = mark; if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID && mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) { - mNoteSettingStatusListener.onWidgetChanged(); + mNoteSettingStatusListener.onWidgetChanged(); + // 调用mNoteSettingStatusListener的 onWidgetChanged方法 } } + // 设定背景颜色 public void setBgColorId(int id) { - if (id != mBgColorId) { + if (id != mBgColorId) { //设定条件 id != mBgColorId mBgColorId = id; if (mNoteSettingStatusListener != null) { mNoteSettingStatusListener.onBackgroundColorChanged(); @@ -257,8 +266,10 @@ public class WorkingNote { } } + // 设定检查列表模式 + // 参数:mode public void setCheckListMode(int mode) { - if (mMode != mode) { + if (mMode != mode) { //设定条件 mMode != mode if (mNoteSettingStatusListener != null) { mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode); } @@ -267,81 +278,108 @@ public class WorkingNote { } } + + // 设定WidgetType + // 参数:type public void setWidgetType(int type) { - if (type != mWidgetType) { + if (type != mWidgetType) {//设定条件 type != mWidgetType mWidgetType = type; mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType)); + // 调用Note的setNoteValue方法更改WidgetType } } + // 设定WidgetId + // 参数:id public void setWidgetId(int id) { - if (id != mWidgetId) { + if (id != mWidgetId) {//设定条件 id != mWidgetId mWidgetId = id; mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId)); + // 调用Note的setNoteValue方法更改WidgetId } } + // 设定WorkingTex + // 参数:更改的text public void setWorkingText(String text) { - if (!TextUtils.equals(mContent, text)) { + if (!TextUtils.equals(mContent, text)) {//设定条件 mContent, text内容不同 mContent = text; mNote.setTextData(DataColumns.CONTENT, mContent); + // 调用Note的setTextData方法更改WorkingText } } + // 转变mNote的CallData及CallNote信息 + // 参数:String phoneNumber, long 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)); } + // 判断是否有时钟题型 public boolean hasClockAlert() { return (mAlertDate > 0 ? true : false); } + // 获取Content public String getContent() { return mContent; } + // 获取AlertDate public long getAlertDate() { return mAlertDate; } + // 获取ModifiedDate public long getModifiedDate() { return mModifiedDate; } + // 获取背景颜色来源id public int getBgColorResId() { return NoteBgResources.getNoteBgResource(mBgColorId); } + // 获取背景颜色id public int getBgColorId() { return mBgColorId; } + // 获取标题背景颜色id public int getTitleBgResId() { return NoteBgResources.getNoteTitleBgResource(mBgColorId); } + // 获取CheckListMode public int getCheckListMode() { return mMode; } + // 获取便签id public long getNoteId() { return mNoteId; } + // 获取文件夹id public long getFolderId() { return mFolderId; } + // 获取WidgetId public int getWidgetId() { return mWidgetId; } + // 获取WidgetType public int getWidgetType() { return mWidgetType; } + // 创建接口 NoteSettingChangedListener,便签更新监视 + // 为NoteEditActivity提供接口 + // 提供函数有 public interface NoteSettingChangedListener { /** * Called when the background color of current note has just changed diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/BackupUtils.java b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/BackupUtils.java index 39f6ec4..e38b6ed 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/BackupUtils.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/BackupUtils.java @@ -39,10 +39,14 @@ import java.io.PrintStream; public class BackupUtils { private static final String TAG = "BackupUtils"; // Singleton stuff - private static BackupUtils sInstance; + private static BackupUtils sInstance; //类里面为什么可以定义自身类的对象? public static synchronized BackupUtils getInstance(Context context) { + //ynchronized 关键字,代表这个方法加锁,相当于不管哪一个线程(例如线程A) + //运行到这个方法时,都要检查有没有其它线程B(或者C、 D等)正在用这个方法(或者该类的其他同步方法),有的话要等正在使用synchronized方法的线程B(或者C 、D)运行完这个方法后再运行此线程A,没有的话,锁定调用者,然后直接运行。 + //它包括两种用法:synchronized 方法和 synchronized 块。 if (sInstance == null) { + //如果当前备份不存在,则新声明一个 sInstance = new BackupUtils(context); } return sInstance; @@ -52,24 +56,24 @@ public class BackupUtils { * Following states are signs to represents backup or restore * status */ - // Currently, the sdcard is not mounted + // Currently, the sdcard is not mounted SD卡没有被装入手机 public static final int STATE_SD_CARD_UNMOUONTED = 0; - // The backup file not exist + // The backup file not exist 备份文件夹不存在 public static final int STATE_BACKUP_FILE_NOT_EXIST = 1; - // The data is not well formated, may be changed by other programs + // The data is not well formated, may be changed by other programs 数据已被破坏,可能被修改 public static final int STATE_DATA_DESTROIED = 2; - // Some run-time exception which causes restore or backup fails + // Some run-time exception which causes restore or backup fails 超时异常 public static final int STATE_SYSTEM_ERROR = 3; - // Backup or restore success + // Backup or restore success 成功存储 public static final int STATE_SUCCESS = 4; private TextExport mTextExport; - private BackupUtils(Context context) { + private BackupUtils(Context context) { //初始化函数 mTextExport = new TextExport(context); } - private static boolean externalStorageAvailable() { + private static boolean externalStorageAvailable() { //外部存储功能是否可用 return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); } @@ -128,11 +132,11 @@ public class BackupUtils { public TextExport(Context context) { TEXT_FORMAT = context.getResources().getStringArray(R.array.format_for_exported_note); mContext = context; - mFileName = ""; + mFileName = ""; //为什么为空? mFileDirectory = ""; } - private String getFormat(int id) { + private String getFormat(int id) { //获取文本的组成部分 return TEXT_FORMAT[id]; } @@ -140,22 +144,22 @@ 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 + // Query notes belong to this folder 通过查询parent id是文件夹id的note来选出制定ID文件夹下的Note Cursor notesCursor = mContext.getContentResolver().query(Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, NoteColumns.PARENT_ID + "=?", new String[] { - folderId + folderId }, null); if (notesCursor != null) { if (notesCursor.moveToFirst()) { do { - // Print note's last modified date + // Print note's last modified date ps里面保存有这份note的日期 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); + exportNoteToText(noteId, ps); //将文件导出到text } while (notesCursor.moveToNext()); } notesCursor.close(); @@ -168,10 +172,10 @@ public class BackupUtils { private void exportNoteToText(String noteId, PrintStream ps) { Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] { - noteId + noteId }, null); - if (dataCursor != null) { + if (dataCursor != null) { //利用光标来扫描内容,区别为callnote和note两种,靠ps.printline输出 if (dataCursor.moveToFirst()) { do { String mimeType = dataCursor.getString(DATA_COLUMN_MIME_TYPE); @@ -181,7 +185,7 @@ public class BackupUtils { long callDate = dataCursor.getLong(DATA_COLUMN_CALL_DATE); String location = dataCursor.getString(DATA_COLUMN_CONTENT); - if (!TextUtils.isEmpty(phoneNumber)) { + if (!TextUtils.isEmpty(phoneNumber)) { //判断是否为空字符 ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT), phoneNumber)); } @@ -218,7 +222,7 @@ public class BackupUtils { /** * Note will be exported as text which is user readable */ - public int exportToText() { + public int exportToText() { //总函数,调用上面的exportFolder和exportNote if (!externalStorageAvailable()) { Log.d(TAG, "Media was not mounted"); return STATE_SD_CARD_UNMOUONTED; @@ -229,7 +233,7 @@ public class BackupUtils { Log.e(TAG, "get print stream error"); return STATE_SYSTEM_ERROR; } - // First export folder and its notes + // First export folder and its notes 导出文件夹,就是导出里面包含的便签 Cursor folderCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, @@ -257,7 +261,7 @@ public class BackupUtils { folderCursor.close(); } - // Export notes in root's folder + // Export notes in root's folder 将根目录里的便签导出(由于不属于任何文件夹,因此无法通过文件夹导出来实现这一部分便签的导出) Cursor noteCursor = mContext.getContentResolver().query( Notes.CONTENT_NOTE_URI, NOTE_PROJECTION, @@ -297,7 +301,7 @@ public class BackupUtils { PrintStream ps = null; try { FileOutputStream fos = new FileOutputStream(file); - ps = new PrintStream(fos); + ps = new PrintStream(fos); //将ps输出流输出到特定的文件,目的就是导出到文件,而不是直接输出 } catch (FileNotFoundException e) { e.printStackTrace(); return null; @@ -314,16 +318,16 @@ public class BackupUtils { */ 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(Environment.getExternalStorageDirectory()); //外部(SD卡)的存储路径 + sb.append(context.getString(filePathResId)); //文件的存储路径 + File filedir = new File(sb.toString()); //filedir应该就是用来存储路径信息 sb.append(context.getString( fileNameFormatResId, DateFormat.format(context.getString(R.string.format_date_ymd), System.currentTimeMillis()))); File file = new File(sb.toString()); - try { + try { //如果这些文件不存在,则新建 if (!filedir.exists()) { filedir.mkdir(); } @@ -336,7 +340,7 @@ public class BackupUtils { } catch (IOException e) { e.printStackTrace(); } - +// try catch 异常处理 return null; } } diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/DataUtils.java b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/DataUtils.java index 2a14982..cfa057d 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/DataUtils.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/DataUtils.java @@ -37,7 +37,7 @@ import java.util.HashSet; public class DataUtils { public static final String TAG = "DataUtils"; - public static boolean batchDeleteNotes(ContentResolver resolver, HashSet ids) { + public static boolean batchDeleteNotes(ContentResolver resolver, HashSet ids) { //直接删除多个笔记 if (ids == null) { Log.d(TAG, "the ids is null"); return true; @@ -47,18 +47,19 @@ public class DataUtils { return true; } - ArrayList operationList = new ArrayList(); + 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()); + .newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); //用newDelete实现删除功能 + operationList.add(builder.build()); // } try { - ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); + ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);//主机名(或叫Authority)用于唯一标识这个ContentProvider,外部调用者可以根据这个标识来找到它。 + //数据库事务,数据库事务是由一组数据库操作序列组成,事务作为一个整体被执行 if (results == null || results.length == 0 || results[0] == null) { Log.d(TAG, "delete notes failed, ids:" + ids.toString()); return false; @@ -77,11 +78,11 @@ public class DataUtils { 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); + resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null); //对需要移动的便签进行数据更新,然后用update实现 } public static boolean batchMoveToFolder(ContentResolver resolver, HashSet ids, - long folderId) { + long folderId) { if (ids == null) { Log.d(TAG, "the ids is null"); return true; @@ -90,14 +91,14 @@ public class DataUtils { ArrayList operationList = new ArrayList(); for (long id : ids) { ContentProviderOperation.Builder builder = ContentProviderOperation - .newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); + .newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id)); //通过withAppendedId方法,为该Uri加上ID builder.withValue(NoteColumns.PARENT_ID, folderId); builder.withValue(NoteColumns.LOCAL_MODIFIED, 1); operationList.add(builder.build()); - } + }//将ids里包含的每一列的数据逐次加入到operationList中,等待最后的批量处理 try { - ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); + ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList); //applyBatch一次性处理一个操作列表 if (results == null || results.length == 0 || results[0] == null) { Log.d(TAG, "delete notes failed, ids:" + ids.toString()); return false; @@ -119,7 +120,7 @@ public class DataUtils { new String[] { "COUNT(*)" }, NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?", new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)}, - null); + null); //筛选条件:源文件不为trash folder int count = 0; if(cursor != null) { @@ -137,15 +138,15 @@ public class DataUtils { } public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) { - Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), + Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), //通过withAppendedId方法,为该Uri加上ID null, NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER, new String [] {String.valueOf(type)}, - null); + null); //查询条件:type符合,且不属于垃圾文件夹 boolean exist = false; if (cursor != null) { - if (cursor.getCount() > 0) { + if (cursor.getCount() > 0) {//用getcount函数判断cursor是否为空 exist = true; } cursor.close(); @@ -184,9 +185,10 @@ public class DataUtils { public static boolean checkVisibleFolderName(ContentResolver resolver, String name) { Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null, NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER + - " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + - " AND " + NoteColumns.SNIPPET + "=?", + " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER + + " AND " + NoteColumns.SNIPPET + "=?", new String[] { name }, null); + //通过名字查询文件是否存在 boolean exist = false; if(cursor != null) { if(cursor.getCount() > 0) { @@ -202,7 +204,7 @@ public class DataUtils { new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE }, NoteColumns.PARENT_ID + "=?", new String[] { String.valueOf(folderId) }, - null); + null); //查询条件:父ID是传入的folderId; HashSet set = null; if (c != null) { @@ -211,13 +213,13 @@ public class DataUtils { do { try { AppWidgetAttribute widget = new AppWidgetAttribute(); - widget.widgetId = c.getInt(0); - widget.widgetType = c.getInt(1); + widget.widgetId = c.getInt(0); //0对应的NoteColumns.WIDGET_ID + widget.widgetType = c.getInt(1); //1对应的NoteColumns.WIDGET_TYPE set.add(widget); } catch (IndexOutOfBoundsException e) { Log.e(TAG, e.toString()); } - } while (c.moveToNext()); + } while (c.moveToNext()); //查询下一条 } c.close(); } @@ -247,14 +249,15 @@ public class DataUtils { Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI, new String [] { CallNote.NOTE_ID }, CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL(" - + CallNote.PHONE_NUMBER + ",?)", + + CallNote.PHONE_NUMBER + ",?)", new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber }, null); + //通过数据库操作,查询条件是(callDate和phoneNumber匹配传入参数的值) if (cursor != null) { if (cursor.moveToFirst()) { try { - return cursor.getLong(0); + return cursor.getLong(0); //0对应的CallNote.NOTE_ID } catch (IndexOutOfBoundsException e) { Log.e(TAG, "Get call note id fails " + e.toString()); } @@ -269,7 +272,7 @@ public class DataUtils { new String [] { NoteColumns.SNIPPET }, NoteColumns.ID + "=?", new String [] { String.valueOf(noteId)}, - null); + null);//查询条件:noteId if (cursor != null) { String snippet = ""; @@ -281,8 +284,7 @@ public class DataUtils { } throw new IllegalArgumentException("Note is not found with id: " + noteId); } - - public static String getFormattedSnippet(String snippet) { + public static String getFormattedSnippet(String snippet) { //对字符串进行格式处理,将字符串两头的空格去掉,同时将换行符去掉 if (snippet != null) { snippet = snippet.trim(); int index = snippet.indexOf('\n'); diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/ResourceParser.java b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/ResourceParser.java index 1ad3ad6..d229c64 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/tool/ResourceParser.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/tool/ResourceParser.java @@ -22,6 +22,21 @@ import android.preference.PreferenceManager; import net.micode.notes.R; import net.micode.notes.ui.NotesPreferenceActivity; +/*简介:字面意义是资源分析器,实际上就是获取资源并且在程序中使用,比如颜色图片等 + * 实现方法:主要利用R.java这个类,其中包括 + * R.id 组件资源引用 + * R.drawable 图片资源 (被使用) + * R.layout 布局资源 + * R.menu 菜单资源 + * R.String 文字资源 + * R.style 主题资源 (被使用) + * 在按顺序设置好相应的id后,就可以编写简单的getXXX函数获取需要的资源 + * + * 特殊的变量 : + * @BG_DEFAULT_COLOR 默认背景颜色(黄) + * BG_DEFAULT_FONT_SIZE 默认文本大小(中) + */ + public class ResourceParser { public static final int YELLOW = 0; @@ -64,7 +79,7 @@ public class ResourceParser { return BG_EDIT_TITLE_RESOURCES[id]; } } - + //直接获取默认的背景颜色。看不太懂,这个PREFERENCE_SET_BG_COLOR_KEY是个final string,也就是说getBoolean肯定执行else,为什么要这么写 public static int getDefaultBgId(Context context) { if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean( NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) { @@ -161,7 +176,7 @@ public class ResourceParser { R.style.TextAppearanceLarge, R.style.TextAppearanceSuper }; - + //这里有一个容错的函数,防止输入的id大于资源总量,若如此,则自动返回默认的设置结果 public static int getTexAppearanceResource(int id) { /** * HACKME: Fix bug of store the resource id in shared preference. diff --git a/src/Notes-master2/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java b/src/Notes-master2/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java index 85723be..918412e 100644 --- a/src/Notes-master2/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java +++ b/src/Notes-master2/app/src/main/java/net/micode/notes/ui/AlarmAlertActivity.java @@ -41,118 +41,169 @@ import java.io.IOException; public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener { - private long mNoteId; - private String mSnippet; - private static final int SNIPPET_PREW_MAX_LEN = 60; - MediaPlayer mPlayer; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - requestWindowFeature(Window.FEATURE_NO_TITLE); - - final Window win = getWindow(); - win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); - - if (!isScreenOn()) { - win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON - | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON - | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); + private long mNoteId; //文本在数据库存储中的ID号 + private String mSnippet; //闹钟提示时出现的文本片段 + private static final int SNIPPET_PREW_MAX_LEN = 60; + MediaPlayer mPlayer; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + //Bundle类型的数据与Map类型的数据相似,都是以key-value的形式存储数据的 + //onsaveInstanceState方法是用来保存Activity的状态的 + //能从onCreate的参数savedInsanceState中获得状态数据 + requestWindowFeature(Window.FEATURE_NO_TITLE); + //界面显示——无标题 + + final Window win = getWindow(); + win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + + if (!isScreenOn()) { + win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON + //保持窗体点亮 + | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON + //将窗体点亮 + | WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON + //允许窗体点亮时锁屏 + | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); + }//在手机锁屏后如果到了闹钟提示时间,点亮屏幕 + + Intent intent = getIntent(); + + try { + mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1)); + mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId); + //根据ID从数据库中获取标签的内容; + //getContentResolver()是实现数据共享,实例存储。 + mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, + SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) + : mSnippet; + //判断标签片段是否达到符合长度 + } catch (IllegalArgumentException e) { + e.printStackTrace(); + return; + } + /* + try + { + // 代码区 } - - Intent intent = getIntent(); - - try { - mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1)); - mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId); - mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0, - SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info) - : mSnippet; - } catch (IllegalArgumentException e) { - e.printStackTrace(); - return; + catch(Exception e) + { + // 异常处理 } - - mPlayer = new MediaPlayer(); - if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { - showActionDialog(); - playAlarmSound(); - } else { - finish(); + 代码区如果有错误,就会返回所写异常的处理。*/ + mPlayer = new MediaPlayer(); + if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) { + showActionDialog(); + //弹出对话框 + playAlarmSound(); + //闹钟提示音激发 + } else { + finish(); + //完成闹钟动作 + } } - } - private boolean isScreenOn() { - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - return pm.isScreenOn(); - } - - private void playAlarmSound() { - Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM); - - int silentModeStreams = Settings.System.getInt(getContentResolver(), - Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); + private boolean isScreenOn() { + //判断屏幕是否锁屏,调用系统函数判断,最后返回值是布尔类型 + PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); + return pm.isScreenOn(); + } - if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) { - mPlayer.setAudioStreamType(silentModeStreams); - } else { - mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); + private void playAlarmSound() { + //闹钟提示音激发 + Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM); + //调用系统的铃声管理URI,得到闹钟提示音 + int silentModeStreams = Settings.System.getInt(getContentResolver(), + Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0); + + if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) { + mPlayer.setAudioStreamType(silentModeStreams); + } else { + mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); + } + try { + mPlayer.setDataSource(this, url); + //方法:setDataSource(Context context, Uri uri) + //解释:无返回值,设置多媒体数据来源【根据 Uri】 + mPlayer.prepare(); + //准备同步 + mPlayer.setLooping(true); + //设置是否循环播放 + mPlayer.start(); + //开始播放 + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + //e.printStackTrace()函数功能是抛出异常, 还将显示出更深的调用信息 + //System.out.println(e),这个方法打印出异常,并且输出在哪里出现的异常 + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalStateException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } - try { - mPlayer.setDataSource(this, url); - mPlayer.prepare(); - mPlayer.setLooping(true); - mPlayer.start(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + + private void showActionDialog() { + AlertDialog.Builder dialog = new AlertDialog.Builder(this); + //AlertDialog的构造方法全部是Protected的 + //所以不能直接通过new一个AlertDialog来创建出一个AlertDialog。 + //要创建一个AlertDialog,就要用到AlertDialog.Builder中的create()方法 + //如这里的dialog就是新建了一个AlertDialog + dialog.setTitle(R.string.app_name); + //为对话框设置标题 + dialog.setMessage(mSnippet); + //为对话框设置内容 + dialog.setPositiveButton(R.string.notealert_ok, this); + //给对话框添加"Yes"按钮 + if (isScreenOn()) { + dialog.setNegativeButton(R.string.notealert_enter, this); + }//对话框添加"No"按钮 + dialog.show().setOnDismissListener(this); } - } - - private void showActionDialog() { - AlertDialog.Builder dialog = new AlertDialog.Builder(this); - dialog.setTitle(R.string.app_name); - dialog.setMessage(mSnippet); - dialog.setPositiveButton(R.string.notealert_ok, this); - if (isScreenOn()) { - dialog.setNegativeButton(R.string.notealert_enter, this); + + public void onClick(DialogInterface dialog, int which) { + switch (which) { + //用which来选择click后下一步的操作 + case DialogInterface.BUTTON_NEGATIVE: + //这是取消操作 + Intent intent = new Intent(this, NoteEditActivity.class); + //实现两个类间的数据传输 + intent.setAction(Intent.ACTION_VIEW); + //设置动作属性 + intent.putExtra(Intent.EXTRA_UID, mNoteId); + //实现key-value对 + //EXTRA_UID为key;mNoteId为键 + startActivity(intent); + //开始动作 + break; + default: + //这是确定操作 + break; + } } - dialog.show().setOnDismissListener(this); - } - - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case DialogInterface.BUTTON_NEGATIVE: - Intent intent = new Intent(this, NoteEditActivity.class); - intent.setAction(Intent.ACTION_VIEW); - intent.putExtra(Intent.EXTRA_UID, mNoteId); - startActivity(intent); - break; - default: - break; + + public void onDismiss(DialogInterface dialog) { + //忽略 + stopAlarmSound(); + //停止闹钟声音 + finish(); + //完成该动作 } - } - - public void onDismiss(DialogInterface dialog) { - stopAlarmSound(); - finish(); - } - - private void stopAlarmSound() { - if (mPlayer != null) { - mPlayer.stop(); - mPlayer.release(); - mPlayer = null; + + private void stopAlarmSound() { + if (mPlayer != null) { + mPlayer.stop(); + //停止播放 + mPlayer.release(); + //释放MediaPlayer对象 + mPlayer = null; + } } - } }