From e583481b9ab6d5604096749ad5fa053aba58887d 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 10:43:35 +0900 Subject: [PATCH] =?UTF-8?q?moveDocument=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../viewer/ViewerContainerFragment.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java index b74d75d2..ef60e938 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerContainerFragment.java @@ -29,6 +29,7 @@ import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.common.LacertaApplyTagDialog; import one.nem.lacerta.component.common.LacertaSelectRevDialog; import one.nem.lacerta.component.common.LacertaSelectRevDialogListener; +import one.nem.lacerta.component.common.picker.LacertaDirPickerDialog; import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; @@ -247,7 +248,7 @@ public class ViewerContainerFragment extends Fragment { deleteDocument(); return true; } else if (item.getItemId() == R.id.action_move) { - Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); + moveDocument(); return true; } else if (item.getItemId() == R.id.action_combine) { combineDocument(); @@ -281,6 +282,24 @@ public class ViewerContainerFragment extends Fragment { lacertaSelectRevDialog.show(getParentFragmentManager(), "select_rev_dialog"); } + private void moveDocument() { + LacertaDirPickerDialog lacertaDirPickerDialog = new LacertaDirPickerDialog(); + lacertaDirPickerDialog.setListener((name, dirId) -> { + logger.debug("MoveDocument", "Selected dir: " + name + ", " + dirId); + document.moveDocument(documentId, dirId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + // Stop Activity + getActivity().finish(); // TODO-rca: ファイル移動後に終了するべきかは検討 + }); + }); + }); + lacertaDirPickerDialog.setTitle("ファイルの移動") + .setMessage("ファイルを移動するフォルダを選択してください。") + .setPositiveButtonText("移動") + .setNegativeButtonText("キャンセル"); + lacertaDirPickerDialog.show(getParentFragmentManager(), "select_dir_dialog"); + } + private void deleteDocument() { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle("ファイルの削除");