|
|
|
@ -474,16 +474,15 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() {
|
|
|
|
|
protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) {
|
|
|
|
|
HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget();
|
|
|
|
|
if (!isSyncMode()) {
|
|
|
|
|
// if not synced, delete notes directly
|
|
|
|
|
if (mCurrentFolderId == Notes.ID_TRASH_FOLER){
|
|
|
|
|
// if in trash, really delete notes
|
|
|
|
|
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
|
|
|
|
|
.getSelectedItemIds())) {
|
|
|
|
|
} else {
|
|
|
|
|
Log.e(TAG, "Delete notes error, should not happens");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// in sync mode, we'll move the deleted note into the trash
|
|
|
|
|
// folder
|
|
|
|
|
// move notes to trash
|
|
|
|
|
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
|
|
|
|
|
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
|
|
|
|
|
Log.e(TAG, "Move notes to trash folder error, should not happens");
|
|
|
|
@ -517,11 +516,11 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
ids.add(folderId);
|
|
|
|
|
HashSet<AppWidgetAttribute> widgets = DataUtils.getFolderNoteWidget(mContentResolver,
|
|
|
|
|
folderId);
|
|
|
|
|
if (!isSyncMode()) {
|
|
|
|
|
// if not synced, delete folder directly
|
|
|
|
|
if (mCurrentFolderId == Notes.ID_TRASH_FOLER) {
|
|
|
|
|
// if in trash, delete folder directly
|
|
|
|
|
DataUtils.batchDeleteNotes(mContentResolver, ids);
|
|
|
|
|
} else {
|
|
|
|
|
// in sync mode, we'll move the deleted folder into the trash folder
|
|
|
|
|
//move the deleted folder into the trash folder
|
|
|
|
|
DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER);
|
|
|
|
|
}
|
|
|
|
|
if (widgets != null) {
|
|
|
|
@ -813,12 +812,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
case R.id.menu_search:
|
|
|
|
|
onSearchRequested();
|
|
|
|
|
break;
|
|
|
|
|
case R.id.menu_trash:
|
|
|
|
|
openTrashFolder();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void openTrashFolder() {
|
|
|
|
|
// 将当前列表的编辑状态设置为子文件夹模式
|
|
|
|
|
mState = ListEditState.SUB_FOLDER;
|
|
|
|
|
// 将当前文件夹 ID 设置为垃圾箱的 ID
|
|
|
|
|
mCurrentFolderId = Notes.ID_TRASH_FOLER;
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
// 不显示底部的“写便签”
|
|
|
|
|
mAddNewNote.setVisibility(View.GONE);
|
|
|
|
|
// 将顶部栏设置为 data.getSnippet 文件夹名称
|
|
|
|
|
mTitleBar.setText(NotesListActivity.this
|
|
|
|
|
.getString(R.string.menu_trash));
|
|
|
|
|
mTitleBar.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onSearchRequested() {
|
|
|
|
|
startSearch(null, false, null /* appData */, false);
|
|
|
|
|