Squashed commit of the following:

commit 85eea4ea72
Merge: e386d33 4d298a1
Author: lyy <627219260@qq.com>
Date:   Sat May 4 19:26:26 2024 +0800

    Merge branch 'develop' of https://bdgit.educoder.net/p82fie9y6/Notes-master into text

commit e386d33ba0
Author: lyy <627219260@qq.com>
Date:   Sat May 4 19:24:25 2024 +0800

    Squashed commit of the following:

    commit 4d298a1d1c
    Author: lyy <627219260@qq.com>
    Date:   Fri Apr 26 14:25:39 2024 +0800

        精读

commit c8e65c4496
Author: lyy <627219260@qq.com>
Date:   Sat May 4 19:11:11 2024 +0800

    打开回收站

commit 9816a0b8b8
Author: lyy <627219260@qq.com>
Date:   Sat May 4 15:34:56 2024 +0800

    在非回收站处删除便签时,移入回收站;在回收站删除便签时,彻底删除
    在主页面菜单里提供“Recycle Bin”选项,允许用户进入回收站
pull/1/head
lyy 1 year ago
parent 4d298a1d1c
commit 814967bce3

@ -474,16 +474,15 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() { new AsyncTask<Void, Void, HashSet<AppWidgetAttribute>>() {
protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) { protected HashSet<AppWidgetAttribute> doInBackground(Void... unused) {
HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget(); HashSet<AppWidgetAttribute> widgets = mNotesListAdapter.getSelectedWidget();
if (!isSyncMode()) { if (mCurrentFolderId == Notes.ID_TRASH_FOLER){
// if not synced, delete notes directly // if in trash, really delete notes
if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter if (DataUtils.batchDeleteNotes(mContentResolver, mNotesListAdapter
.getSelectedItemIds())) { .getSelectedItemIds())) {
} else { } else {
Log.e(TAG, "Delete notes error, should not happens"); Log.e(TAG, "Delete notes error, should not happens");
} }
} else { } else {
// in sync mode, we'll move the deleted note into the trash // move notes to trash
// folder
if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter if (!DataUtils.batchMoveToFolder(mContentResolver, mNotesListAdapter
.getSelectedItemIds(), Notes.ID_TRASH_FOLER)) { .getSelectedItemIds(), Notes.ID_TRASH_FOLER)) {
Log.e(TAG, "Move notes to trash folder error, should not happens"); 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); ids.add(folderId);
HashSet<AppWidgetAttribute> widgets = DataUtils.getFolderNoteWidget(mContentResolver, HashSet<AppWidgetAttribute> widgets = DataUtils.getFolderNoteWidget(mContentResolver,
folderId); folderId);
if (!isSyncMode()) { if (mCurrentFolderId == Notes.ID_TRASH_FOLER) {
// if not synced, delete folder directly // if in trash, delete folder directly
DataUtils.batchDeleteNotes(mContentResolver, ids); DataUtils.batchDeleteNotes(mContentResolver, ids);
} else { } 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); DataUtils.batchMoveToFolder(mContentResolver, ids, Notes.ID_TRASH_FOLER);
} }
if (widgets != null) { if (widgets != null) {
@ -813,12 +812,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
case R.id.menu_search: case R.id.menu_search:
onSearchRequested(); onSearchRequested();
break; break;
case R.id.menu_trash:
openTrashFolder();
break;
default: default:
break; break;
} }
return true; 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 @Override
public boolean onSearchRequested() { public boolean onSearchRequested() {
startSearch(null, false, null /* appData */, false); startSearch(null, false, null /* appData */, false);

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

@ -110,6 +110,7 @@
<string name="preferences_toast_cannot_change_account">正在同步中,不能修改同步帐号</string> <string name="preferences_toast_cannot_change_account">正在同步中,不能修改同步帐号</string>
<string name="preferences_toast_success_set_accout">同步帐号已设置为%1$s</string> <string name="preferences_toast_success_set_accout">同步帐号已设置为%1$s</string>
<string name="preferences_bg_random_appear_title">新建便签背景颜色随机</string> <string name="preferences_bg_random_appear_title">新建便签背景颜色随机</string>
<string name="menu_trash">回收站</string>
<string name="button_delete">删除</string> <string name="button_delete">删除</string>
<string name="call_record_folder_name">通话便签</string> <string name="call_record_folder_name">通话便签</string>
<string name="hint_foler_name">请输入名称</string> <string name="hint_foler_name">请输入名称</string>

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

Loading…
Cancel
Save