フォルダ削除実装

This commit is contained in:
ろむねこ 2024-01-29 12:31:18 +09:00
parent 8f7594c628
commit 841258d82a
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 26 additions and 1 deletions

View File

@ -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();
});
}
/**
* メディアピッカーを使用してドキュメントを作成する(呼び出し部分)
*/

View File

@ -8,10 +8,15 @@
android:title="@string/create_new_folder"
app:showAsAction="never"/>
<item
android:id="@+id/menu_item_delete_folder"
android:title="このフォルダを削除"
app:showAsAction="never"/>
<item
android:id="@+id/menu_item_add_by_media"
android:icon="@drawable/developer_mode_24px"
android:title="DEBUG_メディアピッカーから新規作成"
android:title="DEBUG_MediaPicker"
app:showAsAction="never"/>
</menu>