diff --git a/src/Notes-master/src/net/micode/notes/data/Notes.java b/src/Notes-master/src/net/micode/notes/data/Notes.java index 731b55d..087d09e 100644 --- a/src/Notes-master/src/net/micode/notes/data/Notes.java +++ b/src/Notes-master/src/net/micode/notes/data/Notes.java @@ -19,51 +19,44 @@ package net.micode.notes.data; import android.net.Uri; /** - * 笔记应用的数据结构定义 - * 包含所有笔记相关的常量、接口和内部类定义 - * 纯定义类,不包含函数实现 + * 绗旇搴旂敤鐨勬暟鎹粨鏋勫畾涔 + * 鍖呭惈鎵鏈夌瑪璁扮浉鍏崇殑甯搁噺銆佹帴鍙e拰鍐呴儴绫诲畾涔 + * 绾畾涔夌被锛屼笉鍖呭惈鍑芥暟瀹炵幇 */ public class Notes { - // ContentProvider的授权标识 + // ContentProvider鐨勬巿鏉冩爣璇 public static final String AUTHORITY = "micode_notes"; - // 日志标签 + // 鏃ュ織鏍囩 public static final String TAG = "Notes"; - // 0类型:普通笔记 + // 0绫诲瀷锛氭櫘閫氱瑪璁 public static final int TYPE_NOTE = 0; - // 1类型:文件夹 + // 1绫诲瀷锛氭枃浠跺す public static final int TYPE_FOLDER = 1; - // 2类型:系统文件夹 + // 2绫诲瀷锛氱郴缁熸枃浠跺す public static final int TYPE_SYSTEM = 2; - - // 系统文件夹的 ID 定义。 - // #ID_ROOT_FOLDER 默认根文件夹 - // #ID_TEMPARAY_FOLDER 临时文件夹,移动笔记时的中转 - // #ID_CALL_RECORD_FOLDER 通话记录专用文件夹 - // #ID_TRASH_FOLER 回收站 - 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; // 回收站文件夹 + // 3绫诲瀷锛氭竻鍗 + public static final int TYPE_CHECKLIST = 3; + + // 绯荤粺鏂囦欢澶圭殑 ID 瀹氫箟銆 + // #ID_ROOT_FOLDER 榛樿鏍规枃浠跺す + // #ID_TEMPARAY_FOLDER 涓存椂鏂囦欢澶癸紝绉诲姩绗旇鏃剁殑涓浆 + // #ID_CALL_RECORD_FOLDER 閫氳瘽璁板綍涓撶敤鏂囦欢澶 + // #ID_TRASH_FOLER 鍥炴敹绔 + 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; // 鍥炴敹绔欐枃浠跺す /** - * Intent Extra 键常量,用于在 Android 组件间通过 Intent 传递数据,包括: - * 1. 提醒日期 - * 2. 背景颜色ID - * 3. 小部件ID - * 4. 小部件类型 - * 5. 文件夹ID - * 6. 通话日期 - * 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 - * 7. 笔记类型 + * Intent Extra 閿父閲忥紝鐢ㄤ簬鍦 Android 缁勪欢闂撮氳繃 Intent 浼犻掓暟鎹紝鍖呮嫭锛 + * 1. 鎻愰啋鏃ユ湡 + * 2. 鑳屾櫙棰滆壊ID + * 3. 灏忛儴浠禝D + * 4. 灏忛儴浠剁被鍨 + * 5. 鏂囦欢澶笽D + * 6. 閫氳瘽鏃ユ湡 + * 7. 绗旇绫诲瀷 */ - 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"; public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id"; @@ -72,262 +65,176 @@ public class Notes { public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date"; public static final String INTENT_EXTRA_NOTE_TYPE = "net.micode.notes.note_type"; + // 鏃犳晥鐨勫皬閮ㄤ欢绫诲瀷 -1 public static final int TYPE_WIDGET_INVALIDE = -1; + // 2x2灏忛儴浠剁被鍨 0 public static final int TYPE_WIDGET_2X = 0; + // 4x4灏忛儴浠剁被鍨 1 public static final int TYPE_WIDGET_4X = 1; + /** + * 鏁版嵁绫诲瀷甯搁噺瀹氫箟 + */ public static class DataConstants { + // 鏅氱瑪璁扮殑MIME绫诲瀷 public static final String NOTE = TextNote.CONTENT_ITEM_TYPE; + // 閫氳瘽璁板綍绗旇鐨凪IME绫诲瀷 public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE; } - /** - * Uri to query all notes and folders - */ + // URI 鏄 ContentProvider 鐨勬爣鍑嗚闂叆鍙o紝鐢ㄤ簬缁熶竴璁块棶搴旂敤鐨勬暟鎹 + // 鏌ヨ鎵鏈夌瑪璁板拰鏂囦欢澶圭殑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"); /** - * Uri to query trash notes + * NoteColumns 鎺ュ彛 - 渚跨琛(notes琛)鍒楀畾涔 + * 瀹氫箟浜嗕究绛惧拰鏂囦欢澶规暟鎹簱琛ㄧ殑鎵鏈夊垪鍚嶅拰绫诲瀷 + */ + /** + * 绗旇琛ㄧ殑鍒楀悕瀹氫箟鎺ュ彛 */ - public static final Uri CONTENT_TRASH_URI = Uri.parse("content://" + AUTHORITY + "/trash"); - public interface NoteColumns { - /** - * The unique ID for a row - *
Type: INTEGER (long)
- */ + + // 琛岀殑鍞竴ID 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"; - /** - * Created data for note or folder - *Type: INTEGER (long)
- */ + // 绗旇鎴栨枃浠跺す鐨勫垱寤烘棩鏈 public static final String CREATED_DATE = "created_date"; - /** - * Latest modified date - *Type: INTEGER (long)
- */ + // 鏈鍚庝慨鏀规棩鏈 public static final String MODIFIED_DATE = "modified_date"; - - /** - * Alert date - *Type: INTEGER (long)
- */ + // 鎻愰啋鏃ユ湡 public static final String ALERTED_DATE = "alert_date"; - /** - * Folder's name or text content of note - *Type: TEXT
- */ + // 鏂囦欢澶瑰悕绉版垨绗旇鐨勬枃鏈唴瀹规憳瑕 public static final String SNIPPET = "snippet"; - /** - * Note's widget id - *Type: INTEGER (long)
- */ + // 绗旇鐨勫皬閮ㄤ欢ID public static final String WIDGET_ID = "widget_id"; - /** - * Note's widget type - *Type: INTEGER (long)
- */ + // 绗旇鐨勫皬閮ㄤ欢绫诲瀷 public static final String WIDGET_TYPE = "widget_type"; - /** - * Note's background color's id - *Type: INTEGER (long)
- */ + // 绗旇鐨勮儗鏅鑹睮D 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 - *Type: INTEGER
- */ + // 鏄惁鏈夐檮浠讹紱瀵逛簬鏂囨湰绗旇娌℃湁闄勪欢锛屽濯掍綋绗旇鑷冲皯鏈変竴涓檮浠 public static final String 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"; - /** - * 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"; - /** - * The gtask id - *Type : TEXT
- */ + // Google Task鐨処D public static final String GTASK_ID = "gtask_id"; - /** - * The version code - *Type : INTEGER (long)
- */ + // 鐗堟湰鍙 public static final String VERSION = "version"; - - /** - * Whether the note is encrypted - *Type : INTEGER (0 = not encrypted, 1 = encrypted)
- */ - public static final String IS_ENCRYPTED = "is_encrypted"; - } - - public interface TrashColumns extends NoteColumns { - /** - * Deleted date for trash note - *Type: INTEGER (long)
- */ - public static final String DELETED_DATE = "deleted_date"; } /** - * DataColumns 接口 - 便签数据表(data表)列定义 - * 定义了便签详细内容的数据表列名和类型 - * 使用MIME_TYPE字段区分不同类型的便签数据(文本便签、通话记录等) + * DataColumns 鎺ュ彛 - 渚跨鏁版嵁琛(data琛)鍒楀畾涔 + * 瀹氫箟浜嗕究绛捐缁嗗唴瀹圭殑鏁版嵁琛ㄥ垪鍚嶅拰绫诲瀷 + * 浣跨敤MIME_TYPE瀛楁鍖哄垎涓嶅悓绫诲瀷鐨勪究绛炬暟鎹紙鏂囨湰渚跨銆侀氳瘽璁板綍绛夛級 */ public interface DataColumns { - /** - * The unique ID for a row - *Type: INTEGER (long)
- */ + // 琛岀殑鍞竴ID public static final String ID = "_id"; - /** - * The MIME type of the item represented by this row. - *Type: Text
- */ + // 璇ヨ鏁版嵁椤圭殑MIME绫诲瀷 public static final String MIME_TYPE = "mime_type"; - /** - * The reference id to note that this data belongs to - *Type: INTEGER (long)
- */ + // 璇ユ暟鎹墍灞炵瑪璁扮殑寮曠敤ID public static final String NOTE_ID = "note_id"; - /** - * Created data for note or folder - *Type: INTEGER (long)
- */ + // 绗旇鎴栨枃浠跺す鐨勫垱寤烘棩鏈 public static final String CREATED_DATE = "created_date"; - /** - * Latest modified date - *Type: INTEGER (long)
- */ + // 鏈鍚庝慨鏀规棩鏈 public static final String MODIFIED_DATE = "modified_date"; - /** - * Data's content - *Type: TEXT
- */ + // 鏁版嵁鍐呭 public static final String CONTENT = "content"; - - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * integer data type - *Type: INTEGER
- */ + // 閫氱敤鏁版嵁鍒1 public static final String DATA1 = "data1"; - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * integer data type - *Type: INTEGER
- */ + // 閫氱敤鏁版嵁鍒2 public static final String DATA2 = "data2"; - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *Type: TEXT
- */ + // 閫氱敤鏁版嵁鍒3 public static final String DATA3 = "data3"; - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *Type: TEXT
- */ + // 閫氱敤鏁版嵁鍒4 public static final String DATA4 = "data4"; - /** - * Generic data column, the meaning is {@link #MIMETYPE} specific, used for - * TEXT data type - *Type: TEXT
- */ + // 閫氱敤鏁版嵁鍒5 public static final String DATA5 = "data5"; } + /** + * TextNote 绫 - 鏂囨湰渚跨鏁版嵁瀹氫箟 + * 瀹氫箟浜嗘枃鏈究绛剧壒鏈夌殑鏁版嵁鍒楀拰URI + */ 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
- */ + // 妯″紡鏍囪瘑锛氭枃鏈槸鍚︿负娓呭崟妯″紡 public static final String MODE = DATA1; + // 娓呭崟妯″紡甯搁噺 public static final int MODE_CHECK_LIST = 1; + // 鏅氭ā寮忓父閲 + public static final int MODE_NORMAL = 0; + + // 鏂囨湰绗旇鐨勭洰褰昅IME绫诲瀷 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note"; + // 鏂囨湰绗旇鐨勫崟椤筂IME绫诲瀷 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note"; + // 鏂囨湰绗旇鐨刄RI public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note"); } + /** + * CallNote 绫 - 閫氳瘽璁板綍渚跨鏁版嵁瀹氫箟 + * 瀹氫箟浜嗛氳瘽璁板綍渚跨鐗规湁鐨勬暟鎹垪鍜孶RI + */ public static final class CallNote implements DataColumns { - /** - * Call date for this record - *Type: INTEGER (long)
- */ + // 閫氳瘽鏃ユ湡 public static final String CALL_DATE = DATA1; - /** - * Phone number for this record - *Type: TEXT
- */ + // 鐢佃瘽鍙风爜 public static final String PHONE_NUMBER = DATA3; + // 鑱旂郴浜哄鍚 + public static final String CONTACT_NAME = DATA4; + + // 閫氳瘽璁板綍绗旇鐨勭洰褰昅IME绫诲瀷 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note"; + // 閫氳瘽璁板綍绗旇鐨勫崟椤筂IME绫诲瀷 public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note"; + // 閫氳瘽璁板綍绗旇鐨刄RI public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note"); } }