|
|
|
@ -17,12 +17,19 @@
|
|
|
|
|
package net.micode.notes.data;
|
|
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author hzx
|
|
|
|
|
* 版本:1.0
|
|
|
|
|
* 创建日期:2023/10/28
|
|
|
|
|
* 描述:Notes 便签类,封装便签相关的属性和方法
|
|
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
@ -30,10 +37,10 @@ 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
|
|
|
|
|
*/
|
|
|
|
|
public static final int ID_ROOT_FOLDER = 0;
|
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1;
|
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2;
|
|
|
|
|
public static final int ID_TRASH_FOLER = -3;
|
|
|
|
|
public static final int ID_ROOT_FOLDER = 0; // 默认的文件夹
|
|
|
|
|
public static final int ID_TEMPARAY_FOLDER = -1; // 临时文件夹
|
|
|
|
|
public static final int ID_CALL_RECORD_FOLDER = -2; // 调用记录文件夹
|
|
|
|
|
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";
|
|
|
|
@ -46,42 +53,51 @@ public class Notes {
|
|
|
|
|
public static final int TYPE_WIDGET_2X = 0;
|
|
|
|
|
public static final int TYPE_WIDGET_4X = 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装一些数据常量
|
|
|
|
|
*/
|
|
|
|
|
public static class DataConstants {
|
|
|
|
|
public static final String NOTE = TextNote.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");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Uri to query data
|
|
|
|
|
* 查询所有数据的Uri
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 便签字段接口,封装每一个字段实际存储的名字
|
|
|
|
|
*/
|
|
|
|
|
public interface NoteColumns {
|
|
|
|
|
/**
|
|
|
|
|
* The unique ID for a row
|
|
|
|
|
* 每一行的唯一ID
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
public static final String PARENT_ID = "parent_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created data for note or folder
|
|
|
|
|
* 便签或文件夹的创建日期
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String CREATED_DATE = "created_date";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Latest modified date
|
|
|
|
|
* 最后一次修改的日期
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String MODIFIED_DATE = "modified_date";
|
|
|
|
@ -95,24 +111,28 @@ public class Notes {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Folder's name or text content of note
|
|
|
|
|
* 文件夹名或便签的文本内容
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String SNIPPET = "snippet";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Note's widget id
|
|
|
|
|
* 便签的小部件ID
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String WIDGET_ID = "widget_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Note's widget type
|
|
|
|
|
* 便签的小部件类型
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String WIDGET_TYPE = "widget_type";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Note's background color's id
|
|
|
|
|
* 便签的背景颜色ID
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String BG_COLOR_ID = "bg_color_id";
|
|
|
|
@ -120,127 +140,149 @@ public class Notes {
|
|
|
|
|
/**
|
|
|
|
|
* 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";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Folder's count of notes
|
|
|
|
|
* 文件夹中便签的数量
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String NOTES_COUNT = "notes_count";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The file type: folder or note
|
|
|
|
|
* 文件类型:文件夹或便签
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String TYPE = "type";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The last sync id
|
|
|
|
|
* 最后一次云同步的ID
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String SYNC_ID = "sync_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sign to indicate local modified or not
|
|
|
|
|
* 是否本地修改的标记
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String LOCAL_MODIFIED = "local_modified";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Original parent id before moving into temporary folder
|
|
|
|
|
* 在移动到临时文件夹之前,文件夹或便签的父ID
|
|
|
|
|
* <P> Type : INTEGER </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String ORIGIN_PARENT_ID = "origin_parent_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The gtask id
|
|
|
|
|
* 云同步ID
|
|
|
|
|
* <P> Type : TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String GTASK_ID = "gtask_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The version code
|
|
|
|
|
* 版本号
|
|
|
|
|
* <P> Type : INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String VERSION = "version";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据字段接口
|
|
|
|
|
*/
|
|
|
|
|
public interface DataColumns {
|
|
|
|
|
/**
|
|
|
|
|
* The unique ID for a row
|
|
|
|
|
* 行的唯一ID
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String ID = "_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The MIME type of the item represented by this row.
|
|
|
|
|
* 这一行代表的项的MIME类型
|
|
|
|
|
* <P> Type: Text </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String MIME_TYPE = "mime_type";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The reference id to note that this data belongs to
|
|
|
|
|
* 这一行数据所属的便签的ID
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String NOTE_ID = "note_id";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created data for note or folder
|
|
|
|
|
* 创建日期
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String CREATED_DATE = "created_date";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Latest modified date
|
|
|
|
|
* 上一次修改的日期
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String MODIFIED_DATE = "modified_date";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Data's content
|
|
|
|
|
* 数据的内容
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String CONTENT = "content";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
* Generic data column, the meaning is {@link #MIME_TYPE} specific, used for
|
|
|
|
|
* integer data type
|
|
|
|
|
* 整型数据
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String DATA1 = "data1";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
* Generic data column, the meaning is {@link #MIME_TYPE} specific, used for
|
|
|
|
|
* integer data type
|
|
|
|
|
* <P> Type: INTEGER </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String DATA2 = "data2";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
* Generic data column, the meaning is {@link #MIME_TYPE} specific, used for
|
|
|
|
|
* TEXT data type
|
|
|
|
|
* 文本数据
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String DATA3 = "data3";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
* Generic data column, the meaning is {@link #MIME_TYPE} specific, used for
|
|
|
|
|
* TEXT data type
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String DATA4 = "data4";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
|
|
|
|
|
* Generic data column, the meaning is {@link #MIME_TYPE} specific, used for
|
|
|
|
|
* TEXT data type
|
|
|
|
|
* <P> Type: TEXT </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String DATA5 = "data5";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据字段接口的实现,文本便签
|
|
|
|
|
*/
|
|
|
|
|
public static final class TextNote implements DataColumns {
|
|
|
|
|
/**
|
|
|
|
|
* Mode to indicate the text in check list mode or not
|
|
|
|
@ -250,16 +292,29 @@ public class Notes {
|
|
|
|
|
|
|
|
|
|
public static final int MODE_CHECK_LIST = 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 内容类型
|
|
|
|
|
*/
|
|
|
|
|
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 内容项类型
|
|
|
|
|
*/
|
|
|
|
|
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取内容的Uri
|
|
|
|
|
*/
|
|
|
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 数据字段接口的实现,调用便签
|
|
|
|
|
*/
|
|
|
|
|
public static final class CallNote implements DataColumns {
|
|
|
|
|
/**
|
|
|
|
|
* Call date for this record
|
|
|
|
|
* 调用日期
|
|
|
|
|
* <P> Type: INTEGER (long) </P>
|
|
|
|
|
*/
|
|
|
|
|
public static final String CALL_DATE = DATA1;
|
|
|
|
@ -270,10 +325,19 @@ public class Notes {
|
|
|
|
|
*/
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|