From 71c5c3e2245e2cf1b1d90b76b581872d61891a65 Mon Sep 17 00:00:00 2001 From: dingxinnan <1175943266@qq.com> Date: Thu, 21 Dec 2023 00:30:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/micode/notes/data/Notes.java | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/Notes-master1/app/src/main/java/net/micode/notes/data/Notes.java b/src/Notes-master1/app/src/main/java/net/micode/notes/data/Notes.java index f240604..1c49573 100644 --- a/src/Notes-master1/app/src/main/java/net/micode/notes/data/Notes.java +++ b/src/Notes-master1/app/src/main/java/net/micode/notes/data/Notes.java @@ -14,12 +14,16 @@ * limitations under the License. */ + 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; @@ -30,11 +34,16 @@ public class Notes { * {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder * {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records */ + // 定义根文件夹的ID public static final int ID_ROOT_FOLDER = 0; + // 定义临时文件夹的ID public static final int ID_TEMPARAY_FOLDER = -1; + // 定义通话记录文件夹的ID public static final int ID_CALL_RECORD_FOLDER = -2; + // 定义垃圾文件夹的ID 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"; @@ -42,18 +51,22 @@ public class Notes { 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 class DataConstants { + // 定义一个NOTE变量,值为TextNote.CONTENT_ITEM_TYPE public static final String NOTE = TextNote.CONTENT_ITEM_TYPE; + // 定义一个CALL_NOTE变量,值为CallNote.CONTENT_ITEM_TYPE public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE; } /** * Uri to query all notes and folders */ + // 定义一个Uri对象,用于存储note的路径 public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note"); /** @@ -61,6 +74,7 @@ public class Notes { */ public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data"); + // 定义一个接口NoteColumns public interface NoteColumns { /** * The unique ID for a row @@ -116,7 +130,6 @@ public class Notes { *
Type: INTEGER (long)
*/ 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 @@ -167,11 +180,13 @@ public class Notes { public static final String VERSION = "version"; } + // 定义接口DataColumns public interface DataColumns { /** * The unique ID for a row *Type: INTEGER (long)
*/ + // 定义一个静态变量ID,值为"_id" public static final String ID = "_id"; /** @@ -179,31 +194,31 @@ public class Notes { *Type: Text
*/ public static final String MIME_TYPE = "mime_type"; - + // 定义一个静态变量ID,值为"mime_type" /** * The reference id to note that this data belongs to *Type: INTEGER (long)
*/ public static final String NOTE_ID = "note_id"; - + // 定义一个静态变量ID,值为"note_id" /** * Created data for note or folder *Type: INTEGER (long)
*/ public static final String CREATED_DATE = "created_date"; - + // 定义一个静态变量ID,值为"created_date" /** * Latest modified date *Type: INTEGER (long)
*/ public static final String MODIFIED_DATE = "modified_date"; - + // 定义一个静态变量ID,值为"modified_date" /** * Data's content *Type: TEXT
*/ public static final String CONTENT = "content"; - + // 定义一个静态变量ID,值为"content" /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for @@ -241,19 +256,25 @@ public class Notes { public static final String DATA5 = "data5"; } + public static final class TextNote implements DataColumns { /** * Mode to indicate the text in check list mode or not *Type: Integer 1:check list mode 0: normal mode
*/ +// 定义一个静态变量MODE,值为DATA1 public static final String MODE = DATA1; +// 定义一个静态变量MODE_CHECK_LIST,值为1 public static final int MODE_CHECK_LIST = 1; +// 定义一个静态变量CONTENT_TYPE,值为"vnd.android.cursor.dir/text_note" public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note"; +// 定义一个静态变量CONTENT_ITEM_TYPE,值为"vnd.android.cursor.item/text_note" public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note"; +// 定义一个静态变量CONTENT_URI,值为Uri.parse("content://" + AUTHORITY + "/text_note") public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); } @@ -268,12 +289,16 @@ public class Notes { * Phone number for this record *Type: TEXT
*/ + // 定义一个静态常量,用于存储电话号码 public static final String PHONE_NUMBER = DATA3; + // 定义一个静态常量,用于存储内容类型 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note"; + // 定义一个静态常量,用于存储内容项类型 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note"; + // 定义一个静态常量,用于存储内容URI public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); } }