|
|
@ -62,6 +62,9 @@ public class WorkingNote {
|
|
|
|
|
|
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 声明 DATA_PROJECTION字符串数组
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static final String[] DATA_PROJECTION = new String[]{
|
|
|
|
public static final String[] DATA_PROJECTION = new String[]{
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.CONTENT,
|
|
|
|
DataColumns.CONTENT,
|
|
|
@ -102,6 +105,10 @@ public class WorkingNote {
|
|
|
|
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
|
|
|
|
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
|
|
|
|
|
|
|
|
|
|
|
|
// New note construct
|
|
|
|
// New note construct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* WorkingNote的构造函数
|
|
|
|
|
|
|
|
* */
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
mContext = context;
|
|
|
|
mContext = context;
|
|
|
|
mAlertDate = 0;
|
|
|
|
mAlertDate = 0;
|
|
|
@ -124,6 +131,9 @@ public class WorkingNote {
|
|
|
|
loadNote();
|
|
|
|
loadNote();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过数据库调用query函数找到第一个条目
|
|
|
|
|
|
|
|
*/
|
|
|
|
private void loadNote() {
|
|
|
|
private void loadNote() {
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(
|
|
|
|
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
|
|
|
|
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
|
|
|
@ -151,7 +161,9 @@ public class WorkingNote {
|
|
|
|
DataColumns.NOTE_ID + "=?", new String[]{
|
|
|
|
DataColumns.NOTE_ID + "=?", new String[]{
|
|
|
|
String.valueOf(mNoteId)
|
|
|
|
String.valueOf(mNoteId)
|
|
|
|
}, null);
|
|
|
|
}, null);
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查看第一项是否存在
|
|
|
|
|
|
|
|
*/
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
@ -174,6 +186,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 创建空的Note 传参:context,文件夹id,widget,背景颜色
|
|
|
|
|
|
|
|
*/
|
|
|
|
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
|
|
|
|
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
|
|
|
|
int widgetType, int defaultBgColorId) {
|
|
|
|
int widgetType, int defaultBgColorId) {
|
|
|
|
WorkingNote note = new WorkingNote(context, folderId);
|
|
|
|
WorkingNote note = new WorkingNote(context, folderId);
|
|
|
@ -229,6 +244,10 @@ public class WorkingNote {
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 设置AlertDate
|
|
|
|
|
|
|
|
* 若 mAlertDate与data不同,则更改mAlertDate并设定NoteValue
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
mAlertDate = date;
|
|
|
|
mAlertDate = date;
|
|
|
@ -239,6 +258,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 设定删除标记
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void markDeleted(boolean mark) {
|
|
|
|
public void markDeleted(boolean mark) {
|
|
|
|
mIsDeleted = mark;
|
|
|
|
mIsDeleted = mark;
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
@ -247,6 +269,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*设定背景颜色
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
mBgColorId = id;
|
|
|
|
mBgColorId = id;
|
|
|
@ -257,6 +282,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*设定检查列表模式
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
if (mMode != mode) {
|
|
|
|
if (mMode != mode) {
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
@ -267,6 +295,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*设定WidgetType
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
mWidgetType = type;
|
|
|
|
mWidgetType = type;
|
|
|
@ -274,6 +305,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*设定WidgetId
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
mWidgetId = id;
|
|
|
|
mWidgetId = id;
|
|
|
@ -281,6 +315,9 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
*设定setWorkingText
|
|
|
|
|
|
|
|
*/
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
mContent = text;
|
|
|
|
mContent = text;
|
|
|
|