|
|
@ -35,78 +35,78 @@ import java.util.ArrayList;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DataUtils {
|
|
|
|
public class DataUtils {// 定义日志标签
|
|
|
|
public static final String TAG = "DataUtils";
|
|
|
|
public static final String TAG = "DataUtils";
|
|
|
|
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {
|
|
|
|
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {// 批量删除笔记的方法
|
|
|
|
if (ids == null) {
|
|
|
|
if (ids == null) {
|
|
|
|
Log.d(TAG, "the ids is null");
|
|
|
|
Log.d(TAG, "the ids is null");// 记录日志,ids 为空
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ids.size() == 0) {
|
|
|
|
if (ids.size() == 0) {
|
|
|
|
Log.d(TAG, "no id is in the hashset");
|
|
|
|
Log.d(TAG, "no id is in the hashset");// 记录日志,ids 集合中没有 ID
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();// 创建操作列表
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {// 遍历需要删除的 ID,并创建对应的删除操作
|
|
|
|
if(id == Notes.ID_ROOT_FOLDER) {
|
|
|
|
if(id == Notes.ID_ROOT_FOLDER) {
|
|
|
|
Log.e(TAG, "Don't delete system folder root");
|
|
|
|
Log.e(TAG, "Don't delete system folder root");
|
|
|
|
continue;
|
|
|
|
continue;// 如果是系统文件夹的 ID,则跳过不执行删除操作
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
.newDelete(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));// 创建删除操作
|
|
|
|
operationList.add(builder.build());
|
|
|
|
operationList.add(builder.build());// 将操作添加到操作列表
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);// 应用批量操作
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());// 记录日志,删除失败
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));// 记录远程异常日志
|
|
|
|
} catch (OperationApplicationException e) {
|
|
|
|
} catch (OperationApplicationException e) {
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));// 记录操作异常日志
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {
|
|
|
|
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {// 移动笔记到文件夹的方法
|
|
|
|
ContentValues values = new ContentValues();
|
|
|
|
ContentValues values = new ContentValues();// 创建内容值对象
|
|
|
|
values.put(NoteColumns.PARENT_ID, desFolderId);
|
|
|
|
values.put(NoteColumns.PARENT_ID, desFolderId);// 设置父文件夹 ID
|
|
|
|
values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId);
|
|
|
|
values.put(NoteColumns.ORIGIN_PARENT_ID, srcFolderId);// 设置原始父文件夹 ID
|
|
|
|
values.put(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
values.put(NoteColumns.LOCAL_MODIFIED, 1);// 设置本地修改标志
|
|
|
|
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);
|
|
|
|
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);// 执行更新操作
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids,
|
|
|
|
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids,// 批量移动笔记到文件夹的方法
|
|
|
|
long folderId) {
|
|
|
|
long folderId) {
|
|
|
|
if (ids == null) {
|
|
|
|
if (ids == null) {
|
|
|
|
Log.d(TAG, "the ids is null");
|
|
|
|
Log.d(TAG, "the ids is null");// 记录日志,ids 为空
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
|
|
|
|
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();// 遍历需要移动的笔记 ID,并创建对应的更新操作
|
|
|
|
for (long id : ids) {
|
|
|
|
for (long id : ids) {
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
ContentProviderOperation.Builder builder = ContentProviderOperation
|
|
|
|
.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
|
|
|
|
.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));// 创建更新操作
|
|
|
|
builder.withValue(NoteColumns.PARENT_ID, folderId);
|
|
|
|
builder.withValue(NoteColumns.PARENT_ID, folderId);// 设置父文件夹 ID
|
|
|
|
builder.withValue(NoteColumns.LOCAL_MODIFIED, 1);
|
|
|
|
builder.withValue(NoteColumns.LOCAL_MODIFIED, 1);// 设置本地修改标志
|
|
|
|
operationList.add(builder.build());
|
|
|
|
operationList.add(builder.build());// 将操作添加到操作列表
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
|
|
|
|
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);// 应用批量操作
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
if (results == null || results.length == 0 || results[0] == null) {
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());
|
|
|
|
Log.d(TAG, "delete notes failed, ids:" + ids.toString());// 记录日志,删除失败
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
} catch (RemoteException e) {
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));// 记录远程异常日志
|
|
|
|
} catch (OperationApplicationException e) {
|
|
|
|
} catch (OperationApplicationException e) {
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));
|
|
|
|
Log.e(TAG, String.format("%s: %s", e.toString(), e.getMessage()));// 记录操作异常日志
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -114,9 +114,9 @@ public class DataUtils {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}}
|
|
|
|
* Get the all folder count except system folders {@link Notes#TYPE_SYSTEM}}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static int getUserFolderCount(ContentResolver resolver) {
|
|
|
|
public static int getUserFolderCount(ContentResolver resolver) {// 获取用户文件夹数量(排除系统文件夹)
|
|
|
|
Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor cursor =resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String[] { "COUNT(*)" },
|
|
|
|
new String[] { "COUNT(*)" },// 查询结果为数量
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?",
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>?",
|
|
|
|
new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)},
|
|
|
|
new String[] { String.valueOf(Notes.TYPE_FOLDER), String.valueOf(Notes.ID_TRASH_FOLER)},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
@ -125,26 +125,26 @@ public class DataUtils {
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor.moveToFirst()) {
|
|
|
|
if(cursor.moveToFirst()) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
count = cursor.getInt(0);
|
|
|
|
count = cursor.getInt(0);// 获取数量
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
Log.e(TAG, "get folder count failed:" + e.toString());
|
|
|
|
Log.e(TAG, "get folder count failed:" + e.toString());// 记录日志,获取数量失败
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
cursor.close();
|
|
|
|
cursor.close();// 关闭游标
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
|
|
|
|
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {// 查询指定ID的笔记,根据类型和父ID条件进行筛选
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,
|
|
|
|
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,// 传入需要查找的类型
|
|
|
|
new String [] {String.valueOf(type)},
|
|
|
|
new String [] {String.valueOf(type)},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {// 判断是否存在记录
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -154,11 +154,11 @@ public class DataUtils {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
|
|
|
|
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),// 查询指定ID的笔记
|
|
|
|
null, null, null, null);
|
|
|
|
null, null, null, null);
|
|
|
|
|
|
|
|
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {// 判断是否存在记录
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -167,12 +167,12 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {
|
|
|
|
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {// 查询指定ID的数据
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId),
|
|
|
|
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_DATA_URI, dataId),
|
|
|
|
null, null, null, null);
|
|
|
|
null, null, null, null);
|
|
|
|
|
|
|
|
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {// 判断是否存在记录
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
if (cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -181,14 +181,14 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
|
|
|
|
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {// 查询非回收站中特定名称的文件夹笔记
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI, null,
|
|
|
|
NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
|
|
|
|
NoteColumns.TYPE + "=" + Notes.TYPE_FOLDER +
|
|
|
|
" AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER +
|
|
|
|
" AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER +
|
|
|
|
" AND " + NoteColumns.SNIPPET + "=?",
|
|
|
|
" AND " + NoteColumns.SNIPPET + "=?",// 传入需要查找的名称
|
|
|
|
new String[] { name }, null);
|
|
|
|
new String[] { name }, null);
|
|
|
|
boolean exist = false;
|
|
|
|
boolean exist = false;
|
|
|
|
if(cursor != null) {
|
|
|
|
if(cursor != null) {// 判断是否存在记录
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
if(cursor.getCount() > 0) {
|
|
|
|
exist = true;
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -197,10 +197,10 @@ public class DataUtils {
|
|
|
|
return exist;
|
|
|
|
return exist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {
|
|
|
|
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {// 获取文件夹笔记的小部件数据
|
|
|
|
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor c = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE },
|
|
|
|
new String[] { NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE },
|
|
|
|
NoteColumns.PARENT_ID + "=?",
|
|
|
|
NoteColumns.PARENT_ID + "=?",// 传入文件夹ID
|
|
|
|
new String[] { String.valueOf(folderId) },
|
|
|
|
new String[] { String.valueOf(folderId) },
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
@ -224,15 +224,15 @@ public class DataUtils {
|
|
|
|
return set;
|
|
|
|
return set;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {
|
|
|
|
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {// 通过笔记ID获取电话号码
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
new String [] { CallNote.PHONE_NUMBER },
|
|
|
|
new String [] { CallNote.PHONE_NUMBER },
|
|
|
|
CallNote.NOTE_ID + "=? AND " + CallNote.MIME_TYPE + "=?",
|
|
|
|
CallNote.NOTE_ID + "=? AND " + CallNote.MIME_TYPE + "=?",// 传入笔记ID和MIME类型
|
|
|
|
new String [] { String.valueOf(noteId), CallNote.CONTENT_ITEM_TYPE },
|
|
|
|
new String [] { String.valueOf(noteId), CallNote.CONTENT_ITEM_TYPE },
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null && cursor.moveToFirst()) {
|
|
|
|
if (cursor != null && cursor.moveToFirst()) {
|
|
|
|
try {
|
|
|
|
try {// 返回电话号码
|
|
|
|
return cursor.getString(0);
|
|
|
|
return cursor.getString(0);
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
Log.e(TAG, "Get call number fails " + e.toString());
|
|
|
|
Log.e(TAG, "Get call number fails " + e.toString());
|
|
|
@ -243,17 +243,17 @@ public class DataUtils {
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {
|
|
|
|
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {// 通过电话号码和通话日期获取笔记ID
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_DATA_URI,
|
|
|
|
new String [] { CallNote.NOTE_ID },
|
|
|
|
new String [] { CallNote.NOTE_ID },
|
|
|
|
CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL("
|
|
|
|
CallNote.CALL_DATE + "=? AND " + CallNote.MIME_TYPE + "=? AND PHONE_NUMBERS_EQUAL("
|
|
|
|
+ CallNote.PHONE_NUMBER + ",?)",
|
|
|
|
+ CallNote.PHONE_NUMBER + ",?)",// 传入通话日期、MIME类型和电话号码
|
|
|
|
new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber },
|
|
|
|
new String [] { String.valueOf(callDate), CallNote.CONTENT_ITEM_TYPE, phoneNumber },
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor != null) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
|
try {
|
|
|
|
try {// 返回笔记ID
|
|
|
|
return cursor.getLong(0);
|
|
|
|
return cursor.getLong(0);
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
|
|
Log.e(TAG, "Get call note id fails " + e.toString());
|
|
|
|
Log.e(TAG, "Get call note id fails " + e.toString());
|
|
|
@ -264,10 +264,10 @@ public class DataUtils {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String getSnippetById(ContentResolver resolver, long noteId) {
|
|
|
|
public static String getSnippetById(ContentResolver resolver, long noteId) {// 通过笔记ID获取摘要内容
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
Cursor cursor = resolver.query(Notes.CONTENT_NOTE_URI,
|
|
|
|
new String [] { NoteColumns.SNIPPET },
|
|
|
|
new String [] { NoteColumns.SNIPPET },
|
|
|
|
NoteColumns.ID + "=?",
|
|
|
|
NoteColumns.ID + "=?",// 传入笔记ID
|
|
|
|
new String [] { String.valueOf(noteId)},
|
|
|
|
new String [] { String.valueOf(noteId)},
|
|
|
|
null);
|
|
|
|
null);
|
|
|
|
|
|
|
|
|
|
|
@ -282,7 +282,7 @@ public class DataUtils {
|
|
|
|
throw new IllegalArgumentException("Note is not found with id: " + noteId);
|
|
|
|
throw new IllegalArgumentException("Note is not found with id: " + noteId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String getFormattedSnippet(String snippet) {
|
|
|
|
public static String getFormattedSnippet(String snippet) {// 对摘要内容进行格式化处理
|
|
|
|
if (snippet != null) {
|
|
|
|
if (snippet != null) {
|
|
|
|
snippet = snippet.trim();
|
|
|
|
snippet = snippet.trim();
|
|
|
|
int index = snippet.indexOf('\n');
|
|
|
|
int index = snippet.indexOf('\n');
|
|
|
|