|
|
@ -31,43 +31,37 @@ import net.micode.notes.data.Notes.NoteColumns;
|
|
|
|
import net.micode.notes.data.Notes.TextNote;
|
|
|
|
import net.micode.notes.data.Notes.TextNote;
|
|
|
|
import net.micode.notes.tool.ResourceParser.NoteBgResources;
|
|
|
|
import net.micode.notes.tool.ResourceParser.NoteBgResources;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @description:活动中的便签类,是对正处于用户编辑等工作状态下的便签,可以对于便签做
|
|
|
|
|
|
|
|
* 更新组件,修改内容,设置提醒,背景颜色修改等在便签内进行文本编辑工作时可以进行的操作
|
|
|
|
|
|
|
|
* @date: 2024/1/4 11:03
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class WorkingNote {
|
|
|
|
public class WorkingNote {
|
|
|
|
// Note for the working note
|
|
|
|
// Note for the working note
|
|
|
|
private Note mNote;//便签对象
|
|
|
|
private Note mNote;
|
|
|
|
// Note Id
|
|
|
|
// Note Id
|
|
|
|
private long mNoteId;//便签的id
|
|
|
|
private long mNoteId;
|
|
|
|
// Note content
|
|
|
|
// Note content
|
|
|
|
private String mContent;//内容字符串
|
|
|
|
public String mContent;
|
|
|
|
// Note mode
|
|
|
|
// Note mode
|
|
|
|
private int mMode;//便签所处的模式(任务清单/普通)
|
|
|
|
private int mMode;
|
|
|
|
|
|
|
|
|
|
|
|
private long mAlertDate;//提醒时间
|
|
|
|
private long mAlertDate;
|
|
|
|
|
|
|
|
|
|
|
|
private long mModifiedDate;//修改日期
|
|
|
|
private long mModifiedDate;
|
|
|
|
|
|
|
|
|
|
|
|
private int mBgColorId;//背景颜色
|
|
|
|
private int mBgColorId;
|
|
|
|
|
|
|
|
|
|
|
|
private int mWidgetId;//小插件的id号
|
|
|
|
private int mWidgetId;
|
|
|
|
|
|
|
|
|
|
|
|
private int mWidgetType;//小插件的类型
|
|
|
|
private int mWidgetType;
|
|
|
|
|
|
|
|
|
|
|
|
private long mFolderId;//所属便签包的id号
|
|
|
|
private long mFolderId;
|
|
|
|
|
|
|
|
|
|
|
|
private Context mContext;//便签的上下文
|
|
|
|
private Context mContext;
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "WorkingNote";//用于接收日志的标签
|
|
|
|
private static final String TAG = "WorkingNote";
|
|
|
|
|
|
|
|
|
|
|
|
private boolean mIsDeleted;//表示是否已经被删除
|
|
|
|
private boolean mIsDeleted;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;
|
|
|
|
|
|
|
|
|
|
|
|
private NoteSettingChangedListener mNoteSettingStatusListener;//设置一个监听器,监听便签设置的改变
|
|
|
|
|
|
|
|
//定义数据的字段
|
|
|
|
|
|
|
|
public static final String[] DATA_PROJECTION = new String[] {
|
|
|
|
public static final String[] DATA_PROJECTION = new String[] {
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.ID,
|
|
|
|
DataColumns.CONTENT,
|
|
|
|
DataColumns.CONTENT,
|
|
|
@ -77,7 +71,7 @@ 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,
|
|
|
@ -86,7 +80,7 @@ public class WorkingNote {
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
NoteColumns.MODIFIED_DATE
|
|
|
|
NoteColumns.MODIFIED_DATE
|
|
|
|
};
|
|
|
|
};
|
|
|
|
//数据相关的参数
|
|
|
|
|
|
|
|
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;
|
|
|
@ -94,7 +88,7 @@ public class WorkingNote {
|
|
|
|
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;
|
|
|
@ -108,38 +102,19 @@ 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
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @methodname WorkingNote
|
|
|
|
|
|
|
|
* @description:构造函数,构造一个新的便签,完成初始赋值
|
|
|
|
|
|
|
|
* @date: 2024/1/3 19:26
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
* @param:context相关的文本
|
|
|
|
|
|
|
|
* @param:folderId所属包的id
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
private WorkingNote(Context context, long folderId) {
|
|
|
|
mContext = context;
|
|
|
|
mContext = context;
|
|
|
|
mAlertDate = 0;
|
|
|
|
mAlertDate = 0;
|
|
|
|
mModifiedDate = System.currentTimeMillis();
|
|
|
|
mModifiedDate = System.currentTimeMillis();
|
|
|
|
mFolderId = folderId;
|
|
|
|
mFolderId = folderId;
|
|
|
|
mNote = new Note();
|
|
|
|
mNote = new Note();
|
|
|
|
mNoteId = 0;//初始化笔记id为0
|
|
|
|
mNoteId = 0;
|
|
|
|
mIsDeleted = false;
|
|
|
|
mIsDeleted = false;
|
|
|
|
mMode = 0;
|
|
|
|
mMode = 0;
|
|
|
|
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
|
|
|
|
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Existing note construct
|
|
|
|
// Existing note construct
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @methodname WorkingNote
|
|
|
|
|
|
|
|
* @description:从现有的笔记创建工作中的笔记(被使用)
|
|
|
|
|
|
|
|
* @date: 2024/1/3 21:33
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
* @param:context上下文
|
|
|
|
|
|
|
|
* @param:noteId笔记的id号
|
|
|
|
|
|
|
|
* @param:folderId所属文件夹的id
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private WorkingNote(Context context, long noteId, long folderId) {
|
|
|
|
private WorkingNote(Context context, long noteId, long folderId) {
|
|
|
|
mContext = context;
|
|
|
|
mContext = context;
|
|
|
|
mNoteId = noteId;
|
|
|
|
mNoteId = noteId;
|
|
|
@ -148,23 +123,14 @@ public class WorkingNote {
|
|
|
|
mNote = new Note();
|
|
|
|
mNote = new Note();
|
|
|
|
loadNote();
|
|
|
|
loadNote();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @methodname loadNote
|
|
|
|
|
|
|
|
* @description:加载/读取便签
|
|
|
|
|
|
|
|
* @date: 2024/1/3 21:34
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void loadNote() {
|
|
|
|
private void loadNote() {
|
|
|
|
//查询数据库,获取与给定笔记id关联的笔记
|
|
|
|
|
|
|
|
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,
|
|
|
|
null, null);
|
|
|
|
null, null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {
|
|
|
|
//如果cursor不为空,移动到结果集的第一行
|
|
|
|
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
//从结果集获取各个属性值
|
|
|
|
|
|
|
|
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
|
|
|
|
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
|
|
|
|
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
|
|
|
|
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
|
|
|
|
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
|
|
|
|
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
|
|
|
@ -173,43 +139,33 @@ public class WorkingNote {
|
|
|
|
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
|
|
|
|
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cursor.close();
|
|
|
|
cursor.close();
|
|
|
|
} else {//如果找不到关联的笔记抛出异常
|
|
|
|
} else {
|
|
|
|
Log.e(TAG, "No note with id:" + mNoteId);
|
|
|
|
Log.e(TAG, "No note with id:" + mNoteId);
|
|
|
|
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
|
|
|
|
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 调用loadNoteData方法,继续加载与笔记相关的其他数据(标记)
|
|
|
|
|
|
|
|
loadNoteData();
|
|
|
|
loadNoteData();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @methodname loadNoteData
|
|
|
|
|
|
|
|
* @description:将便签里的数据加载进去并存储
|
|
|
|
|
|
|
|
* @date: 2024/1/3 21:48
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void loadNoteData() {
|
|
|
|
private void loadNoteData() {
|
|
|
|
//查询数据库,获取与给定笔记id关联的笔记
|
|
|
|
|
|
|
|
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) {
|
|
|
|
//光标移动到查询结果的第一行
|
|
|
|
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);//获取当前笔记的类型
|
|
|
|
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
|
|
|
|
//如果笔记是普通的笔记,获取笔记内容、模式、id等参数完成赋值
|
|
|
|
|
|
|
|
if (DataConstants.NOTE.equals(type)) {
|
|
|
|
if (DataConstants.NOTE.equals(type)) {
|
|
|
|
mContent = cursor.getString(DATA_CONTENT_COLUMN);
|
|
|
|
mContent = cursor.getString(DATA_CONTENT_COLUMN);
|
|
|
|
mMode = cursor.getInt(DATA_MODE_COLUMN);
|
|
|
|
mMode = cursor.getInt(DATA_MODE_COLUMN);
|
|
|
|
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
} else if (DataConstants.CALL_NOTE.equals(type)) {//如果数据是通话数据,从数据行中直接获取数据id
|
|
|
|
} else if (DataConstants.CALL_NOTE.equals(type)) {
|
|
|
|
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Log.d(TAG, "Wrong note type with type:" + type);
|
|
|
|
Log.d(TAG, "Wrong note type with type:" + type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (cursor.moveToNext());//光标移动到下一行
|
|
|
|
} while (cursor.moveToNext());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cursor.close();
|
|
|
|
cursor.close();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -217,7 +173,7 @@ 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//创建一个空的便签,设置属性以及资源的id号等等信息
|
|
|
|
|
|
|
|
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);
|
|
|
@ -226,17 +182,15 @@ public class WorkingNote {
|
|
|
|
note.setWidgetType(widgetType);
|
|
|
|
note.setWidgetType(widgetType);
|
|
|
|
return note;
|
|
|
|
return note;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//读取便签的内容
|
|
|
|
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
public static WorkingNote load(Context context, long id) {
|
|
|
|
return new WorkingNote(context, id, 0);
|
|
|
|
return new WorkingNote(context, id, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
public synchronized boolean saveNote() {
|
|
|
|
//检查笔记是否有保存的价值
|
|
|
|
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
if (isWorthSaving()) {
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
if (!existInDatabase()) {
|
|
|
|
// 如果不在数据库里,根据包的id和上下文获取一个新的笔记ID,如果获取失败则返回false并记录日志
|
|
|
|
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
|
|
|
|
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {//获取失败返回的id是0
|
|
|
|
|
|
|
|
Log.e(TAG, "Create new note fail with id:" + mNoteId);
|
|
|
|
Log.e(TAG, "Create new note fail with id:" + mNoteId);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -246,7 +200,6 @@ public class WorkingNote {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update widget content if there exist any widget of this note
|
|
|
|
* Update widget content if there exist any widget of this note
|
|
|
|
* 当组件发生变化时,对笔记设置状态的监听器进行更新?
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
|
|
|
|
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
|
|
|
@ -258,13 +211,12 @@ public class WorkingNote {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//检查是否位于数据库中
|
|
|
|
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
public boolean existInDatabase() {
|
|
|
|
return mNoteId > 0;
|
|
|
|
return mNoteId > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//检查便签是否具有保存的价值
|
|
|
|
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
private boolean isWorthSaving() {
|
|
|
|
//如果在数据库中已经存在而本地没有修改,或者便签已被删除了,或者便签为空,不值得保存
|
|
|
|
|
|
|
|
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|
|
|
|
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|
|
|
|
|| (existInDatabase() && !mNote.isLocalModified())) {
|
|
|
|
|| (existInDatabase() && !mNote.isLocalModified())) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -272,11 +224,11 @@ public class WorkingNote {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设置笔记设置状态的监听器为工作状态
|
|
|
|
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
mNoteSettingStatusListener = l;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设置提醒的日期
|
|
|
|
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
public void setAlertDate(long date, boolean set) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
if (date != mAlertDate) {
|
|
|
|
mAlertDate = date;
|
|
|
|
mAlertDate = date;
|
|
|
@ -286,7 +238,7 @@ public class WorkingNote {
|
|
|
|
mNoteSettingStatusListener.onClockAlertChanged(date, set);
|
|
|
|
mNoteSettingStatusListener.onClockAlertChanged(date, set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//删除标记值
|
|
|
|
|
|
|
|
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
|
|
|
@ -295,7 +247,6 @@ public class WorkingNote {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置背景的颜色id
|
|
|
|
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
public void setBgColorId(int id) {
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
if (id != mBgColorId) {
|
|
|
|
mBgColorId = id;
|
|
|
|
mBgColorId = id;
|
|
|
@ -305,10 +256,9 @@ public class WorkingNote {
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设置任务清单模式
|
|
|
|
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
public void setCheckListMode(int mode) {
|
|
|
|
if (mMode != mode) {
|
|
|
|
if (mMode != mode) {
|
|
|
|
//进行任务清单模式必要组件的的设置
|
|
|
|
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
if (mNoteSettingStatusListener != null) {
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -316,7 +266,7 @@ public class WorkingNote {
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设定组件相关的类型id等信息
|
|
|
|
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
public void setWidgetType(int type) {
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
if (type != mWidgetType) {
|
|
|
|
mWidgetType = type;
|
|
|
|
mWidgetType = type;
|
|
|
@ -330,25 +280,24 @@ public class WorkingNote {
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//设置当前工作便签的文本
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//将便签转化为通话便签
|
|
|
|
|
|
|
|
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);
|
|
|
|
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
|
|
|
|
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取是否设置有提醒
|
|
|
|
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
public boolean hasClockAlert() {
|
|
|
|
return (mAlertDate > 0 ? true : false);
|
|
|
|
return (mAlertDate > 0 ? true : false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//根据需要,返回对应的参数值
|
|
|
|
|
|
|
|
public String getContent() {
|
|
|
|
public String getContent() {
|
|
|
|
return mContent;
|
|
|
|
return mContent;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -392,13 +341,7 @@ public class WorkingNote {
|
|
|
|
public int getWidgetType() {
|
|
|
|
public int getWidgetType() {
|
|
|
|
return mWidgetType;
|
|
|
|
return mWidgetType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @classname: WorkingNote
|
|
|
|
|
|
|
|
* @description:接口,进行便签设置状态的监听,
|
|
|
|
|
|
|
|
* 并根据状态改变调用相应的背景颜色,任务清单模式,时间提醒,组件更新功能
|
|
|
|
|
|
|
|
* @date: 2024/1/4 9:22
|
|
|
|
|
|
|
|
* @author: Xia Yanbo
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
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
|
|
|
@ -412,7 +355,6 @@ public class WorkingNote {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Call when user create note from widget
|
|
|
|
* Call when user create note from widget
|
|
|
|
* 实际完成的是更新控件并通知调用者的工作
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void onWidgetChanged();
|
|
|
|
void onWidgetChanged();
|
|
|
|
|
|
|
|
|
|
|
|