Merge branch 'wlx_real_branch'

a_branch
王岚馨 1 year ago
commit 6c3b3607aa

@ -0,0 +1,29 @@
g
java:S1301"KReplace this "switch" statement by "if" statements to increase readability.(öÛ«°þÿÿÿÿ
X
java:S18749"=Remove this use of "FLAG_SHOW_WHEN_LOCKED"; it is deprecated.(÷±µÁúÿÿÿÿ
Q
java:S1874=";Remove this use of "FLAG_TURN_SCREEN_ON"; it is deprecated.(ƒìýè
Z
java:S1874?"?Remove this use of "FLAG_LAYOUT_INSET_DECOR"; it is deprecated.(‹”‡Ñúÿÿÿÿ
H
java:S1874["2Remove this use of "isScreenOn"; it is deprecated.(¤® ²
O
java:S1874e":Remove this use of "setAudioStreamType"; it is deprecated.(¡Ìé0
U
java:S1874g":Remove this use of "setAudioStreamType"; it is deprecated.(†Å¨ªùÿÿÿÿ
`
java:S2147q"ECombine this catch with the one at line 110, which has the same body.(ÿëÛßúÿÿÿÿ
[
java:S2147t"ECombine this catch with the one at line 113, which has the same body.(‚ùïÄ
[
java:S2147w"ECombine this catch with the one at line 116, which has the same body.(ï­£Ä
M
java:S1135o"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ
M
java:S1135r"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ
M
java:S1135u"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ
M
java:S1135x"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ

@ -0,0 +1,11 @@
t
java:S2293)"YReplace the type specification in this constructor call with the diamond operator ("<>").(<28>½ñäÿÿÿÿÿ
P
java:S1118":Add a private constructor to hide the implicit public one.(ãÛÒÛ
q
java:S3252!"VUse static access with "android.provider.ContactsContract$DataColumns" for "MIMETYPE".(‡ù¯–ÿÿÿÿÿ
r
java:S3252""\Use static access with "android.provider.ContactsContract$DataColumns" for "RAW_CONTACT_ID".(Ðäç÷
t
java:S32524"^Use static access with "android.provider.ContactsContract$ContactsColumns" for "DISPLAY_NAME".(Úÿ†Ø

@ -0,0 +1,9 @@
m
java:S37764"RRefactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.(üßú–ùÿÿÿÿ
O
java:S1874@"9Remove this use of "setTextAppearance"; it is deprecated.(¤ñÝ×
O
java:S1874G"9Remove this use of "setTextAppearance"; it is deprecated.(Á†<C381>ö
O
java:S1874Q"9Remove this use of "setTextAppearance"; it is deprecated.(¤ñÝ×

@ -0,0 +1,16 @@
V java:S125"<This block of commented-out lines of code should be removed.(Í<C38D>¸ýÿÿÿÿ

java:S3008&"eRename this field "GTASK_SYNC_NOTIFICATION_ID" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ëíÅÍúÿÿÿÿ
L
java:S1874$"1Remove this use of "AsyncTask"; it is deprecated.(¯ÚÔËúÿÿÿÿ
N
java:S3878A"8Remove this array creation and simply pass the elements.(‘Àߎ
M
java:S1874A"7Remove this use of "publishProgress"; it is deprecated.(‘Àߎ
e
java:S1874f"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(ë•·ÿÿÿÿÿ
e
java:S1874n"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(÷ችûÿÿÿÿ
H
java:S1068."2Remove this unused "mNotifiManager" private field.(ºíØÛ

@ -0,0 +1,39 @@
t
java:S22930"YReplace the type specification in this constructor call with the diamond operator ("<>").(àÉ™âùÿÿÿÿ
o
java:S2293d"YReplace the type specification in this constructor call with the diamond operator ("<>").(œ€ÄÑ
o
java:S2293t"YReplace the type specification in this constructor call with the diamond operator ("<>").(¾<>Ȫ
J
java:S1066\"/Merge this if statement with the enclosing one.(ßÚ§µúÿÿÿÿ
ˆ
java:S1319c"mThe return type of this method should be an interface such as "Set" rather than the implementation "HashSet".(“Ÿóßûÿÿÿÿ
ˆ
java:S1319s"mThe return type of this method should be an interface such as "Set" rather than the implementation "HashSet".(•Ñòóýÿÿÿÿ
j
java:S1104*"TMake widgetId a static final constant or non-public and provide accessors if needed.(åÇŽ<C387>
q
java:S1104+"VMake widgetType a static final constant or non-public and provide accessors if needed.(ö漬þÿÿÿÿ
C
java:S5411f"(Use a primitive boolean expression here.(ɯÀÐüÿÿÿÿ
C
java:S5411v"(Use a primitive boolean expression here.(ɯÀÐüÿÿÿÿ
D
java:S5411˜"(Use a primitive boolean expression here.( „Œ¢ùÿÿÿÿ
7
java:S1116,"Remove this empty statement.(ôŸŽìúÿÿÿÿ
D
java:S1874/".Remove this use of "<init>"; it is deprecated.(ÌÖçü
J
java:S2864e"4Iterate over the "entrySet" instead of the "keySet".(਷â
B
java:S1125f"'Remove the unnecessary boolean literal.(ɯÀÐüÿÿÿÿ
J
java:S2864u"4Iterate over the "entrySet" instead of the "keySet".(਷â
B
java:S1125v"'Remove the unnecessary boolean literal.(ɯÀÐüÿÿÿÿ
B
java:S1168ƒ"+Return an empty collection instead of null.(¥¹ï<C2B9>
C
java:S1125˜"'Remove the unnecessary boolean literal.( „Œ¢ùÿÿÿÿ

@ -0,0 +1,13 @@
f
java:S11929"KDefine a constant instead of duplicating this literal "content://" 4 times.(š¨ú¯üÿÿÿÿ
U
java:S11181":Add a private constructor to hide the implicit public one.(ž’Í“úÿÿÿÿ
^
java:S1214@"CMove constants defined in this interfaces to another class or enum.(É⸫úÿÿÿÿ
Z
java:S1214ª"CMove constants defined in this interfaces to another class or enum.(ŠÉôŸ
V
java:S1118ô":Add a private constructor to hide the implicit public one.(<28>ˆþÿÿÿÿ
Q
java:S1118":Add a private constructor to hide the implicit public one.(߀°•

@ -1,72 +1,74 @@
w
java:S2293ˆ"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥ð8—©æÛª1
java:S2293¡"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥ð8Ž³”‚¬1
n
java:S1301"KReplace this "switch" statement by "if" statements to increase readability.(ד¾ñùÿÿÿÿ8ž©æÛª1
java:S1301Ï"KReplace this "switch" statement by "if" statements to increase readability.(ד¾ñùÿÿÿÿ8‘³”‚¬1
>
java:S1116e"Remove this empty statement.(ôŸŽìúÿÿÿÿ8ŪæÛª1
java:S1116e"Remove this empty statement.(ôŸŽìúÿÿÿÿ8ü´”‚¬1
h
java:S1124Œ"EReorder the modifiers to comply with the Java Language Specification.(¹úæµûÿÿÿÿ8ǪæÛª1
java:S1124Œ"EReorder the modifiers to comply with the Java Language Specification.(¹úæµûÿÿÿÿ8ý´”‚¬1
b
java:S1124<18>"EReorder the modifiers to comply with the Java Language Specification.(ìѾk8ǪæÛª1
java:S1124<18>"EReorder the modifiers to comply with the Java Language Specification.(ìѾk8ý´”‚¬1
u
java:S3776¥"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(áé–Þÿÿÿÿÿ8ѪæÛª1
java:S3776¥"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(áé–Þÿÿÿÿÿ8ÿ´”‚¬1
9
java:S3626"Remove this redundant jump.(ûÁÝ…8ѪæÛª1
java:S3626"Remove this redundant jump.(ûÁÝ…8€µ”‚¬1
9
java:S3626º"Remove this redundant jump.(ûÁÝ…8ѪæÛª1
java:S3626º"Remove this redundant jump.(ûÁÝ…8€µ”‚¬1
9
java:S3626Î"Remove this redundant jump.(ûÁÝ…8ÒªæÛª1
java:S3626Î"Remove this redundant jump.(ûÁÝ…8€µ”‚¬1
W
java:S1874¦"9Remove this use of "PreferenceManager"; it is deprecated.(­©Ð8ÕªæÛª1
java:S1874¦"9Remove this use of "PreferenceManager"; it is deprecated.(­©Ð8€µ”‚¬1
a
java:S1874¦"CRemove this use of "getDefaultSharedPreferences"; it is deprecated.(­©Ð8ÖªæÛª1
java:S1874¦"CRemove this use of "getDefaultSharedPreferences"; it is deprecated.(­©Ð8€µ”‚¬1
U
java:S1135À"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ8ÞªæÛª1
java:S1135À"2Complete the task associated to this TODO comment.(ÕÌ<C395>®þÿÿÿÿ8…µ”‚¬1
M
java:S2093ª"*Change this "try" to a try-with-resources.(¡»¢üùÿÿÿÿ8ÞªæÛª1
java:S2093ª"*Change this "try" to a try-with-resources.(¡»¢üùÿÿÿÿ8…µ”‚¬1
v
java:S1450ò"XRemove the "mMoveMenu" field and declare it as a local variable in the relevant methods.(ž¢—ò8ëªæÛª1
java:S1450ò"XRemove the "mMoveMenu" field and declare it as a local variable in the relevant methods.(ž¢—ò8‹µ”‚¬1
u
java:S3252ï"RUse static access with "android.widget.AbsListView" for "MultiChoiceModeListener".(¦Ûî„úÿÿÿÿ8íªæÛª1
java:S3252ï"RUse static access with "android.widget.AbsListView" for "MultiChoiceModeListener".(¦Ûî„úÿÿÿÿ8‹µ”‚¬1
U
java:S1135§"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8«æÛª1
java:S1135«"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8“µ”¬1
U
java:S1135¬"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8Œ«æÛª1
java:S1135°"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8“µ”¬1
\
java:S1874ç"9Remove this use of "getDefaultDisplay"; it is deprecated.(ĸ¬Ìýÿÿÿÿ8—«æÛª1
java:S1874ó"9Remove this use of "getDefaultDisplay"; it is deprecated.(ĸ¬Ìýÿÿÿÿ8œµ”¬1
T
java:S1874è"1Remove this use of "getHeight"; it is deprecated.(·¡ªÃýÿÿÿÿ8˜«æÛª1
java:S1874ô"1Remove this use of "getHeight"; it is deprecated.(·¡ªÃýÿÿÿÿ8œµ”¬1
?
java:S1116ž"Remove this empty statement.(ôŸŽìúÿÿÿÿ8<>«æÛª1
java:S1116ª"Remove this empty statement.(ôŸŽìúÿÿÿÿ8Ÿµ”¬1
p
java:S3776Ý"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(ãìîí8ª«æÛª1
java:S3776ö"RRefactor this method to reduce its Cognitive Complexity from 20 to the 15 allowed.(ãìîí8³µ”¬1
J
java:S1874Þ".Remove this use of "<init>"; it is deprecated.(ýî?8¬«æÛª1
F java:S108ä")Either remove or fill this block of code.(žûÊ¥8°«æÛª1
java:S1874÷".Remove this use of "<init>"; it is deprecated.(ýî?8³µ”¬1
F java:S108ý")Either remove or fill this block of code.(žûÊ¥8´µ”¬1
h
java:S1874<18>"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(§Í¿Â8ö©è߬1
R
java:S1874ÿ"/Remove this use of "execute"; it is deprecated.( å«<C3A5>ûÿÿÿÿ8²«æÛª1
java:S1874˜"/Remove this use of "execute"; it is deprecated.( å«<C3A5>ûÿÿÿÿ8¶µ”¬1
o
java:S3776Ë"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(ÅôÉ#8¾«æÛª1
java:S3776ä"RRefactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.(ÅôÉ#8¾µ”¬1
U
java:S1135<EFBFBD>"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8Í«æÛª1
java:S1135¦"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8Ƶ”¬1
e
java:S1126"BReplace this if-then-else statement by a single method invocation.(玒¦ýÿÿÿÿ8ΫæÛª1
java:S1126«"BReplace this if-then-else statement by a single method invocation.(玒¦ýÿÿÿÿ8ǵ”¬1
U
java:S1135š"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8ЫæÛª1
java:S1135³"2Complete the task associated to this TODO comment.(» æžÿÿÿÿÿ8ǵ”¬1
Q
java:S1874Â".Remove this use of "<init>"; it is deprecated.(ЧðÛýÿÿÿÿ8æ«æÛª1
java:S1874Û".Remove this use of "<init>"; it is deprecated.(ЧðÛýÿÿÿÿ8Öµ”¬1
m
java:S1874Ê"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(÷ችûÿÿÿÿ8è«æÛª1
java:S1874ã"JDon't override a deprecated method or explicitly mark it as "@Deprecated".(÷ችûÿÿÿÿ8æÊØà¬1
R
java:S1874ç"/Remove this use of "execute"; it is deprecated.( å«<C3A5>ûÿÿÿÿ8í«æÛª1
java:S1874"/Remove this use of "execute"; it is deprecated.( å«<C3A5>ûÿÿÿÿ8Ùµ”¬1
o
java:S3776ö"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(ôŒùb8ó«æÛª1
java:S3776<EFBFBD>"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(ôŒùb8Ûµ”¬1
C
java:S3398Ý"%Move this method into "ModeCallback".(ãìîí8ý«æÛª1
java:S3398ö"%Move this method into "ModeCallback".(ãìîí8ൔ¬1
H
java:S3398<EFBFBD>"%Move this method into "ModeCallback".(“ðÉçýÿÿÿÿ8ý«æÛª1
java:S3398"%Move this method into "ModeCallback".(“ðÉçýÿÿÿÿ8ൔ¬1
R
java:S3398Á"/Move this method into "BackgroundQueryHandler".(—÷õŽüÿÿÿÿ8ý«æÛª1
java:S3398Ú"/Move this method into "BackgroundQueryHandler".(—÷õŽüÿÿÿÿ8ൔ¬1
N
java:S3398<EFBFBD>"0Move this method into "OnListItemClickListener".(‘ðð¡8ý«æÛª1
java:S3398"0Move this method into "OnListItemClickListener".(‘ðð¡8ൔ¬1

@ -0,0 +1,11 @@
s
java:S4144Á"\Update this method so that its implementation is not identical to "getParentId" on line 185.(ø¦¯ÿ
>
java:S1125T"(Remove the unnecessary boolean literals.(ú«€É
m
java:S3776p"RRefactor this method to reduce its Cognitive Complexity from 18 to the 15 allowed.(Ñý¨úýÿÿÿÿ
C
java:S1125q"(Remove the unnecessary boolean literals.(¢´—Öÿÿÿÿÿ
>
java:S1125r"(Remove the unnecessary boolean literals.(ãêÛì

@ -6,4 +6,18 @@ Tapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/DropdownMenu
<
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
@
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
<EFBFBD>
Qapp/src/main/java/com/example/notes_master/src/net/micode/notes/data/Contact.java,0\8\08962fe591286696ecd017e3adc4630c1217309b
<EFBFBD>
`app/src/main/java/com/example/notes_master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java,1\a\1a4e3da7b86cbac8cbaa0189939fbddcc15fe216
Š
Zapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/AlarmAlertActivity.java,0\4\0443b0f98e2a8a605b866a1b1bef7e47c8c8ea8e

Tapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NoteItemData.java,d\6\d63b8495246ee14beb91a1f887d1ff4a009634d3
ˆ
Xapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NotesListAdapter.java,3\2\32e993b9c4de8af917eefa04505aeda3d70c1aff

Oapp/src/main/java/com/example/notes_master/src/net/micode/notes/data/Notes.java,4\1\41b8b7f348f46f3b57551e41c1bbe95463dbc90e

Uapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NotesListItem.java,1\9\19661b4b3ff75e064358871f8409e1a1eef63bf6

@ -6,4 +6,18 @@ Tapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/DropdownMenu
<
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
@
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca
<EFBFBD>
Qapp/src/main/java/com/example/notes_master/src/net/micode/notes/data/Contact.java,0\8\08962fe591286696ecd017e3adc4630c1217309b
<EFBFBD>
`app/src/main/java/com/example/notes_master/src/net/micode/notes/gtask/remote/GTaskASyncTask.java,1\a\1a4e3da7b86cbac8cbaa0189939fbddcc15fe216
Š
Zapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/AlarmAlertActivity.java,0\4\0443b0f98e2a8a605b866a1b1bef7e47c8c8ea8e

Tapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NoteItemData.java,d\6\d63b8495246ee14beb91a1f887d1ff4a009634d3

Oapp/src/main/java/com/example/notes_master/src/net/micode/notes/data/Notes.java,4\1\41b8b7f348f46f3b57551e41c1bbe95463dbc90e
ˆ
Xapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NotesListAdapter.java,3\2\32e993b9c4de8af917eefa04505aeda3d70c1aff

Uapp/src/main/java/com/example/notes_master/src/net/micode/notes/ui/NotesListItem.java,1\9\19661b4b3ff75e064358871f8409e1a1eef63bf6

@ -24,14 +24,14 @@ import android.telephony.PhoneNumberUtils;
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 final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
+ " AND " + Data.RAW_CONTACT_ID + " IN "
+ "(SELECT raw_contact_id "
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";

@ -17,6 +17,7 @@
package com.example.notes_master.src.net.micode.notes.data;
import android.net.Uri;
//便签数据库,用于记录便签相关属性和数据
public class Notes {
public static final String AUTHORITY = "micode_notes";
public static final String TAG = "Notes";

@ -26,7 +26,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes.DataColumns;
import com.example.notes_master.src.net.micode.notes.data.Notes.DataConstants;
import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
//数据库帮助类,用于辅助创建、处理数据库的条目
public class NotesDatabaseHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "note.db";
@ -43,168 +43,168 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
private static NotesDatabaseHelper mInstance;
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" +
")";
"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" +
")";
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.DATA1 + " INTEGER," +
DataColumns.DATA2 + " INTEGER," +
DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
")";
"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.DATA1 + " INTEGER," +
DataColumns.DATA2 + " INTEGER," +
DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
")";
private static final String CREATE_DATA_NOTE_ID_INDEX_SQL =
"CREATE INDEX IF NOT EXISTS note_id_index ON " +
TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";
"CREATE INDEX IF NOT EXISTS note_id_index ON " +
TABLE.DATA + "(" + DataColumns.NOTE_ID + ");";
/**
* 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 "+
" AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
" WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
" END";
"CREATE TRIGGER increase_folder_count_on_update "+
" AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
" WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
" END";
/**
* 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 " +
" AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
" WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
" AND " + NoteColumns.NOTES_COUNT + ">0" + ";" +
" END";
"CREATE TRIGGER decrease_folder_count_on_update " +
" AFTER UPDATE OF " + NoteColumns.PARENT_ID + " ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
" WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
" AND " + NoteColumns.NOTES_COUNT + ">0" + ";" +
" END";
/**
* 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 " +
" AFTER INSERT ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
" WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
" END";
"CREATE TRIGGER increase_folder_count_on_insert " +
" AFTER INSERT ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + " + 1" +
" WHERE " + NoteColumns.ID + "=new." + NoteColumns.PARENT_ID + ";" +
" END";
/**
* 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 " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
" WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
" AND " + NoteColumns.NOTES_COUNT + ">0;" +
" END";
"CREATE TRIGGER decrease_folder_count_on_delete " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN " +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.NOTES_COUNT + "=" + NoteColumns.NOTES_COUNT + "-1" +
" WHERE " + NoteColumns.ID + "=old." + NoteColumns.PARENT_ID +
" AND " + NoteColumns.NOTES_COUNT + ">0;" +
" END";
/**
* Update note's content when insert data with type {@link DataConstants#NOTE}
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_INSERT_TRIGGER =
"CREATE TRIGGER update_note_content_on_insert " +
" AFTER INSERT ON " + TABLE.DATA +
" WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
" WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
" END";
"CREATE TRIGGER update_note_content_on_insert " +
" AFTER INSERT ON " + TABLE.DATA +
" WHEN new." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
" WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
" END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has changed
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_UPDATE_TRIGGER =
"CREATE TRIGGER update_note_content_on_update " +
" AFTER UPDATE ON " + TABLE.DATA +
" WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
" WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
" END";
"CREATE TRIGGER update_note_content_on_update " +
" AFTER UPDATE ON " + TABLE.DATA +
" WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=new." + DataColumns.CONTENT +
" WHERE " + NoteColumns.ID + "=new." + DataColumns.NOTE_ID + ";" +
" END";
/**
* Update note's content when data with {@link DataConstants#NOTE} type has deleted
*/
private static final String DATA_UPDATE_NOTE_CONTENT_ON_DELETE_TRIGGER =
"CREATE TRIGGER update_note_content_on_delete " +
" AFTER delete ON " + TABLE.DATA +
" WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=''" +
" WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" +
" END";
"CREATE TRIGGER update_note_content_on_delete " +
" AFTER delete ON " + TABLE.DATA +
" WHEN old." + DataColumns.MIME_TYPE + "='" + DataConstants.NOTE + "'" +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.SNIPPET + "=''" +
" WHERE " + NoteColumns.ID + "=old." + DataColumns.NOTE_ID + ";" +
" END";
/**
* 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 " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN" +
" DELETE FROM " + TABLE.DATA +
" WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" +
" END";
"CREATE TRIGGER delete_data_on_delete " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN" +
" DELETE FROM " + TABLE.DATA +
" WHERE " + DataColumns.NOTE_ID + "=old." + NoteColumns.ID + ";" +
" END";
/**
* 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 " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN" +
" DELETE FROM " + TABLE.NOTE +
" WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
" END";
"CREATE TRIGGER folder_delete_notes_on_delete " +
" AFTER DELETE ON " + TABLE.NOTE +
" BEGIN" +
" DELETE FROM " + TABLE.NOTE +
" WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
" END";
/**
* 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 " +
" AFTER UPDATE ON " + TABLE.NOTE +
" WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
" WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
" END";
"CREATE TRIGGER folder_move_notes_on_trash " +
" AFTER UPDATE ON " + TABLE.NOTE +
" WHEN new." + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
" BEGIN" +
" UPDATE " + TABLE.NOTE +
" SET " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER +
" WHERE " + NoteColumns.PARENT_ID + "=old." + NoteColumns.ID + ";" +
" END";
public NotesDatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);

@ -35,7 +35,7 @@ import com.example.notes_master.src.net.micode.notes.data.NotesDatabaseHelper.TA
import net.micode.notes.R;
//便签信息提供类
public class NotesProvider extends ContentProvider {
private static final UriMatcher mMatcher;
@ -67,18 +67,18 @@ public class NotesProvider extends ContentProvider {
* 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 + ","
+ "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + ","
+ 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;
+ NoteColumns.ID + " AS " + SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA + ","
+ "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_1 + ","
+ "TRIM(REPLACE(" + NoteColumns.SNIPPET + ", x'0A','')) AS " + SearchManager.SUGGEST_COLUMN_TEXT_2 + ","
+ 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() {
@ -88,7 +88,7 @@ public class NotesProvider extends ContentProvider {
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
String sortOrder) {
Cursor c = null;
SQLiteDatabase db = mHelper.getReadableDatabase();
String id = null;

@ -24,7 +24,7 @@ import com.example.notes_master.src.net.micode.notes.tool.GTaskStringUtils;
import org.json.JSONException;
import org.json.JSONObject;
//关于同步任务的元数据
public class MetaData extends Task {
private final static String TAG = MetaData.class.getSimpleName();

@ -19,7 +19,7 @@ package com.example.notes_master.src.net.micode.notes.gtask.data;
import android.database.Cursor;
import org.json.JSONObject;
//同步任务的管理节点,用于设置、保存同步动作的信息
public abstract class Node {
public static final int SYNC_ACTION_NONE = 0;

@ -34,7 +34,7 @@ import com.example.notes_master.src.net.micode.notes.gtask.exception.ActionFailu
import org.json.JSONException;
import org.json.JSONObject;
//数据库中基本数据,方法包括读取数据、获取数据库中数据、提交数据到数据库
public class SqlData {
private static final String TAG = SqlData.class.getSimpleName();

@ -37,7 +37,7 @@ import org.json.JSONObject;
import java.util.ArrayList;
//数据库中便签数据,方法包括读取便签内容、从数据库中获取便签数据、设置便签内容、提交便签到数据库
public class SqlNote {
private static final String TAG = SqlNote.class.getSimpleName();

@ -31,7 +31,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
//同步任务将创建、更新和同步动作包装成JSON对象用本地和远程的JSON对节点内容进行设置获取同步信息进行本地和远程的同步
public class Task extends Node {
private static final String TAG = Task.class.getSimpleName();

@ -29,7 +29,7 @@ import org.json.JSONObject;
import java.util.ArrayList;
//同步任务列表将Task组织成同步任务列表进行管理
public class TaskList extends Node {
private static final String TAG = TaskList.class.getSimpleName();

@ -15,7 +15,7 @@
*/
package com.example.notes_master.src.net.micode.notes.gtask.exception;
//动作失败异常
public class ActionFailureException extends RuntimeException {
private static final long serialVersionUID = 4425249765923293627L;

@ -15,7 +15,7 @@
*/
package com.example.notes_master.src.net.micode.notes.gtask.exception;
//网络失败异常
public class NetworkFailureException extends Exception {
private static final long serialVersionUID = 2107610287180234136L;

@ -32,7 +32,7 @@ import com.example.notes_master.src.net.micode.notes.ui.NotesPreferenceActivity;
import net.micode.notes.R;
//GTask异步任务方法包括任务同步和取消显示同步任务的进程、通知和结果
public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
private static int GTASK_SYNC_NOTIFICATION_ID = 5234235;

@ -60,7 +60,7 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
//GTask客户端提供登录Google账户创建任务和任务列表添加和删除节点提交、重置更新获取任务列表等功能
public class GTaskClient {
private static final String TAG = GTaskClient.class.getSimpleName();

@ -47,7 +47,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
//GTask管理者提供同步本地和远端的任务初始化任务列表同步内容、文件夹添加、更新本地和远端节点刷新本地同步任务ID等功能
public class GTaskManager {
private static final String TAG = GTaskManager.class.getSimpleName();

@ -22,7 +22,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
//GTask同步服务用于提供同步服务开始、取消同步发送广播
public class GTaskSyncService extends Service {
public final static String ACTION_STRING_NAME = "sync_action_type";

@ -32,8 +32,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
import com.example.notes_master.src.net.micode.notes.data.Notes.TextNote;
import java.util.ArrayList;
//单个便签项
public class Note {
private ContentValues mNoteDiffValues;
private NoteData mNoteData;

@ -31,7 +31,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
import com.example.notes_master.src.net.micode.notes.data.Notes.TextNote;
import com.example.notes_master.src.net.micode.notes.tool.ResourceParser.NoteBgResources;
//当前活动便签项
public class WorkingNote {
// Note for the working note
private Note mNote;

@ -36,7 +36,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
//备份工具类,用于数据备份读取、显示
public class BackupUtils {
private static final String TAG = "BackupUtils";
// Singleton stuff

@ -34,7 +34,7 @@ import com.example.notes_master.src.net.micode.notes.ui.NotesListAdapter.AppWidg
import java.util.ArrayList;
import java.util.HashSet;
//便签数据处理工具类,封装如查找、移动、删除数据等工作
public class DataUtils {
public static final String TAG = "DataUtils";
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {

@ -15,7 +15,7 @@
*/
package com.example.notes_master.src.net.micode.notes.tool;
//同步中使用的字符串工具类为JSONObject提供string对象
public class GTaskStringUtils {
public final static String GTASK_JSON_ACTION_ID = "action_id";

@ -22,7 +22,7 @@ import android.preference.PreferenceManager;
import com.example.notes_master.src.net.micode.notes.ui.NotesPreferenceActivity;
import net.micode.notes.R;
//界面元素的解析工具类利用R.java这个类获取资源供程序调用
public class ResourceParser {
public static final int YELLOW = 0;

@ -41,7 +41,7 @@ import net.micode.notes.R;
import java.io.IOException;
//闹铃提醒界面
public class AlarmAlertActivity extends AppCompatActivity implements OnClickListener, OnDismissListener {
private long mNoteId;
private String mSnippet;

@ -27,7 +27,7 @@ import android.database.Cursor;
import com.example.notes_master.src.net.micode.notes.data.Notes;
import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
//闹铃提醒启动消息接收器
public class AlarmInitReceiver extends BroadcastReceiver {
private static final String [] PROJECTION = new String [] {

@ -19,7 +19,7 @@ package com.example.notes_master.src.net.micode.notes.ui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
//闹铃提醒接收器
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

@ -26,7 +26,7 @@ import net.micode.notes.R;
import java.text.DateFormatSymbols;
import java.util.Calendar;
//设置提醒时间的部件
public class DateTimePicker extends FrameLayout {
private static final boolean DEFAULT_ENABLE_STATE = true;

@ -28,7 +28,7 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
//设置提醒时间的对话框界面
public class DateTimePickerDialog extends AlertDialog implements OnClickListener {
private Calendar mDate = Calendar.getInstance();

@ -26,7 +26,7 @@ import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import net.micode.notes.R;
//下拉菜单界面
public class DropdownMenu {
private Button mButton;
private PopupMenu mPopupMenu;

@ -29,7 +29,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.R;
//文件夹列表适配器(链接数据库)
public class FoldersListAdapter extends CursorAdapter {
public static final String [] PROJECTION = {
NoteColumns.ID,

@ -73,7 +73,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//便签编辑活动
public class NoteEditActivity extends AppCompatActivity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
private class HeadViewHolder {

@ -35,7 +35,7 @@ import net.micode.notes.R;
import java.util.HashMap;
import java.util.Map;
//便签的文本编辑界面
public class NoteEditText extends androidx.appcompat.widget.AppCompatEditText {
private static final String TAG = "NoteEditText";
private int mIndex;

@ -25,7 +25,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes;
import com.example.notes_master.src.net.micode.notes.data.Notes.NoteColumns;
import com.example.notes_master.src.net.micode.notes.tool.DataUtils;
//便签项数据
public class NoteItemData {
static final String [] PROJECTION = new String [] {
NoteColumns.ID,
@ -77,20 +77,20 @@ public class NoteItemData {
private boolean mIsMultiNotesFollowingFolder;
public NoteItemData(Context context, Cursor cursor) {
mId = cursor.getLong(ID_COLUMN);
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);
mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN);
mCreatedDate = cursor.getLong(CREATED_DATE_COLUMN);
mHasAttachment = (cursor.getInt(HAS_ATTACHMENT_COLUMN) > 0) ? true : false;
mModifiedDate = cursor.getLong(MODIFIED_DATE_COLUMN);
mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN);
mParentId = cursor.getLong(PARENT_ID_COLUMN);
mSnippet = cursor.getString(SNIPPET_COLUMN);
mId = cursor.getLong(ID_COLUMN);//0
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);//1
mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN);//2
mCreatedDate = cursor.getLong(CREATED_DATE_COLUMN);//3
mHasAttachment = (cursor.getInt(HAS_ATTACHMENT_COLUMN) > 0) ? true : false;//4
mModifiedDate = cursor.getLong(MODIFIED_DATE_COLUMN);//5
mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN);//6
mParentId = cursor.getLong(PARENT_ID_COLUMN);//7
mSnippet = cursor.getString(SNIPPET_COLUMN);//8
mSnippet = mSnippet.replace(NoteEditActivity.TAG_CHECKED, "").replace(
NoteEditActivity.TAG_UNCHECKED, "");
mType = cursor.getInt(TYPE_COLUMN);
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
mType = cursor.getInt(TYPE_COLUMN);//9
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);//10
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);//11
mPhoneNumber = "";
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
@ -218,6 +218,11 @@ public class NoteItemData {
return (mParentId == Notes.ID_CALL_RECORD_FOLDER && !TextUtils.isEmpty(mPhoneNumber));
}
/**
* 便
* @param cursor
* @return
*/
public static int getNoteType(Cursor cursor) {
return cursor.getInt(TYPE_COLUMN);
}

@ -30,12 +30,12 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
//便签列表适配器(链接数据库)
public class NotesListAdapter extends CursorAdapter {
private static final String TAG = "NotesListAdapter";
private Context mContext;
private HashMap<Integer, Boolean> mSelectedIndex;
private int mNotesCount;
private int mNotesCount;//文件夹外的便签数量
private boolean mChoiceMode;
public static class AppWidgetAttribute {
@ -55,6 +55,13 @@ public class NotesListAdapter extends CursorAdapter {
return new NotesListItem(context);
}
/**
* bindView() Cursor TextViewImageView
* @param view Existing view, returned earlier by newView
* @param context Interface to application's global information
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
if (view instanceof NotesListItem) {
@ -128,12 +135,18 @@ public class NotesListAdapter extends CursorAdapter {
return itemSet;
}
/**
*便mSelectedIndexvaluetrue
* @return
*/
public int getSelectedCount() {
Collection<Boolean> values = mSelectedIndex.values();
Collection<Boolean> values = mSelectedIndex.values();//在 HashMap 中,每个键都关联一个值。
// values 方法返回的是所有键值对中的值组成的集合,而不包括键。
// 该集合是一个 Collection 类型,可以遍历、迭代或进行其他操作。
if (null == values) {
return 0;
}
Iterator<Boolean> iter = values.iterator();
Iterator<Boolean> iter = values.iterator();//返回一个迭代器对象Iterator类型用于遍历集合中的元素
int count = 0;
while (iter.hasNext()) {
if (true == iter.next()) {
@ -164,15 +177,15 @@ public class NotesListAdapter extends CursorAdapter {
@Override
public void changeCursor(Cursor cursor) {
super.changeCursor(cursor);
calcNotesCount();
calcNotesCount();//为了给mNotesCount赋值也就是计算出便签数量
}
private void calcNotesCount() {
mNotesCount = 0;
for (int i = 0; i < getCount(); i++) {
mNotesCount = 0;//便签数量先赋为0
for (int i = 0; i < getCount(); i++) {//getCount()方法是CursorAdapter中的方法用于返回游标集中元素个数
Cursor c = (Cursor) getItem(i);
if (c != null) {
if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) {
if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) {//0。是单纯的便签就便签数量++
mNotesCount++;
}
} else {

@ -30,7 +30,7 @@ import com.example.notes_master.src.net.micode.notes.tool.ResourceParser.NoteIte
import net.micode.notes.R;
//便签列表项
public class NotesListItem extends LinearLayout {
private ImageView mAlert;
private TextView mTitle;

@ -46,7 +46,7 @@ import com.example.notes_master.src.net.micode.notes.gtask.remote.GTaskSyncServi
import net.micode.notes.R;
//便签同步的设置界面
public class NotesPreferenceActivity extends PreferenceActivity {
public static final String PREFERENCE_NAME = "notes_preferences";

@ -32,7 +32,7 @@ import com.example.notes_master.src.net.micode.notes.ui.NoteEditActivity;
import com.example.notes_master.src.net.micode.notes.ui.NotesListActivity;
import net.micode.notes.R;
//桌面挂件
public abstract class NoteWidgetProvider extends AppWidgetProvider {
public static final String [] PROJECTION = new String [] {
NoteColumns.ID,

@ -23,7 +23,7 @@ import com.example.notes_master.src.net.micode.notes.data.Notes;
import com.example.notes_master.src.net.micode.notes.tool.ResourceParser;
import net.micode.notes.R;
//2倍大小的桌面挂件
public class NoteWidgetProvider_2x extends NoteWidgetProvider {
@Override

@ -24,7 +24,7 @@ import com.example.notes_master.src.net.micode.notes.tool.ResourceParser;
import net.micode.notes.R;
//4倍大小的桌面挂件
public class NoteWidgetProvider_4x extends NoteWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {

Loading…
Cancel
Save