注释了一点

b_branch
ynmlzdwsp 1 year ago
parent 82d9f400d8
commit d4a66e755a

@ -1,13 +1,13 @@
i p
java:S1192Ž"MDefine a constant instead of duplicating this literal "Unknown URI " 4 times.(¶ª¦þüÿÿÿÿ java:S1192<18>"MDefine a constant instead of duplicating this literal "Unknown URI " 4 times.(¶ª¦þüÿÿÿÿ8µ„é«1
M
java:S1153ž"1Directly append the argument of String.valueOf().(œËߦýÿÿÿÿ

java:S3008L"eRename this field "NOTES_SNIPPET_SEARCH_QUERY" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Èò<C388>ƒùÿÿÿÿ
_
java:S1659"CDeclare "noteId" and all following declarations on a separate line.(Ÿàؘøÿÿÿÿ
T T
java:S2130É"8Use "Long.parseLong" for this string-to-long conversion.(•ãÿ¬ÿÿÿÿÿ java:S1153â"1Directly append the argument of String.valueOf().(œËߦýÿÿÿÿ8µ„é«1
N 
java:S1135­"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ java:S3008S"eRename this field "NOTES_SNIPPET_SEARCH_QUERY" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(Èò<C388>ƒùÿÿÿÿ8Ú¶„é«1
f
java:S1659²"CDeclare "noteId" and all following declarations on a separate line.(Ÿàؘøÿÿÿÿ8é«1
[
java:S2130î"8Use "Long.parseLong" for this string-to-long conversion.(•ãÿ¬ÿÿÿÿÿ8ø¶„é«1
U
java:S1135ø"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8·„é«1

@ -1,11 +1,11 @@
{ {
java:S2293)"YReplace the type specification in this constructor call with the diamond operator ("<>").(<28>½ñäÿÿÿÿÿ8«’Ò¿«1 java:S2293,"YReplace the type specification in this constructor call with the diamond operator ("<>").(<28>½ñäÿÿÿÿÿ8ÜÝ<EFBFBD>è«1
W W
java:S1118":Add a private constructor to hide the implicit public one.(ãÛÒÛ8Â’Ò¿«1 java:S1118":Add a private constructor to hide the implicit public one.(ãÛÒÛ8üÝ<EFBFBD>è«1
x x
java:S3252!"VUse static access with "android.provider.ContactsContract$DataColumns" for "MIMETYPE".(‡ù¯–ÿÿÿÿÿ8È’Ò¿«1 java:S3252#"VUse static access with "android.provider.ContactsContract$DataColumns" for "MIMETYPE".(‡ù¯–ÿÿÿÿÿ8‡Þ<EFBFBD>è«1
y y
java:S3252""\Use static access with "android.provider.ContactsContract$DataColumns" for "RAW_CONTACT_ID".(Ðäç÷8È’Ò¿«1 java:S3252$"\Use static access with "android.provider.ContactsContract$DataColumns" for "RAW_CONTACT_ID".(Ðäç÷8‡Þ<EFBFBD>è«1
{ {
java:S32524"^Use static access with "android.provider.ContactsContract$ContactsColumns" for "DISPLAY_NAME".(Úÿ†Ø8Ê’Ò¿«1 java:S3252<"^Use static access with "android.provider.ContactsContract$ContactsColumns" for "DISPLAY_NAME".(Úÿ†Ø8Þ<EFBFBD>è«1

@ -141,3 +141,11 @@ w
G.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9,0\1\0105d5a774c76db833eb83cbebde54a8abef1599 G.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9,0\1\0105d5a774c76db833eb83cbebde54a8abef1599
d d
4app/src/main/java/net/micode/notes/data/Contact.java,9\a\9a3a19793537958b8b1b03a81985999e22705a2f 4app/src/main/java/net/micode/notes/data/Contact.java,9\a\9a3a19793537958b8b1b03a81985999e22705a2f
b
2app/src/main/java/net/micode/notes/data/Notes.java,a\7\a7641cfac724321d508c2a284223a711011a93f5
p
@app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java,1\e\1eb2363b523dbcae43d3c6e4790c64436af61b13
k
;app/src/main/java/net/micode/notes/gtask/data/MetaData.java,c\1\c182d0c9c237ea8a46a92ccaae9bb5c751923a88
j
:app/src/main/java/net/micode/notes/data/NotesProvider.java,6\a\6a65e747031f27aef20597b4181148a9fbf963d5

@ -141,3 +141,11 @@ w
G.idea/sonarlint/issuestore/f/4/f4a01d6a4fcb971362ec00a83903fd3902f52164,3\1\31073cf3a12b082ef2fe0f9403916a4db3811c89 G.idea/sonarlint/issuestore/f/4/f4a01d6a4fcb971362ec00a83903fd3902f52164,3\1\31073cf3a12b082ef2fe0f9403916a4db3811c89
w w
G.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9,0\1\0105d5a774c76db833eb83cbebde54a8abef1599 G.idea/sonarlint/issuestore/9/e/9e08934d811afe28fbc77aaa3c0d747b94348db9,0\1\0105d5a774c76db833eb83cbebde54a8abef1599
b
2app/src/main/java/net/micode/notes/data/Notes.java,a\7\a7641cfac724321d508c2a284223a711011a93f5
p
@app/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java,1\e\1eb2363b523dbcae43d3c6e4790c64436af61b13
j
:app/src/main/java/net/micode/notes/data/NotesProvider.java,6\a\6a65e747031f27aef20597b4181148a9fbf963d5
k
;app/src/main/java/net/micode/notes/gtask/data/MetaData.java,c\1\c182d0c9c237ea8a46a92ccaae9bb5c751923a88

@ -147,7 +147,10 @@ public class SqlData {
public void commit(long noteId, boolean validateVersion, long version) { public void commit(long noteId, boolean validateVersion, long version) {
if (mIsCreate) { if (mIsCreate) {
//创建新的数据
if (mDataId == INVALID_ID && mDiffDataValues.containsKey(DataColumns.ID)) { if (mDataId == INVALID_ID && mDiffDataValues.containsKey(DataColumns.ID)) {
//如果 mDataId 的值为无效的 ID
// 并且 mDiffDataValues 包含了键为 DataColumns.ID 的差异数据,则会将该键移除。
mDiffDataValues.remove(DataColumns.ID); mDiffDataValues.remove(DataColumns.ID);
} }
@ -160,6 +163,7 @@ public class SqlData {
throw new ActionFailureException("create note failed"); throw new ActionFailureException("create note failed");
} }
} else { } else {
//更新已有的数据
if (mDiffDataValues.size() > 0) { if (mDiffDataValues.size() > 0) {
int result = 0; int result = 0;
if (!validateVersion) { if (!validateVersion) {

@ -166,6 +166,10 @@ public class SqlNote {
} }
/**
* ID
* @param id
*/
private void loadFromCursor(long id) { private void loadFromCursor(long id) {
Cursor c = null; Cursor c = null;
try { try {
@ -185,6 +189,7 @@ public class SqlNote {
} }
} }
private void loadFromCursor(Cursor c) { private void loadFromCursor(Cursor c) {
mId = c.getLong(ID_COLUMN); mId = c.getLong(ID_COLUMN);
mAlertDate = c.getLong(ALERTED_DATE_COLUMN); mAlertDate = c.getLong(ALERTED_DATE_COLUMN);
@ -226,12 +231,21 @@ public class SqlNote {
} }
} }
/**
* JSONjsnotenote
* @param js
* @return
*/
public boolean setContent(JSONObject js) { public boolean setContent(JSONObject js) {
try { try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE); JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_SYSTEM) { if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_SYSTEM) {
//无法设置系统文件夹,会记录一个警告日志
Log.w(TAG, "cannot set system folder"); Log.w(TAG, "cannot set system folder");
} else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) { } else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) {
//只能更新摘要snippet和类型type
// 如果正在创建新的文件夹或者摘要与原摘要不相同则将摘要添加到差异值列表mDiffNoteValues中
// 并更新当前的摘要mSnippet和类型mType。
// for folder we can only update the snnipet and type // for folder we can only update the snnipet and type
String snippet = note.has(NoteColumns.SNIPPET) ? note String snippet = note.has(NoteColumns.SNIPPET) ? note
.getString(NoteColumns.SNIPPET) : ""; .getString(NoteColumns.SNIPPET) : "";
@ -247,6 +261,11 @@ public class SqlNote {
} }
mType = type; mType = type;
} else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_NOTE) { } else if (note.getInt(NoteColumns.TYPE) == Notes.TYPE_NOTE) {
//如果note的类型为笔记类型Notes.TYPE_NOTE
// 则需要进一步处理其中的数据数组dataArray。
// 先获取笔记的ID、提醒日期、背景色ID、创建日期、附件标识、修改日期、父文件夹ID、摘要、类型、
// 小部件ID、小部件类型和原始父文件夹ID等信息并将它们与当前的值进行比较
// 如果有改变则添加到差异值列表中并更新对应的字段
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA); JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
long id = note.has(NoteColumns.ID) ? note.getLong(NoteColumns.ID) : INVALID_ID; long id = note.has(NoteColumns.ID) ? note.getLong(NoteColumns.ID) : INVALID_ID;
if (mIsCreate || mId != id) { if (mIsCreate || mId != id) {
@ -331,6 +350,7 @@ public class SqlNote {
} }
mOriginParent = originParent; mOriginParent = originParent;
//遍历数据数组dataArray将每个数据对象转换为SqlData对象并设置其内容
for (int i = 0; i < dataArray.length(); i++) { for (int i = 0; i < dataArray.length(); i++) {
JSONObject data = dataArray.getJSONObject(i); JSONObject data = dataArray.getJSONObject(i);
SqlData sqlData = null; SqlData sqlData = null;

Loading…
Cancel
Save