Compare commits

...

20 Commits

Author SHA1 Message Date
庞浩 ce28b7edc9 Merge branch 'master' into cyx_branch
2 years ago
庞浩 c1a759803c 分组注释
2 years ago
庞浩 8d860e7a00 修改
2 years ago
庞浩 b48f8248c6 更改
2 years ago
庞浩 add039a4a1 Merge branch 'master' of https://bdgit.educoder.net/mbhvfy6mx/gitProject
2 years ago
庞浩 8741dc4cf6 统一控制
2 years ago
mbhvfy6mx 7d312c9c4a Merge pull request '注释代码' (#10) from zxy_branch into master
2 years ago
邹兴云 f1955e5c4a 邹兴云注释
2 years ago
邹兴云 4dd18f2d5c 邹兴云注释
2 years ago
邹兴云 3d803bc080 邹兴云注释
2 years ago
邹兴云 5c27788389 邹兴云注释
2 years ago
邹兴云 d600a5fb23 邹兴云注释
2 years ago
庞浩 ced305cd3b 庞浩的注释
2 years ago
庞浩 f5b025db80 庞浩的注释
2 years ago
庞浩 4ad8e66d2b 庞浩的注释
2 years ago
庞浩 30352f16b0 注释
2 years ago
庞浩 21b28459b6 注释
2 years ago
mbhvfy6mx 225f60584e Merge pull request 'heb' (#9) from master into zxy_branch
2 years ago
mbhvfy6mx a8dbc2e1d7 Merge pull request '注释代码' (#7) from master into zxy_branch
2 years ago
mbhvfy6mx 4cfce06d64 Merge pull request 'heb' (#4) from master into zxy_branch
2 years ago

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidLayouts">
<shared>
<config />
</shared>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="NONE" />
</component>
<component name="ChangeListManager">
<list default="true" id="2531eea7-ec98-43ef-9f7f-09fe1004db56" name="变更" comment="庞浩的注释">
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/checksums/checksums.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/checksums/md5-checksums.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/checksums/sha1-checksums.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/dependencies-accessors/gc.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/executionHistory/executionHistory.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/fileChanges/last-build.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/fileHashes/fileHashes.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.4.2/gc.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/checksums/checksums.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/checksums/md5-checksums.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/checksums/sha1-checksums.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/dependencies-accessors/gc.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/executionHistory/executionHistory.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/executionHistory/executionHistory.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/fileChanges/last-build.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/fileHashes/fileHashes.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/fileHashes/fileHashes.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/fileHashes/resourceHashesCache.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/7.5/gc.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/buildOutputCleanup/buildOutputCleanup.lock" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/buildOutputCleanup/cache.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/buildOutputCleanup/outputFiles.bin" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/file-system.probe" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.gradle/vcs-1/gc.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/compiler.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/deploymentTargetDropDown.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/gradle.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/jarRepositories.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/modules/app/minote.app.androidTest.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/modules/app/minote.app.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/modules/app/minote.app.main.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/modules/app/minote.app.unitTest.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/build.gradle" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/gradle/wrapper/gradle-wrapper.jar" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/gradle/wrapper/gradle-wrapper.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/gradlew" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/gradlew.bat" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/import-summary.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/local.properties" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/minote.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/settings.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/deploymentTargetDropDown.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/minote.app.androidTest.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/minote.app.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/minote.app.main.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules/app/minote.app.unitTest.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/NotesProvider.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/data/NotesProvider.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/model/Note.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/model/Note.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/model/WorkingNote.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/net/micode/notes/model/WorkingNote.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.jar" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.properties" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/gradlew" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/gradlew.bat" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/import-summary.txt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/local.properties" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/minote.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/settings.gradle" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[C:\Users\庞浩的电脑\.android\avd\Pixel_3_API_22.avd]" />
<component name="ExternalProjectsData">
<projectState path="$PROJECT_DIR$">
<ProjectState />
</projectState>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2O5GlHnjCn5qBz61G2RsTAQaajO" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;cidr.known.project.marker&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;D:/softwareengineering/Notes-master&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.17&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.customizations&quot;
}
}</component>
<component name="RunManager" selected="Android App.app">
<configuration name="app" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="minote.app.main" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="INSPECTION_WITHOUT_ACTIVITY_RESTART" value="false" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Auto" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Hybrid>
<Java />
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="D:/softwareengineering/minote/app/build.gradle" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/app/build.gradle" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
<recent_temporary>
<list>
<item itemvalue="Gradle.D:/softwareengineering/minote/app/build.gradle" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="默认任务">
<changelist id="2531eea7-ec98-43ef-9f7f-09fe1004db56" name="变更" comment="" />
<created>1680843179165</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1680843179165</updated>
</task>
<task id="LOCAL-00001" summary="更新">
<created>1680848243607</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1680848243608</updated>
</task>
<task id="LOCAL-00002" summary="注释">
<created>1680850445899</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1680850445899</updated>
</task>
<task id="LOCAL-00003" summary="注释">
<created>1680942675194</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1680942675194</updated>
</task>
<task id="LOCAL-00004" summary="庞浩的注释">
<created>1680942721752</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1680942721752</updated>
</task>
<task id="LOCAL-00005" summary="庞浩的注释">
<created>1681292428634</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1681292428635</updated>
</task>
<task id="LOCAL-00006" summary="庞浩的注释">
<created>1681312464473</created>
<option name="number" value="00006" />
<option name="presentableId" value="LOCAL-00006" />
<option name="project" value="LOCAL" />
<updated>1681312464473</updated>
</task>
<option name="localTasksCounter" value="7" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State>
<option name="FILTERS">
<map>
<entry key="branch">
<value>
<list>
<option value="master" />
</list>
</value>
</entry>
</map>
</option>
</State>
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="更新" />
<MESSAGE value="注释" />
<MESSAGE value="庞浩的注释" />
<option name="LAST_COMMIT_MESSAGE" value="庞浩的注释" />
</component>
</project>

@ -1,253 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.model;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.OperationApplicationException;
import android.net.Uri;
import android.os.RemoteException;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.Notes.TextNote;
import java.util.ArrayList;
public class Note {
private ContentValues mNoteDiffValues;
private NoteData mNoteData;
private static final String TAG = "Note";
/**
* Create a new note id for adding a new note to databases
*/
public static synchronized long getNewNoteId(Context context, long folderId) {
// Create a new note in the database
ContentValues values = new ContentValues();
long createdTime = System.currentTimeMillis();
values.put(NoteColumns.CREATED_DATE, createdTime);
values.put(NoteColumns.MODIFIED_DATE, createdTime);
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
values.put(NoteColumns.LOCAL_MODIFIED, 1);
values.put(NoteColumns.PARENT_ID, folderId);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);
long noteId = 0;
try {
noteId = Long.valueOf(uri.getPathSegments().get(1));
} catch (NumberFormatException e) {
Log.e(TAG, "Get note id error :" + e.toString());
noteId = 0;
}
if (noteId == -1) {
throw new IllegalStateException("Wrong note id:" + noteId);
}
return noteId;
}
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);
}
public long getTextDataId() {
return mNoteData.mTextDataId;
}
public void setCallDataId(long id) {
mNoteData.setCallDataId(id);
}
public void setCallData(String key, String value) {
mNoteData.setCallData(key, value);
}
public boolean isLocalModified() {
return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified();
}
public boolean syncNote(Context context, long noteId) {
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
if (!isLocalModified()) {
return true;
}
/**
* In theory, once data changed, the note should be updated on {@link NoteColumns#LOCAL_MODIFIED} and
* {@link NoteColumns#MODIFIED_DATE}. For data safety, though update note fails, we also update the
* note data info
*/
if (context.getContentResolver().update(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), mNoteDiffValues, null,
null) == 0) {
Log.e(TAG, "Update note error, should not happen");
// Do not return, fall through
}
mNoteDiffValues.clear();
if (mNoteData.isLocalModified()
&& (mNoteData.pushIntoContentResolver(context, noteId) == null)) {
return false;
}
return true;
}
private class NoteData {
private long mTextDataId;
private ContentValues mTextDataValues;
private long mCallDataId;
private ContentValues mCallDataValues;
private static final String TAG = "NoteData";
public NoteData() {
mTextDataValues = new ContentValues();
mCallDataValues = new ContentValues();
mTextDataId = 0;
mCallDataId = 0;
}
boolean isLocalModified() {
return mTextDataValues.size() > 0 || mCallDataValues.size() > 0;
}
void setTextDataId(long id) {
if(id <= 0) {
throw new IllegalArgumentException("Text data id should larger than 0");
}
mTextDataId = id;
}
void setCallDataId(long id) {
if (id <= 0) {
throw new IllegalArgumentException("Call data id should larger than 0");
}
mCallDataId = id;
}
void setCallData(String key, String value) {
mCallDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
void setTextData(String key, String value) {
mTextDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
Uri pushIntoContentResolver(Context context, long noteId) {
/**
* Check for safety
*/
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
ContentProviderOperation.Builder builder = null;
if(mTextDataValues.size() > 0) {
mTextDataValues.put(DataColumns.NOTE_ID, noteId);
if (mTextDataId == 0) {
mTextDataValues.put(DataColumns.MIME_TYPE, TextNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mTextDataValues);
try {
setTextDataId(Long.valueOf(uri.getPathSegments().get(1)));
} catch (NumberFormatException e) {
Log.e(TAG, "Insert new text data fail with noteId" + noteId);
mTextDataValues.clear();
return null;
}
} else {
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mTextDataId));
builder.withValues(mTextDataValues);
operationList.add(builder.build());
}
mTextDataValues.clear();
}
if(mCallDataValues.size() > 0) {
mCallDataValues.put(DataColumns.NOTE_ID, noteId);
if (mCallDataId == 0) {
mCallDataValues.put(DataColumns.MIME_TYPE, CallNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mCallDataValues);
try {
setCallDataId(Long.valueOf(uri.getPathSegments().get(1)));
} catch (NumberFormatException e) {
Log.e(TAG, "Insert new call data fail with noteId" + noteId);
mCallDataValues.clear();
return null;
}
} else {
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mCallDataId));
builder.withValues(mCallDataValues);
operationList.add(builder.build());
}
mCallDataValues.clear();
}
if (operationList.size() > 0) {
try {
ContentProviderResult[] results = context.getContentResolver().applyBatch(
Notes.AUTHORITY, operationList);
return (results == null || results.length == 0 || results[0] == null) ? null
: ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId);
} catch (RemoteException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null;
} catch (OperationApplicationException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null;
}
}
return null;
}
}
}

@ -1,368 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.model;
import android.appwidget.AppWidgetManager;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.DataConstants;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.Notes.TextNote;
import net.micode.notes.tool.ResourceParser.NoteBgResources;
public class WorkingNote {
// Note for the working note
private Note mNote;
// Note Id
private long mNoteId;
// Note content
private String mContent;
// Note mode
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";
private boolean mIsDeleted;
private NoteSettingChangedListener mNoteSettingStatusListener;
public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID,
DataColumns.CONTENT,
DataColumns.MIME_TYPE,
DataColumns.DATA1,
DataColumns.DATA2,
DataColumns.DATA3,
DataColumns.DATA4,
};
public static final String[] NOTE_PROJECTION = new String[] {
NoteColumns.PARENT_ID,
NoteColumns.ALERTED_DATE,
NoteColumns.BG_COLOR_ID,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE
};
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) {
mContext = context;
mAlertDate = 0;
mModifiedDate = System.currentTimeMillis();
mFolderId = folderId;
mNote = new Note();
mNoteId = 0;
mIsDeleted = false;
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
}
// Existing note construct
private WorkingNote(Context context, long noteId, long folderId) {
mContext = context;
mNoteId = noteId;
mFolderId = folderId;
mIsDeleted = false;
mNote = new Note();
loadNote();
}
private void loadNote() {
Cursor cursor = mContext.getContentResolver().query(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
null, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
}
cursor.close();
} else {
Log.e(TAG, "No note with id:" + mNoteId);
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
}
loadNoteData();
}
private void loadNoteData() {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
String.valueOf(mNoteId)
}, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
if (DataConstants.NOTE.equals(type)) {
mContent = cursor.getString(DATA_CONTENT_COLUMN);
mMode = cursor.getInt(DATA_MODE_COLUMN);
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
} else if (DataConstants.CALL_NOTE.equals(type)) {
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
} else {
Log.d(TAG, "Wrong note type with type:" + type);
}
} while (cursor.moveToNext());
}
cursor.close();
} else {
Log.e(TAG, "No data with id:" + mNoteId);
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
}
}
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
int widgetType, int defaultBgColorId) {
WorkingNote note = new WorkingNote(context, folderId);
note.setBgColorId(defaultBgColorId);
note.setWidgetId(widgetId);
note.setWidgetType(widgetType);
return note;
}
public static WorkingNote load(Context context, long id) {
return new WorkingNote(context, id, 0);
}
public synchronized boolean saveNote() {
if (isWorthSaving()) {
if (!existInDatabase()) {
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
Log.e(TAG, "Create new note fail with id:" + mNoteId);
return false;
}
}
mNote.syncNote(mContext, mNoteId);
/**
* Update widget content if there exist any widget of this note
*/
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
&& mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged();
}
return true;
} else {
return false;
}
}
public boolean existInDatabase() {
return mNoteId > 0;
}
private boolean isWorthSaving() {
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|| (existInDatabase() && !mNote.isLocalModified())) {
return false;
} else {
return true;
}
}
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
mNoteSettingStatusListener = l;
}
public void setAlertDate(long date, boolean set) {
if (date != mAlertDate) {
mAlertDate = date;
mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate));
}
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onClockAlertChanged(date, set);
}
}
public void markDeleted(boolean mark) {
mIsDeleted = mark;
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged();
}
}
public void setBgColorId(int id) {
if (id != mBgColorId) {
mBgColorId = id;
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onBackgroundColorChanged();
}
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
}
}
public void setCheckListMode(int mode) {
if (mMode != mode) {
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
}
mMode = mode;
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
}
}
public void setWidgetType(int type) {
if (type != mWidgetType) {
mWidgetType = type;
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
}
}
public void setWidgetId(int id) {
if (id != mWidgetId) {
mWidgetId = id;
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
}
}
public void setWorkingText(String text) {
if (!TextUtils.equals(mContent, text)) {
mContent = text;
mNote.setTextData(DataColumns.CONTENT, mContent);
}
}
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);
}
public String getContent() {
return mContent;
}
public long getAlertDate() {
return mAlertDate;
}
public long getModifiedDate() {
return mModifiedDate;
}
public int getBgColorResId() {
return NoteBgResources.getNoteBgResource(mBgColorId);
}
public int getBgColorId() {
return mBgColorId;
}
public int getTitleBgResId() {
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
}
public int getCheckListMode() {
return mMode;
}
public long getNoteId() {
return mNoteId;
}
public long getFolderId() {
return mFolderId;
}
public int getWidgetId() {
return mWidgetId;
}
public int getWidgetType() {
return mWidgetType;
}
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed
*/
void onBackgroundColorChanged();
/**
* Called when user set clock
*/
void onClockAlertChanged(long date, boolean set);
/**
* Call when user create note from widget
*/
void onWidgetChanged();
/**
* Call when switch between check list mode and normal mode
* @param oldMode is previous mode before change
* @param newMode is new mode
*/
void onCheckListModeChanged(int oldMode, int newMode);
}
}

@ -1,181 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.tool;
import android.content.Context;
import android.preference.PreferenceManager;
import net.micode.notes.R;
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 {
private final static int [] BG_EDIT_RESOURCES = new int [] {
R.drawable.edit_yellow,
R.drawable.edit_blue,
R.drawable.edit_white,
R.drawable.edit_green,
R.drawable.edit_red
};
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
R.drawable.edit_title_yellow,
R.drawable.edit_title_blue,
R.drawable.edit_title_white,
R.drawable.edit_title_green,
R.drawable.edit_title_red
};
public static int getNoteBgResource(int id) {
return BG_EDIT_RESOURCES[id];
}
public static int getNoteTitleBgResource(int id) {
return BG_EDIT_TITLE_RESOURCES[id];
}
}
public static int getDefaultBgId(Context context) {
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) {
return (int) (Math.random() * NoteBgResources.BG_EDIT_RESOURCES.length);
} else {
return BG_DEFAULT_COLOR;
}
}
public static class NoteItemBgResources {
private final static int [] BG_FIRST_RESOURCES = new int [] {
R.drawable.list_yellow_up,
R.drawable.list_blue_up,
R.drawable.list_white_up,
R.drawable.list_green_up,
R.drawable.list_red_up
};
private final static int [] BG_NORMAL_RESOURCES = new int [] {
R.drawable.list_yellow_middle,
R.drawable.list_blue_middle,
R.drawable.list_white_middle,
R.drawable.list_green_middle,
R.drawable.list_red_middle
};
private final static int [] BG_LAST_RESOURCES = new int [] {
R.drawable.list_yellow_down,
R.drawable.list_blue_down,
R.drawable.list_white_down,
R.drawable.list_green_down,
R.drawable.list_red_down,
};
private final static int [] BG_SINGLE_RESOURCES = new int [] {
R.drawable.list_yellow_single,
R.drawable.list_blue_single,
R.drawable.list_white_single,
R.drawable.list_green_single,
R.drawable.list_red_single
};
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;
}
}
public static class WidgetBgResources {
private final static int [] BG_2X_RESOURCES = new int [] {
R.drawable.widget_2x_yellow,
R.drawable.widget_2x_blue,
R.drawable.widget_2x_white,
R.drawable.widget_2x_green,
R.drawable.widget_2x_red,
};
public static int getWidget2xBgResource(int id) {
return BG_2X_RESOURCES[id];
}
private final static int [] BG_4X_RESOURCES = new int [] {
R.drawable.widget_4x_yellow,
R.drawable.widget_4x_blue,
R.drawable.widget_4x_white,
R.drawable.widget_4x_green,
R.drawable.widget_4x_red
};
public static int getWidget4xBgResource(int id) {
return BG_4X_RESOURCES[id];
}
}
public static class TextAppearanceResources {
private final static int [] TEXTAPPEARANCE_RESOURCES = new int [] {
R.style.TextAppearanceNormal,
R.style.TextAppearanceMedium,
R.style.TextAppearanceLarge,
R.style.TextAppearanceSuper
};
public static int getTexAppearanceResource(int id) {
/**
* HACKME: Fix bug of store the resource id in shared preference.
* The id may larger than the length of resources, in this case,
* return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE}
*/
if (id >= TEXTAPPEARANCE_RESOURCES.length) {
return BG_DEFAULT_FONT_SIZE;
}
return TEXTAPPEARANCE_RESOURCES[id];
}
public static int getResourcesSize() {
return TEXTAPPEARANCE_RESOURCES.length;
}
}
}

@ -26,25 +26,34 @@ import android.util.Log;
import java.util.HashMap;
public class Contact {
private static HashMap<String, String> sContactCache;
private static final String TAG = "Contact";
private static HashMap<String, String> sContactCache;// 用于缓存已查询过的联系人信息
private static final String TAG = "Contact";// 用于日志输出的 TAG
// 查询电话号码与联系人名字匹配的过滤条件
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ "(SELECT raw_contact_id "
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
/*
*
* @param context
* @param phoneNumber
* @return
*/
public static String getContact(Context context, String phoneNumber) {
// 如果缓存为空,创建新的缓存对象
if(sContactCache == null) {
sContactCache = new HashMap<String, String>();
}
// 如果已经查询过该电话号码,直接返回缓存中的联系人名字
if(sContactCache.containsKey(phoneNumber)) {
return sContactCache.get(phoneNumber);
}
// 构造查询条件
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
Cursor cursor = context.getContentResolver().query(
@ -54,20 +63,22 @@ public class Contact {
new String[] { phoneNumber },
null);
// 如果能够查询到联系人信息
if (cursor != null && cursor.moveToFirst()) {
try {
String name = cursor.getString(0);
// 将电话号码与联系人名字加入缓存中
sContactCache.put(phoneNumber, name);
return name;
} catch (IndexOutOfBoundsException e) {
Log.e(TAG, " Cursor get string error " + e.toString());
return null;
} finally {
cursor.close();
cursor.close();// 关闭查询结果游标
}
} else {
} else {// 如果未能查询到联系人信息,输出日志并返回 null
Log.d(TAG, "No contact matched with number:" + phoneNumber);
return null;
}
}
}
}

@ -0,0 +1,268 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.model;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.OperationApplicationException;
import android.net.Uri;
import android.os.RemoteException;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.Notes.TextNote;
import java.util.ArrayList;
public class Note {
private ContentValues mNoteDiffValues;//声明了一个私有成员变量mNoteDiffValues用于存储笔记的差异数据
private NoteData mNoteData;
private static final String TAG = "Note";// 定义了一个静态常量TAG用于在日志输出时标记日志来源
/**
* Create a new note id for adding a new note to databasesid
*/
public static synchronized long getNewNoteId(Context context, long folderId) {
// Create a new note in the database在数据库中创建一个新笔记
ContentValues values = new ContentValues();// 创建一个ContentValues对象用于存储要添加的笔记数据
long createdTime = System.currentTimeMillis(); // 获取当前时间戳,作为笔记的创建时间和修改时间
values.put(NoteColumns.CREATED_DATE, createdTime);// 将笔记的创建时间存储到ContentValues对象中
values.put(NoteColumns.MODIFIED_DATE, createdTime);// 将笔记的修改时间存储到ContentValues对象中
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);// 将笔记的类型设置为“普通便签”
values.put(NoteColumns.LOCAL_MODIFIED, 1);// 将笔记的“本地修改”标志设置为“已修改”
values.put(NoteColumns.PARENT_ID, folderId);// 将笔记的父文件夹id存储到ContentValues对象中
Uri uri = context.getContentResolver().insert(Notes.CONTENT_NOTE_URI, values);// 将ContentValues对象插入到数据库中返回插入的笔记的Uri地址
long noteId = 0; // 定义一个变量用于存储新创建的笔记id
try {
noteId = Long.valueOf(uri.getPathSegments().get(1)); // 从Uri地址中提取新创建的笔记id
} catch (NumberFormatException e) { // 如果提取失败,记录错误日志
Log.e(TAG, "Get note id error :" + e.toString());
noteId = 0;
}
if (noteId == -1) {// 如果便签id异常抛出异常
throw new IllegalStateException("Wrong note id:" + noteId);
}
return noteId;// 返回新创建的便签id
}
public Note() {
mNoteDiffValues = new ContentValues();// 创建一个ContentValues对象用于存储便签的差异数据
mNoteData = new NoteData();// 创建一个NoteData对象用于存储便签的详细数据
}
public void setNoteValue(String key, String value) {
mNoteDiffValues.put(key, value);// 将便签的属性名和属性值存储到ContentValues对象中
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);// 将便签的“本地修改”标志设置为“已修改”
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis()); // 将便签的修改时间设置为当前时间戳
}
public void setTextData(String key, String value) {
mNoteData.setTextData(key, value);
}//将便签的文本数据如标题、正文等存储到NoteData对象中
public void setTextDataId(long id) {
mNoteData.setTextDataId(id);
}// 将便签的文本数据的id存储到NoteData对象中
public long getTextDataId() {
return mNoteData.mTextDataId;
}// 返回便签的文本数据的id
public void setCallDataId(long id) {
mNoteData.setCallDataId(id);
}// 将便签的通讯数据的id存储到NoteData对象中
public void setCallData(String key, String value) {
mNoteData.setCallData(key, value);
}// 将便签的通讯数据如联系人、电话号码等存储到NoteData对象中
public boolean isLocalModified() {
return mNoteDiffValues.size() > 0 || mNoteData.isLocalModified();
}// 检查便签是否被修改过如果便签的差异数据或详细数据被修改过则返回true否则返回false。
public boolean syncNote(Context context, long noteId) {
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}// 如果便签id异常抛出异常
if (!isLocalModified()) {
return true;
}// 如果便签没有被修改直接返回true
/**
* In theory, once data changed, the note should be updated on {@link NoteColumns#LOCAL_MODIFIED} and
* {@link NoteColumns#MODIFIED_DATE}. For data safety, though update note fails, we also update the
* note data info{@link NoteColumns#LOCAL_MODIFIED}{@link NoteColumns#MODIFIED_DATE}
*
*/
if (context.getContentResolver().update(// 更新便签数据
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), mNoteDiffValues, null,
null) == 0) {
Log.e(TAG, "Update note error, should not happen");// 如果更新失败,记录错误日志
// Do not return, fall through没有返回就是失败
}
mNoteDiffValues.clear();// 清空便签的差异数据
if (mNoteData.isLocalModified()// 更新便签的详细数据
&& (mNoteData.pushIntoContentResolver(context, noteId) == null)) {
return false;// 如果更新失败返回false
}
return true;// 更新成功返回true
}
private class NoteData {// 定义私有字段
private long mTextDataId;// 文本数据的 ID
private ContentValues mTextDataValues;// 文本数据的 ContentValues 对象
private long mCallDataId;// 通话数据的 ID
private ContentValues mCallDataValues;// 通话数据的 ContentValues 对象
private static final String TAG = "NoteData";// 定义静态常量TAG
public NoteData() {// 定义构造函数
mTextDataValues = new ContentValues(); // 初始化文本数据的 ContentValues 对象
mCallDataValues = new ContentValues();// 初始化通话数据的 ContentValues 对象
mTextDataId = 0;// 初始化文本数据的 ID
mCallDataId = 0;// 初始化通话数据的 ID
}
boolean isLocalModified() {// 定义方法 isLocalModified判断数据是否被修改过
return mTextDataValues.size() > 0 || mCallDataValues.size() > 0;
}
void setTextDataId(long id) { // 定义方法 setTextDataId设置文本数据的 ID
if(id <= 0) {
throw new IllegalArgumentException("Text data id should larger than 0");
}
mTextDataId = id;
}
void setCallDataId(long id) {// 定义方法 setCallDataId设置通话数据的 ID
if (id <= 0) {
throw new IllegalArgumentException("Call data id should larger than 0");
}
mCallDataId = id;
}
void setCallData(String key, String value) {// 定义方法 setCallData用于设置通话数据的键值对
mCallDataValues.put(key, value);// 将键值对存储在 mCallDataValues 中
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);// 标记数据已被修改
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis()); // 记录修改时间
}
void setTextData(String key, String value) {// 定义方法 setTextData用于设置文本数据的键值对
mTextDataValues.put(key, value);// 将键值对存储在 mTextDataValues 中
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1); // 标记数据已被修改
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());// 记录修改时间
}
/**
* pushIntoContentResolver ContentProvider
* context noteId ID
* noteId 0
* ContentProviderOperation
* mTextDataValues mCallDataValues
* ContentProvider
* mTextDataId mCallDataId 0
* ContentResolver ContentProvider
* URI null
* @param context
* @param noteId
* @return
*/
Uri pushIntoContentResolver(Context context, long noteId) {
/**
* Check for safety
*/
if (noteId <= 0) {
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
ContentProviderOperation.Builder builder = null;// 创建一个ContentProviderOperation列表
if(mTextDataValues.size() > 0) {// 如果有文本数据需要更新或添加
mTextDataValues.put(DataColumns.NOTE_ID, noteId);// 设置文本数据的noteId
if (mTextDataId == 0) {
mTextDataValues.put(DataColumns.MIME_TYPE, TextNote.CONTENT_ITEM_TYPE);// 如果文本数据的id为0表示需要添加新的文本数据
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mTextDataValues);// 插入新的文本数据到数据表中
try {// 从插入结果中获取新插入数据的id
setTextDataId(Long.valueOf(uri.getPathSegments().get(1)));
} catch (NumberFormatException e) {
Log.e(TAG, "Insert new text data fail with noteId" + noteId);
mTextDataValues.clear();
return null;// 插入失败清空数据并返回null
}
} else {
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mTextDataId));
builder.withValues(mTextDataValues);
operationList.add(builder.build());
} // 如果文本数据的id不为0表示需要更新已有的文本数据
mTextDataValues.clear();// 清空文本数据的值
}
if(mCallDataValues.size() > 0) {// 如果有电话数据需要更新或添加
mCallDataValues.put(DataColumns.NOTE_ID, noteId);// 设置电话数据的noteId
if (mCallDataId == 0) {// 如果电话数据的id为0表示需要添加新的电话数据
mCallDataValues.put(DataColumns.MIME_TYPE, CallNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mCallDataValues);// 插入新的电话数据到数据表中
try { // 从插入结果中获取新插入数据的id
setCallDataId(Long.valueOf(uri.getPathSegments().get(1)));
} catch (NumberFormatException e) {
Log.e(TAG, "Insert new call data fail with noteId" + noteId);
mCallDataValues.clear();
return null;// 插入失败清空数据并返回null
}
} else {
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mCallDataId));
builder.withValues(mCallDataValues);
operationList.add(builder.build());
} // 如果电话数据的id不为0表示需要更新已有的电话数据
mCallDataValues.clear(); // 清空电话数据的值
}
if (operationList.size() > 0) { // 如果有操作需要执行
try {// 执行操作并获取结果
ContentProviderResult[] results = context.getContentResolver().applyBatch(
Notes.AUTHORITY, operationList);// 返回操作结果的Uri
return (results == null || results.length == 0 || results[0] == null) ? null
: ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId);
} catch (RemoteException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null; // 操作失败返回null并记录日志
} catch (OperationApplicationException e) {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
return null;// 操作失败返回null并记录日志
}
}
return null;
}
}
}

@ -18,155 +18,165 @@ package net.micode.notes.data;
import android.net.Uri;
public class Notes {
public static final String AUTHORITY = "micode_notes";
public static final String TAG = "Notes";
public static final int TYPE_NOTE = 0;
public static final int TYPE_FOLDER = 1;
public static final int TYPE_SYSTEM = 2;
public static final String AUTHORITY = "micode_notes"; // 小米便签内容提供器的URI授权
public static final String TAG = "Notes"; // 用于调试和日志记录的标签
// 小米便签支持的三种类型
public static final int TYPE_NOTE = 0; // 笔记
public static final int TYPE_FOLDER = 1;// 文件夹
public static final int TYPE_SYSTEM = 2;// 系统便签
/**
* Following IDs are system folders' identifiers
* {@link Notes#ID_ROOT_FOLDER } is default folder
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
* {@link Notes#ID_ROOT_FOLDER } is default folder
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
*/
public static final int ID_ROOT_FOLDER = 0;
public static final int ID_TEMPARAY_FOLDER = -1;
public static final int ID_CALL_RECORD_FOLDER = -2;
public static final int ID_TRASH_FOLER = -3;
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";
public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id";
public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id";
public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type";
public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id";
public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";
public static final int TYPE_WIDGET_INVALIDE = -1;
public static final int TYPE_WIDGET_2X = 0;
public static final int TYPE_WIDGET_4X = 1;
// 小米便签内置的四个特殊文件夹
public static final int ID_ROOT_FOLDER = 0; // 根文件夹
public static final int ID_TEMPARAY_FOLDER = -1; // 临时文件夹
public static final int ID_CALL_RECORD_FOLDER = -2;// 通话记录文件夹
public static final int ID_TRASH_FOLER = -3; // 回收站文件夹
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";//提醒时间的Intent extra key用于设置笔记的提醒时间。
public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id";//背景颜色的Intent extra key用于设置笔记的背景颜色。
public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id";//小部件ID的Intent extra key用于设置小部件的ID。
public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type";//小部件类型的Intent extra key用于设置小部件的类型。
public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id";//文件夹ID的Intent extra key用于设置笔记所属的文件夹。
public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";//通话时间的Intent extra key用于设置通话笔记的通话时间。
public static final int TYPE_WIDGET_INVALIDE = -1;//表示无效的小部件类型,其值为-1。
public static final int TYPE_WIDGET_2X = 0;//表示2x2大小的小部件其值为0。
public static final int TYPE_WIDGET_4X = 1;//表示4x4大小的小部件其值为1。
public static class DataConstants {
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
}
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;//指定普通的文本笔记类型
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;//指定通话记录笔记类型
}//定义笔记的类型
/**
* Uri to query all notes and folders
* Uri to query all notes and folders
*/
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
/**
* Uri to query data
* Uri to query data
*/
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
public interface NoteColumns {
/**
* The unique ID for a row
* The unique ID for a rowID
* <P> Type: INTEGER (long) </P>
*/
public static final String ID = "_id";
/**
* The parent's id for note or folder
* The parent's id for note or folder ID
* <P> Type: INTEGER (long) </P>
*/
public static final String PARENT_ID = "parent_id";
/**
* Created data for note or folder
* Created data for note or folder
* <P> Type: INTEGER (long) </P>
*/
public static final String CREATED_DATE = "created_date";
/**
* Latest modified date
* Latest modified date
* <P> Type: INTEGER (long) </P>
*/
public static final String MODIFIED_DATE = "modified_date";
/**
* Alert date
* Alert date
* <P> Type: INTEGER (long) </P>
*/
public static final String ALERTED_DATE = "alert_date";
/**
* Folder's name or text content of note
* Folder's name or text content of note
* <P> Type: TEXT </P>
*/
public static final String SNIPPET = "snippet";
/**
* Note's widget id
* Note's widget id ID
* <P> Type: INTEGER (long) </P>
*/
public static final String WIDGET_ID = "widget_id";
/**
* Note's widget type
* Note's widget type
* <P> Type: INTEGER (long) </P>
*/
public static final String WIDGET_TYPE = "widget_type";
/**
* Note's background color's id
* Note's background color's id ID
* <P> Type: INTEGER (long) </P>
*/
public static final String BG_COLOR_ID = "bg_color_id";
/**
* For text note, it doesn't has attachment, for multi-media
* note, it has at least one attachment
* note, it has at least one attachment
* <P> Type: INTEGER </P>
*/
public static final String HAS_ATTACHMENT = "has_attachment";
/**
* Folder's count of notes
* Folder's count of notes
* <P> Type: INTEGER (long) </P>
*/
public static final String NOTES_COUNT = "notes_count";
/**
* The file type: folder or note
* The file type: folder or note
* <P> Type: INTEGER </P>
*/
public static final String TYPE = "type";
/**
* The last sync id
* The last sync id ID
* <P> Type: INTEGER (long) </P>
*/
public static final String SYNC_ID = "sync_id";
/**
* Sign to indicate local modified or not
* Sign to indicate local modified or not
* <P> Type: INTEGER </P>
*/
public static final String LOCAL_MODIFIED = "local_modified";
/**
* Original parent id before moving into temporary folder
* Original parent id before moving into temporary folder ID
* <P> Type : INTEGER </P>
*/
public static final String ORIGIN_PARENT_ID = "origin_parent_id";
/**
* The gtask id
* The gtask idGoogle ID
* <P> Type : TEXT </P>
*/
public static final String GTASK_ID = "gtask_id";
/**
* The version code
* The version code
* <P> Type : INTEGER (long) </P>
*/
public static final String VERSION = "version";
}
/**
* DataColumns
* NotesColumns
* DataColumnsNotesColumns
* NotesColumns
* DataColumns
* 使
*/
public interface DataColumns {
/**
* The unique ID for a row
@ -175,13 +185,13 @@ public class Notes {
public static final String ID = "_id";
/**
* The MIME type of the item represented by this row.
* The MIME type of the item represented by this row.MIME
* <P> Type: Text </P>
*/
public static final String MIME_TYPE = "mime_type";
/**
* The reference id to note that this data belongs to
* The reference id to note that this data belongs toID
* <P> Type: INTEGER (long) </P>
*/
public static final String NOTE_ID = "note_id";
@ -241,39 +251,54 @@ public class Notes {
public static final String DATA5 = "data5";
}
/**
* NotePadTextNote
* DataColumnsURI
* NotesColumnsTextNote
* MODEMODE_CHECK_LIST
* TextNote访URIURIContentProvidertext_note
*/
public static final class TextNote implements DataColumns {
/**
* Mode to indicate the text in check list mode or not
* <P> Type: Integer 1:check list mode 0: normal mode </P>
*/
public static final String MODE = DATA1;
public static final String MODE = DATA1;//MODE字段表示文本笔记的模式可以是正常模式或者是带有任务清单的模式类型为整数。它使用了接口中的DATA1字段来表示其存储值的列名。
public static final int MODE_CHECK_LIST = 1;
public static final int MODE_CHECK_LIST = 1;//MODE_CHECK_LIST字段表示任务清单模式的值为1。
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note";
//CONTENT_TYPE字段表示此数据的MIME类型指示ContentProvider返回的数据类型。此处表示返回的是文本笔记列表。
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note";
//CONTENT_ITEM_TYPE字段表示此数据的单个项目的MIME类型。
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
}
//CONTENT_URI字段表示此数据的URI地址。
}
/**
* NotesCallNoteDataColumns
* CallNoteCALL_DATEPHONE_NUMBER
* ContentProvider使MIMEURI
*/
public static final class CallNote implements DataColumns {
/**
* Call date for this record
* Call date for this record
* <P> Type: INTEGER (long) </P>
*/
public static final String CALL_DATE = DATA1;
//表示通话日期的列名数据类型为long存储在DATA1列中。
/**
* Phone number for this record
* Phone number for this record
* <P> Type: TEXT </P>
*/
public static final String PHONE_NUMBER = DATA3;
//表示电话号码的列名数据类型为String存储在DATA3列中。
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note";
//单条通话记录用于指定MIME类型的常量
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note";
//同上,多条通话记录
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
}
//该类的内容URI用于访问通话记录。
}
}

@ -26,7 +26,13 @@ import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.DataConstants;
import net.micode.notes.data.Notes.NoteColumns;
/**
* NotesDatabaseHelperSQLiteOpenHelper
* DB_NAMEDB_VERSION
* TABLENOTEDATA
* SQLiteOpenHelperAndroidSQLite
*
*/
public class NotesDatabaseHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "note.db";
@ -38,52 +44,64 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
public static final String DATA = "data";
}
private static final String TAG = "NotesDatabaseHelper";
private static final String TAG = "NotesDatabaseHelper";//这一行代码定义了一个名为TAG的字符串常量用于在调试时作为日志标签。
/**
* mInstanceNotesDatabaseHelperstatic
*
* NotesDatabaseHelper
*
*/
private static NotesDatabaseHelper mInstance;
/**
* CREATE_NOTE_TABLE_SQL CREATE_DATA_TABLE_SQL
* note data
*/
private static final String CREATE_NOTE_TABLE_SQL =
"CREATE TABLE " + TABLE.NOTE + "(" +
NoteColumns.ID + " INTEGER PRIMARY KEY," +
NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," +
NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +
NoteColumns.ID + " INTEGER PRIMARY KEY," +//笔记 ID整数类型作为主键
NoteColumns.PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +//父笔记 ID整数类型不为空默认为 0
NoteColumns.ALERTED_DATE + " INTEGER NOT NULL DEFAULT 0," +//提醒时间,整数类型,不为空,默认为 0
NoteColumns.BG_COLOR_ID + " INTEGER NOT NULL DEFAULT 0," +//背景颜色 ID整数类型不为空默认为 0
NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +//创建时间,整数类型,不为空,默认为当前时间
NoteColumns.HAS_ATTACHMENT + " INTEGER NOT NULL DEFAULT 0," +//是否有附件,整数类型,不为空,默认为 0
NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +//修改时间,整数类型,不为空,默认为当前时间
NoteColumns.NOTES_COUNT + " INTEGER NOT NULL DEFAULT 0," +//笔记数量,整数类型,不为空,默认为 0
NoteColumns.SNIPPET + " TEXT NOT NULL DEFAULT ''," +//笔记概要,文本类型,不为空,默认为空字符串
NoteColumns.TYPE + " INTEGER NOT NULL DEFAULT 0," +//笔记类型,整数类型,不为空,默认为 0
NoteColumns.WIDGET_ID + " INTEGER NOT NULL DEFAULT 0," +//小部件 ID整数类型不为空默认为 0
NoteColumns.WIDGET_TYPE + " INTEGER NOT NULL DEFAULT -1," +//小部件类型,整数类型,不为空,默认为 -1
NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," +//同步 ID整数类型不为空默认为 0
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +//本地修改标识,整数类型,不为空,默认为 0
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +//原始父笔记 ID整数类型不为空默认为 0
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +//Google 任务 ID文本类型不为空默认为空字符串
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +//版本号,整数类型,不为空,默认为 0
")";
private static final String CREATE_DATA_TABLE_SQL =
"CREATE TABLE " + TABLE.DATA + "(" +
DataColumns.ID + " INTEGER PRIMARY KEY," +
DataColumns.MIME_TYPE + " TEXT NOT NULL," +
DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +
DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," +
DataColumns.ID + " INTEGER PRIMARY KEY," +//数据 ID整数类型作为主键
DataColumns.MIME_TYPE + " TEXT NOT NULL," +//MIME 类型,文本类型,不为空
DataColumns.NOTE_ID + " INTEGER NOT NULL DEFAULT 0," +//笔记 ID整数类型不为空默认为 0
NoteColumns.CREATED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +//创建时间,整数类型,不为空,默认为当前时间
NoteColumns.MODIFIED_DATE + " INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)," +//修改时间,整数类型,不为空,默认为当前时间
DataColumns.CONTENT + " TEXT NOT NULL DEFAULT ''," +//数据内容,文本类型,不为空,默认为空字符串
DataColumns.DATA1 + " INTEGER," +
DataColumns.DATA2 + " INTEGER," +
DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
")";
/**
* SQL"note_id_index"
* "TABLE.DATA"使"DataColumns.NOTE_ID"
* ID
*/
private static final String CREATE_DATA_NOTE_ID_INDEX_SQL =
"CREATE INDEX IF NOT EXISTS note_id_index ON " +
TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";
//以下是各种 SQLite 数据库的触发器,用于更新数据库
/**
* Increase folder's note count when move note to the folder
* Increase folder's note count when move note to the folder
*/
private static final String NOTE_INCREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER =
"CREATE TRIGGER increase_folder_count_on_update "+
@ -95,7 +113,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Decrease folder's note count when move note from folder
* Decrease folder's note count when move note from folder
*/
private static final String NOTE_DECREASE_FOLDER_COUNT_ON_UPDATE_TRIGGER =
"CREATE TRIGGER decrease_folder_count_on_update " +
@ -108,7 +126,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Increase folder's note count when insert new note to the folder
* Increase folder's note count when insert new note to the folder
*/
private static final String NOTE_INCREASE_FOLDER_COUNT_ON_INSERT_TRIGGER =
"CREATE TRIGGER increase_folder_count_on_insert " +
@ -120,7 +138,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Decrease folder's note count when delete note from the folder
* Decrease folder's note count when delete note from the folder
*/
private static final String NOTE_DECREASE_FOLDER_COUNT_ON_DELETE_TRIGGER =
"CREATE TRIGGER decrease_folder_count_on_delete " +
@ -133,7 +151,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Update note's content when insert data with type {@link DataConstants#NOTE}
* Update note's content when insert data with type {@link DataConstants#NOTE}DataConstants
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_INSERT_TRIGGER =
"CREATE TRIGGER update_note_content_on_insert " +
@ -146,7 +164,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has changed
* Update note's content when data with {@link DataConstants#NOTE} type has changedDataConstants
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_UPDATE_TRIGGER =
"CREATE TRIGGER update_note_content_on_update " +
@ -159,7 +177,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has deleted
* Update note's content when data with {@link DataConstants#NOTE} type has deletedDataConstants
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER =
"CREATE TRIGGER update_note_content_on_delete " +
@ -172,7 +190,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Delete datas belong to note which has been deleted
* Delete datas belong to note which has been deleted
*/
private static final String NOTE_DELETE_DATA_ON_DELETE_TRIGGER =
"CREATE TRIGGER delete_data_on_delete " +
@ -183,7 +201,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Delete notes belong to folder which has been deleted
* Delete notes belong to folder which has been deleted
*/
private static final String FOLDER_DELETE_NOTES_ON_DELETE_TRIGGER =
"CREATE TRIGGER folder_delete_notes_on_delete " +
@ -194,7 +212,7 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" END";
/**
* Move notes belong to folder which has been moved to trash folder
* Move notes belong to folder which has been moved to trash folder
*/
private static final String FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER =
"CREATE TRIGGER folder_move_notes_on_trash " +
@ -206,10 +224,23 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
" WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
" END";
/**
* NotesDatabaseHelperSQLite
*
* Context context访
* String DB_NAME
* CursorFactory factorynull使
* int DB_VERSION
*/
public NotesDatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
/**
*
* SQLCREATE_NOTE_TABLE_SQLreCreateNoteTableTriggers
* createSystemFolder使Log.d
*/
public void createNoteTable(SQLiteDatabase db) {
db.execSQL(CREATE_NOTE_TABLE_SQL);
reCreateNoteTableTriggers(db);
@ -217,6 +248,12 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
Log.d(TAG, "note table has been created");
}
/**
*
* 使DROP TRIGGER使CREATE TRIGGER
* 使便
* @param db
*/
private void reCreateNoteTableTriggers(SQLiteDatabase db) {
db.execSQL("DROP TRIGGER IF EXISTS increase_folder_count_on_update");
db.execSQL("DROP TRIGGER IF EXISTS decrease_folder_count_on_update");
@ -235,18 +272,25 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL(FOLDER_MOVE_NOTES_ON_TRASH_TRIGGER);
}
/**
*
* ContentValuesIDTYPE
* 使SQLiteDatabaseinsert
* IDNotes
*
*/
private void createSystemFolder(SQLiteDatabase db) {
ContentValues values = new ContentValues();
/**
* call record foler for call notes
* call record folder for call notes
*/
values.put(NoteColumns.ID, Notes.ID_CALL_RECORD_FOLDER);
values.put(NoteColumns.TYPE, Notes.TYPE_SYSTEM);
db.insert(TABLE.NOTE, null, values);
/**
* root folder which is default folder
* root folder which is default foldermo
*/
values.clear();
values.put(NoteColumns.ID, Notes.ID_ROOT_FOLDER);
@ -270,6 +314,14 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.insert(TABLE.NOTE, null, values);
}
/**
*
* SQLiteDatabaseSQL
* CREATE_DATA_TABLE_SQLSQL
* recreatedatabletriggers
* CREATE_DATA_NOTE_ID_INDEX_SQLSQLNOTE ID
* NOTE IDNOTE
*/
public void createDataTable(SQLiteDatabase db) {
db.execSQL(CREATE_DATA_TABLE_SQL);
reCreateDataTableTriggers(db);
@ -277,6 +329,13 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
Log.d(TAG, "data table has been created");
}
/**
* Recreatedatabletriggersinsertupdatedelete
* 使
* update_note_content_on_insert_content_on_update_note_content_on_delete
* data_update_note_content_on_insert_trigger data_update_trigger data_update_note_content_on_delete_trigger
* snippet
*/
private void reCreateDataTableTriggers(SQLiteDatabase db) {
db.execSQL("DROP TRIGGER IF EXISTS update_note_content_on_insert");
db.execSQL("DROP TRIGGER IF EXISTS update_note_content_on_update");
@ -287,6 +346,12 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL(DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER);
}
/**
* NotesDatabaseHelper
* ContextNotesDatabaseHelpernull
* nullNotesDatabaseHelper
* 线访
*/
static synchronized NotesDatabaseHelper getInstance(Context context) {
if (mInstance == null) {
mInstance = new NotesDatabaseHelper(context);
@ -294,6 +359,18 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
return mInstance;
}
/**
* NotesDatabaseHelperonCreateonUpgrade
* onCreate
* 使createNoteTablecreateDataTableNoteData
* onUpgrade
*
* 12Note使createNoteTablecreateDataTable
* 23使Notegtask_id
* 34
* reCreateNoteTableTriggersrecreateDatabletriggers
* IllegalStateException
*/
@Override
public void onCreate(SQLiteDatabase db) {
createNoteTable(db);

@ -35,20 +35,20 @@ import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
public class NotesProvider extends ContentProvider {
private static final UriMatcher mMatcher;
public class NotesProvider extends ContentProvider {//定义NotesProvider类它继承自ContentProvider类
private static final UriMatcher mMatcher;//声明UriMatcher实例
private NotesDatabaseHelper mHelper;
private NotesDatabaseHelper mHelper;//声明NotesDatabaseHelper实例用于匹配Uri以确定请求的类型例如是否是请求特定的数据项或者是否是搜索建议请求。
private static final String TAG = "NotesProvider";
private static final int URI_NOTE = 1;
private static final int URI_NOTE_ITEM = 2;
private static final int URI_DATA = 3;
private static final int URI_DATA_ITEM = 4;
private static final int URI_NOTE = 1;//代表笔记数据的URI
private static final int URI_NOTE_ITEM = 2;//代表单个笔记数据的URI
private static final int URI_DATA = 3;//代表附加数据的URI
private static final int URI_DATA_ITEM = 4;//代表单个附加数据的URI
private static final int URI_SEARCH = 5;
private static final int URI_SEARCH_SUGGEST = 6;
private static final int URI_SEARCH = 5;//代表搜索请求的URI
private static final int URI_SEARCH_SUGGEST = 6;//代表搜索建议请求的URI
static {
mMatcher = new UriMatcher(UriMatcher.NO_MATCH);
@ -65,6 +65,7 @@ public class NotesProvider extends ContentProvider {
* x'0A' represents the '\n' character in sqlite. For title and content in the search result,
* we will trim '\n' and white space in order to show more information.
*/
// 定义将在搜索结果中返回的列
private static final String NOTES_SEARCH_PROJECTION = NoteColumns.ID + ","
+ NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + ","
+ "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + ","
@ -72,15 +73,15 @@ public class NotesProvider extends ContentProvider {
+ R.drawable.search_result + " AS " + SearchManager.SUGGEST_COLUMN_ICON_1 + ","
+ "'" + Intent.ACTION_VIEW + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_ACTION + ","
+ "'" + Notes.TextNote.CONTENT_TYPE + "' AS " + SearchManager.SUGGEST_COLUMN_INTENT_DATA;
// 定义将执行以检索搜索结果的搜索查询
private static String NOTES_SNIPPET_SEARCH_QUERY = "SELECT " + NOTES_SEARCH_PROJECTION
+ " FROM " + TABLE.NOTE
+ " WHERE " + NoteColumns.SNIPPET + " LIKE ?"
+ " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER
+ " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE;
+ " FROM " + TABLE.NOTE// 指定要搜索的表
+ " WHERE " + NoteColumns.SNIPPET + " LIKE ?"// 指定搜索查询
+ " AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER// 排除在垃圾桶文件夹中的笔记
+ " AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE;// 排除非笔记条目
@Override
public boolean onCreate() {
public boolean onCreate() {// 获取数据库帮助类的实例
mHelper = NotesDatabaseHelper.getInstance(getContext());
return true;
}
@ -88,30 +89,30 @@ public class NotesProvider extends ContentProvider {
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
Cursor c = null;
Cursor c = null;// 获取可读的数据库实例
SQLiteDatabase db = mHelper.getReadableDatabase();
String id = null;
switch (mMatcher.match(uri)) {
case URI_NOTE:
case URI_NOTE:// 查询所有笔记
c = db.query(TABLE.NOTE, projection, selection, selectionArgs, null, null,
sortOrder);
break;
case URI_NOTE_ITEM:
case URI_NOTE_ITEM:// 查询单个笔记
id = uri.getPathSegments().get(1);
c = db.query(TABLE.NOTE, projection, NoteColumns.ID + "=" + id
+ parseSelection(selection), selectionArgs, null, null, sortOrder);
break;
case URI_DATA:
case URI_DATA:// 查询所有数据
c = db.query(TABLE.DATA, projection, selection, selectionArgs, null, null,
sortOrder);
break;
case URI_DATA_ITEM:
case URI_DATA_ITEM: // 查询单个数据
id = uri.getPathSegments().get(1);
c = db.query(TABLE.DATA, projection, DataColumns.ID + "=" + id
+ parseSelection(selection), selectionArgs, null, null, sortOrder);
break;
case URI_SEARCH:
case URI_SEARCH_SUGGEST:
case URI_SEARCH_SUGGEST:// 搜索笔记
if (sortOrder != null || projection != null) {
throw new IllegalArgumentException(
"do not specify sortOrder, selection, selectionArgs, or projection" + "with this query");
@ -130,7 +131,7 @@ public class NotesProvider extends ContentProvider {
return null;
}
try {
try {// 搜索所有匹配的笔记
searchString = String.format("%%%s%%", searchString);
c = db.rawQuery(NOTES_SNIPPET_SEARCH_QUERY,
new String[] { searchString });
@ -141,44 +142,44 @@ public class NotesProvider extends ContentProvider {
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (c != null) {
if (c != null) {// 设置通知URI以便在数据更改时通知观察者
c.setNotificationUri(getContext().getContentResolver(), uri);
}
return c;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
SQLiteDatabase db = mHelper.getWritableDatabase();
long dataId = 0, noteId = 0, insertedId = 0;
public Uri insert(Uri uri, ContentValues values) {// 获取可写的 SQLiteDatabase 对象
SQLiteDatabase db = mHelper.getWritableDatabase();// 初始化三个变量,用于存储 note、data 和插入的记录的 ID
long dataId = 0, noteId = 0, insertedId = 0;// 根据传入的 Uri 进行匹配
switch (mMatcher.match(uri)) {
case URI_NOTE:
case URI_NOTE:// 向 TABLE.NOTE 表中插入记录,并获取插入的记录的 ID
insertedId = noteId = db.insert(TABLE.NOTE, null, values);
break;
case URI_DATA:
if (values.containsKey(DataColumns.NOTE_ID)) {
noteId = values.getAsLong(DataColumns.NOTE_ID);
if (values.containsKey(DataColumns.NOTE_ID)) {// 如果 ContentValues 包含 DataColumns.NOTE_ID 列
noteId = values.getAsLong(DataColumns.NOTE_ID);// 获取 DataColumns.NOTE_ID 列的值
} else {
Log.d(TAG, "Wrong data format without note id:" + values.toString());
}
insertedId = dataId = db.insert(TABLE.DATA, null, values);
}//打印日志
insertedId = dataId = db.insert(TABLE.DATA, null, values);// 向 TABLE.DATA 表中插入记录,并获取插入的记录的 ID
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
throw new IllegalArgumentException("Unknown URI " + uri);// 抛出 IllegalArgumentException 异常
}
// Notify the note uri
if (noteId > 0) {
if (noteId > 0) { // 如果 noteId 大于 0则通知 content resolver 对应的 Uri 对应的数据已经发生了变化
getContext().getContentResolver().notifyChange(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), null);
}
// Notify the data uri
if (dataId > 0) {
if (dataId > 0) {// 如果 dataId 大于 0则通知 content resolver 对应的 Uri 对应的数据已经发生了变化
getContext().getContentResolver().notifyChange(
ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId), null);
}
return ContentUris.withAppendedId(uri, insertedId);
return ContentUris.withAppendedId(uri, insertedId); // 返回插入的记录的 Uri
}
@Override
@ -187,60 +188,62 @@ public class NotesProvider extends ContentProvider {
String id = null;
SQLiteDatabase db = mHelper.getWritableDatabase();
boolean deleteData = false;
switch (mMatcher.match(uri)) {
case URI_NOTE:
selection = "(" + selection + ") AND " + NoteColumns.ID + ">0 ";
count = db.delete(TABLE.NOTE, selection, selectionArgs);
switch (mMatcher.match(uri)) {// 根据传入的 Uri 进行匹配
case URI_NOTE:// 如果匹配到 URI_NOTE
selection = "(" + selection + ") AND " + NoteColumns.ID + ">0 ";// 组合 selection 条件,以确保删除的是用户笔记,而不是系统文件夹
count = db.delete(TABLE.NOTE, selection, selectionArgs);// 删除 TABLE.NOTE 表中符合条件的记录,并返回删除的数量
break;
case URI_NOTE_ITEM:
id = uri.getPathSegments().get(1);
case URI_NOTE_ITEM: // 如果匹配到 URI_NOTE_ITEM
id = uri.getPathSegments().get(1);// 获取 Uri 中的 ID
/**
* ID that smaller than 0 is system folder which is not allowed to
* trash
*/
long noteId = Long.valueOf(id);
if (noteId <= 0) {
if (noteId <= 0) { // 如果 ID 小于等于 0则直接跳出 switch 语句
break;
}
count = db.delete(TABLE.NOTE,
NoteColumns.ID + "=" + id + parseSelection(selection), selectionArgs);
NoteColumns.ID + "=" + id + parseSelection(selection), selectionArgs);// 删除 TABLE.NOTE 表中符合条件的记录,并返回删除的数量
break;
case URI_DATA:
count = db.delete(TABLE.DATA, selection, selectionArgs);
case URI_DATA:// 如果匹配到 URI_DATA
count = db.delete(TABLE.DATA, selection, selectionArgs);// 删除 TABLE.DATA 表中符合条件的记录,并返回删除的数量
deleteData = true;
break;
case URI_DATA_ITEM:
id = uri.getPathSegments().get(1);
case URI_DATA_ITEM:// 如果匹配到 URI_DATA_ITEM
id = uri.getPathSegments().get(1); // 获取 Uri 中的 ID
count = db.delete(TABLE.DATA,
DataColumns.ID + "=" + id + parseSelection(selection), selectionArgs);
DataColumns.ID + "=" + id + parseSelection(selection), selectionArgs);// 删除 TABLE.DATA 表中符合条件的记录,并返回删除的数量
deleteData = true;
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
default:// 如果无法匹配到 Uri
throw new IllegalArgumentException("Unknown URI " + uri);// 抛出 IllegalArgumentException 异常
}
if (count > 0) {
if (count > 0) {// 如果删除的数量大于 0
if (deleteData) {
getContext().getContentResolver().notifyChange(Notes.CONTENT_NOTE_URI, null);
}
} // 如果删除的是 TABLE.DATA 表中的记录,则通知 content resolver 对应的 Uri 对应的笔记数据已经发生了变化
getContext().getContentResolver().notifyChange(uri, null);
}
return count;
return count;// 返回删除的数量
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
int count = 0;
String id = null;
SQLiteDatabase db = mHelper.getWritableDatabase();
boolean updateData = false;
switch (mMatcher.match(uri)) {
int count = 0;// 受影响的行数
String id = null;// 被更新的笔记或数据项的ID
SQLiteDatabase db = mHelper.getWritableDatabase();// 获取可写数据库
boolean updateData = false;// 是否更新数据项
switch (mMatcher.match(uri)) {// 使用 switch 语句处理不同类型的 URI
case URI_NOTE:
increaseNoteVersion(-1, selection, selectionArgs);
count = db.update(TABLE.NOTE, values, selection, selectionArgs);
increaseNoteVersion(-1, selection, selectionArgs);// 在更新前增加所有受影响的笔记的版本号
count = db.update(TABLE.NOTE, values, selection, selectionArgs);// 更新数据库中的行并获取受影响的行数
break;
case URI_NOTE_ITEM:
id = uri.getPathSegments().get(1);
increaseNoteVersion(Long.valueOf(id), selection, selectionArgs);
id = uri.getPathSegments().get(1);// 在更新前增加笔记的版本号
increaseNoteVersion(Long.valueOf(id), selection, selectionArgs); // 更新数据库中的行并获取受影响的行数
count = db.update(TABLE.NOTE, values, NoteColumns.ID + "=" + id
+ parseSelection(selection), selectionArgs);
break;
@ -257,20 +260,20 @@ public class NotesProvider extends ContentProvider {
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
// 如果有行被更新,通知已注册的 ContentObserver
if (count > 0) {
if (updateData) {
getContext().getContentResolver().notifyChange(Notes.CONTENT_NOTE_URI, null);
}
getContext().getContentResolver().notifyChange(uri, null);
}
return count;
return count; // 返回受影响的行数
}
// 辅助方法,如果传递了 selection 参数,则将其添加到 SQL 查询中
private String parseSelection(String selection) {
return (!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : "");
}
// 辅助方法,在更新笔记之前增加其版本号
private void increaseNoteVersion(long id, String selection, String[] selectionArgs) {
StringBuilder sql = new StringBuilder(120);
sql.append("UPDATE ");
@ -278,7 +281,7 @@ public class NotesProvider extends ContentProvider {
sql.append(" SET ");
sql.append(NoteColumns.VERSION);
sql.append("=" + NoteColumns.VERSION + "+1 ");
// 如果传递了 ID 或 selection 参数,则将其添加到 SQL 查询中
if (id > 0 || !TextUtils.isEmpty(selection)) {
sql.append(" WHERE ");
}
@ -293,12 +296,12 @@ public class NotesProvider extends ContentProvider {
sql.append(selectString);
}
mHelper.getWritableDatabase().execSQL(sql.toString());
mHelper.getWritableDatabase().execSQL(sql.toString());// 执行 SQL 查询以更新笔记的版本号
}
@Override
public String getType(Uri uri) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub这是一个待办事项,需要根据 ContentProvider需求添加适当的 MIME类型。
return null;
}

@ -47,23 +47,28 @@ public class BackupUtils {
}
return sInstance;
}
/* `TAG` String tag
`sInstance`
`getInstance()` `Context` `BackupUtils`
使线
*/
/**
* Following states are signs to represents backup or restore
* Following states are signs to represents backup or restore
* status
*/
// Currently, the sdcard is not mounted
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 TextExport mTextExport;//实例化对象
private BackupUtils(Context context) {
mTextExport = new TextExport(context);
@ -75,15 +80,15 @@ public class BackupUtils {
public int exportToText() {
return mTextExport.exportToText();
}
}//这是一个 public 方法,用于将数据导出为文本,并返回一个整数值。
public String getExportedTextFileName() {
return mTextExport.mFileName;
}
}//这是一个 public 方法,用于获取导出的文本文件名。
public String getExportedTextFileDir() {
return mTextExport.mFileDirectory;
}
}//这是一个 public 方法,用于获取导出的文本文件所在的目录。
private static class TextExport {
private static final String[] NOTE_PROJECTION = {
@ -91,7 +96,8 @@ public class BackupUtils {
NoteColumns.MODIFIED_DATE,
NoteColumns.SNIPPET,
NoteColumns.TYPE
};
};//这是一个私有的静态内部类,用于完成数据导出的操作。
private static final int NOTE_COLUMN_ID = 0;
@ -115,32 +121,37 @@ public class BackupUtils {
private static final int DATA_COLUMN_CALL_DATE = 2;
private static final int DATA_COLUMN_PHONE_NUMBER = 4;
// 定义了多个常量,用于操作笔记和数据的列索引
private final String [] TEXT_FORMAT;
private static final int FORMAT_FOLDER_NAME = 0;
private static final int FORMAT_NOTE_DATE = 1;
private static final int FORMAT_NOTE_CONTENT = 2;
// 定义了一个字符串数组 TEXT_FORMAT其中存储了导出笔记时的文件格式
private Context mContext;
private String mFileName;
private String mFileDirectory;
// 定义了 Context mContext、String mFileName、String mFileDirectory 三个变量
// mContext 存储了当前上下文mFileName 存储了文件名mFileDirectory 存储了文件夹路径
public TextExport(Context context) {
TEXT_FORMAT = context.getResources().getStringArray(R.array.format_for_exported_note);
mContext = context;
mFileName = "";
mFileDirectory = "";
mFileDirectory = "";// 构造函数,初始化了 TEXT_FORMAT、mContext、mFileName 和 mFileDirectory
}
private String getFormat(int id) {
return TEXT_FORMAT[id];
}
}// getFormat 方法返回 TEXT_FORMAT 数组中指定 id 的字符串
/**
* Export the folder identified by folder id to text
* (exportFolderToText )
*/
private void exportFolderToText(String folderId, PrintStream ps) {
// Query notes belong to this folder
// Query notes belong to this folder// 查询属于该文件夹的笔记
Cursor notesCursor = mContext.getContentResolver().query(Notes.CONTENT_NOTE_URI,
NOTE_PROJECTION, NoteColumns.PARENT_ID + "=?", new String[] {
folderId
@ -149,11 +160,11 @@ public class BackupUtils {
if (notesCursor != null) {
if (notesCursor.moveToFirst()) {
do {
// Print note's last modified date
// Print note's last modified date // 输出笔记的最后修改日期
ps.println(String.format(getFormat(FORMAT_NOTE_DATE), DateFormat.format(
mContext.getString(R.string.format_datetime_mdhm),
notesCursor.getLong(NOTE_COLUMN_MODIFIED_DATE))));
// Query data belong to this note
// Query data belong to this note // 查询属于该笔记的数据
String noteId = notesCursor.getString(NOTE_COLUMN_ID);
exportNoteToText(noteId, ps);
} while (notesCursor.moveToNext());
@ -169,14 +180,14 @@ public class BackupUtils {
Cursor dataCursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI,
DATA_PROJECTION, DataColumns.NOTE_ID + "=?", new String[] {
noteId
}, null);
}, null);// exportNoteToText 方法用于将指定笔记的数据导出到文本中
if (dataCursor != null) {
if (dataCursor.moveToFirst()) {
do {
String mimeType = dataCursor.getString(DATA_COLUMN_MIME_TYPE);
if (DataConstants.CALL_NOTE.equals(mimeType)) {
// Print phone number
// Print phone number // 输出电话号码
String phoneNumber = dataCursor.getString(DATA_COLUMN_PHONE_NUMBER);
long callDate = dataCursor.getLong(DATA_COLUMN_CALL_DATE);
String location = dataCursor.getString(DATA_COLUMN_CONTENT);
@ -185,11 +196,11 @@ public class BackupUtils {
ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT),
phoneNumber));
}
// Print call date
// 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
// Print call attachment location // 输出通话附件位置
if (!TextUtils.isEmpty(location)) {
ps.println(String.format(getFormat(FORMAT_NOTE_CONTENT),
location));
@ -205,7 +216,7 @@ public class BackupUtils {
}
dataCursor.close();
}
// print a line separator between note
// print a line separator between note// 在导出每个笔记后输出一个分隔符
try {
ps.write(new byte[] {
Character.LINE_SEPARATOR, Character.LETTER_NUMBER
@ -222,14 +233,20 @@ public class BackupUtils {
if (!externalStorageAvailable()) {
Log.d(TAG, "Media was not mounted");
return STATE_SD_CARD_UNMOUONTED;
}
}/*PrintStream使JavabyteCharacter.LINE_SEPARATORCharacter.LETTER_NUMBER
Character.LINE_SEPARATORWindows"\r\n"Unix/Linux"\n"
Character.LETTER_NUMBER
bytePrintStream便IOExceptionLogcat*/
PrintStream ps = getExportToTextPrintStream();
if (ps == null) {
Log.e(TAG, "get print stream error");
return STATE_SYSTEM_ERROR;
}
// First export folder and its notes
}//这段代码中的 getExportToTextPrintStream() 是一个自定义方法,它返回一个 PrintStream 对象,该对象用于将笔记数据导出到文本文件中
// First export folder and its notes//“首先导出文件夹及其包含的笔记”
Cursor folderCursor = mContext.getContentResolver().query(
Notes.CONTENT_NOTE_URI,
NOTE_PROJECTION,
@ -255,7 +272,11 @@ public class BackupUtils {
} while (folderCursor.moveToNext());
}
folderCursor.close();
}
}/*
ContentResolver query() Call Record Cursor folderCursor
folderCursor ID ps Call Record 使*/
// Export notes in root's folder
Cursor noteCursor = mContext.getContentResolver().query(
@ -280,7 +301,13 @@ public class BackupUtils {
ps.close();
return STATE_SUCCESS;
}
}/*
ContentResolver query() Cursor noteCursor
noteCursor ps exportNoteToText() ps
ps STATE_SUCCESS noteCursor */
/**
* Get a print stream pointed to the file {@generateExportedTextFile}
@ -307,7 +334,15 @@ public class BackupUtils {
}
return ps;
}
}
}/* PrintStream
generateFileMountedOnSDcard() File file
file nullLogcat "create file to exported failed" null
file FileOutputStream fos PrintStream PrintStream ps
ps PrintStream FileNotFoundException NullPointerException null*/
/**
* Generate the text file to store imported data
@ -339,6 +374,14 @@ public class BackupUtils {
return null;
}
}
}/*
filePathResId StringBuilder sb
File filedir mkdir()
使 fileNameFormatResId sb File file
file filedir file SecurityException IOException null*/

@ -36,7 +36,7 @@ import java.util.HashSet;
public class DataUtils {
public static final String TAG = "DataUtils";
public static final String TAG = "DataUtils";//定义了一个Java常量变量名为TAG
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {
if (ids == null) {
Log.d(TAG, "the ids is null");
@ -70,7 +70,13 @@ public class DataUtils {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
}
return false;
}
}/*ContentResolverLongHashSet
idstrueids0true
ids0idsNotes.ID_ROOT_FOLDERContentProviderOperation使ContentProviderOperation.newDelete()operationList
使ContentResolver.applyBatch()truefalseRemoteExceptionOperationApplicationExceptionfalse*/
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {
ContentValues values = new ContentValues();
@ -78,7 +84,11 @@ public class DataUtils {
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);
}
}/*ContentResolverlongidlongsrcFolderIdlongdesFolderId
ContentValuesNoteColumns.PARENT_IDdesFolderIdNoteColumns.ORIGIN_PARENT_IDsrcFolderIdNoteColumns.LOCAL_MODIFIED1
ContentResolver.update()URIURIContentUris.withAppendedId()Notes.CONTENT_NOTE_URIidContentValuesnull*/
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids,
long folderId) {
@ -109,7 +119,13 @@ public class DataUtils {
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
}
return false;
}
}/*ContentResolverLongHashSetidsLongfolderId
idstrue
idsidsContentProviderOperation使ContentProviderOperation.newUpdate()NoteColumns.PARENT_IDfolderIdNoteColumns.LOCAL_MODIFIED1operationList
使ContentResolver.applyBatch()truefalseRemoteExceptionOperationApplicationExceptionfalse*/
/**
* Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}}
@ -134,7 +150,13 @@ public class DataUtils {
}
}
return count;
}
}/*ContentResolver
Cursor使ContentResolver.query()Notes.TYPE_FOLDERCOUNT(*)
CursorCursornull使getInt(0)IndexOutOfBoundsExceptionCursor
*/
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
@ -151,7 +173,11 @@ public class DataUtils {
cursor.close();
}
return exist;
}
}/*ContentResolverlongnoteIdinttype
Cursor使ContentResolver.query()type
existtrueCursorexist*/
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
@ -165,7 +191,11 @@ public class DataUtils {
cursor.close();
}
return exist;
}
}/*ContentResolverlongnoteId
Cursor使ContentResolver.query()IDnoteId
existtrueCursorexist*/
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId),
@ -179,7 +209,11 @@ public class DataUtils {
cursor.close();
}
return exist;
}
}/*ContentResolverlongdataId
Cursor使ContentResolver.query()IDdataId
existtrueCursorexist*/
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
@ -195,7 +229,11 @@ public class DataUtils {
cursor.close();
}
return exist;
}
}/*ContentResolverStringname
Cursor使ContentResolver.query()Notes.TYPE_FOLDERNoteColumns.PARENT_ID <> Notes.ID_TRASH_FOLERNoteColumns.SNIPPET
existtrueCursorexist*/
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
@ -222,7 +260,13 @@ public class DataUtils {
c.close();
}
return set;
}
}/*ContentResolverlongfolderIdID
Cursor使ContentResolver.query()IDfolderIdID
HashSetHashSet<AppWidgetAttribute>IDHashSetnull
CursorHashSetID*/
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
@ -241,7 +285,13 @@ public class DataUtils {
}
}
return "";
}
}/*ContentResolverlongnoteIdID
Cursor使ContentResolver.query()IDnoteIdMIMECallNote.CONTENT_ITEM_TYPE
Cursor*/
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
@ -262,7 +312,13 @@ public class DataUtils {
cursor.close();
}
return 0;
}
}/*ContentResolverStringphoneNumberlongcallDateID
Cursor使ContentResolver.query()callDateMIMECallNote.CONTENT_ITEM_TYPEphoneNumberID
ID0
CursorID0*/
public static String getSnippetById(ContentResolver resolver, long noteId) {
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
@ -280,7 +336,11 @@ public class DataUtils {
return snippet;
}
throw new IllegalArgumentException("Note is not found with id: " + noteId);
}
}/*ContentResolverlongnoteIdIDsnippet
Cursor使ContentResolver.query()IDnoteId
snippetCursorsnippetIllegalArgumentExceptionNote is not found with id: noteId*/
public static String getFormattedSnippet(String snippet) {
if (snippet != null) {
@ -292,4 +352,8 @@ public class DataUtils {
}
return snippet;
}
}
}/*Stringsnippetsnippet便
snippet使String.trim()snippet使String.indexOf()snippet使String.substring()snippetsnippetsnippet
snippet*/

@ -18,96 +18,95 @@ package net.micode.notes.tool;
public class GTaskStringUtils {
public final static String GTASK_JSON_ACTION_ID = "action_id";
public final static String GTASK_JSON_ACTION_ID = "action_id";// 行动 ID
public final static String GTASK_JSON_ACTION_LIST = "action_list";
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 = "action_type";// 行动类型
public final static String GTASK_JSON_ACTION_TYPE_CREATE = "create";
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_GETALL = "get_all";// 获取全部行动
public final static String GTASK_JSON_ACTION_TYPE_MOVE = "move";
public final static String GTASK_JSON_ACTION_TYPE_MOVE = "move";// 移动行动
public final static String GTASK_JSON_ACTION_TYPE_UPDATE = "update";
public final static String GTASK_JSON_ACTION_TYPE_UPDATE = "update"; // 更新行动
public final static String GTASK_JSON_CREATOR_ID = "creator_id";
public final static String GTASK_JSON_CREATOR_ID = "creator_id";// 创建者 ID
public final static String GTASK_JSON_CHILD_ENTITY = "child_entity";
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_CLIENT_VERSION = "client_version";// 客户端版本
public final static String GTASK_JSON_COMPLETED = "completed";
public final static String GTASK_JSON_COMPLETED = "completed"; // 完成状态
public final static String GTASK_JSON_CURRENT_LIST_ID = "current_list_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_DEFAULT_LIST_ID = "default_list_id"; // 默认清单 ID
public final static String GTASK_JSON_DELETED = "deleted";
public final static String GTASK_JSON_DELETED = "deleted";// 删除状态
public final static String GTASK_JSON_DEST_LIST = "dest_list";
public final static String GTASK_JSON_DEST_LIST = "dest_list";// 目标清单
public final static String GTASK_JSON_DEST_PARENT = "dest_parent";
public final static String GTASK_JSON_DEST_PARENT = "dest_parent";// 目标父元素
public final static String GTASK_JSON_DEST_PARENT_TYPE = "dest_parent_type";
public final static String GTASK_JSON_DEST_PARENT_TYPE = "dest_parent_type"; // 目标父元素类型
public final static String GTASK_JSON_ENTITY_DELTA = "entity_delta";
public final static String GTASK_JSON_ENTITY_DELTA = "entity_delta";// 实体增量
public final static String GTASK_JSON_ENTITY_TYPE = "entity_type";
public final static String GTASK_JSON_ENTITY_TYPE = "entity_type"; // 实体类型
public final static String GTASK_JSON_GET_DELETED = "get_deleted";
public final static String GTASK_JSON_GET_DELETED = "get_deleted"; // 获取删除状态
public final static String GTASK_JSON_ID = "id";
public final static String GTASK_JSON_ID = "id";// ID
public final static String GTASK_JSON_INDEX = "index";
public final static String GTASK_JSON_INDEX = "index";// 索引
public final static String GTASK_JSON_LAST_MODIFIED = "last_modified";
public final static String GTASK_JSON_LAST_MODIFIED = "last_modified"; // 最后修改时间
public final static String GTASK_JSON_LATEST_SYNC_POINT = "latest_sync_point";
public final static String GTASK_JSON_LATEST_SYNC_POINT = "latest_sync_point";// 最新同步点
public final static String GTASK_JSON_LIST_ID = "list_id";
public final static String GTASK_JSON_LIST_ID = "list_id"; // 清单 ID
public final static String GTASK_JSON_LISTS = "lists";
public final static String GTASK_JSON_LISTS = "lists";// 清单列表
public final static String GTASK_JSON_NAME = "name";// 名称
public final static String GTASK_JSON_NAME = "name";
public final static String GTASK_JSON_NEW_ID = "new_id";// 新 ID
public final static String GTASK_JSON_NEW_ID = "new_id";
public final static String GTASK_JSON_NOTES = "notes";// 备注
public final static String GTASK_JSON_NOTES = "notes";
public final static String GTASK_JSON_PARENT_ID = "parent_id";// 父 ID
public final static String GTASK_JSON_PARENT_ID = "parent_id";
public final static String GTASK_JSON_PRIOR_SIBLING_ID = "prior_sibling_id";// 上一个同级 ID
public final static String GTASK_JSON_PRIOR_SIBLING_ID = "prior_sibling_id";
public final static String GTASK_JSON_RESULTS = "results";// 结果
public final static String GTASK_JSON_RESULTS = "results";
public final static String GTASK_JSON_SOURCE_LIST = "source_list";// 源清单
public final static String GTASK_JSON_SOURCE_LIST = "source_list";
public final static String GTASK_JSON_TASKS = "tasks";// 任务列表
public final static String GTASK_JSON_TASKS = "tasks";
public final static String GTASK_JSON_TYPE = "type";// 类型
public final static String GTASK_JSON_TYPE = "type";
public final static String GTASK_JSON_TYPE_GROUP = "GROUP";// 分组类型
public final static String GTASK_JSON_TYPE_GROUP = "GROUP";
public final static String GTASK_JSON_TYPE_TASK = "TASK";// 任务类型
public final static String GTASK_JSON_TYPE_TASK = "TASK";
public final static String GTASK_JSON_USER = "user";// 用户
public final static String GTASK_JSON_USER = "user";
public final static String MIUI_FOLDER_PREFFIX = "[MIUI_Notes]"; // MIUI 笔记前缀
public final static String MIUI_FOLDER_PREFFIX = "[MIUI_Notes]";
public final static String FOLDER_DEFAULT = "Default";// 默认文件夹
public final static String FOLDER_DEFAULT = "Default";
public final static String FOLDER_CALL_NOTE = "Call_Note"; // 通话笔记文件夹
public final static String FOLDER_CALL_NOTE = "Call_Note";
public final static String FOLDER_META = "METADATA";// 元数据文件夹
public final static String FOLDER_META = "METADATA";
public final static String META_HEAD_GTASK_ID = "meta_gid";// GTASK ID 元数据头
public final static String META_HEAD_GTASK_ID = "meta_gid";
public final static String META_HEAD_NOTE = "meta_note";// 笔记元数据头
public final static String META_HEAD_NOTE = "meta_note";
public final static String META_HEAD_DATA = "meta_data";// 数据元数据头
public final static String META_HEAD_DATA = "meta_data";
public final static String META_NOTE_NAME = "[META INFO] DON'T UPDATE AND DELETE";
public final static String META_NOTE_NAME = "[META INFO] DON'T UPDATE AND DELETE";// 元数据笔记名称
}

@ -37,13 +37,15 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
NoteColumns.ID,
NoteColumns.BG_COLOR_ID,
NoteColumns.SNIPPET
};
};/* NoteWidgetProvider AppWidgetProvider
public static final int COLUMN_ID = 0;
public static final int COLUMN_BG_COLOR_ID = 1;
public static final int COLUMN_SNIPPET = 2;
PROJECTION ID ID */
private static final String TAG = "NoteWidgetProvider";
public static final int COLUMN_ID = 0;// 笔记 ID 列在 PROJECTION 数组中的索引
public static final int COLUMN_BG_COLOR_ID = 1;// 笔记背景颜色 ID 列在 PROJECTION 数组中的索引
public static final int COLUMN_SNIPPET = 2;// 笔记摘录内容列在 PROJECTION 数组中的索引
private static final String TAG = "NoteWidgetProvider";// 日志输出标识符
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
@ -55,19 +57,28 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
NoteColumns.WIDGET_ID + "=?",
new String[] { String.valueOf(appWidgetIds[i])});
}
}
}/* NoteWidgetProvider onDeleted() AppWidgetProvider
ContentValues values NoteColumns.WIDGET_ID AppWidgetManager.INVALID_APPWIDGET_ID
private Cursor getNoteWidgetInfo(Context context, int widgetId) {
return context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
appWidgetIds NoteColumns.WIDGET_ID AppWidgetManager.INVALID_APPWIDGET_ID便
使 getContentResolver() ContentResolver update() NoteColumns.WIDGET_ID + "=?" NoteColumns.WIDGET_ID ID values NoteColumns.WIDGET_ID AppWidgetManager.INVALID_APPWIDGET_ID*/
private Cursor getNoteWidgetInfo(Context context, int widgetId) {// 使用 getContentResolver() 方法获取 ContentResolver 对象,通过该对象进行对笔记数据库的查询操作
return context.getContentResolver().query(Notes.CONTENT_NOTE_URI, // 使用 query() 方法查询笔记数据库,返回一个 Cursor 对象
return context.getContentResolver().query(// 查询的 URI笔记数据库中笔记的内容保存在该 URI 下
PROJECTION,
Notes.CONTENT_NOTE_URI,
PROJECTION,
NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?",
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) },
null);
NoteColumns.WIDGET_ID + "=? AND " + NoteColumns.PARENT_ID + "<>?",// 查询的列,即笔记 ID、笔记背景颜色 ID 和笔记摘录内容
new String[] { String.valueOf(widgetId), String.valueOf(Notes.ID_TRASH_FOLER) },//查询的条件,即笔记关联的小部件 ID 以及笔记的父 ID 不为回收站的笔记
null);// 排序方式,这里为 null 表示不排序
}
protected void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
update(context, appWidgetManager, appWidgetIds, false);
}
}/*这是 NoteWidgetProvider 抽象类中的一个受保护的方法 update(),它接受一个 Context 对象、一个 AppWidgetManager 对象和一个整型数组 appWidgetIds 作为参数,并在方法中调用了另一个同名方法。*/
private void update(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds,
boolean privacyMode) {
@ -122,11 +133,21 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
appWidgetManager.updateAppWidget(appWidgetIds[i], rv);
}
}
}
}/* `NoteWidgetProvider` `update()` `Context` `AppWidgetManager` `appWidgetIds` `privacyMode`
`appWidgetIds` ID `AppWidgetManager.INVALID_APPWIDGET_ID`
- ID
- `NoteEditActivity` ID
- `getNoteWidgetInfo()` ID
- ID `RemoteViews` ID `PendingIntent`
- `AppWidgetManager` `updateAppWidget()`
`privacyMode` `true` "隐私模式" `NotesListActivity` `NoteEditActivity`*/
protected abstract int getBgResourceId(int bgId);
protected abstract int getBgResourceId(int bgId);//用于获取小部件的背景资源 ID。
protected abstract int getLayoutId();
protected abstract int getLayoutId();//用于获取小部件的布局资源 ID。
protected abstract int getWidgetType();
protected abstract int getWidgetType();//用于获取小部件的类型。
}

@ -24,24 +24,24 @@ import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser;
public class NoteWidgetProvider_2x extends NoteWidgetProvider {
public class NoteWidgetProvider_2x extends NoteWidgetProvider {//创建一个继承自 NoteWidgetProvider 的子类 NoteWidgetProvider_2x
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.update(context, appWidgetManager, appWidgetIds);
}
}/*重写父类的 onUpdate() 方法,并在其中调用父类的 update() 方法,以更新小部件的显示内容和点击事件。*/
@Override
protected int getLayoutId() {
return R.layout.widget_2x;
}
}/*重写父类的 getLayoutId() 方法,返回用于小部件的布局资源 ID。这里返回 R.layout.widget_2x表示使用 widget_2x.xml 文件作为布局资源。*/
@Override
protected int getBgResourceId(int bgId) {
return ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId);
}
}/*重写父类的 getBgResourceId() 方法,返回用于小部件的背景资源 ID。这里调用了 ResourceParser.WidgetBgResources.getWidget2xBgResource(bgId) 方法,该方法根据传入的背景 ID 返回相应的背景资源 ID。*/
@Override
protected int getWidgetType() {
return Notes.TYPE_WIDGET_2X;
}
}/*重写父类的 getWidgetType() 方法,返回小部件的类型。这里返回 Notes.TYPE_WIDGET_2X表示这是一个 2x 大小的小部件。*/
}

@ -24,23 +24,22 @@ import net.micode.notes.data.Notes;
import net.micode.notes.tool.ResourceParser;
public class NoteWidgetProvider_4x extends NoteWidgetProvider {
public class NoteWidgetProvider_4x extends NoteWidgetProvider {//创建一个继承自 NoteWidgetProvider 的子类 NoteWidgetProvider_4x。
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.update(context, appWidgetManager, appWidgetIds);
}
}/*重写父类的 onUpdate() 方法,并在其中调用父类的 update() 方法,以更新小部件的显示内容和点击事件。*/
protected int getLayoutId() {
return R.layout.widget_4x;
}
}/*重写父类的 getLayoutId() 方法,返回用于小部件的布局资源 ID。这里返回 R.layout.widget_4x表示使用 widget_4x.xml 文件作为布局资源。*/
@Override
protected int getBgResourceId(int bgId) {
return ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId);
}
}/*重写父类的 getBgResourceId() 方法,返回用于小部件的背景资源 ID。这里调用了 ResourceParser.WidgetBgResources.getWidget4xBgResource(bgId) 方法,该方法根据传入的背景 ID 返回相应的背景资源 ID。*/
@Override
protected int getWidgetType() {
return Notes.TYPE_WIDGET_4X;
}
}
}/*重写父类的 getWidgetType() 方法,返回小部件的类型。这里返回 Notes.TYPE_WIDGET_4X表示这是一个 4x 大小的小部件。*/

@ -48,26 +48,28 @@ import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.gtask.remote.GTaskSyncService;
public class NotesPreferenceActivity extends PreferenceActivity {
public static final String PREFERENCE_NAME = "notes_preferences";
public class NotesPreferenceActivity extends PreferenceActivity {// 定义了一个常量字符串 PREFERENCE_NAME表示 SharedPreferences 的名称
public static final String PREFERENCE_NAME = "notes_preferences";// 定义了一个常量字符串 PREFERENCE_SYNC_ACCOUNT_NAME表示同步账户名称的键名
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";
public static final String PREFERENCE_SYNC_ACCOUNT_NAME = "pref_key_account_name";// 定义了一个常量字符串 PREFERENCE_LAST_SYNC_TIME表示上一次同步时间的键名
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";
public static final String PREFERENCE_LAST_SYNC_TIME = "pref_last_sync_time";// 定义了一个常量字符串 PREFERENCE_SET_BG_COLOR_KEY表示是否随机设置背景颜色的键名
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";
public static final String PREFERENCE_SET_BG_COLOR_KEY = "pref_key_bg_random_appear";// 定义了一个常量字符串 PREFERENCE_SYNC_ACCOUNT_KEY表示同步账户的键名
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";
private static final String PREFERENCE_SYNC_ACCOUNT_KEY = "pref_sync_account_key";// 定义了一个常量字符串 PREFERENCE_SYNC_ACCOUNT_KEY表示同步账户的键名
private static final String AUTHORITIES_FILTER_KEY = "authorities";
private static final String AUTHORITIES_FILTER_KEY = "authorities";// 定义了一个常量字符串 AUTHORITIES_FILTER_KEY表示过滤器的 authorities 键名
private PreferenceCategory mAccountCategory;
private PreferenceCategory mAccountCategory;// 声明了一个 PreferenceCategory 类型的成员变量 mAccountCategory表示账户分类
private GTaskReceiver mReceiver;
private Account[] mOriAccounts;
private GTaskReceiver mReceiver;// 声明了一个 GTaskReceiver 类型的成员变量 mReceiver表示 GTask 接收器
private boolean mHasAddedAccount;
private Account[] mOriAccounts;// 声明了一个 Account 数组类型的成员变量 mOriAccounts表示原始账户
private boolean mHasAddedAccount;// 声明了一个 boolean 类型的成员变量 mHasAddedAccount表示是否已添加了账户
@Override
protected void onCreate(Bundle icicle) {
@ -76,21 +78,22 @@ public class NotesPreferenceActivity extends PreferenceActivity {
/* using the app icon for navigation */
getActionBar().setDisplayHomeAsUpEnabled(true);
addPreferencesFromResource(R.xml.preferences);
mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);
addPreferencesFromResource(R.xml.preferences);// 加载 preferences.xml 文件中的 Preference
mAccountCategory = (PreferenceCategory) findPreference(PREFERENCE_SYNC_ACCOUNT_KEY);// 从 preferences.xml 中找到同步账户分类,赋值给 mAccountCategory
mReceiver = new GTaskReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(GTaskSyncService.GTASK_SERVICE_BROADCAST_NAME);
registerReceiver(mReceiver, filter);
registerReceiver(mReceiver, filter);// 注册 GTaskReceiver 广播接收器,监听 Gtask 同步服务的消息
mOriAccounts = null;
View header = LayoutInflater.from(this).inflate(R.layout.settings_header, null);
getListView().addHeaderView(header, null, true);
getListView().addHeaderView(header, null, true);//将原始账户数组 mOriAccounts 设置为 null。
}
@Override
protected void onResume() {
super.onResume();
super.onResume();// onStart 方法,表示 Activity 启动时调用的方
// need to set sync account automatically if user has added a new
// account
@ -114,7 +117,15 @@ public class NotesPreferenceActivity extends PreferenceActivity {
}
refreshUI();
}
}/*1. onCreate() Activity
2. 便Activity
3. preferences.xml Preference
4. preferences.xml mAccountCategory
5. GTaskReceiver 广 GTask
6. mOriAccounts null
7. LayoutInflater R.layout.settings_header
8. ListView
广*/
@Override
protected void onDestroy() {
@ -122,64 +133,67 @@ public class NotesPreferenceActivity extends PreferenceActivity {
unregisterReceiver(mReceiver);
}
super.onDestroy();
}
}/* Android Activity onDestroy()
1. mReceiver null null广
2. onDestroy() Activity
Activity 广 Android 广广 Activity Activity广*/
private void loadAccountPreference() {
mAccountCategory.removeAll();
mAccountCategory.removeAll();// 清空同步账户分类中的所有设置项
Preference accountPref = new Preference(this);
final String defaultAccount = getSyncAccountName(this);
accountPref.setTitle(getString(R.string.preferences_account_title));
accountPref.setSummary(getString(R.string.preferences_account_summary));
Preference accountPref = new Preference(this);// 创建一个新的 Preference 对象 accountPref
final String defaultAccount = getSyncAccountName(this);// 获取当前默认的同步账户名称
accountPref.setTitle(getString(R.string.preferences_account_title));// 设置 accountPref 的标题和摘要
accountPref.setSummary(getString(R.string.preferences_account_summary)); // 设置 accountPref 的点击事件监听器
accountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
public boolean onPreferenceClick(Preference preference) {// 判断是否正在进行同步任务
if (!GTaskSyncService.isSyncing()) {
if (TextUtils.isEmpty(defaultAccount)) {
// the first time to set account
showSelectAccountAlertDialog();
showSelectAccountAlertDialog();//如果当前同步账户为空,则弹出选择账户对话框
} else {
// if the account has already been set, we need to promp
// user about the risk
showChangeAccountConfirmAlertDialog();
}
}// 如果已经设置了同步账户,则需要提示用户风险
} else {
Toast.makeText(NotesPreferenceActivity.this,
R.string.preferences_toast_cannot_change_account, Toast.LENGTH_SHORT)
.show();
.show();// 如果正在进行同步任务,则提示用户无法更改账户
}
return true;
return true;// 返回 true表示点击事件已被处理
}
});
mAccountCategory.addPreference(accountPref);
mAccountCategory.addPreference(accountPref);// 将 accountPref 添加到同步账户分类中
}
private void loadSyncButton() {
Button syncButton = (Button) findViewById(R.id.preference_sync_button);
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
Button syncButton = (Button) findViewById(R.id.preference_sync_button);// 获取同步按钮和上次同步时间的视图对
TextView lastSyncTimeView = (TextView) findViewById(R.id.prefenerece_sync_status_textview);// 设置同步按钮的状态和点击事件监听器
// set button state
if (GTaskSyncService.isSyncing()) {
syncButton.setText(getString(R.string.preferences_button_sync_cancel));
syncButton.setText(getString(R.string.preferences_button_sync_cancel)); // 如果正在同步任务中,则将按钮文本设置为“取消同步”,并添加取消同步的点击事件监听器
syncButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GTaskSyncService.cancelSync(NotesPreferenceActivity.this);
}
});
} else {
syncButton.setText(getString(R.string.preferences_button_sync_immediately));
syncButton.setText(getString(R.string.preferences_button_sync_immediately));// 如果没有正在同步任务,则将按钮文本设置为“立即同步”,并添加开始同步的点击事件监听器
syncButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GTaskSyncService.startSync(NotesPreferenceActivity.this);
}
});
}
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));
}// 根据当前是否设置了同步账户来设置同步按钮的可用状态
syncButton.setEnabled(!TextUtils.isEmpty(getSyncAccountName(this)));// 设置上次同步时间的显示状态和文本内容
// set last sync time
if (GTaskSyncService.isSyncing()) {
lastSyncTimeView.setText(GTaskSyncService.getProgressString());
lastSyncTimeView.setVisibility(View.VISIBLE);
lastSyncTimeView.setVisibility(View.VISIBLE); // 如果正在同步任务中,则显示当前同步进度,并将上次同步时间视图设置为可见状态
} else {
long lastSyncTime = getLastSyncTime(this);
if (lastSyncTime != 0) {
@ -191,184 +205,192 @@ public class NotesPreferenceActivity extends PreferenceActivity {
lastSyncTimeView.setVisibility(View.GONE);
}
}
}
}// 如果没有正在同步任务则获取上次同步时间并根据上次同步时间是否为0来设置上次同步时间视图的可见状态和文本内容
private void refreshUI() {
loadAccountPreference();
loadSyncButton();
}
}/*loadAccountPreference() 方法用于加载和显示当前同步账户的信息,而 loadSyncButton() 方法则用于设置同步按钮的状态和点击事件监听器,并显示上次同步时间的信息。*/
private void showSelectAccountAlertDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);// 创建 AlertDialog.Builder 对象
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_select_account_title));
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);/// 创建自定义标题视图
titleTextView.setText(getString(R.string.preferences_dialog_select_account_title));// 设置标题文本
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));
subtitleTextView.setText(getString(R.string.preferences_dialog_select_account_tips));// 设置副标题文本
dialogBuilder.setCustomTitle(titleView);
dialogBuilder.setPositiveButton(null, null);
dialogBuilder.setCustomTitle(titleView);// 将自定义标题视图设置到对话框中
dialogBuilder.setPositiveButton(null, null); // 不设置确定按钮和点击事件监听器
Account[] accounts = getGoogleAccounts();
String defAccount = getSyncAccountName(this);
String defAccount = getSyncAccountName(this);// 获取所有谷歌账户的列表和当前同步账户的名称
mOriAccounts = accounts;
mHasAddedAccount = false;
mHasAddedAccount = false;// 保存原始账户列表并将“已添加账户”标志设为 false
if (accounts.length > 0) {
CharSequence[] items = new CharSequence[accounts.length];
final CharSequence[] itemMapping = items;
int checkedItem = -1;
if (accounts.length > 0) {// 如果找到了至少一个谷歌账户,则创建单选项列表
CharSequence[] items = new CharSequence[accounts.length];// 创建单选项列表的选项文本数组
final CharSequence[] itemMapping = items;// 创建选项文本数组的映射数组
int checkedItem = -1; // 初始化默认选中项的索引为 -1
int index = 0;
for (Account account : accounts) {
for (Account account : accounts) {// 遍历所有谷歌账户,为每个账户设置一个选项
if (TextUtils.equals(account.name, defAccount)) {
checkedItem = index;
}
items[index++] = account.name;
}// 如果该账户的名称与当前同步账户的名称相同,则将其作为默认选中项
items[index++] = account.name;// 将该账户的名称添加到选项文本数组中
}
dialogBuilder.setSingleChoiceItems(items, checkedItem,
dialogBuilder.setSingleChoiceItems(items, checkedItem, // 将单选项列表设置到对话框中,并为每个选项设置点击事件监听器
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setSyncAccount(itemMapping[which].toString());
dialog.dismiss();
refreshUI();
setSyncAccount(itemMapping[which].toString()); // 将用户选择的账户名称设置为同步账户
dialog.dismiss();// 关闭对话框
refreshUI();// 刷新 UI 界面上的账户和同步按钮状态
}
});
}
View addAccountView = LayoutInflater.from(this).inflate(R.layout.add_account_text, null);
dialogBuilder.setView(addAccountView);
View addAccountView = LayoutInflater.from(this).inflate(R.layout.add_account_text, null);//从布局文件中加载一个视图对象并将其赋值给 addAccountView 变量
dialogBuilder.setView(addAccountView);//将 addAccountView 设置为对话框的自定义视图
final AlertDialog dialog = dialogBuilder.show();
addAccountView.setOnClickListener(new View.OnClickListener() {
final AlertDialog dialog = dialogBuilder.show();//创建一个 AlertDialog 对象,并将其显示出来
addAccountView.setOnClickListener(new View.OnClickListener() {//添加一个点击事件监听器
public void onClick(View v) {
mHasAddedAccount = true;
mHasAddedAccount = true;//用户是否已经添加了一个账户
Intent intent = new Intent("android.settings.ADD_ACCOUNT_SETTINGS");
intent.putExtra(AUTHORITIES_FILTER_KEY, new String[] {
"gmail-ls"
});
startActivityForResult(intent, -1);
dialog.dismiss();
});//创建了一个 Intent 对象,用于启动一个系统设置界面,以便让用户添加新的帐户
startActivityForResult(intent, -1);//启动一个新的界面,等待用户添加新的账户
dialog.dismiss();//关闭对话框
}
});
}
private void showChangeAccountConfirmAlertDialog() {
// 创建一个 AlertDialog.Builder 对象
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
// 从布局文件 R.layout.account_dialog_title 中加载一个视图 titleView
View titleView = LayoutInflater.from(this).inflate(R.layout.account_dialog_title, null);
// 从 titleView 中找到一个 TextView 对象 titleTextView并设置其文本
TextView titleTextView = (TextView) titleView.findViewById(R.id.account_dialog_title);
titleTextView.setText(getString(R.string.preferences_dialog_change_account_title,
getSyncAccountName(this)));
// 从 titleView 中找到一个 TextView 对象 subtitleTextView并设置其文本
TextView subtitleTextView = (TextView) titleView.findViewById(R.id.account_dialog_subtitle);
subtitleTextView.setText(getString(R.string.preferences_dialog_change_account_warn_msg));
// 将 titleView 设置为对话框的自定义标题
dialogBuilder.setCustomTitle(titleView);
// 创建一个 CharSequence 类型的数组 menuItemArray包含三个字符串作为选项菜单的标签文字
CharSequence[] menuItemArray = new CharSequence[] {
getString(R.string.preferences_menu_change_account),
getString(R.string.preferences_menu_remove_account),
getString(R.string.preferences_menu_cancel)
};
dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialogBuilder.setItems(menuItemArray, new DialogInterface.OnClickListener() { // 创建一个 DialogInterface.OnClickListener 对象,用于处理选项菜单的点击事件
public void onClick(DialogInterface dialog, int which) {// 判断点击了哪个菜单项
if (which == 0) {
showSelectAccountAlertDialog();
showSelectAccountAlertDialog();// 如果点击了第一个菜单项,调用 showSelectAccountAlertDialog() 方法显示“选择帐户”对话框
} else if (which == 1) {
removeSyncAccount();
refreshUI();
refreshUI();// 如果点击了第二个菜单项,先调用 removeSyncAccount() 方法删除同步帐户,再调用 refreshUI() 方法刷新界面
}
}
});
dialogBuilder.show();
dialogBuilder.show();// 显示对话框
}
private Account[] getGoogleAccounts() {
// 获取 AccountManager 对象
AccountManager accountManager = AccountManager.get(this);
// 调用 getAccountsByType() 方法,传入参数 "com.google",以获取所有类型为 "com.google" 的帐户
return accountManager.getAccountsByType("com.google");
}
private void setSyncAccount(String account) {
if (!getSyncAccountName(this).equals(account)) {
if (!getSyncAccountName(this).equals(account)) {// 判断传入的 account 是否与当前同步帐户相同
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
SharedPreferences.Editor editor = settings.edit();// 获取 SharedPreferences 对象
if (account != null) {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account);
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, account); // 如果传入的 account 不为 null则将其存储到 SharedPreferences 中
} else {
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
editor.putString(PREFERENCE_SYNC_ACCOUNT_NAME, "");// 如果传入的 account 为 null则将空字符串存储到 SharedPreferences 中
}
editor.commit();
editor.commit();// 提交修改
// clean up last sync time
setLastSyncTime(this, 0);
setLastSyncTime(this, 0);// 清除上一次同步的时间
// clean up local gtask related info
new Thread(new Runnable() {
public void run() {
ContentValues values = new ContentValues();
values.put(NoteColumns.GTASK_ID, "");
values.put(NoteColumns.SYNC_ID, 0);
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
ContentValues values = new ContentValues(); // 创建一个 ContentValues 对象,用于更新所有的 note
values.put(NoteColumns.GTASK_ID, "");// 清空 GTasks ID 和 sync ID
values.put(NoteColumns.SYNC_ID, 0);// 清空 GTasks ID 和 sync ID
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null); // 更新所有的 note
}
}).start();
Toast.makeText(NotesPreferenceActivity.this,
getString(R.string.preferences_toast_success_set_accout, account),
Toast.LENGTH_SHORT).show();
Toast.LENGTH_SHORT).show();// 显示一个 Toast提示同步帐户设置成功
}
}
private void removeSyncAccount() {
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
SharedPreferences settings = getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); // 获取 SharedPreferences 对象
SharedPreferences.Editor editor = settings.edit();// 获取 SharedPreferences 对象
if (settings.contains(PREFERENCE_SYNC_ACCOUNT_NAME)) {
editor.remove(PREFERENCE_SYNC_ACCOUNT_NAME);
}
}// 如果 SharedPreferences 包含同步帐户名称,则从 SharedPreferences 中删除该名称
if (settings.contains(PREFERENCE_LAST_SYNC_TIME)) {
editor.remove(PREFERENCE_LAST_SYNC_TIME);
editor.remove(PREFERENCE_LAST_SYNC_TIME); // 如果 SharedPreferences 包含上一次同步的时间,则从 SharedPreferences 中删除该时间
}
editor.commit();
editor.commit(); // 提交修改
// clean up local gtask related info
new Thread(new Runnable() {
public void run() {
ContentValues values = new ContentValues();
ContentValues values = new ContentValues();// 创建一个 ContentValues 对象,用于更新所有的 note
values.put(NoteColumns.GTASK_ID, "");
values.put(NoteColumns.SYNC_ID, 0);
values.put(NoteColumns.SYNC_ID, 0); // 清空 GTasks ID 和 sync ID
getContentResolver().update(Notes.CONTENT_NOTE_URI, values, null, null);
}
}).start();
}).start();// 更新所有的 note
}
public static String getSyncAccountName(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,// 获取 SharedPreferences 对象
Context.MODE_PRIVATE);
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");
return settings.getString(PREFERENCE_SYNC_ACCOUNT_NAME, "");// 从 SharedPreferences 中获取同步帐户名称
}
public static void setLastSyncTime(Context context, long time) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putLong(PREFERENCE_LAST_SYNC_TIME, time);
editor.commit();
SharedPreferences.Editor editor = settings.edit(); // 获取 SharedPreferences 对象
editor.putLong(PREFERENCE_LAST_SYNC_TIME, time);// 将最后一次同步的时间保存到 SharedPreferences 中
editor.commit();// 提交修改
}
public static long getLastSyncTime(Context context) {
SharedPreferences settings = context.getSharedPreferences(PREFERENCE_NAME,
Context.MODE_PRIVATE);
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);
Context.MODE_PRIVATE);// 获取 SharedPreferences 对象
return settings.getLong(PREFERENCE_LAST_SYNC_TIME, 0);// 从 SharedPreferences 中获取最后一次同步的时间
}
private class GTaskReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
refreshUI();
refreshUI();// 刷新用户界面
if (intent.getBooleanExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_IS_SYNCING, false)) {
TextView syncStatus = (TextView) findViewById(R.id.prefenerece_sync_status_textview);
syncStatus.setText(intent
.getStringExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_PROGRESS_MSG));
.getStringExtra(GTaskSyncService.GTASK_SERVICE_BROADCAST_PROGRESS_MSG));// 如果正在同步,则更新同步状态
}
}
@ -380,9 +402,9 @@ public class NotesPreferenceActivity extends PreferenceActivity {
Intent intent = new Intent(this, NotesListActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
return true; // 创建一个 Intent 对象,跳转到 NotesListActivity并清除之前的所有 Activity
default:
return false;
return false;// 如果选择的菜单项不是返回主页,则返回 false
}
}
}

@ -0,0 +1,215 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.tool;
import android.content.Context;
import android.preference.PreferenceManager;
import net.micode.notes.R;
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 {
private final static int [] BG_EDIT_RESOURCES = new int [] {
R.drawable.edit_yellow,
R.drawable.edit_blue,
R.drawable.edit_white,
R.drawable.edit_green,
R.drawable.edit_red
};/*这是一个静态内部类 NoteBgResources其中包含一个名为 BG_EDIT_RESOURCES 的静态常量数组,该数组包含了 5 个整型元素,这些整型元素对应着项目中的一些 drawable 资源 R.drawable.edit_yellow、R.drawable.edit_blue、R.drawable.edit_white、R.drawable.edit_green、R.drawable.edit_red。*/
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
R.drawable.edit_title_yellow,
R.drawable.edit_title_blue,
R.drawable.edit_title_white,
R.drawable.edit_title_green,
R.drawable.edit_title_red
};/*这是一个私有的静态常量数组 BG_EDIT_TITLE_RESOURCES它包含了五个整型元素这些整型元素对应着项目中的一些 drawable 资源 R.drawable.edit_title_yellow、R.drawable.edit_title_blue、R.drawable.edit_title_white、R.drawable.edit_title_green、R.drawable.edit_title_red。*/
public static int getNoteBgResource(int id) {
return BG_EDIT_RESOURCES[id];
}/*一个静态方法 getNoteBgResource(),它接受一个整型参数 id并返回一个整型值。在这个方法中静态常量数组 BG_EDIT_RESOURCES 被索引到,以返回该数组中索引为 id 的元素的值。*/
public static int getNoteTitleBgResource(int id) {
return BG_EDIT_TITLE_RESOURCES[id];
}
}/*一个静态方法 getNoteTitleBgResource(),它接受一个整型参数 id并返回一个整型值。在这个方法中静态常量数组 BG_EDIT_TITLE_RESOURCES 被索引到,以返回该数组中索引为 id 的元素的值。*/
public static int getDefaultBgId(Context context) {
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(
NotesPreferenceActivity.PREFERENCE_SET_BG_COLOR_KEY, false)) {
return (int) (Math.random() * NoteBgResources.BG_EDIT_RESOURCES.length);
} else {
return BG_DEFAULT_COLOR;
}
}/* getDefaultBgId() Context
PreferenceManager.getDefaultSharedPreferences(context) SharedPreferences PREFERENCE_SET_BG_COLOR_KEY true true使 Math.random() NoteBgResources.BG_EDIT_RESOURCES ID PREFERENCE_SET_BG_COLOR_KEY false BG_DEFAULT_COLOR ResourceParser */
public static class NoteItemBgResources {
private final static int [] BG_FIRST_RESOURCES = new int [] {
R.drawable.list_yellow_up,
R.drawable.list_blue_up,
R.drawable.list_white_up,
R.drawable.list_green_up,
R.drawable.list_red_up
};/* NoteItemBgResources BG_FIRST_RESOURCES
5 drawable R.drawable.list_yellow_upR.drawable.list_blue_upR.drawable.list_white_upR.drawable.list_green_upR.drawable.list_red_up*/
private final static int [] BG_NORMAL_RESOURCES = new int [] {
R.drawable.list_yellow_middle,
R.drawable.list_blue_middle,
R.drawable.list_white_middle,
R.drawable.list_green_middle,
R.drawable.list_red_middle
};/* BG_NORMAL_RESOURCES drawable R.drawable.list_yellow_middleR.drawable.list_blue_middleR.drawable.list_white_middleR.drawable.list_green_middleR.drawable.list_red_middle
drawable
R.drawable.list_yellow_middleR.drawable.list_blue_middleR.drawable.list_white_middleR.drawable.list_green_middleR.drawable.list_red_middle */
private final static int [] BG_LAST_RESOURCES = new int [] {
R.drawable.list_yellow_down,
R.drawable.list_blue_down,
R.drawable.list_white_down,
R.drawable.list_green_down,
R.drawable.list_red_down,
};/* BG_LAST_RESOURCES drawable R.drawable.list_yellow_downR.drawable.list_blue_downR.drawable.list_white_downR.drawable.list_green_downR.drawable.list_red_down
drawable R.drawable.list_yellow_downR.drawable.list_blue_downR.drawable.list_white_downR.drawable.list_green_downR.drawable.list_red_down */
private final static int [] BG_SINGLE_RESOURCES = new int [] {
R.drawable.list_yellow_single,
R.drawable.list_blue_single,
R.drawable.list_white_single,
R.drawable.list_green_single,
R.drawable.list_red_single
};/* BG_SINGLE_RESOURCES drawable R.drawable.list_yellow_singleR.drawable.list_blue_singleR.drawable.list_white_singleR.drawable.list_green_singleR.drawable.list_red_single
drawable R.drawable.list_yellow_singleR.drawable.list_blue_singleR.drawable.list_white_singleR.drawable.list_green_singleR.drawable.list_red_single */
public static int getNoteBgFirstRes(int id) {
return BG_FIRST_RESOURCES[id];
}/*一个公共静态方法 getNoteBgFirstRes(),它接受一个整型参数 id并返回一个整型值。*/
public static int getNoteBgLastRes(int id) {
return BG_LAST_RESOURCES[id];
}/* getNoteBgLastRes() id
BG_LAST_RESOURCES id */
public static int getNoteBgSingleRes(int id) {
return BG_SINGLE_RESOURCES[id];
}/* getNoteBgSingleRes() id
BG_SINGLE_RESOURCES id */
public static int getNoteBgNormalRes(int id) {
return BG_NORMAL_RESOURCES[id];
}/* getNoteBgNormalRes() id
BG_NORMAL_RESOURCES id */
public static int getFolderBgRes() {
return R.drawable.list_folder;
}
}/* getFolderBgRes()
list_folder drawable ID*/
public static class WidgetBgResources {
private final static int [] BG_2X_RESOURCES = new int [] {
R.drawable.widget_2x_yellow,
R.drawable.widget_2x_blue,
R.drawable.widget_2x_white,
R.drawable.widget_2x_green,
R.drawable.widget_2x_red,
};/*一个静态内部类 WidgetBgResources它包含一个私有的静态常量数组 BG_2X_RESOURCES该数组包含五个整型元素这些整型元素对应着项目中的一些 drawable 资源 R.drawable.widget_2x_yellow、R.drawable.widget_2x_blue、R.drawable.widget_2x_white、R.drawable.widget_2x_green、R.drawable.widget_2x_red。*/
public static int getWidget2xBgResource(int id) {
return BG_2X_RESOURCES[id];
}
private final static int [] BG_4X_RESOURCES = new int [] {
R.drawable.widget_4x_yellow,
R.drawable.widget_4x_blue,
R.drawable.widget_4x_white,
R.drawable.widget_4x_green,
R.drawable.widget_4x_red
};/* getWidget2xBgResource() id
BG_2X_RESOURCES id
2x2 ID drawable
BG_4X_RESOURCES drawable R.drawable.widget_4x_yellowR.drawable.widget_4x_blueR.drawable.widget_4x_whiteR.drawable.widget_4x_greenR.drawable.widget_4x_red*/
public static int getWidget4xBgResource(int id) {
return BG_4X_RESOURCES[id];
}
}/* getWidget4xBgResource() id
BG_4X_RESOURCES id */
public static class TextAppearanceResources {
private final static int [] TEXTAPPEARANCE_RESOURCES = new int [] {
R.style.TextAppearanceNormal,
R.style.TextAppearanceMedium,
R.style.TextAppearanceLarge,
R.style.TextAppearanceSuper
};/*一个静态内部类 TextAppearanceResources它包含一个私有的静态常量数组 TEXTAPPEARANCE_RESOURCES该数组包含四个整型元素这些整型元素对应着项目中的一些样式资源 R.style.TextAppearanceNormal、R.style.TextAppearanceMedium、R.style.TextAppearanceLarge、R.style.TextAppearanceSuper。*/
public static int getTexAppearanceResource(int id) {
/**
* HACKME: Fix bug of store the resource id in shared preference.
* The id may larger than the length of resources, in this case,
* return the {@link ResourceParser#BG_DEFAULT_FONT_SIZE}
*/
if (id >= TEXTAPPEARANCE_RESOURCES.length) {
return BG_DEFAULT_FONT_SIZE;
}
return TEXTAPPEARANCE_RESOURCES[id];
}/* getTexAppearanceResource() id
id TEXTAPPEARANCE_RESOURCES BG_DEFAULT_FONT_SIZE
id TEXTAPPEARANCE_RESOURCES TEXTAPPEARANCE_RESOURCES id */
public static int getResourcesSize() {
return TEXTAPPEARANCE_RESOURCES.length;
}
}
}/* getTexAppearanceResource() id
id TEXTAPPEARANCE_RESOURCES BG_DEFAULT_FONT_SIZE
id TEXTAPPEARANCE_RESOURCES TEXTAPPEARANCE_RESOURCES id */

@ -0,0 +1,2 @@
#Thu Apr 13 13:41:37 CST 2023
gradle.version=7.5

Binary file not shown.

@ -12,6 +12,10 @@
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<<<<<<< HEAD:.idea/deploymentTargetDropDown.xml
<timeTargetWasSelectedWithDropDown value="2023-04-07T06:44:46.634860500Z" />
=======
<timeTargetWasSelectedWithDropDown value="2023-04-07T06:36:29.852905700Z" />
>>>>>>> master:src/.idea/deploymentTargetDropDown.xml
</component>
</project>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app:androidTest" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app/build/generated/aidl_source_output_dir/debugAndroidTest/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debugAndroidTest/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debugAndroidTest/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/androidTest/debug" />
<content url="file://$MODULE_DIR$/../../../app/src/androidTest" />
<content url="file://$MODULE_DIR$/../../../app/src/androidTestDebug" />
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="minote.app.main" scope="TEST" />
</component>
<component name="TestModuleProperties" production-module="minote.app.main" />
</module>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="minote" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
<option name="LAST_KNOWN_AGP_VERSION" value="7.4.2" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app">
<excludeFolder url="file://$MODULE_DIR$/../../../app/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/../../../app/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app:main" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app/build/generated/aidl_source_output_dir/debug/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/renderscript_source_output_dir/debug/out" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" type="java-resource" />
</content>
<content url="file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug" />
<content url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/debug">
<sourceFolder url="file://$MODULE_DIR$/../../../app/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
</content>
<content url="file://$MODULE_DIR$/../../../app/src/debug" />
<content url="file://$MODULE_DIR$/../../../app/src/main">
<sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/../../../app/src/main/res" type="java-resource" />
</content>
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app:unitTest" external.linked.project.path="$MODULE_DIR$/../../../app" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/../../../app/build/generated/res/resValues/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/../../../app/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$/../../../app/build/generated/ap_generated_sources/debugUnitTest/out" />
<content url="file://$MODULE_DIR$/../../../app/src/test" />
<content url="file://$MODULE_DIR$/../../../app/src/testDebug" />
<orderEntry type="jdk" jdkName="Android API 33, extension level 3 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="minote.app.main" scope="TEST" />
</component>
<component name="TestModuleProperties" production-module="minote.app.main" />
</module>

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "net.micode.notes",
"variantName": "debug",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "0.1",
"outputFile": "app-debug.apk"
}
],
"elementType": "File"
}

@ -0,0 +1,2 @@
#- File Locator -
listingFile=../../apk/debug/output-metadata.json

@ -0,0 +1,2 @@
appMetadataVersion=1.1
androidGradlePluginVersion=7.4.2

@ -0,0 +1,10 @@
{
"version": 3,
"artifactType": {
"type": "COMPATIBLE_SCREEN_MANIFEST",
"kind": "Directory"
},
"applicationId": "net.micode.notes",
"variantName": "debug",
"elements": []
}

@ -0,0 +1,96 @@
#Thu Apr 13 13:41:58 CST 2023
net.micode.notes.app-main-7\:/drawable-hdpi/font_super.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_super.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/call_record.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_call_record.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/new_note_normal.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_new_note_normal.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_yellow.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_yellow.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_green.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_green.9.png.flat
net.micode.notes.app-main-7\:/menu/sub_folder.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_sub_folder.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_yellow.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_yellow.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_small.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_small.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_white.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_white.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_white.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_white.9.png.flat
net.micode.notes.app-main-7\:/layout/account_dialog_title.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_account_dialog_title.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_green.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_green.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_down.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_down.9.png.flat
net.micode.notes.app-main-7\:/color/secondary_text_dark.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\color_secondary_text_dark.xml.flat
net.micode.notes.app-main-7\:/layout/dialog_edit_text.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_dialog_edit_text.xml.flat
net.micode.notes.app-main-7\:/layout/widget_4x.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_widget_4x.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_middle.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/menu_delete.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_menu_delete.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/clock.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_clock.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_normal.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_normal.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/dropdown_icon.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_dropdown_icon.9.png.flat
net.micode.notes.app-main-7\:/layout/note_edit.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_edit.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_green.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_green.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_single.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_single.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_single.9.png.flat
net.micode.notes.app-main-7\:/raw-zh-rCN/introduction=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\raw-zh-rCN_introduction.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_green.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_green.png.flat
net.micode.notes.app-main-7\:/xml/preferences.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\xml_preferences.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_single.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/delete.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_delete.png.flat
net.micode.notes.app-main-7\:/menu/call_record_folder.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_call_record_folder.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_red.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_red.png.flat
net.micode.notes.app-main-7\:/layout/widget_2x.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_widget_2x.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/menu_move.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_menu_move.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_down.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_down.9.png.flat
net.micode.notes.app-main-7\:/layout/note_edit_list_item.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_edit_list_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_blue.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_blue.png.flat
net.micode.notes.app-main-7\:/layout/add_account_text.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_add_account_text.xml.flat
net.micode.notes.app-main-7\:/xml/widget_4x_info.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\xml_widget_4x_info.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_size_selector_bg.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_size_selector_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/selected.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_selected.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/search_result.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_search_result.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_white.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_white.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_middle.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_middle.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_middle.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_down.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_down.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_single.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/font_large.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_font_large.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_up.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_up.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_middle.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_middle.9.png.flat
net.micode.notes.app-main-7\:/layout/settings_header.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_settings_header.xml.flat
net.micode.notes.app-main-7\:/menu/note_list.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list.xml.flat
net.micode.notes.app-main-7\:/menu/call_note_edit.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_call_note_edit.xml.flat
net.micode.notes.app-main-7\:/drawable/new_note.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable_new_note.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_red.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_red.9.png.flat
net.micode.notes.app-main-7\:/layout/note_list.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list.xml.flat
net.micode.notes.app-main-7\:/color/primary_text_dark.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\color_primary_text_dark.xml.flat
net.micode.notes.app-main-7\:/layout/datetime_picker.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_datetime_picker.xml.flat
net.micode.notes.app-main-7\:/raw/introduction=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\raw_introduction.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_single.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_single.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_yellow.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_yellow.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_red.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_red.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/title_alert.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_title_alert.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_down.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_down.9.png.flat
net.micode.notes.app-main-7\:/menu/note_list_options.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list_options.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_2x_yellow.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_2x_yellow.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/icon_app.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_icon_app.png.flat
net.micode.notes.app-main-7\:/layout/note_item.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_background.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_background.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_red.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_red.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/title_bar_bg.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_title_bar_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_footer_bg.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_footer_bg.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/new_note_pressed.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_new_note_pressed.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_green_up.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_green_up.9.png.flat
net.micode.notes.app-main-7\:/layout/note_list_dropdown_menu.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list_dropdown_menu.xml.flat
net.micode.notes.app-main-7\:/layout/note_list_footer.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_note_list_footer.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_red_up.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_red_up.9.png.flat
net.micode.notes.app-main-7\:/menu/note_list_dropdown.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_note_list_dropdown.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_up.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_up.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_blue.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_blue.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/bg_color_btn_mask.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_bg_color_btn_mask.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_blue.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_blue.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/bg_btn_set_color.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_bg_btn_set_color.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/edit_title_white.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_edit_title_white.9.png.flat
net.micode.notes.app-main-7\:/xml/searchable.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\xml_searchable.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/notification.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_notification.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_blue_up.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_blue_up.9.png.flat
net.micode.notes.app-main-7\:/xml/widget_2x_info.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\xml_widget_2x_info.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/note_edit_color_selector_panel.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_note_edit_color_selector_panel.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_white_middle.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_white_middle.9.png.flat
net.micode.notes.app-main-7\:/layout/folder_list_item.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\layout_folder_list_item.xml.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_folder.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_folder.9.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/widget_4x_blue.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_widget_4x_blue.png.flat
net.micode.notes.app-main-7\:/drawable-hdpi/list_yellow_down.9.png=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_list_yellow_down.9.png.flat
net.micode.notes.app-main-7\:/menu/note_edit.xml=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\merged_res\\debug\\menu_note_edit.xml.flat

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="menu_share_ways">
<item>短信</item>
<item>邮件</item>
</string-array>
<plurals name="search_results_title">
<item quantity="other"><ns1:g id="NUMBER">%1$s</ns1:g> 条符合“<ns1:g id="SEARCH">%2$s</ns1:g>”的搜索结果</item>
</plurals>
<string name="alert_message_delete_folder">确认删除文件夹及所包含的便签吗?</string>
<string name="alert_message_delete_note">确认要删除该条便签吗?</string>
<string name="alert_message_delete_notes">确认要删除所选的 %d 条便签吗?</string>
<string name="alert_title_delete">删除</string>
<string name="app_name">便签</string>
<string name="app_widget2x2">便签2x2</string>
<string name="app_widget4x4">便签4x4</string>
<string name="button_delete">删除</string>
<string name="call_record_folder_name">通话便签</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="datetime_dialog_ok">设置</string>
<string name="delete_remind_time_message">成功删除提醒</string>
<string name="error_note_empty_for_clock">不能为空便签设置闹钟提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能将空便签发送到桌面</string>
<string name="error_note_not_exist">要查看的便签不存在</string>
<string name="error_sdcard_export">导出文本时发生错误请检查SD卡</string>
<string name="error_sdcard_unmounted">SD卡被占用不能操作</string>
<string name="error_sync_cancelled">同步已取消</string>
<string name="error_sync_internal">同步失败,发生内部错误</string>
<string name="error_sync_network">同步失败,请检查网络和帐号设置</string>
<string name="failed_sdcard_export">导出失败</string>
<string name="folder_exist">文件夹 %1$s 已存在,请重新命名</string>
<string name="format_date_ymd">yyyyMMdd</string>
<string name="format_datetime_mdhm">MM月dd日 kk:mm</string>
<string name="format_exported_file_location">已将文本文件(%1$s)输出至SD卡(%2$s)目录</string>
<string name="format_move_notes_to_folder">已将所选 %1$d 条便签移到 %2$s 文件夹</string>
<string name="hint_foler_name">请输入名称</string>
<string name="info_note_enter_desktop">已添加到桌面</string>
<string name="menu_alert">提醒我</string>
<string name="menu_create_folder">新建文件夹</string>
<string name="menu_delete">删除</string>
<string name="menu_deselect_all">取消全选</string>
<string name="menu_export_text">导出文本</string>
<string name="menu_folder_change_name">修改文件夹名称</string>
<string name="menu_folder_delete">刪除文件夹</string>
<string name="menu_folder_view">查看文件夹</string>
<string name="menu_font_large"></string>
<string name="menu_font_normal">正常</string>
<string name="menu_font_size">文字大小</string>
<string name="menu_font_small"></string>
<string name="menu_font_super">超大</string>
<string name="menu_list_mode">进入清单模式</string>
<string name="menu_move">移动到文件夹</string>
<string name="menu_move_parent_folder">上一级文件夹</string>
<string name="menu_normal_mode">退出清单模式</string>
<string name="menu_remove_remind">删除提醒</string>
<string name="menu_search">搜索</string>
<string name="menu_select_all">全选</string>
<string name="menu_select_none">没有选中项,操作无效</string>
<string name="menu_select_title">选中了 %d 项</string>
<string name="menu_send_to_desktop">发送到桌面</string>
<string name="menu_setting">设置</string>
<string name="menu_share">分享</string>
<string name="menu_sync">同步</string>
<string name="menu_sync_cancel">取消同步</string>
<string name="menu_title_select_folder">选择文件夹</string>
<string name="note_alert_expired">已过期</string>
<string name="note_link_email">发送邮件</string>
<string name="note_link_other">打开地图</string>
<string name="note_link_tel">呼叫电话</string>
<string name="note_link_web">浏览网页</string>
<string name="notealert_enter">查看</string>
<string name="notealert_ok">知道了</string>
<string name="notelist_menu_new">新建便签</string>
<string name="notelist_string_info">...</string>
<string name="preferences_account_summary">与google task同步便签记录</string>
<string name="preferences_account_title">同步账号</string>
<string name="preferences_add_account">添加账号</string>
<string name="preferences_bg_random_appear_title">新建便签背景颜色随机</string>
<string name="preferences_button_sync_cancel">取消同步</string>
<string name="preferences_button_sync_immediately">立即同步</string>
<string name="preferences_dialog_change_account_title">当前帐号 %1$s</string>
<string name="preferences_dialog_change_account_warn_msg">如更换同步帐号,过去的帐号同步信息将被清空,再次切换的同时可能会造成数据重复</string>
<string name="preferences_dialog_select_account_tips">请选择google帐号便签将与该帐号的google task内容同步。</string>
<string name="preferences_dialog_select_account_title">同步便签</string>
<string name="preferences_last_sync_time">上次同步于 %1$s</string>
<string name="preferences_menu_cancel">取消</string>
<string name="preferences_menu_change_account">更换账号</string>
<string name="preferences_menu_remove_account">删除账号</string>
<string name="preferences_title">设置</string>
<string name="preferences_toast_cannot_change_account">正在同步中,不能修改同步帐号</string>
<string name="preferences_toast_success_set_accout">同步帐号已设置为%1$s</string>
<string name="search">便签</string>
<string name="search_hint">搜索便签</string>
<string name="search_label">正在搜索便签</string>
<string name="search_setting_description">便签中的文字</string>
<string name="set_remind_time_message">创建提醒</string>
<string name="success_sdcard_export">导出成功</string>
<string name="success_sync_account">与%1$s同步成功</string>
<string name="sync_progress_init_list">正在获取服务器便签列表...</string>
<string name="sync_progress_login">登录%1$s...</string>
<string name="sync_progress_syncing">正在同步本地便签...</string>
<string name="ticker_cancel">同步已取消</string>
<string name="ticker_fail">同步失败</string>
<string name="ticker_success">同步成功</string>
<string name="ticker_syncing">同步便签...</string>
<string name="widget_havenot_content">没有关联内容,点击新建便签。</string>
<string name="widget_under_visit_mode">访客模式下,便签内容不可见</string>
</resources>

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="menu_share_ways">
<item>短信</item>
<item>郵件</item>
</string-array>
<plurals name="search_results_title">
<item quantity="other"><ns1:g id="NUMBER">%1$s</ns1:g> 條符合”<ns1:g id="SEARCH">%2$s</ns1:g>“的搜尋結果</item>
</plurals>
<string name="alert_message_delete_folder">確認刪除檔夾及所包含的便簽嗎?</string>
<string name="alert_message_delete_note">确认要删除該條便籤嗎?</string>
<string name="alert_message_delete_notes">确认要刪除所選的 %d 條便籤嗎?</string>
<string name="alert_title_delete">刪除</string>
<string name="app_name">便簽</string>
<string name="app_widget2x2">便簽2x2</string>
<string name="app_widget4x4">便簽4x4</string>
<string name="button_delete">刪除</string>
<string name="call_record_folder_name">通話便籤</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="datetime_dialog_ok">設置</string>
<string name="delete_remind_time_message">成功刪除提醒</string>
<string name="error_note_empty_for_clock">不能爲空便籤設置鬧鐘提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能將空便籤發送到桌面</string>
<string name="error_note_not_exist">要查看的便籤不存在</string>
<string name="error_sdcard_export">導出TXT時發生錯誤請檢查SD卡</string>
<string name="error_sdcard_unmounted">SD卡被佔用不能操作</string>
<string name="error_sync_cancelled">同步已取消</string>
<string name="error_sync_internal">同步失敗,發生內部錯誤</string>
<string name="error_sync_network">同步失敗,請檢查網絡和帳號設置</string>
<string name="failed_sdcard_export">導出失敗</string>
<string name="folder_exist">文件夾 %1$s 已存在,請重新命名</string>
<string name="format_date_ymd">yyyyMMdd</string>
<string name="format_datetime_mdhm">MM月dd日 kk:mm</string>
<string name="format_exported_file_location">已將文本文件(%1$s)導出至SD(%2$s)目錄</string>
<string name="format_move_notes_to_folder">已將所選 %1$d 便籤移到 %2$s 文件夾</string>
<string name="hint_foler_name">請輸入名稱</string>
<string name="info_note_enter_desktop">已添加到桌面</string>
<string name="menu_alert">提醒我</string>
<string name="menu_create_folder">新建文件夾</string>
<string name="menu_delete">刪除</string>
<string name="menu_deselect_all">取消全選</string>
<string name="menu_export_text">導出文本</string>
<string name="menu_folder_change_name">修改文件夾名稱</string>
<string name="menu_folder_delete">刪除文件夾</string>
<string name="menu_folder_view">查看文件夾</string>
<string name="menu_font_large"></string>
<string name="menu_font_normal">正常</string>
<string name="menu_font_size">文字大小</string>
<string name="menu_font_small"></string>
<string name="menu_font_super">超大</string>
<string name="menu_list_mode">進入清單模式</string>
<string name="menu_move">移動到文件夾</string>
<string name="menu_move_parent_folder">上一級文件夾</string>
<string name="menu_normal_mode">退出清單模式</string>
<string name="menu_remove_remind">刪除提醒</string>
<string name="menu_search">搜尋</string>
<string name="menu_select_all">全選</string>
<string name="menu_select_none">沒有選中項,操作無效</string>
<string name="menu_select_title">選中了 %d 項</string>
<string name="menu_send_to_desktop">發送到桌面</string>
<string name="menu_setting">設置</string>
<string name="menu_share">分享</string>
<string name="menu_sync">同步</string>
<string name="menu_sync_cancel">取消同步</string>
<string name="menu_title_select_folder">選擇文件夾</string>
<string name="note_alert_expired">已過期</string>
<string name="note_link_email">發送郵件</string>
<string name="note_link_other">打開地圖</string>
<string name="note_link_tel">呼叫電話</string>
<string name="note_link_web">浏覽網頁</string>
<string name="notealert_enter">查看</string>
<string name="notealert_ok">知道了</string>
<string name="notelist_menu_new">新建便簽</string>
<string name="notelist_string_info">...</string>
<string name="preferences_account_summary">与google task同步便簽記錄</string>
<string name="preferences_account_title">同步賬號</string>
<string name="preferences_add_account">添加賬號</string>
<string name="preferences_bg_random_appear_title">新建便籤背景顏色隨機</string>
<string name="preferences_button_sync_cancel">取消同步</string>
<string name="preferences_button_sync_immediately">立即同步</string>
<string name="preferences_dialog_change_account_title">當前帳號 %1$s</string>
<string name="preferences_dialog_change_account_warn_msg">如更換同步帳號,過去的帳號同步信息將被清空,再次切換的同時可能會造成數據重復</string>
<string name="preferences_dialog_select_account_tips">請選擇google帳號便簽將與該帳號的google task內容同步。</string>
<string name="preferences_dialog_select_account_title">同步便簽</string>
<string name="preferences_last_sync_time">上次同步于 %1$s</string>
<string name="preferences_menu_cancel">取消</string>
<string name="preferences_menu_change_account">更換賬號</string>
<string name="preferences_menu_remove_account">刪除賬號</string>
<string name="preferences_title">設置</string>
<string name="preferences_toast_cannot_change_account">正在同步中,不能修改同步帳號</string>
<string name="preferences_toast_success_set_accout">同步帳號已設置為%1$s</string>
<string name="search">便籤</string>
<string name="search_hint">搜索便籤</string>
<string name="search_label">正在搜索便籤</string>
<string name="search_setting_description">便籤中的文字</string>
<string name="set_remind_time_message">創建提醒</string>
<string name="success_sdcard_export">導出成功</string>
<string name="success_sync_account">與%1$s同步成功</string>
<string name="sync_progress_init_list">正在獲取服務器便籤列表...</string>
<string name="sync_progress_login">登陸%1$s...</string>
<string name="sync_progress_syncing">正在同步本地便籤...</string>
<string name="ticker_cancel">同步已取消</string>
<string name="ticker_fail">同步失敗</string>
<string name="ticker_success">同步成功</string>
<string name="ticker_syncing">同步便簽...</string>
<string name="widget_havenot_content">沒有關聯內容,點擊新建便簽。</string>
<string name="widget_under_visit_mode">訪客模式下,便籤內容不可見</string>
</resources>

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
<string-array name="format_for_exported_note">
<item>-%s</item>
<item>--%s</item>
<item>--%s</item>
<item>--%s</item>
</string-array>
<string-array name="menu_share_ways">
<item>Messaging</item>
<item>Email</item>
</string-array>
<color name="user_query_highlight">#335b5b5b</color>
<dimen name="text_font_size_large">26sp</dimen>
<dimen name="text_font_size_medium">20sp</dimen>
<dimen name="text_font_size_normal">17sp</dimen>
<dimen name="text_font_size_small">14sp</dimen>
<dimen name="text_font_size_super">33sp</dimen>
<plurals name="search_results_title">
<item quantity="one"><ns1:g example="1" id="number">%1$s</ns1:g> result for \"<ns1:g example="???" id="search">%2$s</ns1:g>\"</item>
<item quantity="other"><ns1:g example="15" id="number">%1$s</ns1:g> results for \"<ns1:g example="???" id="search">%2$s</ns1:g>\"</item>
</plurals>
<string name="alert_message_delete_folder">Confirm to delete folder and its notes?</string>
<string name="alert_message_delete_note">Confirm to delete this note?</string>
<string name="alert_message_delete_notes">Confirm to delete the selected %d notes?</string>
<string name="alert_title_delete">Delete selected notes</string>
<string name="app_name">Notes</string>
<string name="app_widget2x2">Notes 2x2</string>
<string name="app_widget4x4">Notes 4x4</string>
<string name="button_delete">Delete</string>
<string name="call_record_folder_name">Call notes</string>
<string name="datetime_dialog_cancel">cancel</string>
<string name="datetime_dialog_ok">set</string>
<string name="delete_remind_time_message">Delete reminder successfully</string>
<string name="error_note_empty_for_clock">Sorry, can not set clock on empty note</string>
<string name="error_note_empty_for_send_to_desktop">Sorry, can not send and empty note to home</string>
<string name="error_note_not_exist">The note is not exist</string>
<string name="error_sdcard_export">Export failed, please check SD card</string>
<string name="error_sdcard_unmounted">SD card busy, not available now</string>
<string name="error_sync_cancelled">Sync is canceled</string>
<string name="error_sync_internal">Sync failed, internal error occurs</string>
<string name="error_sync_network">Sync failed, please check network and account settings</string>
<string name="failed_sdcard_export">Export fail</string>
<string name="file_name_txt_format">notes_%s.txt</string>
<string name="file_path">/MIUI/notes/</string>
<string name="folder_exist">The folder %1$s exist, please rename</string>
<string name="format_date_ymd">yyyyMMdd</string>
<string name="format_datetime_mdhm">MMMd kk:mm</string>
<string name="format_exported_file_location">Export text file (%1$s) to SD (%2$s) directory</string>
<string name="format_folder_files_count">(%d)</string>
<string name="format_move_notes_to_folder">Have moved selected %1$d notes to %2$s folder</string>
<string name="hint_foler_name">Input name</string>
<string name="info_note_enter_desktop">Note added to home</string>
<string name="menu_alert">Remind me</string>
<string name="menu_create_folder">New Folder</string>
<string name="menu_delete">Delete</string>
<string name="menu_deselect_all">Deselect all</string>
<string name="menu_export_text">Export text</string>
<string name="menu_folder_change_name">Change folder name</string>
<string name="menu_folder_delete">Delete folder</string>
<string name="menu_folder_view">View folder</string>
<string name="menu_font_large">Large</string>
<string name="menu_font_normal">Medium</string>
<string name="menu_font_size">Font size</string>
<string name="menu_font_small">Small</string>
<string name="menu_font_super">Super</string>
<string name="menu_list_mode">Enter check list</string>
<string name="menu_move">Move to folder</string>
<string name="menu_move_parent_folder">Parent folder</string>
<string name="menu_normal_mode">Leave check list</string>
<string name="menu_remove_remind">Delete reminder</string>
<string name="menu_search">Search</string>
<string name="menu_select_all">Select all</string>
<string name="menu_select_none">Nothing selected, the operation is invalid</string>
<string name="menu_select_title">%d selected</string>
<string name="menu_send_to_desktop">Send to home</string>
<string name="menu_setting">Settings</string>
<string name="menu_share">Share</string>
<string name="menu_sync">Sync</string>
<string name="menu_sync_cancel">Cancel syncing</string>
<string name="menu_title_select_folder">Select folder</string>
<string name="note_alert_expired">Expired</string>
<string name="note_link_email">Send email</string>
<string name="note_link_other">Open map</string>
<string name="note_link_tel">Call</string>
<string name="note_link_web">Browse web</string>
<string name="notealert_enter">Take a look</string>
<string name="notealert_ok">Got it</string>
<string name="notelist_menu_new">Add note</string>
<string name="notelist_string_info">...</string>
<string name="preferences_account_summary">Sync notes with google task</string>
<string name="preferences_account_title">Sync account</string>
<string name="preferences_add_account">Add account</string>
<string name="preferences_bg_random_appear_title">New note background color random</string>
<string name="preferences_button_sync_cancel">Cancel syncing</string>
<string name="preferences_button_sync_immediately">Sync immediately</string>
<string name="preferences_dialog_change_account_title">Current account %1$s</string>
<string name="preferences_dialog_change_account_warn_msg">All sync related information will be deleted, which may result in duplicated items sometime</string>
<string name="preferences_dialog_select_account_tips">Please select a google account. Local notes will be synced with google task.</string>
<string name="preferences_dialog_select_account_title">Sync notes</string>
<string name="preferences_last_sync_time">Last sync time %1$s</string>
<string name="preferences_last_sync_time_format">yyyy-MM-dd hh:mm:ss</string>
<string name="preferences_menu_cancel">Cancel</string>
<string name="preferences_menu_change_account">Change sync account</string>
<string name="preferences_menu_remove_account">Remove sync account</string>
<string name="preferences_title">Settings</string>
<string name="preferences_toast_cannot_change_account">Cannot change the account because sync is in progress</string>
<string name="preferences_toast_success_set_accout">%1$s has been set as the sync account</string>
<string name="search">Notes</string>
<string name="search_hint">Search notes</string>
<string name="search_label">Searching Notes</string>
<string name="search_setting_description">Text in your notes</string>
<string name="set_remind_time_message">Set reminder</string>
<string name="success_sdcard_export">Export successful</string>
<string name="success_sync_account">Sync is successful with account %1$s</string>
<string name="sync_progress_init_list">Getting remote note list...</string>
<string name="sync_progress_login">Logging into %1$s...</string>
<string name="sync_progress_syncing">Synchronize local notes with Google Task...</string>
<string name="ticker_cancel">Sync is canceled</string>
<string name="ticker_fail">Sync is failed</string>
<string name="ticker_success">Sync is successful</string>
<string name="ticker_syncing">Syncing notes...</string>
<string name="widget_havenot_content">No associated note found, click to create associated note.</string>
<string name="widget_under_visit_mode">Privacy modecan not see note content</string>
<style name="HighlightTextAppearancePrimary">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColor">@color/primary_text_dark</item>
</style>
<style name="HighlightTextAppearanceSecondary">
<item name="android:textSize">@dimen/text_font_size_small</item>
<item name="android:textColor">@color/secondary_text_dark</item>
</style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
</style>
<style name="NoteTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>
</style>
<style name="TextAppearanceLarge">
<item name="android:textSize">@dimen/text_font_size_large</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceMedium">
<item name="android:textSize">@dimen/text_font_size_medium</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceNormal">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearancePrimaryItem">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColor">@color/primary_text_dark</item>
</style>
<style name="TextAppearanceSecondaryItem">
<item name="android:textSize">@dimen/text_font_size_small</item>
<item name="android:textColor">@color/secondary_text_dark</item>
</style>
<style name="TextAppearanceSuper">
<item name="android:textSize">@dimen/text_font_size_super</item>
<item name="android:textColorLink">#0000ff</item>
</style>
<style name="TextAppearanceUnderMenuIcon">
<item name="android:textSize">@dimen/text_font_size_normal</item>
<item name="android:textColor">@android:color/black</item>
</style>
</resources>

File diff suppressed because one or more lines are too long

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\main\assets"/><source path="D:\softwareengineering\minote\app\build\intermediates\shader_assets\debug\out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\debug\assets"/></dataSet></merger>

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\debug\jniLibs"/></dataSet></merger>

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="D:\softwareengineering\minote\app\src\debug\shaders"/></dataSet></merger>

@ -0,0 +1,4 @@
#Thu Apr 13 13:42:23 CST 2023
base.0=D\:\\softwareengineering\\minote\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex
path.0=classes.dex

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save