From 6382611563ce160b074ae19a201dcacb1ed88f46 Mon Sep 17 00:00:00 2001 From: Surponess Date: Wed, 21 Jan 2026 15:43:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/net/micode/notes/data/Notes.java | 293 ++++++------------ 1 file changed, 100 insertions(+), 193 deletions(-) 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"); } } -- 2.34.1 From 362bcd4f413d8a7cffee3a89758a2bd6302a2efb Mon Sep 17 00:00:00 2001 From: Surponess Date: Wed, 21 Jan 2026 18:19:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=90=8E=E5=AF=BC=E8=87=B4=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Notes-master/AndroidManifest.xml | 144 ------------------ .../mainfests/AndroidManifest.xml | 49 ++++-- .../src/net/micode/notes/data/Notes.java | 18 ++- .../src/net/micode/notes/ui/NoteItemData.java | 14 +- .../micode/notes/ui/NotesListActivity.java | 32 ++-- 5 files changed, 81 insertions(+), 176 deletions(-) delete mode 100644 src/Notes-master/AndroidManifest.xml diff --git a/src/Notes-master/AndroidManifest.xml b/src/Notes-master/AndroidManifest.xml deleted file mode 100644 index 486c713..0000000 --- a/src/Notes-master/AndroidManifest.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Notes-master/mainfests/AndroidManifest.xml b/src/Notes-master/mainfests/AndroidManifest.xml index 9fb914f..a85867b 100644 --- a/src/Notes-master/mainfests/AndroidManifest.xml +++ b/src/Notes-master/mainfests/AndroidManifest.xml @@ -1,6 +1,21 @@ + + package="net.micode.notes" + android:versionCode="1" + android:versionName="0.1" > + + @@ -11,28 +26,17 @@ + android:icon="@drawable/icon_app" + android:label="@string/app_name" > - - - - + android:exported="true" > @@ -136,6 +140,19 @@ android:launchMode="singleTop" android:theme="@android:style/Theme.Holo.Light" > + + + + 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琛)鍒楀畾涔 * 瀹氫箟浜嗕究绛捐缁嗗唴瀹圭殑鏁版嵁琛ㄥ垪鍚嶅拰绫诲瀷 diff --git a/src/Notes-master/src/net/micode/notes/ui/NoteItemData.java b/src/Notes-master/src/net/micode/notes/ui/NoteItemData.java index 6a78bfd..bdaaf28 100644 --- a/src/Notes-master/src/net/micode/notes/ui/NoteItemData.java +++ b/src/Notes-master/src/net/micode/notes/ui/NoteItemData.java @@ -36,7 +36,19 @@ import net.micode.notes.tool.DataUtils; public class NoteItemData { /** 鏁版嵁搴撴煡璇㈡姇褰辨暟缁 */ static final String [] PROJECTION = new String [] { - NoteColumns.IS_ENCRYPTED, // 鏄惁鍔犲瘑 + NoteColumns.ID, // 绗旇ID + NoteColumns.ALERTED_DATE, // 鎻愰啋鏃ユ湡 + NoteColumns.BG_COLOR_ID, // 鑳屾櫙棰滆壊ID + NoteColumns.CREATED_DATE, // 鍒涘缓鏃ユ湡 + NoteColumns.HAS_ATTACHMENT, // 鏄惁鏈夐檮浠 + NoteColumns.MODIFIED_DATE, // 淇敼鏃ユ湡 + NoteColumns.NOTES_COUNT, // 绗旇鏁伴噺 + NoteColumns.PARENT_ID, // 鐖舵枃浠跺すID + NoteColumns.SNIPPET, // 绗旇鎽樿 + NoteColumns.TYPE, // 绗旇绫诲瀷 + NoteColumns.WIDGET_ID, // 灏忛儴浠禝D + NoteColumns.WIDGET_TYPE, // 灏忛儴浠剁被鍨 + NoteColumns.IS_ENCRYPTED, // 鏄惁鍔犲瘑 }; /** 绗旇ID鍒楃储寮 */ diff --git a/src/Notes-master/src/net/micode/notes/ui/NotesListActivity.java b/src/Notes-master/src/net/micode/notes/ui/NotesListActivity.java index 30975ab..c6210b4 100644 --- a/src/Notes-master/src/net/micode/notes/ui/NotesListActivity.java +++ b/src/Notes-master/src/net/micode/notes/ui/NotesListActivity.java @@ -274,7 +274,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt mNoteModeButton = (Button) findViewById(R.id.btn_note_mode); mChecklistModeButton = (Button) findViewById(R.id.btn_checklist_mode); mIsChecklistMode = false; - updateModeButtons(); + // 鍙湁褰撴寜閽瓨鍦ㄦ椂鎵嶆洿鏂扮姸鎬侊紝閬垮厤绌烘寚閽堝紓甯 + if (mNoteModeButton != null && mChecklistModeButton != null) { + updateModeButtons(); + } mChecklistManager = new ChecklistManager(mContentResolver); } @@ -833,18 +836,21 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt * OMO */ private void updateModeButtons() { - if (mIsChecklistMode) { - // 娓呭崟妯″紡涓嬶紝娓呭崟鎸夐挳楂樹寒 - mChecklistModeButton.setBackgroundColor(0xFF007AFF); - mChecklistModeButton.setTextColor(0xFFFFFFFF); - mNoteModeButton.setBackgroundColor(0xFFFFFFFF); - mNoteModeButton.setTextColor(0xFF000000); - } else { - // 绗旇妯″紡涓嬶紝绗旇鎸夐挳楂樹寒 - mNoteModeButton.setBackgroundColor(0xFF007AFF); - mNoteModeButton.setTextColor(0xFFFFFFFF); - mChecklistModeButton.setBackgroundColor(0xFFFFFFFF); - mChecklistModeButton.setTextColor(0xFF000000); + // 纭繚鎸夐挳涓嶄负绌猴紝閬垮厤绌烘寚閽堝紓甯 + if (mNoteModeButton != null && mChecklistModeButton != null) { + if (mIsChecklistMode) { + // 娓呭崟妯″紡涓嬶紝娓呭崟鎸夐挳楂樹寒 + mChecklistModeButton.setBackgroundColor(0xFF007AFF); + mChecklistModeButton.setTextColor(0xFFFFFFFF); + mNoteModeButton.setBackgroundColor(0xFFFFFFFF); + mNoteModeButton.setTextColor(0xFF000000); + } else { + // 绗旇妯″紡涓嬶紝绗旇鎸夐挳楂樹寒 + mNoteModeButton.setBackgroundColor(0xFF007AFF); + mNoteModeButton.setTextColor(0xFFFFFFFF); + mChecklistModeButton.setBackgroundColor(0xFFFFFFFF); + mChecklistModeButton.setTextColor(0xFF000000); + } } } -- 2.34.1