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