|
|
|
@ -93,7 +93,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
|
|
|
|
|
private enum ListEditState {
|
|
|
|
|
NOTE_LIST, SUB_FOLDER, CALL_RECORD_FOLDER
|
|
|
|
|
};
|
|
|
|
|
}; //NOTE: 三种编辑状态@zhoukexing 2024/1/2 19:31
|
|
|
|
|
|
|
|
|
|
private ListEditState mState;
|
|
|
|
|
|
|
|
|
@ -477,21 +477,30 @@ 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 (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
|
|
|
|
|
.getSelectedItemIds())) {
|
|
|
|
|
// if (!isSyncMode()) { //在AS的虚拟机里,不能联网,不在同步模式下
|
|
|
|
|
// // if not synced, delete notes directly
|
|
|
|
|
// if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
|
|
|
|
|
// .getSelectedItemIds())) {
|
|
|
|
|
// } else {
|
|
|
|
|
// Log.e(TAG, "Delete notes error, should not happens");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
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 {
|
|
|
|
|
Log.e(TAG, "Delete notes error, should not happens");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// in sync mode, we'll move the deleted note into the trash
|
|
|
|
|
// folder
|
|
|
|
|
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
|
|
|
|
|
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
|
|
|
|
|
Log.e(TAG, "Move notes to trash folder error, should not happens");
|
|
|
|
|
// 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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
return widgets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -711,13 +720,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
// 在list(清单界面)按回退键就会被捕捉到这里,执行这个函数 @zhoukexing 2024/1/2 19:33
|
|
|
|
|
switch (mState) {
|
|
|
|
|
case SUB_FOLDER:
|
|
|
|
|
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
|
|
|
|
|
mState = ListEditState.NOTE_LIST;
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
mTitleBar.setVisibility(View.GONE);
|
|
|
|
|
break;
|
|
|
|
|
case SUB_FOLDER: // 当前状态是子文件夹,要回退到主文件夹 @zkx
|
|
|
|
|
// 特殊情况:子文件夹是“回收站”,要显式地说明展示底部栏(模仿下面的call_record_folder) @zkx
|
|
|
|
|
// 添加mAddNewNote.setVisibility(View.VISIBLE);此行后,
|
|
|
|
|
// sub_folder 和 call_record_folder 两种情况无差别,无需分开处理
|
|
|
|
|
case CALL_RECORD_FOLDER:
|
|
|
|
|
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
|
|
|
|
|
mState = ListEditState.NOTE_LIST;
|
|
|
|
@ -871,10 +879,32 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
createNewNote();
|
|
|
|
|
} else if (itemId == R.id.menu_search) {
|
|
|
|
|
onSearchRequested();
|
|
|
|
|
} else if (itemId == R.id.menu_trash) {
|
|
|
|
|
openTrashFolder();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @method: openTrashFolder
|
|
|
|
|
* @description: 打开回收站 todo:添加30天后自动删除【时间】
|
|
|
|
|
* @date: 2024/1/2 19:04
|
|
|
|
|
* @author: zhoukexing
|
|
|
|
|
* @param: []
|
|
|
|
|
* @return: void
|
|
|
|
|
*/
|
|
|
|
|
private void openTrashFolder() {
|
|
|
|
|
mCurrentFolderId = Notes.ID_TRASH_FOLER;
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
// 正常打开文件夹
|
|
|
|
|
mState = ListEditState.SUB_FOLDER;
|
|
|
|
|
// 将顶部栏设置为 data.getSnippet 文件夹名称
|
|
|
|
|
mTitleBar.setText(NotesListActivity.this
|
|
|
|
|
.getString(R.string.menu_trash));
|
|
|
|
|
// 不显示底部的“写便签” todoclosed:从子文件夹回到主页面时,展示底部栏
|
|
|
|
|
mAddNewNote.setVisibility(View.GONE);
|
|
|
|
|
mTitleBar.setVisibility(View.VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
/**
|
|
|
|
|
* @Method onSearchRequested
|
|
|
|
|