From 841258d82a00433551d248cdce048f30d5b0f20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 29 Jan 2024 12:31:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/library/LibraryPageFragment.java | 20 +++++++++++++++++++ .../library/src/main/res/menu/dir_menu.xml | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java index 117f3ce6..1ae7481d 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryPageFragment.java @@ -329,6 +329,20 @@ public class LibraryPageFragment extends Fragment { } else if (item.getItemId() == R.id.menu_item_add_by_media) { createDocByMediaPicker(); return true; + } else if (item.getItemId() == R.id.menu_item_delete_folder) { + MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(requireContext()); + builder.setTitle("フォルダの削除"); + builder.setMessage("フォルダを削除しますか?"); + + builder.setPositiveButton("削除", (dialog, which) -> { + deleteMe(); + }); + builder.setNegativeButton("キャンセル", (dialog, which) -> { + dialog.cancel(); + }); + + builder.show(); + return true; } else { return false; } @@ -336,6 +350,12 @@ public class LibraryPageFragment extends Fragment { }); } + private void deleteMe() { + lacertaLibrary.deleteFolder(this.folderId).thenAccept(aVoid -> { + Navigation.findNavController(requireView()).popBackStack(); + }); + } + /** * メディアピッカーを使用してドキュメントを作成する(呼び出し部分) */ diff --git a/feature/library/src/main/res/menu/dir_menu.xml b/feature/library/src/main/res/menu/dir_menu.xml index 387474a1..872e777b 100644 --- a/feature/library/src/main/res/menu/dir_menu.xml +++ b/feature/library/src/main/res/menu/dir_menu.xml @@ -8,10 +8,15 @@ android:title="@string/create_new_folder" app:showAsAction="never"/> + + \ No newline at end of file