|
|
@ -14,211 +14,143 @@
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.data;
|
|
|
|
package net.micode.notes.data; // 定义了包名,表示这个类属于 net.micode.notes.data 包
|
|
|
|
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.net.Uri; // 导入 Android 的 Uri 类,用于处理内容提供者的 URI
|
|
|
|
public class Notes {
|
|
|
|
|
|
|
|
|
|
|
|
public class Notes { // Notes 类,主要用于定义与笔记相关的常量和 URI 配置
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 内容提供者的 authority 字符串,用于唯一标识此内容提供者
|
|
|
|
public static final String AUTHORITY = "micode_notes";
|
|
|
|
public static final String AUTHORITY = "micode_notes";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于日志输出的标签
|
|
|
|
public static final String TAG = "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;
|
|
|
|
public static final int TYPE_NOTE = 0; // 笔记类型
|
|
|
|
|
|
|
|
public static final int TYPE_FOLDER = 1; // 文件夹类型
|
|
|
|
|
|
|
|
public static final int TYPE_SYSTEM = 2; // 系统类型
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Following IDs are system folders' identifiers
|
|
|
|
* 以下常量是系统文件夹的标识符
|
|
|
|
* {@link Notes#ID_ROOT_FOLDER } is default folder
|
|
|
|
* {@link Notes#ID_ROOT_FOLDER} 是默认文件夹
|
|
|
|
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
|
|
|
|
* {@link Notes#ID_TEMPARAY_FOLDER} 是存储不属于任何文件夹的笔记
|
|
|
|
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
|
|
|
|
* {@link Notes#ID_CALL_RECORD_FOLDER} 用于存储通话记录
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final int ID_ROOT_FOLDER = 0;
|
|
|
|
public static final int ID_ROOT_FOLDER = 0; // 根文件夹的 ID
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1;
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1; // 临时文件夹的 ID
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2;
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2; // 通话记录文件夹的 ID
|
|
|
|
public static final int ID_TRASH_FOLER = -3;
|
|
|
|
public static final int ID_TRASH_FOLER = -3; // 垃圾桶文件夹的 ID
|
|
|
|
|
|
|
|
|
|
|
|
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";
|
|
|
|
// Intent 中传递的额外参数常量,用于与笔记相关的操作
|
|
|
|
public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id";
|
|
|
|
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date"; // 提醒日期
|
|
|
|
public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id";
|
|
|
|
public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id"; // 背景颜色 ID
|
|
|
|
public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type";
|
|
|
|
public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id"; // 小部件 ID
|
|
|
|
public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id";
|
|
|
|
public static final String INTENT_EXTRA_WIDGET_TYPE = "net.micode.notes.widget_type"; // 小部件类型
|
|
|
|
public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date";
|
|
|
|
public static final String INTENT_EXTRA_FOLDER_ID = "net.micode.notes.folder_id"; // 文件夹 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 final int TYPE_WIDGET_INVALIDE = -1; // 无效小部件类型
|
|
|
|
|
|
|
|
public static final int TYPE_WIDGET_2X = 0; // 2x 小部件类型
|
|
|
|
|
|
|
|
public static final int TYPE_WIDGET_4X = 1; // 4x 小部件类型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 数据常量类,定义了笔记和通话记录的内容类型
|
|
|
|
public static class DataConstants {
|
|
|
|
public static class DataConstants {
|
|
|
|
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
|
|
|
|
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE; // 笔记的内容类型
|
|
|
|
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
|
|
|
|
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE; // 通话记录的内容类型
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Uri to query all notes and folders
|
|
|
|
* 用于查询所有笔记和文件夹的 URI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
|
|
|
|
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note"); // 查询笔记的 URI
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Uri to query data
|
|
|
|
* 用于查询数据的 URI
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data"); // 查询数据的 URI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记相关的列定义接口,包含笔记的数据列
|
|
|
|
public interface NoteColumns {
|
|
|
|
public interface NoteColumns {
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The unique ID for a row
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String ID = "_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The parent's id for note or folder
|
|
|
|
* 每一行的唯一 ID
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
* <P> 类型: INTEGER (long) </P>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final String PARENT_ID = "parent_id";
|
|
|
|
public static final String ID = "_id"; // 唯一标识符
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Created data for note or folder
|
|
|
|
* 笔记或文件夹的父 ID
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
* <P> 类型: INTEGER (long) </P>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final String CREATED_DATE = "created_date";
|
|
|
|
public static final String PARENT_ID = "parent_id"; // 父级 ID
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Latest modified date
|
|
|
|
* 笔记或文件夹的创建日期
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
* <P> 类型: INTEGER (long) </P>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final String MODIFIED_DATE = "modified_date";
|
|
|
|
public static final String CREATED_DATE = "created_date"; // 创建日期
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Alert date
|
|
|
|
* 笔记或文件夹的最后修改日期
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
* <P> 类型: INTEGER (long) </P>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final String ALERTED_DATE = "alert_date";
|
|
|
|
public static final String MODIFIED_DATE = "modified_date"; // 最后修改日期
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Folder's name or text content of note
|
|
|
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String SNIPPET = "snippet";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Note's widget id
|
|
|
|
* The constant fields represent various columns of a note-taking application database.
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
* These constants are used to define column names and their data types within the database schema.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static final String WIDGET_ID = "widget_id";
|
|
|
|
public static final String ALERTED_DATE = "alert_date"; // 记录提醒日期,数据类型:INTEGER(长整型)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String SNIPPET = "snippet"; // 记录文件夹名称或笔记的文本内容,数据类型:TEXT(字符串)
|
|
|
|
* Note's widget type
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String WIDGET_TYPE = "widget_type";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String WIDGET_ID = "widget_id"; // 记录笔记的小部件ID,数据类型:INTEGER(长整型)
|
|
|
|
* Note's background color's id
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String BG_COLOR_ID = "bg_color_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String WIDGET_TYPE = "widget_type"; // 记录笔记的小部件类型,数据类型:INTEGER(长整型)
|
|
|
|
* For text note, it doesn't has attachment, for multi-media
|
|
|
|
|
|
|
|
* note, it has at least one attachment
|
|
|
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String HAS_ATTACHMENT = "has_attachment";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String BG_COLOR_ID = "bg_color_id"; // 记录笔记的背景颜色ID,数据类型:INTEGER(长整型)
|
|
|
|
* Folder's count of notes
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String NOTES_COUNT = "notes_count";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String HAS_ATTACHMENT = "has_attachment"; // 标记笔记是否有附件,文本笔记没有附件,多媒体笔记至少有一个附件,数据类型:INTEGER(整型)
|
|
|
|
* The file type: folder or note
|
|
|
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String TYPE = "type";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String NOTES_COUNT = "notes_count"; // 文件夹中笔记的数量,数据类型:INTEGER(长整型)
|
|
|
|
* The last sync id
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String SYNC_ID = "sync_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String TYPE = "type"; // 文件类型,标识为文件夹或笔记,数据类型:INTEGER(整型)
|
|
|
|
* Sign to indicate local modified or not
|
|
|
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String LOCAL_MODIFIED = "local_modified";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String SYNC_ID = "sync_id"; // 记录上次同步的ID,数据类型:INTEGER(长整型)
|
|
|
|
* Original parent id before moving into temporary folder
|
|
|
|
|
|
|
|
* <P> Type : INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String ORIGIN_PARENT_ID = "origin_parent_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String LOCAL_MODIFIED = "local_modified"; // 本地修改标识,用来表示该项是否被本地修改过,数据类型:INTEGER(整型)
|
|
|
|
* The gtask id
|
|
|
|
|
|
|
|
* <P> Type : TEXT </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String GTASK_ID = "gtask_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String ORIGIN_PARENT_ID = "origin_parent_id"; // 记录笔记或文件夹在移动到临时文件夹之前的原始父级ID,数据类型:INTEGER(整型)
|
|
|
|
* The version code
|
|
|
|
|
|
|
|
* <P> Type : INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String VERSION = "version";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface DataColumns {
|
|
|
|
public static final String GTASK_ID = "gtask_id"; // 记录Google任务的ID,数据类型:TEXT(字符串)
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The unique ID for a row
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String ID = "_id";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String VERSION = "version"; // 记录笔记或文件夹的版本号,数据类型:INTEGER(长整型)
|
|
|
|
* The MIME type of the item represented by this row.
|
|
|
|
|
|
|
|
* <P> Type: Text </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String MIME_TYPE = "mime_type";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The reference id to note that this data belongs to
|
|
|
|
* DataColumns接口用于定义存储在数据表中的列字段,通常用于数据相关的记录。
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public interface DataColumns {
|
|
|
|
public static final String NOTE_ID = "note_id";
|
|
|
|
public static final String ID = "_id"; // 记录行的唯一标识符,数据类型:INTEGER(长整型)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String MIME_TYPE = "mime_type"; // 记录数据项的MIME类型,数据类型:TEXT(字符串)
|
|
|
|
* Created data for note or folder
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String CREATED_DATE = "created_date";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String NOTE_ID = "note_id"; // 记录数据所对应的笔记ID,数据类型:INTEGER(长整型)
|
|
|
|
* Latest modified date
|
|
|
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String MODIFIED_DATE = "modified_date";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String CREATED_DATE = "created_date"; // 记录数据创建的日期,数据类型:INTEGER(长整型)
|
|
|
|
* Data's content
|
|
|
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String CONTENT = "content";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String MODIFIED_DATE = "modified_date"; // 记录数据最后修改的日期,数据类型:INTEGER(长整型)
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String CONTENT = "content"; // 记录数据的具体内容,数据类型:TEXT(字符串)
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
|
|
|
* integer data type
|
|
|
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String DATA1 = "data1";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
public static final String DATA1 = "data1"; // 一个通用数据列,具体意义根据MIME类型而定,数据类型:INTEGER(整型)
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
|
|
|
* integer data type
|
|
|
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static final String DATA2 = "data2";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String DATA2 = "data2"; // 另一个通用数据列,具体意义根据MIME类型而定,数据类型:INTEGER(整型)
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
* TEXT data type
|
|
|
|
* TEXT data type
|
|
|
@ -277,3 +209,4 @@ public class Notes {
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|