修改部分合并后错误部分 #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"?>
<!-- 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"
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="com.android.launcher.permission.INSTALL_SHORTCUT" />
<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.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
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">
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">
<!-- 这段本来在theme和windowSoftInputMode之间android:uiOptions="splitActionBarWhenNarrow" -->
android:exported="true" > <!-- 新增 -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -136,6 +140,19 @@
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"

@ -19,51 +19,44 @@ package net.micode.notes.data;
import android.net.Uri;
/**
*
*
*
*
*
*
*/
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. ID
* 4.
* 5. ID
* 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,190 @@ 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;
// 通话记录笔记的MIME类型
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
}
/**
* Uri to query all notes and folders
*/
// URI 是 ContentProvider 的标准访问入口,用于统一访问应用的数据。
// 查询所有笔记和文件夹的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
*/
public static final Uri CONTENT_TRASH_URI = Uri.parse("content://" + AUTHORITY + "/trash");
/**
* NoteColumns - 便(notes)
* 便
*/
/**
*
*/
public interface NoteColumns {
/**
* The unique ID for a row
* <P> Type: INTEGER (long) </P>
*/
// 行的唯一ID
public static final String ID = "_id";
/**
* The parent's id for note or folder
* <P> Type: INTEGER (long) </P>
*/
// 笔记或文件夹的父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";
/**
* Latest modified date
* <P> Type: INTEGER (long) </P>
*/
// 最后修改日期
public static final String MODIFIED_DATE = "modified_date";
/**
* Alert date
* <P> Type: INTEGER (long) </P>
*/
// 提醒日期
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";
/**
* Note's widget id
* <P> Type: INTEGER (long) </P>
*/
// 笔记的小部件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";
/**
* Note's background color's id
* <P> Type: INTEGER (long) </P>
*/
// 笔记的背景颜色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";
/**
* 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
* <P> Type: INTEGER (long) </P>
*/
// 最后一次同步的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";
/**
* Original parent id before moving into temporary folder
* <P> Type : INTEGER </P>
*/
// 移动到临时文件夹之前的原始父ID
public static final String ORIGIN_PARENT_ID = "origin_parent_id";
/**
* The gtask id
* <P> Type : TEXT </P>
*/
// Google Task的ID
public static final String GTASK_ID = "gtask_id";
/**
* The version code
* <P> Type : INTEGER (long) </P>
*/
// 版本号
public static final String VERSION = "version";
/**
/**
* Whether the note is encrypted
* <P> Type : INTEGER (0 = not encrypted, 1 = encrypted) </P>
*/
public static final String IS_ENCRYPTED = "is_encrypted";
}
public interface TrashColumns extends NoteColumns {
public interface TrashColumns extends NoteColumns {
/**
* Deleted date for trash note
* <P> Type: INTEGER (long) </P>
*/
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
* <P> Type: INTEGER (long) </P>
*/
// 行的唯一ID
public static final String ID = "_id";
/**
* The MIME type of the item represented by this row.
* <P> Type: Text </P>
*/
// 该行数据项的MIME类型
public static final String MIME_TYPE = "mime_type";
/**
* The reference id to note that this data belongs to
* <P> Type: INTEGER (long) </P>
*/
// 该数据所属笔记的引用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";
/**
* 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
* integer data type
* <P> Type: INTEGER </P>
*/
// 通用数据列1
public static final String DATA1 = "data1";
/**
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* integer data type
* <P> Type: INTEGER </P>
*/
// 通用数据列2
public static final String DATA2 = "data2";
/**
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
// 通用数据列3
public static final String DATA3 = "data3";
/**
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
// 通用数据列4
public static final String DATA4 = "data4";
/**
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
* TEXT data type
* <P> Type: TEXT </P>
*/
// 通用数据列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
* <P> Type: Integer 1:check list mode 0: normal mode </P>
*/
// 模式标识:文本是否为清单模式
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
* <P> Type: INTEGER (long) </P>
*/
// 通话日期
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 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");
}
}

@ -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列索引 */

@ -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);
}
}
}

Loading…
Cancel
Save