|
|
|
|
@ -1,498 +0,0 @@
|
|
|
|
|
package net.micode.notes.model;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
// 桌面小部件类型(2x或4x)
|
|
|
|
|
private int mWidgetType;
|
|
|
|
|
|
|
|
|
|
// 所属文件夹ID
|
|
|
|
|
private long mFolderId;
|
|
|
|
|
|
|
|
|
|
// Android上下文对象
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 数据ID列在查询结果中的索引位置
|
|
|
|
|
private static final int DATA_ID_COLUMN = 0;
|
|
|
|
|
|
|
|
|
|
// 数据内容列在查询结果中的索引位置
|
|
|
|
|
private static final int DATA_CONTENT_COLUMN = 1;
|
|
|
|
|
|
|
|
|
|
// 数据类型(MIME)列在查询结果中的索引位置
|
|
|
|
|
private static final int DATA_MIME_TYPE_COLUMN = 2;
|
|
|
|
|
|
|
|
|
|
// 数据模式列在查询结果中的索引位置
|
|
|
|
|
private static final int DATA_MODE_COLUMN = 3;
|
|
|
|
|
|
|
|
|
|
// 父级文件夹ID列在查询结果中的索引位置
|
|
|
|
|
private static final int NOTE_PARENT_ID_COLUMN = 0;
|
|
|
|
|
|
|
|
|
|
// 提醒日期列在查询结果中的索引位置
|
|
|
|
|
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
|
|
|
|
|
|
|
|
|
|
// 背景颜色ID列在查询结果中的索引位置
|
|
|
|
|
private static final int NOTE_BG_COLOR_ID_COLUMN = 2;
|
|
|
|
|
|
|
|
|
|
// 小部件ID列在查询结果中的索引位置
|
|
|
|
|
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();
|
|
|
|
|
mNoteId = 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()) {
|
|
|
|
|
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();
|
|
|
|
|
} 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 {
|
|
|
|
|
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);
|
|
|
|
|
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();
|
|
|
|
|
} else {
|
|
|
|
|
Log.e(TAG, "No data with id:" + mNoteId);
|
|
|
|
|
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建一个新的空便签(工厂方法)
|
|
|
|
|
* @param context Android上下文
|
|
|
|
|
* @param folderId 所属文件夹ID
|
|
|
|
|
* @param widgetId 桌面小部件ID
|
|
|
|
|
* @param widgetType 桌面小部件类型
|
|
|
|
|
* @param defaultBgColorId 默认背景颜色ID
|
|
|
|
|
* @return 新创建的便签对象
|
|
|
|
|
*/
|
|
|
|
|
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
|
|
|
|
|
int widgetType, int defaultBgColorId) {
|
|
|
|
|
WorkingNote note = new WorkingNote(context, folderId);
|
|
|
|
|
note.setBgColorId(defaultBgColorId);
|
|
|
|
|
note.setWidgetId(widgetId);
|
|
|
|
|
note.setWidgetType(widgetType);
|
|
|
|
|
return note;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从数据库加载指定ID的便签(工厂方法)
|
|
|
|
|
* @param context Android上下文
|
|
|
|
|
* @param id 便签ID
|
|
|
|
|
* @return 加载的便签对象
|
|
|
|
|
*/
|
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
|
return new WorkingNote(context, id, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存便签到数据库(同步操作)
|
|
|
|
|
* @return 保存成功返回true,否则返回false
|
|
|
|
|
*/
|
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
|
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
|
|
|
|
|
Log.e(TAG, "Create new note fail with id:" + mNoteId);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mNote.syncNote(mContext, mNoteId);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 如果存在该便签的桌面小部件,则更新小部件内容
|
|
|
|
|
*/
|
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
|
|
|
|
|
&& mNoteSettingStatusListener != null) {
|
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查便签是否已存在于数据库中(通过ID判断)
|
|
|
|
|
* @return 存在返回true,否则返回false
|
|
|
|
|
*/
|
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
|
return mNoteId > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断便签是否值得保存(是否有实际内容或修改)
|
|
|
|
|
* @return 值得保存返回true,否则返回false
|
|
|
|
|
*/
|
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
|
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|
|
|
|
|
|| (existInDatabase() && !mNote.isLocalModified())) {
|
|
|
|
|
return false;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置便签设置状态变更监听器
|
|
|
|
|
* @param l 监听器对象
|
|
|
|
|
*/
|
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置闹钟提醒日期
|
|
|
|
|
* @param date 提醒日期(时间戳)
|
|
|
|
|
* @param set 是否设置提醒的标志
|
|
|
|
|
*/
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 标记便签的删除状态
|
|
|
|
|
* @param mark true表示标记为删除,false表示取消删除标记
|
|
|
|
|
*/
|
|
|
|
|
public void markDeleted(boolean mark) {
|
|
|
|
|
mIsDeleted = mark;
|
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
|
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置便签的背景颜色
|
|
|
|
|
* @param id 背景颜色ID
|
|
|
|
|
*/
|
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
|
mBgColorId = id;
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
mNoteSettingStatusListener.onBackgroundColorChanged();
|
|
|
|
|
}
|
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置便签的模式(普通文本模式或清单模式)
|
|
|
|
|
* @param mode 模式值(0为普通模式,1为清单模式)
|
|
|
|
|
*/
|
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
|
if (mMode != mode) {
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
|
}
|
|
|
|
|
mMode = mode;
|
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置桌面小部件的类型
|
|
|
|
|
* @param type 小部件类型(2x或4x)
|
|
|
|
|
*/
|
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
|
mWidgetType = type;
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置桌面小部件的ID
|
|
|
|
|
* @param id 小部件ID
|
|
|
|
|
*/
|
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
|
mWidgetId = id;
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置便签的工作文本内容
|
|
|
|
|
* @param text 便签文本内容
|
|
|
|
|
*/
|
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
|
mContent = text;
|
|
|
|
|
mNote.setTextData(DataColumns.CONTENT, mContent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将当前便签转换为通话记录便签
|
|
|
|
|
* @param phoneNumber 电话号码
|
|
|
|
|
* @param callDate 通话日期(时间戳)
|
|
|
|
|
*/
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查便签是否设置了闹钟提醒
|
|
|
|
|
* @return 有提醒返回true,否则返回false
|
|
|
|
|
*/
|
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
|
return (mAlertDate > 0 ? true : false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取便签的文本内容
|
|
|
|
|
* @return 便签内容字符串
|
|
|
|
|
*/
|
|
|
|
|
public String getContent() {
|
|
|
|
|
return mContent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取闹钟提醒日期
|
|
|
|
|
* @return 提醒日期(时间戳),未设置则返回0
|
|
|
|
|
*/
|
|
|
|
|
public long getAlertDate() {
|
|
|
|
|
return mAlertDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取便签的最后修改日期
|
|
|
|
|
* @return 修改日期(时间戳)
|
|
|
|
|
*/
|
|
|
|
|
public long getModifiedDate() {
|
|
|
|
|
return mModifiedDate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取背景颜色的资源ID(用于UI显示)
|
|
|
|
|
* @return 背景颜色资源ID
|
|
|
|
|
*/
|
|
|
|
|
public int getBgColorResId() {
|
|
|
|
|
return NoteBgResources.getNoteBgResource(mBgColorId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取背景颜色ID
|
|
|
|
|
* @return 背景颜色ID
|
|
|
|
|
*/
|
|
|
|
|
public int getBgColorId() {
|
|
|
|
|
return mBgColorId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取标题栏背景颜色的资源ID(用于UI显示)
|
|
|
|
|
* @return 标题背景颜色资源ID
|
|
|
|
|
*/
|
|
|
|
|
public int getTitleBgResId() {
|
|
|
|
|
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取便签的当前模式(普通模式或清单模式)
|
|
|
|
|
* @return 模式值(0为普通模式,1为清单模式)
|
|
|
|
|
*/
|
|
|
|
|
public int getCheckListMode() {
|
|
|
|
|
return mMode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取便签的ID
|
|
|
|
|
* @return 便签ID,新便签返回0
|
|
|
|
|
*/
|
|
|
|
|
public long getNoteId() {
|
|
|
|
|
return mNoteId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取便签所属文件夹的ID
|
|
|
|
|
* @return 文件夹ID
|
|
|
|
|
*/
|
|
|
|
|
public long getFolderId() {
|
|
|
|
|
return mFolderId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取关联的桌面小部件ID
|
|
|
|
|
* @return 小部件ID,未关联则返回无效值
|
|
|
|
|
*/
|
|
|
|
|
public int getWidgetId() {
|
|
|
|
|
return mWidgetId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取关联的桌面小部件类型
|
|
|
|
|
* @return 小部件类型(2x或4x),未关联则返回无效值
|
|
|
|
|
*/
|
|
|
|
|
public int getWidgetType() {
|
|
|
|
|
return mWidgetType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 便签设置变更监听器接口 - 用于通知UI层便签属性的变化
|
|
|
|
|
*/
|
|
|
|
|
public interface NoteSettingChangedListener {
|
|
|
|
|
/**
|
|
|
|
|
* 当当前便签的背景颜色发生改变时调用
|
|
|
|
|
*/
|
|
|
|
|
void onBackgroundColorChanged();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当用户设置或取消闹钟提醒时调用
|
|
|
|
|
* @param date 提醒日期
|
|
|
|
|
* @param set true表示设置提醒,false表示取消提醒
|
|
|
|
|
*/
|
|
|
|
|
void onClockAlertChanged(long date, boolean set);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当用户从小部件创建便签或小部件需要更新时调用
|
|
|
|
|
*/
|
|
|
|
|
void onWidgetChanged();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 当在清单模式和普通模式之间切换时调用
|
|
|
|
|
* @param oldMode 更改前的模式
|
|
|
|
|
* @param newMode 更改后的新模式
|
|
|
|
|
*/
|
|
|
|
|
void onCheckListModeChanged(int oldMode, int newMode);
|
|
|
|
|
}
|
|
|
|
|
}
|