|
|
|
@ -504,28 +504,33 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
}.execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除文件夹
|
|
|
|
|
*
|
|
|
|
|
* @param folderId 要删除的文件夹的ID
|
|
|
|
|
*/
|
|
|
|
|
private void deleteFolder(long folderId) {
|
|
|
|
|
if (folderId == Notes.ID_ROOT_FOLDER) {
|
|
|
|
|
if (folderId == Notes.ID_ROOT_FOLDER) {// 如果要删除的文件夹ID是根文件夹的ID,记录错误日志并返回
|
|
|
|
|
Log.e(TAG, "Wrong folder id, should not happen " + folderId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HashSet<Long> ids = new HashSet<Long>();
|
|
|
|
|
HashSet<Long> ids = new HashSet<Long>();// 创建一个HashSet对象,用于存储要删除的文件夹ID
|
|
|
|
|
ids.add(folderId);
|
|
|
|
|
HashSet<AppWidgetAttribute> widgets = DataUtils.getFolderNoteWidget(mContentResolver,
|
|
|
|
|
folderId);
|
|
|
|
|
folderId);// 获取文件夹中的小部件信息
|
|
|
|
|
if (!isSyncMode()) {
|
|
|
|
|
// if not synced, delete folder directly
|
|
|
|
|
DataUtils.batchDeleteNotes(mContentResolver, ids);
|
|
|
|
|
DataUtils.batchDeleteNotes(mContentResolver, ids);// 如果未同步,直接删除文件夹
|
|
|
|
|
} else {
|
|
|
|
|
// in sync mode, we'll move the deleted folder into the trash folder
|
|
|
|
|
DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER);
|
|
|
|
|
DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER);// 如果是同步模式,将要删除的文件夹移动到回收站文件夹(上面那句话的翻译)
|
|
|
|
|
}
|
|
|
|
|
if (widgets != null) {
|
|
|
|
|
for (AppWidgetAttribute widget : widgets) {
|
|
|
|
|
if (widgets != null) {// 如果文件夹中有小部件
|
|
|
|
|
for (AppWidgetAttribute widget : widgets) {// 遍历小部件集合
|
|
|
|
|
if (widget.widgetId != AppWidgetManager.INVALID_APPWIDGET_ID
|
|
|
|
|
&& widget.widgetType != Notes.TYPE_WIDGET_INVALIDE) {
|
|
|
|
|
updateWidget(widget.widgetId, widget.widgetType);
|
|
|
|
|
&& widget.widgetType != Notes.TYPE_WIDGET_INVALIDE) {// 如果小部件ID有效且小部件类型有效
|
|
|
|
|
updateWidget(widget.widgetId, widget.widgetType);// 更新小部件
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|