diff --git a/src/data/Notes.java b/src/data/Notes.java index f240604..b3b44f3 100644 --- a/src/data/Notes.java +++ b/src/data/Notes.java @@ -17,9 +17,11 @@ package net.micode.notes.data; import android.net.Uri; +// Notes 类中定义了很多常量,这些常量大多是int型和string型 public class Notes { public static final String AUTHORITY = "micode_notes"; public static final String TAG = "Notes"; + //以下三个常量对NoteColumns.TYPE的值进行设置时会用到 public static final int TYPE_NOTE = 0; public static final int TYPE_FOLDER = 1; public static final int TYPE_SYSTEM = 2; @@ -54,13 +56,15 @@ public class Notes { /** * Uri to query all notes and folders */ + //定义查询便签和文件夹的指针。 public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note"); /** * Uri to query data */ + //定义查找数据的指针。 public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data"); - + // 定义NoteColumns的常量,用于后面创建数据库的表头 public interface NoteColumns { /** * The unique ID for a row @@ -72,7 +76,7 @@ public class Notes { * The parent's id for note or folder *

Type: INTEGER (long)

*/ - public static final String PARENT_ID = "parent_id"; + public static final String PARENT_ID = "parent_id";//为什么会有parent_id /** * Created data for note or folder @@ -140,7 +144,7 @@ public class Notes { * The last sync id *

Type: INTEGER (long)

*/ - public static final String SYNC_ID = "sync_id"; + public static final String SYNC_ID = "sync_id";//同步 /** * Sign to indicate local modified or not @@ -165,8 +169,9 @@ public class Notes { *

Type : INTEGER (long)

*/ public static final String VERSION = "version"; - } + }//这些常量主要是定义便签的属性的。 + // 定义DataColumns的常量,用于后面创建数据库的表头 public interface DataColumns { /** * The unique ID for a row @@ -239,7 +244,7 @@ public class Notes { *

Type: TEXT

*/ public static final String DATA5 = "data5"; - } + }//主要是定义存储便签内容数据的 public static final class TextNote implements DataColumns { /** @@ -255,7 +260,7 @@ public class Notes { public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note"; public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); - } + }//文本内容的数据结构 public static final class CallNote implements DataColumns { /** @@ -275,5 +280,5 @@ public class Notes { 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"); - } + }//电话内容的数据结构 }