|
|
|
@ -33,16 +33,44 @@ import net.micode.notes.tool.ResourceParser.NoteBgResources;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @ProjectName: WorkingNote.java
|
|
|
|
* @ProjectName: WorkingNote.java
|
|
|
|
* @Package: net.micode.notes.model
|
|
|
|
* @Package: net.micode.notes.model
|
|
|
|
* @ClassName: WorkingNote
|
|
|
|
* @ClassName: WorkingNote
|
|
|
|
* @Description: 便签运行模块
|
|
|
|
* @Description: 便签运行模块
|
|
|
|
* @Author: ZHANGLINHAO
|
|
|
|
* @Author: ZHANGLINHAO
|
|
|
|
* @CreateDate: 2023/12/22 20:17
|
|
|
|
* @CreateDate: 2023/12/22 20:17
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class WorkingNote {
|
|
|
|
public class WorkingNote {
|
|
|
|
|
|
|
|
// Note for the working note
|
|
|
|
|
|
|
|
private Note mNote;
|
|
|
|
|
|
|
|
// Note Id
|
|
|
|
|
|
|
|
private long mNoteId;
|
|
|
|
|
|
|
|
// Note content
|
|
|
|
|
|
|
|
private String mContent;
|
|
|
|
|
|
|
|
// Note mode
|
|
|
|
|
|
|
|
private int mMode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private long mAlertDate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private long mModifiedDate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int mBgColorId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int mWidgetId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int mWidgetType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private long mFolderId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Context mContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "WorkingNote";
|
|
|
|
|
|
|
|
|
|
|
|
public static final String[] DATA_PROJECTION = new String[]{
|
|
|
|
private boolean mIsDeleted;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String[] DATA_PROJECTION = new String[] {
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.CONTENT,
|
|
|
|
DataColumns.CONTENT,
|
|
|
|
DataColumns.MIME_TYPE,
|
|
|
|
DataColumns.MIME_TYPE,
|
|
|
|
@ -51,43 +79,35 @@ public class WorkingNote {
|
|
|
|
DataColumns.DATA3,
|
|
|
|
DataColumns.DATA3,
|
|
|
|
DataColumns.DATA4,
|
|
|
|
DataColumns.DATA4,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
public static final String[] NOTE_PROJECTION = new String[]{
|
|
|
|
|
|
|
|
|
|
|
|
public static final String[] NOTE_PROJECTION = new String[] {
|
|
|
|
NoteColumns.PARENT_ID,
|
|
|
|
NoteColumns.PARENT_ID,
|
|
|
|
NoteColumns.ALERTED_DATE,
|
|
|
|
NoteColumns.ALERTED_DATE,
|
|
|
|
NoteColumns.BG_COLOR_ID,
|
|
|
|
NoteColumns.BG_COLOR_ID,
|
|
|
|
NoteColumns.WIDGET_ID,
|
|
|
|
NoteColumns.WIDGET_ID,
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
NoteColumns.MODIFIED_DATE,
|
|
|
|
NoteColumns.MODIFIED_DATE
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
private static final String TAG = "WorkingNote";
|
|
|
|
|
|
|
|
private static final int DATA_ID_COLUMN = 0;
|
|
|
|
private static final int DATA_ID_COLUMN = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int DATA_CONTENT_COLUMN = 1;
|
|
|
|
private static final int DATA_CONTENT_COLUMN = 1;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int DATA_MIME_TYPE_COLUMN = 2;
|
|
|
|
private static final int DATA_MIME_TYPE_COLUMN = 2;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int DATA_MODE_COLUMN = 3;
|
|
|
|
private static final int DATA_MODE_COLUMN = 3;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int NOTE_PARENT_ID_COLUMN = 0;
|
|
|
|
private static final int NOTE_PARENT_ID_COLUMN = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
|
|
|
|
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int NOTE_BG_COLOR_ID_COLUMN = 2;
|
|
|
|
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_ID_COLUMN = 3;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int NOTE_WIDGET_TYPE_COLUMN = 4;
|
|
|
|
private static final int NOTE_WIDGET_TYPE_COLUMN = 4;
|
|
|
|
|
|
|
|
|
|
|
|
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
|
|
|
|
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
|
|
|
|
// Note content
|
|
|
|
|
|
|
|
public String mContent;
|
|
|
|
|
|
|
|
// Note for the working note
|
|
|
|
|
|
|
|
private final Note mNote;
|
|
|
|
|
|
|
|
// Note Id
|
|
|
|
|
|
|
|
private long mNoteId;
|
|
|
|
|
|
|
|
// Note mode
|
|
|
|
|
|
|
|
private int mMode;
|
|
|
|
|
|
|
|
private long mAlertDate;
|
|
|
|
|
|
|
|
private long mModifiedDate;
|
|
|
|
|
|
|
|
private int mBgColorId;
|
|
|
|
|
|
|
|
private int mWidgetId;
|
|
|
|
|
|
|
|
private int mWidgetType;
|
|
|
|
|
|
|
|
private long mFolderId;
|
|
|
|
|
|
|
|
private final Context mContext;
|
|
|
|
|
|
|
|
private boolean mIsDeleted;
|
|
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新便签的构造
|
|
|
|
// 新便签的构造
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
@ -111,44 +131,14 @@ public class WorkingNote {
|
|
|
|
mNote = new Note();
|
|
|
|
mNote = new Note();
|
|
|
|
loadNote();
|
|
|
|
loadNote();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: createEmptyNote
|
|
|
|
* @method: loadNote
|
|
|
|
* @description:创建空便签
|
|
|
|
* @description:加载便签
|
|
|
|
* @date: 2023/12/24 20:30
|
|
|
|
* @date: 2023/12/24 20:19
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 文本,文件夹ID,小部件ID,小部件类型,默认背景颜色ID
|
|
|
|
* @param:
|
|
|
|
* @return: note
|
|
|
|
* @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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: load
|
|
|
|
|
|
|
|
* @description:创建一个带有数据的便签
|
|
|
|
|
|
|
|
* @date: 2023/12/22 20:44
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: 文本,ID
|
|
|
|
|
|
|
|
* @return: 工作便签
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
|
|
|
|
return new WorkingNote(context, id, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: loadNote
|
|
|
|
|
|
|
|
* @description:加载便签
|
|
|
|
|
|
|
|
* @date: 2023/12/24 20:19
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param:
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
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,
|
|
|
|
@ -170,19 +160,18 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loadNoteData();
|
|
|
|
loadNoteData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: loadNoteData
|
|
|
|
* @method: loadNoteData
|
|
|
|
* @description:加载便签数据
|
|
|
|
* @description:加载便签数据
|
|
|
|
* @date: 2023/12/22 20:29
|
|
|
|
* @date: 2023/12/22 20:29
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param:
|
|
|
|
* @param:
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void loadNoteData() {
|
|
|
|
private void loadNoteData() {
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
|
|
|
|
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
|
|
|
|
DataColumns.NOTE_ID + "=?", new String[]{
|
|
|
|
DataColumns.NOTE_ID + "=?", new String[] {
|
|
|
|
String.valueOf(mNoteId)
|
|
|
|
String.valueOf(mNoteId)
|
|
|
|
}, null);
|
|
|
|
}, null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {
|
|
|
|
@ -206,15 +195,41 @@ public class WorkingNote {
|
|
|
|
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
|
|
|
|
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: saveNote
|
|
|
|
* @method: createEmptyNote
|
|
|
|
* @description:判断同步便签是否成功
|
|
|
|
* @description:创建空便签
|
|
|
|
* @date: 2023/12/24 20:45
|
|
|
|
* @date: 2023/12/24 20:30
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param:
|
|
|
|
* @param: 文本,文件夹ID,小部件ID,小部件类型,默认背景颜色ID
|
|
|
|
* @return: true/false
|
|
|
|
* @return: note
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: load
|
|
|
|
|
|
|
|
* @description:创建一个带有数据的便签
|
|
|
|
|
|
|
|
* @date: 2023/12/22 20:44
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: 文本,ID
|
|
|
|
|
|
|
|
* @return: 工作便签
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
|
|
|
|
return new WorkingNote(context, id, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: saveNote
|
|
|
|
|
|
|
|
* @description:判断同步便签是否成功
|
|
|
|
|
|
|
|
* @date: 2023/12/24 20:45
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param:
|
|
|
|
|
|
|
|
* @return: true/false
|
|
|
|
|
|
|
|
*/
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
@ -239,52 +254,52 @@ public class WorkingNote {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: existInDatabase
|
|
|
|
* @method: existInDatabase
|
|
|
|
* @description:判断是否存在数据库
|
|
|
|
* @description:判断是否存在数据库
|
|
|
|
* @date: 2023/12/22 20:46
|
|
|
|
* @date: 2023/12/22 20:46
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param:
|
|
|
|
* @param:
|
|
|
|
* @return: 1/0
|
|
|
|
* @return: 1/0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
return mNoteId > 0;
|
|
|
|
return mNoteId > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: isWorthSaving
|
|
|
|
* @method: isWorthSaving
|
|
|
|
* @description:判断是否保存全局变量
|
|
|
|
* @description:判断是否保存全局变量
|
|
|
|
* @date: 2023/12/22 20:47
|
|
|
|
* @date: 2023/12/22 20:47
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param:
|
|
|
|
* @param:
|
|
|
|
* @return: 1/0
|
|
|
|
* @return: 1/0
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
return !mIsDeleted && (existInDatabase() || !TextUtils.isEmpty(mContent))
|
|
|
|
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|
|
|
|
&& (!existInDatabase() || mNote.isLocalModified());
|
|
|
|
|| (existInDatabase() && !mNote.isLocalModified())) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: setOnSettingStatusChangedListener
|
|
|
|
* @method: setOnSettingStatusChangedListener
|
|
|
|
* @description:设置侦听器
|
|
|
|
* @description:设置侦听器
|
|
|
|
* @date: 2023/12/22/20:50
|
|
|
|
* @date: 2023/12/22/20:50
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 侦听器
|
|
|
|
* @param: 侦听器
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: setAlertDate
|
|
|
|
* @method: setAlertDate
|
|
|
|
* @description:设置提醒内容
|
|
|
|
* @description:设置提醒内容
|
|
|
|
* @date: 2023/12/22 21:03
|
|
|
|
* @date: 2023/12/22 21:03
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 提醒内容,是否设置信号量
|
|
|
|
* @param: 提醒内容,是否设置信号量
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
mAlertDate = date;
|
|
|
|
mAlertDate = date;
|
|
|
|
@ -294,46 +309,105 @@ public class WorkingNote {
|
|
|
|
mNoteSettingStatusListener.onClockAlertChanged(date, set);
|
|
|
|
mNoteSettingStatusListener.onClockAlertChanged(date, set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: markDeleted
|
|
|
|
* @method: markDeleted
|
|
|
|
* @description:删除标记
|
|
|
|
* @description:删除标记
|
|
|
|
* @date: 2023/12/22 21:04
|
|
|
|
* @date: 2023/12/22 21:04
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 标记布尔值
|
|
|
|
* @param: 标记布尔值
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
mNoteSettingStatusListener.onWidgetChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setBgColorId
|
|
|
|
|
|
|
|
* @description:设置背景颜色ID
|
|
|
|
|
|
|
|
* @date: 2023/12/22 21:06
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: ID
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
|
|
|
|
mBgColorId = id;
|
|
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
|
|
mNoteSettingStatusListener.onBackgroundColorChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setCheckListMode
|
|
|
|
|
|
|
|
* @description:设置检查列表模式
|
|
|
|
|
|
|
|
* @date: 2023/12/22 21:07
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param:
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
|
|
|
|
if (mMode != mode) {
|
|
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mMode = mode;
|
|
|
|
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setWidgetType
|
|
|
|
|
|
|
|
* @description:设置小部件类型
|
|
|
|
|
|
|
|
* @date: 2023/12/24 21:07
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: 类型
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
|
|
|
|
mWidgetType = type;
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setWidgetId
|
|
|
|
|
|
|
|
* @description:设置小部件ID
|
|
|
|
|
|
|
|
* @date: 2023/12/24 21:08
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: ID
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
|
|
|
|
mWidgetId = id;
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: setWorkingText
|
|
|
|
* @method: setWorkingText
|
|
|
|
* @description:设置工作文本
|
|
|
|
* @description:设置工作文本
|
|
|
|
* @date: 2023/12/24 21:08
|
|
|
|
* @date: 2023/12/24 21:08
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 文本
|
|
|
|
* @param: 文本
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
public void setWorkingText(String text) {
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
if (!TextUtils.equals(mContent, text)) {
|
|
|
|
mContent = text;
|
|
|
|
mContent = text;
|
|
|
|
mNote.setTextData(DataColumns.CONTENT, mContent);
|
|
|
|
mNote.setTextData(DataColumns.CONTENT, mContent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @method: convertToCallNote
|
|
|
|
* @method: convertToCallNote
|
|
|
|
* @description:转换为通话备注
|
|
|
|
* @description:转换为通话备注
|
|
|
|
* @date: 2023/12/24 21:09
|
|
|
|
* @date: 2023/12/24 21:09
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
* @param: 电话号码,通话数据
|
|
|
|
* @param: 电话号码,通话数据
|
|
|
|
* @return:
|
|
|
|
* @return:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void convertToCallNote(String phoneNumber, long callDate) {
|
|
|
|
public void convertToCallNote(String phoneNumber, long callDate) {
|
|
|
|
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
|
|
|
|
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
|
|
|
|
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
|
|
|
|
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
|
|
|
|
@ -341,7 +415,7 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
return (mAlertDate > 0);
|
|
|
|
return (mAlertDate > 0 ? true : false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getContent() {
|
|
|
|
public String getContent() {
|
|
|
|
@ -364,24 +438,6 @@ public class WorkingNote {
|
|
|
|
return mBgColorId;
|
|
|
|
return mBgColorId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setBgColorId
|
|
|
|
|
|
|
|
* @description:设置背景颜色ID
|
|
|
|
|
|
|
|
* @date: 2023/12/22 21:06
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: ID
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
|
|
|
|
mBgColorId = id;
|
|
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
|
|
mNoteSettingStatusListener.onBackgroundColorChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getTitleBgResId() {
|
|
|
|
public int getTitleBgResId() {
|
|
|
|
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
|
|
|
|
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -390,24 +446,6 @@ public class WorkingNote {
|
|
|
|
return mMode;
|
|
|
|
return mMode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setCheckListMode
|
|
|
|
|
|
|
|
* @description:设置检查列表模式
|
|
|
|
|
|
|
|
* @date: 2023/12/22 21:07
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param:
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
|
|
|
|
if (mMode != mode) {
|
|
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mMode = mode;
|
|
|
|
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public long getNoteId() {
|
|
|
|
public long getNoteId() {
|
|
|
|
return mNoteId;
|
|
|
|
return mNoteId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -420,40 +458,10 @@ public class WorkingNote {
|
|
|
|
return mWidgetId;
|
|
|
|
return mWidgetId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setWidgetId
|
|
|
|
|
|
|
|
* @description:设置小部件ID
|
|
|
|
|
|
|
|
* @date: 2023/12/24 21:08
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: ID
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setWidgetId(int id) {
|
|
|
|
|
|
|
|
if (id != mWidgetId) {
|
|
|
|
|
|
|
|
mWidgetId = id;
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getWidgetType() {
|
|
|
|
public int getWidgetType() {
|
|
|
|
return mWidgetType;
|
|
|
|
return mWidgetType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @method: setWidgetType
|
|
|
|
|
|
|
|
* @description:设置小部件类型
|
|
|
|
|
|
|
|
* @date: 2023/12/24 21:07
|
|
|
|
|
|
|
|
* @author: ZHANGLINHAO
|
|
|
|
|
|
|
|
* @param: 类型
|
|
|
|
|
|
|
|
* @return:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
|
|
|
|
mWidgetType = type;
|
|
|
|
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface NoteSettingChangedListener {
|
|
|
|
public interface NoteSettingChangedListener {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Called when the background color of current note has just changed
|
|
|
|
* Called when the background color of current note has just changed
|
|
|
|
@ -472,7 +480,6 @@ public class WorkingNote {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Call when switch between check list mode and normal mode
|
|
|
|
* Call when switch between check list mode and normal mode
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param oldMode is previous mode before change
|
|
|
|
* @param oldMode is previous mode before change
|
|
|
|
* @param newMode is new mode
|
|
|
|
* @param newMode is new mode
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|