|
|
/*
|
|
|
* 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.
|
|
|
*/
|
|
|
|
|
|
package net.micode.notes.model;
|
|
|
|
|
|
|
|
|
|
|
|
// 导入所需的Android和项目内部的类
|
|
|
|
|
|
import android.appwidget.AppWidgetManager;
|
|
|
|
|
|
import android.content.ContentUris;
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
|
|
import net.micode.notes.data.Notes;
|
|
|
|
|
|
import net.micode.notes.data.Notes.CallNote;
|
|
|
|
|
|
import net.micode.notes.data.Notes.DataColumns;
|
|
|
|
|
|
import net.micode.notes.data.Notes.DataConstants;
|
|
|
|
|
|
import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
|
|
import net.micode.notes.data.Notes.TextNote;
|
|
|
|
|
|
import net.micode.notes.tool.ResourceParser.NoteBgResources;
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个用于处理工作中的笔记的类
|
|
|
|
|
|
public class WorkingNote {
|
|
|
|
|
|
// 笔记对象
|
|
|
|
|
|
private Note mNote;
|
|
|
|
|
|
// 笔记ID
|
|
|
|
|
|
private long mNoteId;
|
|
|
|
|
|
// 笔记内容
|
|
|
|
|
|
private String mContent;
|
|
|
|
|
|
// 笔记模式
|
|
|
|
|
|
private int mMode;
|
|
|
|
|
|
|
|
|
|
|
|
// 提醒日期
|
|
|
|
|
|
private long mAlertDate;
|
|
|
|
|
|
|
|
|
|
|
|
// 修改日期
|
|
|
|
|
|
private long mModifiedDate;
|
|
|
|
|
|
|
|
|
|
|
|
// 背景颜色ID
|
|
|
|
|
|
private int mBgColorId;
|
|
|
|
|
|
|
|
|
|
|
|
// 小部件ID
|
|
|
|
|
|
private int mWidgetId;
|
|
|
|
|
|
|
|
|
|
|
|
// 小部件类型
|
|
|
|
|
|
private int mWidgetType;
|
|
|
|
|
|
|
|
|
|
|
|
// 文件夹ID
|
|
|
|
|
|
private long mFolderId;
|
|
|
|
|
|
|
|
|
|
|
|
// 上下文
|
|
|
|
|
|
private Context mContext;
|
|
|
|
|
|
|
|
|
|
|
|
// 日志标签
|
|
|
|
|
|
private static final String TAG = "WorkingNote";
|
|
|
|
|
|
|
|
|
|
|
|
// 标记笔记是否已被删除
|
|
|
|
|
|
private boolean mIsDeleted;
|
|
|
|
|
|
|
|
|
|
|
|
// 笔记设置变化监听器
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
|
|
|
|
|
|
|
|
// 用于从数据表中查询笔记内容的列
|
|
|
|
|
|
public static final String[] DATA_PROJECTION = new String[] {
|
|
|
|
|
|
DataColumns.ID,
|
|
|
|
|
|
DataColumns.CONTENT,
|
|
|
|
|
|
DataColumns.MIME_TYPE,
|
|
|
|
|
|
DataColumns.DATA1,
|
|
|
|
|
|
DataColumns.DATA2,
|
|
|
|
|
|
DataColumns.DATA3,
|
|
|
|
|
|
DataColumns.DATA4,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 用于从笔记表中查询笔记元数据的列
|
|
|
|
|
|
public static final String[] NOTE_PROJECTION = new String[] {
|
|
|
|
|
|
NoteColumns.PARENT_ID,
|
|
|
|
|
|
NoteColumns.ALERTED_DATE,
|
|
|
|
|
|
NoteColumns.BG_COLOR_ID,
|
|
|
|
|
|
NoteColumns.WIDGET_ID,
|
|
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
|
|
NoteColumns.MODIFIED_DATE
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 定义从DATA_PROJECTION数组中获取数据的列索引
|
|
|
|
|
|
private static final int DATA_ID_COLUMN = 0;
|
|
|
|
|
|
private static final int DATA_CONTENT_COLUMN = 1;
|
|
|
|
|
|
private static final int DATA_MIME_TYPE_COLUMN = 2;
|
|
|
|
|
|
private static final int DATA_MODE_COLUMN = 3; // 注意:这里可能有误,因为DATA_PROJECTION中没有直接对应MODE的列
|
|
|
|
|
|
|
|
|
|
|
|
// 定义从NOTE_PROJECTION数组中获取数据的列索引
|
|
|
|
|
|
private static final int NOTE_PARENT_ID_COLUMN = 0;
|
|
|
|
|
|
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
|
|
|
|
|
|
private static final int NOTE_BG_COLOR_ID_COLUMN = 2;
|
|
|
|
|
|
private static final int NOTE_WIDGET_ID_COLUMN = 3;
|
|
|
|
|
|
private static final int NOTE_WIDGET_TYPE_COLUMN = 4;
|
|
|
|
|
|
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
|
|
|
|
|
|
|
|
|
|
|
|
// 构造一个新笔记对象
|
|
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
|
|
mContext = context;
|
|
|
|
|
|
mAlertDate = 0;
|
|
|
|
|
|
mModifiedDate = System.currentTimeMillis(); // 设置当前时间为修改日期
|
|
|
|
|
|
mFolderId = folderId;
|
|
|
|
|
|
mNote = new Note(); // 初始化Note对象
|
|
|
|
|
|
mNoteId = 0; // 新笔记ID为0,表示未保存
|
|
|
|
|
|
mIsDeleted = false;
|
|
|
|
|
|
mMode = 0; // 初始化模式
|
|
|
|
|
|
mWidgetType = Notes.TYPE_WIDGET_INVALIDE; // 初始化小部件类型为无效
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 构造一个已存在的笔记对象
|
|
|
|
|
|
private WorkingNote(Context context, long noteId, long folderId) {
|
|
|
|
|
|
mContext = context;
|
|
|
|
|
|
mNoteId = noteId;
|
|
|
|
|
|
mFolderId = folderId;
|
|
|
|
|
|
mIsDeleted = false;
|
|
|
|
|
|
mNote = new Note();
|
|
|
|
|
|
loadNote(); // 加载笔记数据
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 从数据库中加载笔记元数据
|
|
|
|
|
|
private void loadNote() {
|
|
|
|
|
|
// 使用内容解析器查询笔记元数据
|
|
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(
|
|
|
|
|
|
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
|
|
|
|
|
|
null, null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null) {
|
|
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
|
|
// 从cursor中读取数据并赋值给成员变量
|
|
|
|
|
|
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
|
|
|
|
|
|
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
|
|
|
|
|
|
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
|
|
|
|
|
|
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
|
|
|
|
|
|
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
|
|
|
|
|
|
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
|
|
|
|
|
|
}
|
|
|
|
|
|
cursor.close(); // 关闭cursor
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果查询失败,记录错误日志并抛出异常
|
|
|
|
|
|
Log.e(TAG, "No note with id:" + mNoteId);
|
|
|
|
|
|
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
|
|
|
|
|
|
}
|
|
|
|
|
|
loadNoteData(); // 加载笔记内容数据
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 从数据库中加载笔记内容数据
|
|
|
|
|
|
private void loadNoteData() {
|
|
|
|
|
|
// 使用内容解析器查询笔记内容数据
|
|
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
|
|
|
|
|
|
DataColumns.NOTE_ID + "=?", new String[] {
|
|
|
|
|
|
String.valueOf(mNoteId)
|
|
|
|
|
|
}, null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null) {
|
|
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
|
|
do {
|
|
|
|
|
|
// 根据MIME类型处理不同的笔记数据
|
|
|
|
|
|
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
|
|
|
|
|
|
if (DataConstants.NOTE.equals(type)) {
|
|
|
|
|
|
mContent = cursor.getString(DATA_CONTENT_COLUMN);
|
|
|
|
|
|
mMode = cursor.getInt(DATA_MODE_COLUMN); // 注意:这里可能有问题,因为前面提到DATA_PROJECTION中没有直接对应MODE的列
|
|
|
|
|
|
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
|
|
} else if (DataConstants.CALL_NOTE.equals(type)) {
|
|
|
|
|
|
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Log.d(TAG, "Wrong note type with type:" + type);
|
|
|
|
|
|
}
|
|
|
|
|
|
} while (cursor.moveToNext());
|
|
|
|
|
|
}
|
|
|
|
|
|
cursor.close(); // 关闭cursor
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果查询失败,记录错误日志并抛出异常
|
|
|
|
|
|
Log.e(TAG, "No data with id:" + mNoteId);
|
|
|
|
|
|
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建一个新的空笔记对象
|
|
|
|
|
|
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
|
|
|
|
|
|
int widgetType, int defaultBgColorId) {
|
|
|
|
|
|
WorkingNote note = new WorkingNote(context, folderId); // 调用私有构造函数创建新对象
|
|
|
|
|
|
note.setBgColorId(defaultBgColorId); // 设置背景颜色ID
|
|
|
|
|
|
note.setWidgetId(widgetId); // 设置小部件ID
|
|
|
|
|
|
note.setWidgetType(widgetType); // 设置小部件类型
|
|
|
|
|
|
return note; // 返回新创建的笔记对象
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 根据ID加载一个已存在的笔记对象
|
|
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
|
|
return new WorkingNote(context, id, 0); // 调用私有构造函数加载已存在的笔记对象,文件夹ID默认为0
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// 定义一个同步方法,用于保存笔记
|
|
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
|
|
// 检查笔记是否值得保存
|
|
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
|
|
// 如果笔记在数据库中不存在
|
|
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
|
|
// 为笔记分配一个新的ID
|
|
|
|
|
|
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
|
|
|
|
|
|
// 如果分配ID失败,记录错误日志并返回false
|
|
|
|
|
|
Log.e(TAG, "Create new note fail with id:" + mNoteId);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 同步笔记数据到数据库
|
|
|
|
|
|
mNote.syncNote(mContext, mNoteId);
|
|
|
|
|
|
|
|
|
|
|
|
// 如果存在与笔记关联的widget,则更新widget内容
|
|
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
|
|
|
|
|
|
&& mNoteSettingStatusListener != null) {
|
|
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
// 返回true表示保存成功
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果笔记不值得保存,返回false
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断笔记是否在数据库中已存在
|
|
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
|
|
return mNoteId > 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断笔记是否值得保存
|
|
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
|
|
// 如果笔记被标记为删除,或者内容为空且未存在于数据库中,或者存在于数据库中但未本地修改,则不值得保存
|
|
|
|
|
|
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|
|
|
|
|
|
|| (existInDatabase() && !mNote.isLocalModified())) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记设置状态改变的监听器
|
|
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的提醒日期
|
|
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
|
|
// 如果新的日期与当前日期不同,则更新日期
|
|
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
|
|
mAlertDate = date;
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate));
|
|
|
|
|
|
}
|
|
|
|
|
|
// 如果设置了监听器,通知监听器提醒日期已改变
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
mNoteSettingStatusListener.onClockAlertChanged(date, set);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 标记笔记为已删除或未删除
|
|
|
|
|
|
public void markDeleted(boolean mark) {
|
|
|
|
|
|
mIsDeleted = mark;
|
|
|
|
|
|
// 如果存在与笔记关联的widget,并且设置了监听器,则通知监听器widget已改变
|
|
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
|
|
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的背景颜色ID
|
|
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
|
|
// 如果新的颜色ID与当前不同,则更新颜色ID
|
|
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
|
|
mBgColorId = id;
|
|
|
|
|
|
// 如果设置了监听器,通知监听器背景颜色已改变
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
mNoteSettingStatusListener.onBackgroundColorChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的清单模式
|
|
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
|
|
// 如果新的模式与当前模式不同,则更新模式
|
|
|
|
|
|
if (mMode != mode) {
|
|
|
|
|
|
// 如果设置了监听器,通知监听器清单模式已改变
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
|
|
}
|
|
|
|
|
|
mMode = mode;
|
|
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的widget类型
|
|
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
|
|
// 如果新的类型与当前类型不同,则更新类型
|
|
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
|
|
mWidgetType = type;
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的widget ID
|
|
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
|
|
// 如果新的ID与当前ID不同,则更新ID
|
|
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
|
|
mWidgetId = id;
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置笔记的工作文本内容
|
|
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
|
|
// 如果新的文本与当前文本不同,则更新文本
|
|
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
|
|
mContent = text;
|
|
|
|
|
|
mNote.setTextData(DataColumns.CONTENT, mContent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将笔记转换为通话记录笔记
|
|
|
|
|
|
public void convertToCallNote(String phoneNumber, long callDate) {
|
|
|
|
|
|
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
|
|
|
|
|
|
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断笔记是否有提醒日期
|
|
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
|
|
return (mAlertDate > 0 ? true : false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的内容
|
|
|
|
|
|
public String getContent() {
|
|
|
|
|
|
return mContent;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的提醒日期
|
|
|
|
|
|
public long getAlertDate() {
|
|
|
|
|
|
return mAlertDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的最后修改日期
|
|
|
|
|
|
public long getModifiedDate() {
|
|
|
|
|
|
return mModifiedDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的背景颜色资源ID
|
|
|
|
|
|
public int getBgColorResId() {
|
|
|
|
|
|
return NoteBgResources.getNoteBgResource(mBgColorId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的背景颜色ID
|
|
|
|
|
|
public int getBgColorId() {
|
|
|
|
|
|
return mBgColorId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的标题背景资源ID
|
|
|
|
|
|
public int getTitleBgResId() {
|
|
|
|
|
|
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的清单模式
|
|
|
|
|
|
public int getCheckListMode() {
|
|
|
|
|
|
return mMode;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的ID
|
|
|
|
|
|
public long getNoteId() {
|
|
|
|
|
|
return mNoteId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记所属的文件夹ID
|
|
|
|
|
|
public long getFolderId() {
|
|
|
|
|
|
return mFolderId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的widget ID
|
|
|
|
|
|
public int getWidgetId() {
|
|
|
|
|
|
return mWidgetId;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取笔记的widget类型
|
|
|
|
|
|
public int getWidgetType() {
|
|
|
|
|
|
return mWidgetType;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 定义笔记设置状态改变的监听器接口
|
|
|
|
|
|
public interface NoteSettingChangedListener {
|
|
|
|
|
|
// 当笔记的背景颜色改变时调用
|
|
|
|
|
|
void onBackgroundColorChanged();
|
|
|
|
|
|
|
|
|
|
|
|
// 当用户设置提醒时调用
|
|
|
|
|
|
void onClockAlertChanged(long date, boolean set);
|
|
|
|
|
|
|
|
|
|
|
|
// 当用户通过widget创建笔记时调用
|
|
|
|
|
|
void onWidgetChanged();
|
|
|
|
|
|
|
|
|
|
|
|
// 当用户切换清单模式和普通模式时调用
|
|
|
|
|
|
void onCheckListModeChanged(int oldMode, int newMode);
|
|
|
|
|
|
}
|