You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
software/DataUtils.txt

153 lines
4.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* 工具类DataUtils包含一系列用于操作便签数据的方法。
*/
public class DataUtils {
public static final String TAG = "DataUtils";
/**
* 批量删除便签。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param ids 要删除的便签ID集合。
* @return 如果删除成功返回true否则返回false。
*/
public static boolean batchDeleteNotes(ContentResolver resolver, HashSet<Long> ids) {
// 方法实现...
}
/**
* 将单个便签移动到另一个文件夹。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param id 要移动的便签ID。
* @param srcFolderId 当前文件夹ID。
* @param desFolderId 目标文件夹ID。
*/
public static void moveNoteToFoler(ContentResolver resolver, long id, long srcFolderId, long desFolderId) {
// 方法实现...
}
/**
* 批量将便签移动到指定文件夹。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param ids 要移动的便签ID集合。
* @param folderId 目标文件夹ID。
* @return 如果移动成功返回true否则返回false。
*/
public static boolean batchMoveToFolder(ContentResolver resolver, HashSet<Long> ids, long folderId) {
// 方法实现...
}
/**
* 获取除系统文件夹外的所有文件夹数量。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @return 文件夹数量。
*/
public static int getUserFolderCount(ContentResolver resolver) {
// 方法实现...
}
/**
* 检查便签在数据库中是否可见。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param noteId 便签ID。
* @param type 便签类型。
* @return 如果便签可见返回true否则返回false。
*/
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
// 方法实现...
}
/**
* 检查便签在数据库中是否存在。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param noteId 便签ID。
* @return 如果便签存在返回true否则返回false。
*/
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {
// 方法实现...
}
/**
* 检查数据在数据库中是否存在。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param dataId 数据ID。
* @return 如果数据存在返回true否则返回false。
*/
public static boolean existInDataDatabase(ContentResolver resolver, long dataId) {
// 方法实现...
}
/**
* 检查指定名称的文件夹是否可见。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param name 文件夹名称。
* @return 如果文件夹可见返回true否则返回false。
*/
public static boolean checkVisibleFolderName(ContentResolver resolver, String name) {
// 方法实现...
}
/**
* 获取文件夹中便签的小部件属性集合。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param folderId 文件夹ID。
* @return 小部件属性集合。
*/
public static HashSet<AppWidgetAttribute> getFolderNoteWidget(ContentResolver resolver, long folderId) {
// 方法实现...
}
/**
* 根据便签ID获取关联的电话号码。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param noteId 便签ID。
* @return 电话号码字符串。
*/
public static String getCallNumberByNoteId(ContentResolver resolver, long noteId) {
// 方法实现...
}
/**
* 根据电话号码和通话日期获取便签ID。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param phoneNumber 电话号码。
* @param callDate 通话日期。
* @return 便签ID。
*/
public static long getNoteIdByPhoneNumberAndCallDate(ContentResolver resolver, String phoneNumber, long callDate) {
// 方法实现...
}
/**
* 根据ID获取便签的摘要。
*
* @param resolver ContentResolver对象用于访问内容提供者。
* @param noteId 便签ID。
* @return 便签摘要字符串。
*/
public static String getSnippetById(ContentResolver resolver, long noteId) {
// 方法实现...
}
/**
* 获取格式化后的便签摘要,去除换行符。
*
* @param snippet 原始便签摘要。
* @return 格式化后的便签摘要。
*/
public static String getFormattedSnippet(String snippet) {
// 方法实现...
}
}