/* * 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.data; // 包名:net.micode.notes.data import android.net.Uri; // 导入 Android 中的 Uri 类 public class Notes {// 定义名为 Notes 的公共类 public static final String AUTHORITY = "micode_notes";// 静态常量,权限字符串为“micode_notes” public static final String TAG = "Notes";// 静态常量,标签字符串为“ public static final int TYPE_NOTE = 0;// 静态常量,笔记类型为 0 public static final int TYPE_FOLDER = 1;// 静态常量,文件夹类型为 1 public static final int TYPE_SYSTEM = 2;// 静态常量,系统类型为 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 */ public static final int ID_ROOT_FOLDER = 0;// 静态常量,根文件夹 ID 为 0 public static final int ID_TEMPARAY_FOLDER = -1;// 静态常量,临时文件夹 ID 为 -1 public static final int ID_CALL_RECORD_FOLDER = -2;// 静态常量,通话记录文件夹 ID 为 -2 public static final int ID_TRASH_FOLER = -3;// 静态常量,回收站文件夹 ID 为 -3 public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";// 静态常量,意图额外参数(提醒日期)的字符串为“net.micode.notes.alert_date” public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id";// 静态常量,意图额外参数(背景颜色 ID)的字符串为“net.micode.notes.background_color_id” public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id";// 静态常量,意图额外参数(小组件 ID)的字符串为“net.micode.notes.widget_id” public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type";// 静态常量,意图额外参数(小组件类型)的字符串为“net.micode.notes.widget_type” public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id";// 静态常量,意图额外参数(文件夹 ID)的字符串为“net.micode.notes.folder_id” public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";// 静态常量,意图额外参数(通话日期)的字符串为“net.micode.notes.call_date” public static final int TYPE_WIDGET_INVALIDE = -1;// 静态常量,无效小组件类型为 -1 public static final int TYPE_WIDGET_2X = 0;// 静态常量,2X 小组件类型为 0 public static final int TYPE_WIDGET_4X = 1;// 静态常量,2X 小组件类型为 0 public static class DataConstants {// 定义静态内部类 public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;// 静态常量,笔记字符串为 TextNote 类的 CONTENT_ITEM_TYPE 常量 public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;// 静态常量,通话笔记字符串为 CallNote 类的 CONTENT_ITEM_TYPE 常量 } /** * Uri to query all notes and folders */ public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");// 静态常量,笔记内容的 Uri 为通过解析“content://权限字符串/note”得到的 Uri。 /** * Uri to query data */ // 注释:用于查询数据的 Uri。 public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");// 静态常量,数据内容的 Uri 为通过解析“content://权限字符串/data”得到的 Uri。 public interface NoteColumns {// 定义名为 NoteColumns 的公共接口 /** * The unique ID for a row *
Type: INTEGER (long)
*/ public static final String ID = "_id"; /** * The parent's id for note or folder *Type: INTEGER (long)
*/ // 注释:一行的唯一 ID。类型:整数(长整型)。 public static final String PARENT_ID = "parent_id";// 静态常量,ID 字段为“_id”。 /** * Created data for note or folder *Type: INTEGER (long)
*/ // 注释:笔记或文件夹的父级 ID。类型:整数(长整型)。 public static final String CREATED_DATE = "created_date";// 静态常量,PARENT_ID 字段为“parent_id”。 /** * Latest modified date *Type: INTEGER (long)
*/ // 注释:笔记或文件夹的创建日期。类型:整数(长整型)。 public static final String MODIFIED_DATE = "modified_date";// 静态常量,CREATED_DATE 字段为“created_date”。 /** * Alert date *Type: INTEGER (long)
*/ // 注释:最新修改日期。类型:整数(长整型)。 public static final String ALERTED_DATE = "alert_date";// 静态常量,MODIFIED_DATE 字段为“modified_date”。 /** * Folder's name or text content of note *Type: TEXT
*/ // 注释:提醒日期。类型:整数(长整型)。 public static final String SNIPPET = "snippet";// 静态常量,ALERTED_DATE 字段为“alert_date”。 /** * Note's widget id *Type: INTEGER (long)
*/ // 注释:文件夹的名称或笔记的文本内容。类型:文本。 public static final String WIDGET_ID = "widget_id";// 静态常量,小组件 ID 为“ /** * Note's widget type *Type: INTEGER (long)
*/ // 注释:笔记的小组件类型。类型:整数(长整型)。 public static final String WIDGET_TYPE = "widget_type";// 静态常量,小组件类型字段为“widget_type”。 /** * Note's background color's id *Type: INTEGER (long)
*/ // 注释:笔记的背景颜色 ID。类型:整数(长整型)。 public static final String BG_COLOR_ID = "bg_color_id";// 静态常量,背景颜色 ID 字段为“bg_color_id”。 /** * For text note, it doesn't has attachment, for multi-media * note, it has at least one attachment *Type: INTEGER
*/ // 注释:对于文本笔记,它没有附件;对于多媒体笔记,它至少有一个附件。类型:整数。 public static final String HAS_ATTACHMENT = "has_attachment";// 静态常量,是否有附件字段为“has_attachment”。 /** * Folder's count of notes *Type: INTEGER (long)
*/ // 注释:文件夹中的笔记数量。类型:整数(长整型)。 public static final String NOTES_COUNT = "notes_count";// 静态常量,笔记数量字段为“ /** * The file type: folder or note *Type: INTEGER
*/ // 注释:文件类型:文件夹或笔记。类型:整数。 public static final String TYPE = "type";// 静态常量,文件类型字段为“ /** * The last sync id *Type: INTEGER (long)
*/ // 注释:最后一次同步的 ID。类型:整数(长整型)。 public static final String SYNC_ID = "sync_id";// 静态常量,同步 ID 字段为“sync_id”。 /** * Sign to indicate local modified or not *Type: INTEGER
*/ // 注释:用于指示是否本地修改的标志。类型:整数。 public static final String LOCAL_MODIFIED = "local_modified";// 静态常量,本地修改标志字段为 /** * Original parent id before moving into temporary folder *Type : INTEGER
*/ // 注释:移动到临时文件夹之前的原始父级 ID。类型:整数。 public static final String ORIGIN_PARENT_ID = "origin_parent_id";// 静态常量,原始父级 ID 字段为“origin_parent_id”。 /** * The gtask id *Type : TEXT
*/ // 注释:gtask 的 ID。类型:文本。 public static final String GTASK_ID = "gtask_id";// 静态常量,gtask ID 字段为“gtask_id”。 /** * The version code *Type : INTEGER (long)
*/ // 注释:版本代码。类型:整数(长整型)。 public static final String VERSION = "version";// 静态常量,版本字段为“version”。 } public interface DataColumns {// 定义名为 DataColumns 的公共接口。 /** * The unique ID for a row *Type: INTEGER (long)
*/ // 注释:一行的唯一 ID。类型:整数(长整型)。 public static final String ID = "_id";// 静态常量,ID 字段为“_id”。 /** * The MIME type of the item represented by this row. *Type: Text
*/ public static final String MIME_TYPE = "mime_type";// 静态常量,MIME 类型为“mime_type”。 /** * The reference id to note that this data belongs to *Type: INTEGER (long)
*/ // 注释:此数据所属的引用 ID。类型:整数(长整型)。 public static final String NOTE_ID = "note_id";// 静态常量,NOTE_ID 字段为“note_id”。 /** * Created data for note or folder *Type: INTEGER (long)
*/ // 注释:笔记或文件夹的创建日期。类型:整数(长整型)。 public static final String CREATED_DATE = "created_date";// 静态常量,CREATED_DATE 字段为“created_date”。 /** * Latest modified date *Type: INTEGER (long)
*/ // 注释:最新修改日期。类型:整数(长整型)。 public static final String MODIFIED_DATE = "modified_date";// 静态常量,MODIFIED_DATE 字段为“modified_date”。 /** * Data's content *Type: TEXT
*/ // 注释:数据的内容。类型:文本。 public static final String CONTENT = "content";// 静态常量,CONTENT 字段为“content”。 /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for * integer data type *Type: INTEGER
*/ // 注释:通用数据列,其含义特定于 MIME 类型,用于整数数据类型。类型:整数。 public static final String DATA1 = "data1";// 静态常量,DATA1 字段为“data1”。 /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for * integer data type *Type: INTEGER
*/ // 注释:通用数据列,其含义特定于 MIME 类型,用于整数数据类型。类型:整数。 public static final String DATA2 = "data2";// 静态常量,DATA2 字段为“data2”。 /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for * TEXT data type *Type: TEXT
*/ // 注释:通用数据列,其含义特定于 MIME 类型,用于文本数据类型。类型:文本。 public static final String DATA3 = "data3";// 静态常量,DATA3 字段为“data3”。 /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for * TEXT data type *Type: TEXT
*/ // 注释:通用数据列,其含义特定于 MIME 类型,用于文本数据类型。类型:文本。 public static final String DATA4 = "data4";// 静态常量,DATA4 字段为“data4”。 /** * Generic data column, the meaning is {@link #MIMETYPE} specific, used for * TEXT data type *Type: TEXT
*/ // 注释:通用数据列,其含义特定于 MIME 类型,用于文本数据类型。类型:文本。 public static final String DATA5 = "data5";// 静态常量,DATA5 字段为“data5”。 } public static final class TextNote implements DataColumns {// 定义名为 TextNote 的静态内部类并实现 DataColumns 接口。 /** * Mode to indicate the text in check list mode or not *Type: Integer 1:check list mode 0: normal mode
*/ // 定义名为 TextNote 的静态内部类并实现 DataColumns 接口。 public static final String MODE = DATA1;// 静态常量,模式字段为 DATA1。 public static final int MODE_CHECK_LIST = 1;// 静态常量,清单模式的值为 1。 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note";// 静态常量,清单模式的值为 1。 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note";// 静态常量,内容项类型为“vnd.android.cursor.item/text_note”。 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");// 静态常量,内容 Uri 为通过解析“content://权限字符串/text_note”得到的 Uri。 } public static final class CallNote implements DataColumns {// 定义名为 CallNote 的静态内部类并实现 DataColumns 接口。 /** * Call date for this record *Type: INTEGER (long)
*/ // 注释:此记录的通话日期。类型:整数(长整型)。 public static final String CALL_DATE = DATA1;// 静态常量,通话日期字段为 DATA1。 /** * Phone number for this record *Type: TEXT
*/ // 注释:此记录的电话号码。类型:文本。 public static final String PHONE_NUMBER = DATA3;// 静态常量,电话号码字段为 DATA3。 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note";// 静态常量,内容类型为“vnd.android.cursor.dir/call_note”。 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note";// 静态常量,内容项类型为“vnd.android.cursor.item/call_note”。 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");// 静态常量,内容 Uri 为通过解析“content://权限字符串/call_note”得到的 Uri。 } }