|
|
@ -1,140 +1,175 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
|
|
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
|
|
|
*
|
|
|
|
* 这行注释表明版权所有者是The MiCode Open Source Community,时间为2010-2011年。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
|
|
|
* 这行注释说明该文件是在Apache License 2.0下授权的。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
|
|
|
* 这行注释说明,除了遵守许可证外,你不能使用此文件。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* 你可以通过以下网址获得许可证的副本:
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*/
|
|
|
|
*
|
|
|
|
/*
|
|
|
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
* 这是Apache License 2.0的网址链接。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
|
|
* 除非适用法律要求或书面同意,
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
|
|
|
* 根据许可证分发的软件是在“按原样”的基础上分发的,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
|
|
* 没有任何形式的担保,无论是明示的还是暗示的。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
|
|
|
* 请参阅许可证,了解控制权限和限制的具体语言。
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
|
|
|
|
* 许可证下的限制。
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
package net.micode.notes.ui;
|
|
|
|
|
|
|
|
// 指定包名为net.micode.notes.ui。
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
// 导入Context类,用于访问应用程序的环境信息。
|
|
|
|
|
|
|
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
|
|
// 导入Cursor类,用于遍历数据库查询结果。
|
|
|
|
|
|
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
// 导入TextUtils类,用于操作文本工具。
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.data.Contact;
|
|
|
|
import net.micode.notes.data.Contact;
|
|
|
|
|
|
|
|
// 导入Contact类,用于处理联系人数据。
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
|
|
|
|
// 导入Notes类,用于处理便签数据。
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
|
|
|
|
// 导入NoteColumns类,用于访问便签数据的列。
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.tool.DataUtils;
|
|
|
|
import net.micode.notes.tool.DataUtils;
|
|
|
|
|
|
|
|
// 导入DataUtils类,用于数据处理工具。
|
|
|
|
|
|
|
|
|
|
|
|
// NoteItemData类用于封装便签项的数据
|
|
|
|
// NoteItemData类用于封装便签项的数据
|
|
|
|
public class NoteItemData {
|
|
|
|
public class NoteItemData {
|
|
|
|
// 数据库查询的列
|
|
|
|
// 数据库查询的列
|
|
|
|
static final String [] PROJECTION = new String [] {
|
|
|
|
static final String [] PROJECTION = new String [] {
|
|
|
|
NoteColumns.ID,
|
|
|
|
NoteColumns.ID, // 便签ID
|
|
|
|
NoteColumns.ALERTED_DATE,
|
|
|
|
NoteColumns.ALERTED_DATE, // 便签提醒日期
|
|
|
|
NoteColumns.BG_COLOR_ID,
|
|
|
|
NoteColumns.BG_COLOR_ID, // 便签背景色ID
|
|
|
|
NoteColumns.CREATED_DATE,
|
|
|
|
NoteColumns.CREATED_DATE, // 便签创建日期
|
|
|
|
NoteColumns.HAS_ATTACHMENT,
|
|
|
|
NoteColumns.HAS_ATTACHMENT, // 便签是否有附件
|
|
|
|
NoteColumns.MODIFIED_DATE,
|
|
|
|
NoteColumns.MODIFIED_DATE, // 便签修改日期
|
|
|
|
NoteColumns.NOTES_COUNT,
|
|
|
|
NoteColumns.NOTES_COUNT, // 便签数量
|
|
|
|
NoteColumns.PARENT_ID,
|
|
|
|
NoteColumns.PARENT_ID, // 便签的父ID
|
|
|
|
NoteColumns.SNIPPET,
|
|
|
|
NoteColumns.SNIPPET, // 便签摘要
|
|
|
|
NoteColumns.TYPE,
|
|
|
|
NoteColumns.TYPE, // 便签类型
|
|
|
|
NoteColumns.WIDGET_ID,
|
|
|
|
NoteColumns.WIDGET_ID, // 便签小部件ID
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
NoteColumns.WIDGET_TYPE, // 便签小部件类型
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 列索引
|
|
|
|
// 列索引
|
|
|
|
private static final int ID_COLUMN = 0;
|
|
|
|
private static final int ID_COLUMN = 0; // ID列索引
|
|
|
|
private static final int ALERTED_DATE_COLUMN = 1;
|
|
|
|
private static final int ALERTED_DATE_COLUMN = 1; // ALERTED_DATE列索引
|
|
|
|
private static final int BG_COLOR_ID_COLUMN = 2;
|
|
|
|
private static final int BG_COLOR_ID_COLUMN = 2; // BG_COLOR_ID列索引
|
|
|
|
private static final int CREATED_DATE_COLUMN = 3;
|
|
|
|
private static final int CREATED_DATE_COLUMN = 3; // CREATED_DATE列索引
|
|
|
|
private static final int HAS_ATTACHMENT_COLUMN = 4;
|
|
|
|
private static final int HAS_ATTACHMENT_COLUMN = 4; // HAS_ATTACHMENT列索引
|
|
|
|
private static final int MODIFIED_DATE_COLUMN = 5;
|
|
|
|
private static final int MODIFIED_DATE_COLUMN = 5; // MODIFIED_DATE列索引
|
|
|
|
private static final int NOTES_COUNT_COLUMN = 6;
|
|
|
|
private static final int NOTES_COUNT_COLUMN = 6; // NOTES_COUNT列索引
|
|
|
|
private static final int PARENT_ID_COLUMN = 7;
|
|
|
|
private static final int PARENT_ID_COLUMN = 7; // PARENT_ID列索引
|
|
|
|
private static final int SNIPPET_COLUMN = 8;
|
|
|
|
private static final int SNIPPET_COLUMN = 8; // SNIPPET列索引
|
|
|
|
private static final int TYPE_COLUMN = 9;
|
|
|
|
private static final int TYPE_COLUMN = 9; // TYPE列索引
|
|
|
|
private static final int WIDGET_ID_COLUMN = 10;
|
|
|
|
private static final int WIDGET_ID_COLUMN = 10; // WIDGET_ID列索引
|
|
|
|
private static final int WIDGET_TYPE_COLUMN = 11;
|
|
|
|
private static final int WIDGET_TYPE_COLUMN = 11; // WIDGET_TYPE列索引
|
|
|
|
|
|
|
|
|
|
|
|
// 成员变量,存储便签项的数据
|
|
|
|
// 成员变量,存储便签项的数据
|
|
|
|
private long mId;
|
|
|
|
private long mId; // 便签ID
|
|
|
|
private long mAlertDate;
|
|
|
|
private long mAlertDate; // 便签提醒日期
|
|
|
|
private int mBgColorId;
|
|
|
|
private int mBgColorId; // 便签背景色ID
|
|
|
|
private long mCreatedDate;
|
|
|
|
private long mCreatedDate; // 便签创建日期
|
|
|
|
private boolean mHasAttachment;
|
|
|
|
private boolean mHasAttachment; // 便签是否有附件
|
|
|
|
private long mModifiedDate;
|
|
|
|
private long mModifiedDate; // 便签修改日期
|
|
|
|
private int mNotesCount;
|
|
|
|
private int mNotesCount; // 便签数量
|
|
|
|
private long mParentId;
|
|
|
|
private long mParentId; // 便签的父ID
|
|
|
|
private String mSnippet;
|
|
|
|
private String mSnippet; // 便签摘要
|
|
|
|
private int mType;
|
|
|
|
private int mType; // 便签类型
|
|
|
|
private int mWidgetId;
|
|
|
|
private int mWidgetId; // 便签小部件ID
|
|
|
|
private int mWidgetType;
|
|
|
|
private int mWidgetType; // 便签小部件类型
|
|
|
|
private String mName;
|
|
|
|
private String mName; // 便签联系人名称
|
|
|
|
private String mPhoneNumber;
|
|
|
|
private String mPhoneNumber; // 便签联系人电话号码
|
|
|
|
|
|
|
|
|
|
|
|
// 用于标记便签项的位置状态
|
|
|
|
// 用于标记便签项的位置状态
|
|
|
|
private boolean mIsLastItem;
|
|
|
|
private boolean mIsLastItem; // 是否是最后一项
|
|
|
|
private boolean mIsFirstItem;
|
|
|
|
private boolean mIsFirstItem; // 是否是第一项
|
|
|
|
private boolean mIsOnlyOneItem;
|
|
|
|
private boolean mIsOnlyOneItem; // 是否只有一项
|
|
|
|
private boolean mIsOneNoteFollowingFolder;
|
|
|
|
private boolean mIsOneNoteFollowingFolder; // 是否有一个便签项跟随文件夹
|
|
|
|
private boolean mIsMultiNotesFollowingFolder;
|
|
|
|
private boolean mIsMultiNotesFollowingFolder; // 是否有多个便签项跟随文件夹
|
|
|
|
|
|
|
|
|
|
|
|
// 构造函数,从游标中初始化便签项的数据
|
|
|
|
// 构造函数,从游标中初始化便签项的数据
|
|
|
|
public NoteItemData(Context context, Cursor cursor) {
|
|
|
|
public NoteItemData(Context context, Cursor cursor) {
|
|
|
|
mId = cursor.getLong(ID_COLUMN);
|
|
|
|
// 从游标中获取数据并赋值给成员变量
|
|
|
|
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN);
|
|
|
|
mId = cursor.getLong(ID_COLUMN); // 获取便签ID
|
|
|
|
mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN);
|
|
|
|
mAlertDate = cursor.getLong(ALERTED_DATE_COLUMN); // 获取便签提醒日期
|
|
|
|
mCreatedDate = cursor.getLong(CREATED_DATE_COLUMN);
|
|
|
|
mBgColorId = cursor.getInt(BG_COLOR_ID_COLUMN); // 获取便签背景色ID
|
|
|
|
mHasAttachment = (cursor.getInt(HAS_ATTACHMENT_COLUMN) > 0) ? true : false;
|
|
|
|
mCreatedDate = cursor.getLong(CREATED_DATE_COLUMN); // 获取便签创建日期
|
|
|
|
mModifiedDate = cursor.getLong(MODIFIED_DATE_COLUMN);
|
|
|
|
mHasAttachment = (cursor.getInt(HAS_ATTACHMENT_COLUMN) > 0) ? true : false; // 判断便签是否有附件
|
|
|
|
mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN);
|
|
|
|
mModifiedDate = cursor.getLong(MODIFIED_DATE_COLUMN); // 获取便签修改日期
|
|
|
|
mParentId = cursor.getLong(PARENT_ID_COLUMN);
|
|
|
|
mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN); // 获取便签数量
|
|
|
|
mSnippet = cursor.getString(SNIPPET_COLUMN);
|
|
|
|
mParentId = cursor.getLong(PARENT_ID_COLUMN); // 获取便签的父ID
|
|
|
|
mSnippet = mSnippet.replace(NoteEditActivity.TAG_CHECKED, "").replace(
|
|
|
|
mSnippet = cursor.getString(SNIPPET_COLUMN); // 获取便签摘要
|
|
|
|
NoteEditActivity.TAG_UNCHECKED, "");
|
|
|
|
mSnippet = mSnippet.replace(NoteEditActivity.TAG_CHECKED, "").replace(NoteEditActivity.TAG_UNCHECKED, ""); // 移除摘要中的特定标签
|
|
|
|
mType = cursor.getInt(TYPE_COLUMN);
|
|
|
|
mType = cursor.getInt(TYPE_COLUMN); // 获取便签类型
|
|
|
|
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
|
|
|
|
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN); // 获取便签小部件ID
|
|
|
|
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
|
|
|
|
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN); // 获取便签小部件类型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果便签项是通话记录文件夹
|
|
|
|
mPhoneNumber = "";
|
|
|
|
mPhoneNumber = "";
|
|
|
|
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId);
|
|
|
|
mPhoneNumber = DataUtils.getCallNumberByNoteId(context.getContentResolver(), mId); // 获取通话记录号码
|
|
|
|
if (!TextUtils.isEmpty(mPhoneNumber)) {
|
|
|
|
if (!TextUtils.isEmpty(mPhoneNumber)) {
|
|
|
|
mName = Contact.getContact(context, mPhoneNumber);
|
|
|
|
mName = Contact.getContact(context, mPhoneNumber); // 获取联系人名称
|
|
|
|
if (mName == null) {
|
|
|
|
if (mName == null) {
|
|
|
|
mName = mPhoneNumber;
|
|
|
|
mName = mPhoneNumber; // 如果联系人名称为空,则使用电话号码
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mName == null) {
|
|
|
|
if (mName == null) {
|
|
|
|
mName = "";
|
|
|
|
mName = ""; // 如果联系人名称为空,则设置为空字符串
|
|
|
|
}
|
|
|
|
}
|
|
|
|
checkPostion(cursor);
|
|
|
|
checkPostion(cursor); // 检查便签项的位置状态
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查便签项的位置状态
|
|
|
|
// 检查便签项的位置状态
|
|
|
|
private void checkPostion(Cursor cursor) {
|
|
|
|
private void checkPostion(Cursor cursor) {
|
|
|
|
mIsLastItem = cursor.isLast() ? true : false;
|
|
|
|
// 设置便签项的位置状态标志
|
|
|
|
mIsFirstItem = cursor.isFirst() ? true : false;
|
|
|
|
mIsLastItem = cursor.isLast() ? true : false; // 是否是最后一项
|
|
|
|
mIsOnlyOneItem = (cursor.getCount() == 1);
|
|
|
|
mIsFirstItem = cursor.isFirst() ? true : false; // 是否是第一项
|
|
|
|
mIsMultiNotesFollowingFolder = false;
|
|
|
|
mIsOnlyOneItem = (cursor.getCount() == 1); // 是否只有一项
|
|
|
|
mIsOneNoteFollowingFolder = false;
|
|
|
|
mIsMultiNotesFollowingFolder = false; // 默认没有多个便签项跟随文件夹
|
|
|
|
|
|
|
|
mIsOneNoteFollowingFolder = false; // 默认没有单个便签项跟随文件夹
|
|
|
|
if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {
|
|
|
|
|
|
|
|
int position = cursor.getPosition();
|
|
|
|
if (mType == Notes.TYPE_NOTE && !mIsFirstItem) { // 如果是便签项且不是第一项
|
|
|
|
if (cursor.moveToPrevious()) {
|
|
|
|
int position = cursor.getPosition(); // 获取当前位置
|
|
|
|
if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER
|
|
|
|
if (cursor.moveToPrevious()) { // 移动到前一项
|
|
|
|
|| cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {
|
|
|
|
if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER || cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {
|
|
|
|
if (cursor.getCount() > (position + 1)) {
|
|
|
|
if (cursor.getCount() > (position + 1)) {
|
|
|
|
mIsMultiNotesFollowingFolder = true;
|
|
|
|
mIsMultiNotesFollowingFolder = true; // 有多个便签项跟随文件夹
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
mIsOneNoteFollowingFolder = true;
|
|
|
|
mIsOneNoteFollowingFolder = true; // 有单个便签项跟随文件夹
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!cursor.moveToNext()) {
|
|
|
|
if (!cursor.moveToNext()) { // 移动回原来的位置
|
|
|
|
throw new IllegalStateException("cursor move to previous but can't move back");
|
|
|
|
throw new IllegalStateException("cursor move to previous but can't move back"); // 如果无法移动回原来的位置,抛出异常
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -142,90 +177,90 @@ public class NoteItemData {
|
|
|
|
|
|
|
|
|
|
|
|
// 获取便签项的位置状态
|
|
|
|
// 获取便签项的位置状态
|
|
|
|
public boolean isOneFollowingFolder() {
|
|
|
|
public boolean isOneFollowingFolder() {
|
|
|
|
return mIsOneNoteFollowingFolder;
|
|
|
|
return mIsOneNoteFollowingFolder; // 返回是否有单个便签项跟随文件夹
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isMultiFollowingFolder() {
|
|
|
|
public boolean isMultiFollowingFolder() {
|
|
|
|
return mIsMultiNotesFollowingFolder;
|
|
|
|
return mIsMultiNotesFollowingFolder; // 返回是否有多个便签项跟随文件夹
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isLast() {
|
|
|
|
public boolean isLast() {
|
|
|
|
return mIsLastItem;
|
|
|
|
return mIsLastItem; // 返回是否是最后一项
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getCallName() {
|
|
|
|
public String getCallName() {
|
|
|
|
return mName;
|
|
|
|
return mName; // 返回联系人名称
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isFirst() {
|
|
|
|
public boolean isFirst() {
|
|
|
|
return mIsFirstItem;
|
|
|
|
return mIsFirstItem; // 返回是否是第一项
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isSingle() {
|
|
|
|
public boolean isSingle() {
|
|
|
|
return mIsOnlyOneItem;
|
|
|
|
return mIsOnlyOneItem; // 返回是否只有一项
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getId() {
|
|
|
|
public long getId() {
|
|
|
|
return mId;
|
|
|
|
return mId; // 返回便签ID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getAlertDate() {
|
|
|
|
public long getAlertDate() {
|
|
|
|
return mAlertDate;
|
|
|
|
return mAlertDate; // 返回便签提醒日期
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getCreatedDate() {
|
|
|
|
public long getCreatedDate() {
|
|
|
|
return mCreatedDate;
|
|
|
|
return mCreatedDate; // 返回便签创建日期
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasAttachment() {
|
|
|
|
public boolean hasAttachment() {
|
|
|
|
return mHasAttachment;
|
|
|
|
return mHasAttachment; // 返回便签是否有附件
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getModifiedDate() {
|
|
|
|
public long getModifiedDate() {
|
|
|
|
return mModifiedDate;
|
|
|
|
return mModifiedDate; // 返回便签修改日期
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getBgColorId() {
|
|
|
|
public int getBgColorId() {
|
|
|
|
return mBgColorId;
|
|
|
|
return mBgColorId; // 返回便签背景色ID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getParentId() {
|
|
|
|
public long getParentId() {
|
|
|
|
return mParentId;
|
|
|
|
return mParentId; // 返回便签的父ID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getNotesCount() {
|
|
|
|
public int getNotesCount() {
|
|
|
|
return mNotesCount;
|
|
|
|
return mNotesCount; // 返回便签数量
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public long getFolderId () {
|
|
|
|
public long getFolderId() {
|
|
|
|
return mParentId;
|
|
|
|
return mParentId; // 返回便签文件夹ID,与父ID相同
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getType() {
|
|
|
|
public int getType() {
|
|
|
|
return mType;
|
|
|
|
return mType; // 返回便签类型
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getWidgetType() {
|
|
|
|
public int getWidgetType() {
|
|
|
|
return mWidgetType;
|
|
|
|
return mWidgetType; // 返回便签小部件类型
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getWidgetId() {
|
|
|
|
public int getWidgetId() {
|
|
|
|
return mWidgetId;
|
|
|
|
return mWidgetId; // 返回便签小部件ID
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getSnippet() {
|
|
|
|
public String getSnippet() {
|
|
|
|
return mSnippet;
|
|
|
|
return mSnippet; // 返回便签摘要
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasAlert() {
|
|
|
|
public boolean hasAlert() {
|
|
|
|
return (mAlertDate > 0);
|
|
|
|
return (mAlertDate > 0); // 返回便签是否有提醒,即提醒日期是否大于0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isCallRecord() {
|
|
|
|
public boolean isCallRecord() {
|
|
|
|
return (mParentId == Notes.ID_CALL_RECORD_FOLDER && !TextUtils.isEmpty(mPhoneNumber));
|
|
|
|
return (mParentId == Notes.ID_CALL_RECORD_FOLDER && !TextUtils.isEmpty(mPhoneNumber)); // 返回是否是通话记录
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static int getNoteType(Cursor cursor) {
|
|
|
|
public static int getNoteType(Cursor cursor) {
|
|
|
|
return cursor.getInt(TYPE_COLUMN);
|
|
|
|
return cursor.getInt(TYPE_COLUMN); // 根据游标获取便签类型
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|