This commit is contained in:
square group sky 2019-10-12 04:08:57 +08:00
parent 122ed2135a
commit 31dde50d4a
11 changed files with 411 additions and 284 deletions

View File

@ -11,8 +11,16 @@
<component name="ChangeListManager">
<list default="true" id="a4b1c65b-c711-4e3b-9768-65e31cf57d47" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/DataUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/DataUtils.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -35,55 +43,19 @@
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="292" column="57" selection-start-line="292" selection-start-column="27" selection-end-line="292" selection-end-column="57" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/DataUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2524">
<caret line="285" column="35" lean-forward="true" selection-start-line="285" selection-start-column="24" selection-end-line="285" selection-end-column="38" />
<state relative-caret-position="1364">
<caret line="123" column="50" lean-forward="true" selection-start-line="123" selection-start-column="50" selection-end-line="123" selection-end-column="50" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="jar://G:/Android/Sdk/platforms/android-28/android.jar!/android/content/ContentResolver.class">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="159">
<caret line="82" column="24" selection-start-line="82" selection-start-column="24" selection-end-line="82" selection-end-column="24" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="jar://G:/Android/Sdk/platforms/android-28/android.jar!/android/content/ContentProviderOperation.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="12" column="13" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="68" column="21" selection-start-line="68" selection-start-column="21" selection-end-line="68" selection-end-column="21" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="27" column="29" selection-start-line="27" selection-start-column="13" selection-end-line="27" selection-end-column="29" />
<state relative-caret-position="44">
<caret line="40" column="40" lean-forward="true" selection-start-line="40" selection-start-column="40" selection-end-line="40" selection-end-column="40" />
</state>
</provider>
</entry>
@ -91,26 +63,81 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2205">
<caret line="185" column="1" selection-start-line="185" selection-start-column="1" selection-end-line="185" selection-end-column="1" />
<state relative-caret-position="-402">
<caret line="127" column="17" selection-start-line="127" selection-start-column="17" selection-end-line="127" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="36" column="28" selection-start-line="36" selection-start-column="28" selection-end-line="36" selection-end-column="28" />
<state relative-caret-position="-256">
<caret line="38" column="22" selection-start-line="38" selection-start-column="22" selection-end-line="38" selection-end-column="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/ui/NoteEditActivity.java">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="80" selection-start-line="80" selection-end-line="80" />
<state relative-caret-position="287">
<caret line="69" column="14" selection-start-line="69" selection-start-column="14" selection-end-line="69" selection-end-column="14" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2295">
<caret line="183" column="82" lean-forward="true" selection-start-line="183" selection-start-column="82" selection-end-line="183" selection-end-column="82" />
<folding>
<element signature="e#7615#7616#0" expanded="true" />
<element signature="e#7645#7646#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1633">
<caret line="364" column="25" selection-start-line="364" selection-start-column="25" selection-end-line="364" selection-end-column="25" />
<folding>
<element signature="e#7068#13313#0" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="311" selection-start-line="311" selection-end-line="312" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="324" column="36" lean-forward="true" selection-start-line="324" selection-start-column="36" selection-end-line="324" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
</state>
</provider>
</entry>
@ -123,6 +150,7 @@
<find>exportToText</find>
<find>equal</find>
<find>notesCursor.moveToFirst()</find>
<find>//</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -132,11 +160,6 @@
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/app/build.gradle" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/Contact.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/Notes.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java" />
@ -147,8 +170,16 @@
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/remote/GTaskClient.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/remote/GTaskManager.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/remote/GTaskSyncService.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/DataUtils.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java" />
<option value="$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java" />
</list>
</option>
</component>
@ -212,8 +243,39 @@
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="java" type="edd41e36:AndroidSourceTypeNode" />
<item name="notes" type="cbb59c9e:AndroidPsiDirectoryNode" />
<item name="gtask" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Notes-master" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="java" type="edd41e36:AndroidSourceTypeNode" />
<item name="notes" type="cbb59c9e:AndroidPsiDirectoryNode" />
<item name="gtask" type="462c0819:PsiDirectoryNode" />
<item name="data" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Notes-master" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="java" type="edd41e36:AndroidSourceTypeNode" />
<item name="notes" type="cbb59c9e:AndroidPsiDirectoryNode" />
<item name="gtask" type="462c0819:PsiDirectoryNode" />
<item name="exception" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Notes-master" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="java" type="edd41e36:AndroidSourceTypeNode" />
<item name="notes" type="cbb59c9e:AndroidPsiDirectoryNode" />
<item name="gtask" type="462c0819:PsiDirectoryNode" />
<item name="remote" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Notes-master" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="java" type="edd41e36:AndroidSourceTypeNode" />
<item name="notes" type="cbb59c9e:AndroidPsiDirectoryNode" />
<item name="model" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Notes-master" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
@ -381,7 +443,21 @@
<option name="project" value="LOCAL" />
<updated>1570536169255</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="1">
<created>1570799807767</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1570799807768</updated>
</task>
<task id="LOCAL-00004" summary="1">
<created>1570809117951</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1570809117951</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="ToolWindowManager">
@ -436,29 +512,15 @@
</properties>
<option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java</url>
<properties />
<option name="timeStamp" value="4" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/rt.jar!/java/lang/Thread.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="213" selection-start-line="213" selection-end-line="213" />
</state>
</provider>
</entry>
<entry file="jar://$APPLICATION_HOME_DIR$/jre/jre/lib/rt.jar!/java/util/concurrent/ThreadPoolExecutor.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20">
<caret line="418" lean-forward="true" selection-start-line="418" selection-end-line="418" />
<folding>
<element signature="e#0#28134#0" expanded="true" />
<element signature="e#26887#26888#0" expanded="true" />
<element signature="e#26950#26951#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/build/generated/source/buildConfig/androidTest/debug/net/micode/notes/test/BuildConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
@ -603,27 +665,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-509">
<caret line="27" column="5" selection-start-line="27" selection-start-column="5" selection-end-line="27" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="25" selection-start-line="25" selection-end-line="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1769">
<caret line="48" column="10" lean-forward="true" selection-start-line="48" selection-start-column="10" selection-end-line="48" selection-end-column="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/Notes.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3584">
@ -631,40 +672,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-779">
<caret line="259" selection-start-line="259" selection-end-line="260" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="53" selection-start-line="53" selection-end-line="54" />
<folding>
<element signature="e#7068#13313#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-3989">
<caret line="43" selection-start-line="43" selection-end-line="44" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="20" column="35" selection-start-line="20" selection-start-column="13" selection-end-line="20" selection-end-column="35" />
</state>
</provider>
</entry>
<entry file="jar://G:/Android/Sdk/platforms/android-28/android.jar!/android/app/NotificationManager.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-315">
@ -686,13 +693,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="30" selection-start-line="30" selection-end-line="31" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/Contact.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
@ -724,13 +724,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2205">
<caret line="185" column="1" selection-start-line="185" selection-start-column="1" selection-end-line="185" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
@ -795,17 +788,108 @@
</state>
</provider>
</entry>
<entry file="jar://G:/Android/Sdk/platforms/android-28/android.jar!/android/text/TextUtils.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="18" column="13" selection-start-line="18" selection-start-column="13" selection-end-line="18" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="jar://G:/Android/Sdk/platforms/android-28/android.jar!/java/io/File.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="159">
<caret line="144" column="19" selection-start-line="144" selection-start-column="19" selection-end-line="144" selection-end-column="19" />
<folding>
<element signature="e#3339#3340#0" expanded="true" />
<element signature="e#3390#3391#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/BackupUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="390">
<caret line="292" column="57" selection-start-line="292" selection-start-column="27" selection-end-line="292" selection-end-column="57" />
<state relative-caret-position="272">
<caret line="357" column="14" selection-start-line="357" selection-start-column="12" selection-end-line="357" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/DataUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2524">
<caret line="285" column="35" lean-forward="true" selection-start-line="285" selection-start-column="24" selection-end-line="285" selection-end-column="38" />
<state relative-caret-position="1364">
<caret line="123" column="50" lean-forward="true" selection-start-line="123" selection-start-column="50" selection-end-line="123" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/GTaskStringUtils.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="44">
<caret line="40" column="40" lean-forward="true" selection-start-line="40" selection-start-column="40" selection-end-line="40" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/tool/ResourceParser.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-402">
<caret line="127" column="17" selection-start-line="127" selection-start-column="17" selection-end-line="127" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/MetaData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-256">
<caret line="38" column="22" selection-start-line="38" selection-start-column="22" selection-end-line="38" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Node.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="287">
<caret line="69" column="14" selection-start-line="69" selection-start-column="14" selection-end-line="69" selection-end-column="14" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlData.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2295">
<caret line="183" column="82" lean-forward="true" selection-start-line="183" selection-start-column="82" selection-end-line="183" selection-end-column="82" />
<folding>
<element signature="e#7615#7616#0" expanded="true" />
<element signature="e#7645#7646#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/exception/ActionFailureException.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="22" lean-forward="true" selection-start-line="22" selection-end-line="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/SqlNote.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1633">
<caret line="364" column="25" selection-start-line="364" selection-start-column="25" selection-end-line="364" selection-end-column="25" />
<folding>
<element signature="e#7068#13313#0" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/Task.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="311" selection-start-line="311" selection-end-line="312" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/net/micode/notes/gtask/data/TaskList.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="324" column="36" lean-forward="true" selection-start-line="324" selection-start-column="36" selection-end-line="324" selection-end-column="36" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@ -36,6 +36,7 @@ public class MetaData extends Task {
try {
//put中第一个元素在tool包中
metaInfo.put(GTaskStringUtils.META_HEAD_GTASK_ID, gid);
//捕获json异常
} catch (JSONException e) {
Log.e(TAG, "failed to put related gid");
}
@ -57,6 +58,7 @@ public class MetaData extends Task {
@Override
public void setContentByRemoteJSON(JSONObject js) {
//super这里就指当前对象
super.setContentByRemoteJSON(js);
if (getNotes() != null) {
try {
@ -69,7 +71,12 @@ public class MetaData extends Task {
}
}
}
//以下三个函数表示不能在这里调用只能在Task类中调用
/*override
重写是子类对父类的允许访问的方法的实现过程进行重新编写, 返回值和形参都不能改变
即外壳不变核心重写
重写的好处在于子类可以根据需要定义特定于自己的行为
也就是说子类能够根据需要实现父类的方法
*/
@Override
public void setContentByLocalJSON(JSONObject js) {
// this function should not be called

View File

@ -23,27 +23,27 @@ import org.json.JSONObject;
public abstract class Node {
//定义结点的属性变量
public static final int SYNC_ACTION_NONE = 0;
//添加远程同步动作
public static final int SYNC_ACTION_ADD_REMOTE = 1;
//添加当地同步动作
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_LOCAL = 4;
//更新远程同步动作
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_CONFLICT = 7;
//当地远程同步冲突
public static final int SYNC_ACTION_ERROR = 8;
private String mGid;
private String mName;
//记录最后一次修改
private long mLastModified;
private boolean mDeleted;
@ -55,9 +55,9 @@ public abstract class Node {
mLastModified = 0;
mDeleted = false;
}
//创建
public abstract JSONObject getCreateAction(int actionId);
//更新
public abstract JSONObject getUpdateAction(int actionId);
//通过远程JSON设置内容
public abstract void setContentByRemoteJSON(JSONObject js);
@ -67,7 +67,7 @@ public abstract class Node {
public abstract JSONObject getLocalJSONFromContent();
//获得同步动作
public abstract int getSyncAction(Cursor c);
//下面是一系列初始化
//下面是一系列构造初始化
public void setGid(String gid) {
this.mGid = gid;
}

View File

@ -39,19 +39,19 @@ import org.json.JSONObject;
*/
public class SqlData {
private static final String TAG = SqlData.class.getSimpleName();
//设置初始ID
private static final int INVALID_ID = -99999;
public static final String[] PROJECTION_DATA = new String[] {
DataColumns.ID, DataColumns.MIME_TYPE, DataColumns.CONTENT, DataColumns.DATA1,
DataColumns.DATA3
};
//数据库参数
//数据列ID
public static final int DATA_ID_COLUMN = 0;
//数据列的mime_type
public static final int DATA_MIME_TYPE_COLUMN = 1;
//数据列内容
public static final int DATA_CONTENT_COLUMN = 2;
public static final int DATA_CONTENT_DATA_1_COLUMN = 3;
@ -71,7 +71,13 @@ public class SqlData {
private long mDataContentData1;
private String mDataContentData3;
/*ContentValues
就是用于保存一些数据string/boolean/byte/double/float/int/long/short 信息
这些信息可以被数据库操作时方便地使用
ContentValues HashTable 类似都是一种存储的机制
但是两者最大的区别就在于ContentValues 只能存储基本类型的数据
像stringint之类的不能存储对象这种东西而HashTable却可以存储对象
*/
private ContentValues mDiffDataValues;
//构造函数两种
public SqlData(Context context) {
@ -134,11 +140,13 @@ public class SqlData {
}
//利用JSON获取内容属性
public JSONObject getContent() throws JSONException {
//记录未在数据库建立
if (mIsCreate) {
Log.e(TAG, "it seems that we haven't created this in database yet");
return null;
}
JSONObject js = new JSONObject();
//利用JSON将一系列参数添加进来
js.put(DataColumns.ID, mDataId);
js.put(DataColumns.MIME_TYPE, mDataMimeType);
js.put(DataColumns.CONTENT, mDataContent);
@ -153,11 +161,16 @@ public class SqlData {
if (mDataId == INVALID_ID && mDiffDataValues.containsKey(DataColumns.ID)) {
mDiffDataValues.remove(DataColumns.ID);
}
//保存信息
mDiffDataValues.put(DataColumns.NOTE_ID, noteId);
Uri uri = mContentResolver.insert(Notes.CONTENT_DATA_URI, mDiffDataValues);
try {
/*
Uri的getPathSegments()方法返回的是一个元素为String的List,
每个元素都是从Uri截取出来的一部分
*/
mDataId = Long.valueOf(uri.getPathSegments().get(1));
//捕获数字格式异常
} catch (NumberFormatException e) {
Log.e(TAG, "Get note id error :" + e.toString());
throw new ActionFailureException("create note failed");
@ -166,6 +179,10 @@ public class SqlData {
if (mDiffDataValues.size() > 0) {
int result = 0;
if (!validateVersion) {
/*
ContentResolver.update方法ContentValue只更新指定的字段
.update(Uri arg0,ContentValues arg1,String arg2,String[] arg3)
*/
result = mContentResolver.update(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mDataId), mDiffDataValues, null, null);
} else {
@ -176,12 +193,13 @@ public class SqlData {
String.valueOf(noteId), String.valueOf(version)
});
}
//未更新
if (result == 0) {
Log.w(TAG, "there is no update. maybe user updates note when syncing");
}
}
}
//清空记录建立失败
mDiffDataValues.clear();
mIsCreate = false;
}

View File

@ -51,19 +51,19 @@ public class SqlNote {
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION
};
//一系列参数......
//ID列
public static final int ID_COLUMN = 0;
//警示日期列
public static final int ALERTED_DATE_COLUMN = 1;
//背景颜色id列
public static final int BG_COLOR_ID_COLUMN = 2;
//建立的日期列
public static final int CREATED_DATE_COLUMN = 3;
//有连接列
public static final int HAS_ATTACHMENT_COLUMN = 4;
//修改日期列
public static final int MODIFIED_DATE_COLUMN = 5;
//便签数目列
public static final int NOTES_COUNT_COLUMN = 6;
public static final int PARENT_ID_COLUMN = 7;
@ -362,13 +362,14 @@ public class SqlNote {
public JSONObject getContent() {
try {
JSONObject js = new JSONObject();
//未创建内容加入数据库中
if (mIsCreate) {
Log.e(TAG, "it seems that we haven't created this in database yet");
return null;
}
JSONObject note = new JSONObject();
//如果便签类型匹配
if (mType == Notes.TYPE_NOTE) {
note.put(NoteColumns.ID, mId);
note.put(NoteColumns.ALERTED_DATE, mAlertDate);
@ -406,36 +407,36 @@ public class SqlNote {
}
return null;
}
//设置父ID
public void setParentId(long id) {
mParentId = id;
mDiffNoteValues.put(NoteColumns.PARENT_ID, id);
}
//设置同步任务ID
//设置日程同步ID
public void setGtaskId(String gid) {
mDiffNoteValues.put(NoteColumns.GTASK_ID, gid);
}
//设置同步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
public long getParentId() {
return mParentId;
}
//获取对象片段
public String getSnippet() {
return mSnippet;
}
//判断是否为便签ID
public boolean isNoteType() {
return mType == Notes.TYPE_NOTE;
}
@ -453,6 +454,7 @@ public class SqlNote {
Log.e(TAG, "Get note id error :" + e.toString());
throw new ActionFailureException("create note failed");
}
//建立线程ID失败
if (mId == 0) {
throw new IllegalStateException("Create thread id failed");
}
@ -470,6 +472,7 @@ public class SqlNote {
if (mDiffNoteValues.size() > 0) {
mVersion ++;
int result = 0;
//若有效
if (!validateVersion) {
result = mContentResolver.update(Notes.CONTENT_NOTE_URI, mDiffNoteValues, "("
+ NoteColumns.ID + "=?)", new String[] {
@ -482,6 +485,7 @@ public class SqlNote {
String.valueOf(mId), String.valueOf(mVersion)
});
}
//未更新可能在同步时更新了
if (result == 0) {
Log.w(TAG, "there is no update. maybe user updates note when syncing");
}
@ -494,7 +498,7 @@ public class SqlNote {
}
}
// refresh local infof
// 刷新本地infof
loadFromCursor(mId);
if (mType == Notes.TYPE_NOTE)
loadDataContent();

View File

@ -44,7 +44,7 @@ public class Task extends Node {
private Task mPriorSibling;
private TaskList mParent;
//构造函数
public Task() {
super();
mCompleted = false;
@ -58,17 +58,17 @@ public class Task extends Node {
JSONObject js = new JSONObject();
try {
// action_type
// 动作类型
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_CREATE);
// action_id
// 动作ID
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// index
// 索引
js.put(GTaskStringUtils.GTASK_JSON_INDEX, mParent.getChildTaskIndex(this));
// entity_delta
// JSON创建内容
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
entity.put(GTaskStringUtils.GTASK_JSON_CREATOR_ID, "null");
@ -79,17 +79,17 @@ public class Task extends Node {
}
js.put(GTaskStringUtils.GTASK_JSON_ENTITY_DELTA, entity);
// parent_id
// 父ID
js.put(GTaskStringUtils.GTASK_JSON_PARENT_ID, mParent.getGid());
// dest_parent_type
// 目的父类型
js.put(GTaskStringUtils.GTASK_JSON_DEST_PARENT_TYPE,
GTaskStringUtils.GTASK_JSON_TYPE_GROUP);
// list_id
// 列表ID
js.put(GTaskStringUtils.GTASK_JSON_LIST_ID, mParent.getGid());
// prior_sibling_id
// 优先同级ID
if (mPriorSibling != null) {
js.put(GTaskStringUtils.GTASK_JSON_PRIOR_SIBLING_ID, mPriorSibling.getGid());
}
@ -107,17 +107,17 @@ public class Task extends Node {
JSONObject js = new JSONObject();
try {
// action_type
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_UPDATE);
// action_id
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// id
js.put(GTaskStringUtils.GTASK_JSON_ID, getGid());
// entity_delta
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
if (getNotes() != null) {
@ -143,27 +143,27 @@ public class Task extends Node {
setGid(js.getString(GTaskStringUtils.GTASK_JSON_ID));
}
// last_modified
// 最后一次修改
if (js.has(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED)) {
setLastModified(js.getLong(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED));
}
// name
// 姓名
if (js.has(GTaskStringUtils.GTASK_JSON_NAME)) {
setName(js.getString(GTaskStringUtils.GTASK_JSON_NAME));
}
// notes
// 有便签
if (js.has(GTaskStringUtils.GTASK_JSON_NOTES)) {
setNotes(js.getString(GTaskStringUtils.GTASK_JSON_NOTES));
}
// deleted
// 删除
if (js.has(GTaskStringUtils.GTASK_JSON_DELETED)) {
setDeleted(js.getBoolean(GTaskStringUtils.GTASK_JSON_DELETED));
}
// completed
// 完成
if (js.has(GTaskStringUtils.GTASK_JSON_COMPLETED)) {
setCompleted(js.getBoolean(GTaskStringUtils.GTASK_JSON_COMPLETED));
}
@ -176,6 +176,7 @@ public class Task extends Node {
}
//通过本地JSON设置内容
public void setContentByLocalJSON(JSONObject js) {
//JSON空消息设置内容失败
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
@ -184,12 +185,12 @@ public class Task extends Node {
try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
//无效类型
if (note.getInt(NoteColumns.TYPE) != Notes.TYPE_NOTE) {
Log.e(TAG, "invalid type");
return;
}
//如果文本备份找到一致就跳出
for (int i = 0; i < dataArray.length(); i++) {
JSONObject data = dataArray.getJSONObject(i);
if (TextUtils.equals(data.getString(DataColumns.MIME_TYPE), DataConstants.NOTE)) {
@ -208,7 +209,7 @@ public class Task extends Node {
String name = getName();
try {
if (mMetaInfo == null) {
// new task created from web
// 初始为空从网页创建的新任务
if (name == null) {
Log.w(TAG, "the note seems to be an empty one");
return null;
@ -225,7 +226,7 @@ public class Task extends Node {
js.put(GTaskStringUtils.META_HEAD_NOTE, note);
return js;
} else {
// synced task
// 同步任务
JSONObject note = mMetaInfo.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
JSONArray dataArray = mMetaInfo.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
@ -246,7 +247,7 @@ public class Task extends Node {
return null;
}
}
//设置元信息
public void setMetaInfo(MetaData metaData) {
if (metaData != null && metaData.getNotes() != null) {
try {
@ -275,29 +276,29 @@ public class Task extends Node {
return SYNC_ACTION_UPDATE_LOCAL;
}
// validate the note id now
// 现在验证便签 id
if (c.getLong(SqlNote.ID_COLUMN) != noteInfo.getLong(NoteColumns.ID)) {
Log.w(TAG, "note id doesn't match");
return SYNC_ACTION_UPDATE_LOCAL;
}
if (c.getInt(SqlNote.LOCAL_MODIFIED_COLUMN) == 0) {
// there is no local update
// 没有本地更新
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// no update both side
return SYNC_ACTION_NONE;
} else {
// apply remote to local
// 将远程应用到本地
return SYNC_ACTION_UPDATE_LOCAL;
}
} else {
// validate gtask id
// 验证日程同步 id
if (!c.getString(SqlNote.GTASK_ID_COLUMN).equals(getGid())) {
Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR;
}
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// local modification only
// 只有本地修改
return SYNC_ACTION_UPDATE_REMOTE;
} else {
return SYNC_ACTION_UPDATE_CONFLICT;
@ -310,36 +311,36 @@ public class Task extends Node {
return SYNC_ACTION_ERROR;
}
//值得保留
public boolean isWorthSaving() {
return mMetaInfo != null || (getName() != null && getName().trim().length() > 0)
|| (getNotes() != null && getNotes().trim().length() > 0);
}
//设置完成
public void setCompleted(boolean completed) {
this.mCompleted = completed;
}
//设置便签
public void setNotes(String notes) {
this.mNotes = notes;
}
//设置优先级
public void setPriorSibling(Task priorSibling) {
this.mPriorSibling = priorSibling;
}
//设置父列表
public void setParent(TaskList parent) {
this.mParent = parent;
}
//获得完成项
public boolean getCompleted() {
return this.mCompleted;
}
//获得便签
public String getNotes() {
return this.mNotes;
}
//获得优先级
public Task getPriorSibling() {
return this.mPriorSibling;
}

View File

@ -47,17 +47,17 @@ public class TaskList extends Node {
JSONObject js = new JSONObject();
try {
// action_type
// 动作类型
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_CREATE);
// action_id
// 动作ID
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// index
// 索引
js.put(GTaskStringUtils.GTASK_JSON_INDEX, mIndex);
// entity_delta
// JSON设置内容
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
entity.put(GTaskStringUtils.GTASK_JSON_CREATOR_ID, "null");
@ -78,17 +78,17 @@ public class TaskList extends Node {
JSONObject js = new JSONObject();
try {
// action_type
js.put(GTaskStringUtils.GTASK_JSON_ACTION_TYPE,
GTaskStringUtils.GTASK_JSON_ACTION_TYPE_UPDATE);
// action_id
js.put(GTaskStringUtils.GTASK_JSON_ACTION_ID, actionId);
// id
js.put(GTaskStringUtils.GTASK_JSON_ID, getGid());
// entity_delta
JSONObject entity = new JSONObject();
entity.put(GTaskStringUtils.GTASK_JSON_NAME, getName());
entity.put(GTaskStringUtils.GTASK_JSON_DELETED, getDeleted());
@ -106,17 +106,17 @@ public class TaskList extends Node {
public void setContentByRemoteJSON(JSONObject js) {
if (js != null) {
try {
// id
if (js.has(GTaskStringUtils.GTASK_JSON_ID)) {
setGid(js.getString(GTaskStringUtils.GTASK_JSON_ID));
}
// last_modified
// 最后一次修改
if (js.has(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED)) {
setLastModified(js.getLong(GTaskStringUtils.GTASK_JSON_LAST_MODIFIED));
}
// name
// 姓名
if (js.has(GTaskStringUtils.GTASK_JSON_NAME)) {
setName(js.getString(GTaskStringUtils.GTASK_JSON_NAME));
}
@ -133,19 +133,22 @@ public class TaskList extends Node {
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
}
//建立JSON文件夹加入元头便签
try {
JSONObject folder = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) {
String name = folder.getString(NoteColumns.SNIPPET);
//设置姓名
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX + name);
//获得类型与便签系统类型一样时
} else if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_SYSTEM) {
if (folder.getLong(NoteColumns.ID) == Notes.ID_ROOT_FOLDER)
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX + GTaskStringUtils.FOLDER_DEFAULT);
else if (folder.getLong(NoteColumns.ID) == Notes.ID_CALL_RECORD_FOLDER)
setName(GTaskStringUtils.MIUI_FOLDER_PREFFIX
+ GTaskStringUtils.FOLDER_CALL_NOTE);
//无效系统文件夹
else
Log.e(TAG, "invalid system folder");
} else {
@ -156,7 +159,7 @@ public class TaskList extends Node {
e.printStackTrace();
}
}
//通过内容获得本地JSON
public JSONObject getLocalJSONFromContent() {
try {
JSONObject js = new JSONObject();
@ -167,6 +170,7 @@ public class TaskList extends Node {
folderName = folderName.substring(GTaskStringUtils.MIUI_FOLDER_PREFFIX.length(),
folderName.length());
folder.put(NoteColumns.SNIPPET, folderName);
//文件夹名和默认文件夹名一致时
if (folderName.equals(GTaskStringUtils.FOLDER_DEFAULT)
|| folderName.equals(GTaskStringUtils.FOLDER_CALL_NOTE))
folder.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM);
@ -186,25 +190,25 @@ public class TaskList extends Node {
public int getSyncAction(Cursor c) {
try {
if (c.getInt(SqlNote.LOCAL_MODIFIED_COLUMN) == 0) {
// there is no local update
// t没有本地更新
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// no update both side
// 双方无更新
return SYNC_ACTION_NONE;
} else {
// apply remote to local
// 将远程应用到本地
return SYNC_ACTION_UPDATE_LOCAL;
}
} else {
// validate gtask id
// 验证日程同步 id
if (!c.getString(SqlNote.GTASK_ID_COLUMN).equals(getGid())) {
Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR;
}
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// local modification only
// 只有本地修改
return SYNC_ACTION_UPDATE_REMOTE;
} else {
// for folder conflicts, just apply local modification
// 对于文件夹冲突只需应用本地修改
return SYNC_ACTION_UPDATE_REMOTE;
}
}
@ -225,7 +229,7 @@ public class TaskList extends Node {
if (task != null && !mChildren.contains(task)) {
ret = mChildren.add(task);
if (ret) {
// need to set prior sibling and parent
// 需要设置之前的父结点和兄节点
task.setPriorSibling(mChildren.isEmpty() ? null : mChildren
.get(mChildren.size() - 1));
task.setParent(this);
@ -244,14 +248,14 @@ public class TaskList extends Node {
if (task != null && pos == -1) {
mChildren.add(index, task);
// update the task list
// 更新任务列表
Task preTask = null;
Task afterTask = null;
if (index != 0)
preTask = mChildren.get(index - 1);
if (index != mChildren.size() - 1)
afterTask = mChildren.get(index + 1);
//设置同级
task.setPriorSibling(preTask);
if (afterTask != null)
afterTask.setPriorSibling(task);
@ -267,11 +271,11 @@ public class TaskList extends Node {
ret = mChildren.remove(task);
if (ret) {
// reset prior sibling and parent
task.setPriorSibling(null);
task.setParent(null);
// update the task list
// 更新任务列表
if (index != mChildren.size()) {
mChildren.get(index).setPriorSibling(
index == 0 ? null : mChildren.get(index - 1));
@ -287,7 +291,7 @@ public class TaskList extends Node {
Log.e(TAG, "move child task: invalid index");
return false;
}
//子任务索引位置
int pos = mChildren.indexOf(task);
if (pos == -1) {
Log.e(TAG, "move child task: the task should in the list");
@ -332,7 +336,7 @@ public class TaskList extends Node {
public ArrayList<Task> getChildTaskList() {
return this.mChildren;
}
//设置索引
public void setIndex(int index) {
this.mIndex = index;
}

View File

@ -198,11 +198,11 @@ public class BackupUtils {
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));
@ -219,7 +219,7 @@ public class BackupUtils {
//及时关闭cursor
dataCursor.close();
}
// print a line separator between note
// 在便签之间打印一个行分隔符
try {
ps.write(new byte[] {
Character.LINE_SEPARATOR, Character.LETTER_NUMBER
@ -229,8 +229,8 @@ public class BackupUtils {
}
}
/**
* Note will be exported as text which is user readable
/*
便签将被导出为用户可读的文本
*/
public int exportToText() {
//判断是否有外部存储空间
@ -245,7 +245,7 @@ public class BackupUtils {
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,
@ -256,7 +256,7 @@ public class BackupUtils {
if (folderCursor != null) {
if (folderCursor.moveToFirst()) {
do {
// Print folder's name
// 打印文件夹的名字
String folderName = "";
//若id为最近记录里调用的文件中
if(folderCursor.getLong(NOTE_COLUMN_ID) == Notes.ID_CALL_RECORD_FOLDER) {
@ -277,7 +277,7 @@ public class BackupUtils {
folderCursor.close();
}
// Export notes in root's folder
// 在根目录下导出注释
Cursor noteCursor = mContext.getContentResolver().query(
Notes.CONTENT_NOTE_URI,
NOTE_PROJECTION,
@ -291,7 +291,7 @@ public class BackupUtils {
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);
//通过id导出文本
exportNoteToText(noteId, ps);
@ -304,8 +304,8 @@ public class BackupUtils {
return STATE_SUCCESS;
}
/**
* Get a print stream pointed to the file {@generateExportedTextFile}
/*
获取指向该文件的打印流 {@generateExportedTextFile}
*/
private PrintStream getExportToTextPrintStream() {
File file = generateFileMountedOnSDcard(mContext, R.string.file_path,
@ -331,8 +331,8 @@ public class BackupUtils {
}
}
/**
* Generate the text file to store imported data
/*
生成文本文件来存储导入的数据
*/
private static File generateFileMountedOnSDcard(Context context, int filePathResId, int fileNameFormatResId) {
StringBuilder sb = new StringBuilder();
@ -346,15 +346,19 @@ public class BackupUtils {
File file = new File(sb.toString());
try {
//目录不存在就创建
if (!filedir.exists()) {
filedir.mkdir();
}
//文件不存在也创建
if (!file.exists()) {
file.createNewFile();
}
return file;
//安全性异常
} catch (SecurityException e) {
e.printStackTrace();
//IO异常
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -120,8 +120,8 @@ public class DataUtils {
return false;
}
/**
* Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}}
/*
获取除系统文件夹外的所有文件夹计数 {@link Notes#TYPE_SYSTEM}}
*/
public static int getUserFolderCount(ContentResolver resolver) {
/*
@ -174,6 +174,7 @@ public class DataUtils {
boolean exist = false;
if (cursor != null) {
//行数大于0
if (cursor.getCount() > 0) {
exist = true;
}
@ -233,6 +234,7 @@ public class DataUtils {
} catch (IndexOutOfBoundsException e) {
Log.e(TAG, e.toString());
}
//这里循环是找到cursor不为空的时候
} while (c.moveToNext());
}
c.close();
@ -251,6 +253,7 @@ public class DataUtils {
//获得第一行数据
try {
return cursor.getString(0);
//捕捉超界异常
} catch (IndexOutOfBoundsException e) {
Log.e(TAG, "Get call number fails " + e.toString());
} finally {
@ -292,14 +295,16 @@ public class DataUtils {
if (cursor != null) {
String snippet = "";
if (cursor.moveToFirst()) {
//获取第一列字符串
snippet = cursor.getString(0);
}
cursor.close();
return snippet;
}
//抛出无法利用id找到便签的异常
throw new IllegalArgumentException("Note is not found with id: " + noteId);
}
//获得格式化的snippet
//获得格式化的snippet(主要是去除无用字符
public static String getFormattedSnippet(String snippet) {
if (snippet != null) {
snippet = snippet.trim();

View File

@ -19,33 +19,33 @@ package net.micode.notes.tool;
字符工具类
*/
public class GTaskStringUtils {
//日程同步动作ID
public final static String GTASK_JSON_ACTION_ID = "action_id";
//日程同步动作列表
public final static String GTASK_JSON_ACTION_LIST = "action_list";
//日程同步动作类型
public final static String GTASK_JSON_ACTION_TYPE = "action_type";
//日程同步动作类型构造
public final static String GTASK_JSON_ACTION_TYPE_CREATE = "create";
//返回日程同步动作类型
public final static String GTASK_JSON_ACTION_TYPE_GETALL = "get_all";
//日程同步动作类型移动
public final static String GTASK_JSON_ACTION_TYPE_MOVE = "move";
//日程同步动作类型更新
public final static String GTASK_JSON_ACTION_TYPE_UPDATE = "update";
//日程同步创建id
public final static String GTASK_JSON_CREATOR_ID = "creator_id";
//日程同步子体
public final static String GTASK_JSON_CHILD_ENTITY = "child_entity";
//日程同步用户版本
public final static String GTASK_JSON_CLIENT_VERSION = "client_version";
//日程同步已完成
public final static String GTASK_JSON_COMPLETED = "completed";
//日程同步当前列表ID
public final static String GTASK_JSON_CURRENT_LIST_ID = "current_list_id";
//日程同步默认列表id
public final static String GTASK_JSON_DEFAULT_LIST_ID = "default_list_id";
//日程同步删除
public final static String GTASK_JSON_DELETED = "deleted";
public final static String GTASK_JSON_DEST_LIST = "dest_list";

View File

@ -25,20 +25,20 @@ import net.micode.notes.ui.NotesPreferenceActivity;
界面元素解析工具类
*/
public class ResourceParser {
//定义各种颜色
public static final int YELLOW = 0;
public static final int BLUE = 1;
public static final int WHITE = 2;
public static final int GREEN = 3;
public static final int RED = 4;
//背景默认色
public static final int BG_DEFAULT_COLOR = YELLOW;
public static final int TEXT_SMALL = 0;
public static final int TEXT_MEDIUM = 1;
public static final int TEXT_LARGE = 2;
public static final int TEXT_SUPER = 3;
//背景默认字体大小
public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM;
//便签背景源
public static class NoteBgResources {
@ -67,7 +67,7 @@ public class ResourceParser {
return BG_EDIT_TITLE_RESOURCES[id];
}
}
//获得背景ID默认值颜色
//获得默认背景颜色ID
public static int getDefaultBgId(Context context) {
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) {
@ -109,23 +109,23 @@ public class ResourceParser {
R.drawable.list_green_single,
R.drawable.list_red_single
};
//获得便签背景首源
public static int getNoteBgFirstRes(int id) {
return BG_FIRST_RESOURCES[id];
}
//获得便签背景尾源
public static int getNoteBgLastRes(int id) {
return BG_LAST_RESOURCES[id];
}
//获得单个便签源
public static int getNoteBgSingleRes(int id) {
return BG_SINGLE_RESOURCES[id];
}
//获得便签正常源
public static int getNoteBgNormalRes(int id) {
return BG_NORMAL_RESOURCES[id];
}
//获得文件背景源
public static int getFolderBgRes() {
return R.drawable.list_folder;
}