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 (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)

- */ + // 笔记的背景颜色ID 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的ID 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 { + 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; + + // 文本笔记的目录MIME类型 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/text_note"; + // 文本笔记的单项MIME类型 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"); } + /** + * CallNote 类 - 通话记录便签数据定义 + * 定义了通话记录便签特有的数据列和URI + */ 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; + + // 通话记录笔记的目录MIME类型 public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_note"; + // 通话记录笔记的单项MIME类型 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"); } } 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, // 小部件ID + 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); + } } }