在非回收站处删除便签时,移入回收站;在回收站删除便签时,彻底删除

在主页面菜单里提供“Recycle Bin”选项,允许用户进入回收站
pull/1/head
lyy 1 year ago
parent 29dd857eae
commit 9816a0b8b8

@ -473,16 +473,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");
@ -812,12 +811,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);

@ -33,7 +33,8 @@
android:id="@+id/menu_setting"
android:title="@string/menu_setting" />
<item android:title="@string/menu_search" />
<item
android:id="@+id/menu_search"
android:title="@string/menu_search"/>
android:id="@+id/menu_trash"
android:title="@string/menu_trash"/>
</menu>

@ -116,6 +116,8 @@
<string name="preferences_toast_success_set_accout">%1$s has been set as the sync account</string>
<string name="preferences_bg_random_appear_title">New note background color random</string>
<string name="menu_trash">Recycle Bin</string>
<string name="button_delete">Delete</string>
<string name="call_record_folder_name">Call notes</string>
<string name="hint_foler_name">Input name</string>

Loading…
Cancel
Save