修改部分合并后错误部分 #17

Merged
p82feo7wg merged 3 commits from wangjiaqi_branch into master 2 months ago

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="0.1" >
<!-- 已移除package属性已注释minSdkVersion可选删除 -->
<!-- <uses-sdk android:minSdkVersion="14" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="@drawable/icon_app"
android:label="@string/app_name" >
<activity
android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan"
android:exported="true" > <!-- 新增 -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:exported="true" > <!-- 新增 -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/text_note" />
<data android:mimeType="vnd.android.cursor.item/call_note" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<provider
android:name="net.micode.notes.data.NotesProvider"
android:authorities="micode_notes"
android:multiprocess="true" />
<receiver
android:name=".widget.NoteWidgetProvider_2x"
android:label="@string/app_widget2x2"
android:exported="false" > <!-- 新增 -->
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_2x_info" />
</receiver>
<receiver
android:name=".widget.NoteWidgetProvider_4x"
android:label="@string/app_widget4x4"
android:exported="false" > <!-- 新增 -->
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_4x_info" />
</receiver>
<receiver
android:name=".ui.AlarmInitReceiver"
android:exported="true" > <!-- 新增 -->
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver
android:name="net.micode.notes.ui.AlarmReceiver"
android:process=":remote" >
</receiver>
<activity
android:name=".ui.AlarmAlertActivity"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" >
</activity>
<activity
android:name="net.micode.notes.ui.NotesPreferenceActivity"
android:label="@string/preferences_title"
android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" >
</activity>
<activity
android:name=".ui.TrashActivity"
android:label="@string/menu_trash"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:exported="true" >
</activity>
<activity
android:name=".ui.PasswordInputActivity"
android:label="@string/password_input_title"
android:theme="@style/NoteTheme"
android:exported="false" >
</activity>
<service
android:name="net.micode.notes.gtask.remote.GTaskSyncService"
android:exported="false" >
</service>
<meta-data
android:name="android.app.default_searchable"
android:value=".ui.NoteEditActivity" />
</application>
</manifest>

@ -1,6 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> package="net.micode.notes"
android:versionCode="1"
android:versionName="0.1" >
<!-- 已移除package属性已注释minSdkVersion可选删除 -->
<!-- <uses-sdk android:minSdkVersion="14" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
@ -11,28 +26,17 @@
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application <application
android:allowBackup="true" android:icon="@drawable/icon_app"
android:dataExtractionRules="@xml/data_extraction_rules" android:label="@string/app_name" >
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Notesmaster"
tools:targetApi="31">
<activity <activity
android:name=".ui.NotesListActivity" android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/NoteTheme" android:theme="@style/NoteTheme"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"
android:exported="true"> android:exported="true" > <!-- 新增 -->
<!-- 这段本来在theme和windowSoftInputMode之间android:uiOptions="splitActionBarWhenNarrow" -->
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@ -136,6 +140,19 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@android:style/Theme.Holo.Light" > android:theme="@android:style/Theme.Holo.Light" >
</activity> </activity>
<activity
android:name=".ui.TrashActivity"
android:label="@string/menu_trash"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:exported="true" >
</activity>
<activity
android:name=".ui.PasswordInputActivity"
android:label="@string/password_input_title"
android:theme="@style/NoteTheme"
android:exported="false" >
</activity>
<service <service
android:name="net.micode.notes.gtask.remote.GTaskSyncService" android:name="net.micode.notes.gtask.remote.GTaskSyncService"

@ -19,51 +19,44 @@ package net.micode.notes.data;
import android.net.Uri; import android.net.Uri;
/** /**
* *
* *
* *
*/ */
public class Notes { public class Notes {
// ContentProvider的授权标识 // ContentProvider的授权标识
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";
// 0类型普通笔记 // 0类型普通笔记
public static final int TYPE_NOTE = 0; public static final int TYPE_NOTE = 0;
// 1类型文件夹 // 1类型文件夹
public static final int TYPE_FOLDER = 1; public static final int TYPE_FOLDER = 1;
// 2类型系统文件夹 // 2类型系统文件夹
public static final int TYPE_SYSTEM = 2; public static final int TYPE_SYSTEM = 2;
// 3类型清单
// 系统文件夹的 ID 定义。 public static final int TYPE_CHECKLIST = 3;
// #ID_ROOT_FOLDER 默认根文件夹
// #ID_TEMPARAY_FOLDER 临时文件夹,移动笔记时的中转 // 系统文件夹的 ID 定义。
// #ID_CALL_RECORD_FOLDER 通话记录专用文件夹 // #ID_ROOT_FOLDER 默认根文件夹
// #ID_TRASH_FOLER 回收站 // #ID_TEMPARAY_FOLDER 临时文件夹,移动笔记时的中转
public static final int ID_ROOT_FOLDER = 0; // 默认根文件夹 // #ID_CALL_RECORD_FOLDER 通话记录专用文件夹
public static final int ID_TEMPARAY_FOLDER = -1; // 临时文件夹(用于无归属的笔记) // #ID_TRASH_FOLER 回收站
public static final int ID_CALL_RECORD_FOLDER = -2; // 通话记录文件夹 public static final int ID_ROOT_FOLDER = 0; // 默认根文件夹
public static final int ID_TRASH_FOLER = -3; // 回收站文件夹 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 * Intent Extra Android Intent
* 3. ID * 1.
* 4. * 2. ID
* 5. ID * 3. ID
* 6. * 4.
* Following IDs are system folders' identifiers * 5. ID
* {@link Notes#ID_ROOT_FOLDER } is default folder * 6.
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder * 7.
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
* 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_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_BACKGROUND_ID = "net.micode.notes.background_color_id";
public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id"; public static final String INTENT_EXTRA_WIDGET_ID = "net.micode.notes.widget_id";
@ -72,142 +65,98 @@ public class Notes {
public static final String INTENT_EXTRA_CALL_DATE = "net.micode.notes.call_date"; 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"; public static final String INTENT_EXTRA_NOTE_TYPE = "net.micode.notes.note_type";
// 无效的小部件类型 -1
public static final int TYPE_WIDGET_INVALIDE = -1; public static final int TYPE_WIDGET_INVALIDE = -1;
// 2x2小部件类型 0
public static final int TYPE_WIDGET_2X = 0; public static final int TYPE_WIDGET_2X = 0;
// 4x4小部件类型 1
public static final int TYPE_WIDGET_4X = 1; public static final int TYPE_WIDGET_4X = 1;
/**
*
*/
public static class DataConstants { public static class DataConstants {
// 普通笔记的MIME类型
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE; public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
// 通话记录笔记的MIME类型
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE; public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
} }
/** // URI 是 ContentProvider 的标准访问入口,用于统一访问应用的数据。
* 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
*/
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 to query trash notes * Uri to query trash notes
*/ */
public static final Uri CONTENT_TRASH_URI = Uri.parse("content://" + AUTHORITY + "/trash"); public static final Uri CONTENT_TRASH_URI = Uri.parse("content://" + AUTHORITY + "/trash");
public interface NoteColumns {
/** /**
* The unique ID for a row * NoteColumns - 便(notes)
* <P> Type: INTEGER (long) </P> * 便
*/ */
public static final String ID = "_id";
/** /**
* The parent's id for note or folder *
* <P> Type: INTEGER (long) </P>
*/ */
public interface NoteColumns {
// 行的唯一ID
public static final String ID = "_id";
// 笔记或文件夹的父ID
public static final String PARENT_ID = "parent_id"; 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"; public static final String CREATED_DATE = "created_date";
/** // 最后修改日期
* Latest modified date
* <P> Type: INTEGER (long) </P>
*/
public static final String MODIFIED_DATE = "modified_date"; public static final String MODIFIED_DATE = "modified_date";
// 提醒日期
/**
* Alert date
* <P> Type: INTEGER (long) </P>
*/
public static final String ALERTED_DATE = "alert_date"; public static final String ALERTED_DATE = "alert_date";
/** // 文件夹名称或笔记的文本内容摘要
* Folder's name or text content of note
* <P> Type: TEXT </P>
*/
public static final String SNIPPET = "snippet"; public static final String SNIPPET = "snippet";
/** // 笔记的小部件ID
* Note's widget id
* <P> Type: INTEGER (long) </P>
*/
public static final String WIDGET_ID = "widget_id"; 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"; public static final String WIDGET_TYPE = "widget_type";
/** // 笔记的背景颜色ID
* 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 BG_COLOR_ID = "bg_color_id";
/** // 是否有附件;对于文本笔记没有附件,多媒体笔记至少有一个附件
* 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 HAS_ATTACHMENT = "has_attachment";
/** // 文件夹中的笔记数量
* Folder's count of notes
* <P> Type: INTEGER (long) </P>
*/
public static final String NOTES_COUNT = "notes_count"; public static final String NOTES_COUNT = "notes_count";
/** // 文件类型:文件夹或笔记
* The file type: folder or note
* <P> Type: INTEGER </P>
*/
public static final String TYPE = "type"; public static final String TYPE = "type";
/** // 最后一次同步的ID
* The last sync id
* <P> Type: INTEGER (long) </P>
*/
public static final String SYNC_ID = "sync_id"; 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"; public static final String LOCAL_MODIFIED = "local_modified";
/** // 移动到临时文件夹之前的原始父ID
* 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 ORIGIN_PARENT_ID = "origin_parent_id";
/** // Google Task的ID
* The gtask id
* <P> Type : TEXT </P>
*/
public static final String GTASK_ID = "gtask_id"; public static final String GTASK_ID = "gtask_id";
/** // 版本号
* The version code
* <P> Type : INTEGER (long) </P>
*/
public static final String VERSION = "version"; public static final String VERSION = "version";
/** /**
* Whether the note is encrypted * Whether the note is encrypted
* <P> Type : INTEGER (0 = not encrypted, 1 = encrypted) </P> * <P> Type : INTEGER (0 = not encrypted, 1 = encrypted) </P>
*/ */
public static final String IS_ENCRYPTED = "is_encrypted"; public static final String IS_ENCRYPTED = "is_encrypted";
} }
public interface TrashColumns extends NoteColumns { public interface TrashColumns extends NoteColumns {
/** /**
* Deleted date for trash note * Deleted date for trash note
@ -215,119 +164,91 @@ public class Notes {
*/ */
public static final String DELETED_DATE = "deleted_date"; public static final String DELETED_DATE = "deleted_date";
} }
/** /**
* DataColumns - 便(data) * DataColumns - 便(data)
* 便 * 便
* 使MIME_TYPE便便 * 使MIME_TYPE便便
*/ */
public interface DataColumns { public interface DataColumns {
/** // 行的唯一ID
* The unique ID for a row
* <P> Type: INTEGER (long) </P>
*/
public static final String ID = "_id"; public static final String ID = "_id";
/** // 该行数据项的MIME类型
* The MIME type of the item represented by this row.
* <P> Type: Text </P>
*/
public static final String MIME_TYPE = "mime_type"; public static final String MIME_TYPE = "mime_type";
/** // 该数据所属笔记的引用ID
* The reference id to note that this data belongs to
* <P> Type: INTEGER (long) </P>
*/
public static final String NOTE_ID = "note_id"; 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"; public static final String CREATED_DATE = "created_date";
/** // 最后修改日期
* Latest modified date
* <P> Type: INTEGER (long) </P>
*/
public static final String MODIFIED_DATE = "modified_date"; public static final String MODIFIED_DATE = "modified_date";
/** // 数据内容
* Data's content
* <P> Type: TEXT </P>
*/
public static final String CONTENT = "content"; public static final String CONTENT = "content";
// 通用数据列1
/**
* 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";
/** // 通用数据列2
* 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";
/** // 通用数据列3
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
public static final String DATA3 = "data3"; public static final String DATA3 = "data3";
/** // 通用数据列4
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
public static final String DATA4 = "data4"; public static final String DATA4 = "data4";
/** // 通用数据列5
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
public static final String DATA5 = "data5"; public static final String DATA5 = "data5";
} }
public static final class TextNote implements DataColumns {
/** /**
* Mode to indicate the text in check list mode or not * TextNote - 便
* <P> Type: Integer 1:check list mode 0: normal mode </P> * 便URI
*/ */
public static final class TextNote implements DataColumns {
// 模式标识:文本是否为清单模式
public static final String MODE = DATA1; public static final String MODE = DATA1;
// 清单模式常量
public static final int MODE_CHECK_LIST = 1; 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"; 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"; 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 Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
} }
public static final class CallNote implements DataColumns {
/** /**
* Call date for this record * CallNote - 便
* <P> Type: INTEGER (long) </P> * 便URI
*/ */
public static final class CallNote implements DataColumns {
// 通话日期
public static final String CALL_DATE = DATA1; public static final String CALL_DATE = DATA1;
/** // 电话号码
* Phone number for this record
* <P> Type: TEXT </P>
*/
public static final String PHONE_NUMBER = DATA3; 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"; 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"; 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"); public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
} }
} }

@ -36,6 +36,18 @@ import net.micode.notes.tool.DataUtils;
public class NoteItemData { public class NoteItemData {
/** 数据库查询投影数组 */ /** 数据库查询投影数组 */
static final String [] PROJECTION = new String [] { static final String [] PROJECTION = new String [] {
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, // 是否加密 NoteColumns.IS_ENCRYPTED, // 是否加密
}; };

@ -274,7 +274,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
mNoteModeButton = (Button) findViewById(R.id.btn_note_mode); mNoteModeButton = (Button) findViewById(R.id.btn_note_mode);
mChecklistModeButton = (Button) findViewById(R.id.btn_checklist_mode); mChecklistModeButton = (Button) findViewById(R.id.btn_checklist_mode);
mIsChecklistMode = false; mIsChecklistMode = false;
// 只有当按钮存在时才更新状态,避免空指针异常
if (mNoteModeButton != null && mChecklistModeButton != null) {
updateModeButtons(); updateModeButtons();
}
mChecklistManager = new ChecklistManager(mContentResolver); mChecklistManager = new ChecklistManager(mContentResolver);
} }
@ -833,6 +836,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
* OMO * OMO
*/ */
private void updateModeButtons() { private void updateModeButtons() {
// 确保按钮不为空,避免空指针异常
if (mNoteModeButton != null && mChecklistModeButton != null) {
if (mIsChecklistMode) { if (mIsChecklistMode) {
// 清单模式下,清单按钮高亮 // 清单模式下,清单按钮高亮
mChecklistModeButton.setBackgroundColor(0xFF007AFF); mChecklistModeButton.setBackgroundColor(0xFF007AFF);
@ -847,6 +852,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
mChecklistModeButton.setTextColor(0xFF000000); mChecklistModeButton.setTextColor(0xFF000000);
} }
} }
}
/** /**
* *

Loading…
Cancel
Save