deleteDocument実装

This commit is contained in:
ろむねこ 2024-01-29 10:42:20 +09:00
parent 732f599df9
commit 9861dfe5b6
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -244,7 +244,7 @@ public class ViewerContainerFragment extends Fragment {
renameDocument(); renameDocument();
return true; return true;
} else if (item.getItemId() == R.id.action_delete) { } else if (item.getItemId() == R.id.action_delete) {
Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); deleteDocument();
return true; return true;
} else if (item.getItemId() == R.id.action_move) { } else if (item.getItemId() == R.id.action_move) {
Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show();
@ -281,6 +281,26 @@ public class ViewerContainerFragment extends Fragment {
lacertaSelectRevDialog.show(getParentFragmentManager(), "select_rev_dialog"); lacertaSelectRevDialog.show(getParentFragmentManager(), "select_rev_dialog");
} }
private void deleteDocument() {
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext());
builder.setTitle("ファイルの削除");
builder.setMessage("ファイルを削除しますか?");
builder.setPositiveButton("削除", (dialog, which) -> {
document.deleteDocument(documentId).thenAccept(aVoid -> {
getActivity().runOnUiThread(() -> {
Toast.makeText(getContext(), "削除しました", Toast.LENGTH_SHORT).show();
getActivity().finish(); // TODO-rca: 終了させずにUIを更新したい
});
});
});
builder.setNegativeButton("キャンセル", (dialog, which) -> {
dialog.cancel();
});
builder.show();
}
private void applyTag() { private void applyTag() {
LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog(); LacertaApplyTagDialog lacertaApplyTagDialog = new LacertaApplyTagDialog();
lacertaApplyTagDialog lacertaApplyTagDialog