From 4779d5197644b5b4b609d31e60b4e6f602c064ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 15:24:22 +0900 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E3=81=97=E3=81=84=E5=AE=9F=E8=A3=85?= =?UTF-8?q?=E3=81=AB=E3=81=82=E3=82=8F=E3=81=9B=E3=81=A6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerListFragment.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java index be566e6a..7a35379a 100644 --- a/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java +++ b/component/viewer/src/main/java/one/nem/lacerta/component/viewer/ViewerListFragment.java @@ -20,6 +20,7 @@ import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.common.LacertaSelectDirDialog; +import one.nem.lacerta.component.common.LacertaSelectDirDialogListener; import one.nem.lacerta.data.Document; import one.nem.lacerta.model.document.page.Page; import one.nem.lacerta.utils.FeatureSwitch; @@ -206,7 +207,28 @@ public class ViewerListFragment extends Fragment { } else if (item.getItemId() == R.id.action_move) { // Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); LacertaSelectDirDialog lacertaSelectDirDialog = new LacertaSelectDirDialog(); - lacertaSelectDirDialog.show(getParentFragmentManager(), "LacertaSelectDirDialog"); + lacertaSelectDirDialog.setListener(new LacertaSelectDirDialogListener() { + @Override + public void onDirSelected(String name, String itemId) { + logger.debug(TAG, "Selected dir: " + name + ", " + itemId); + document.moveDocument(documentId, itemId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + // Stop Activity + getActivity().finish(); // TODO-rca: ファイル移動後に終了するべきかは検討 + }); + }); + } + + @Override + public void onCanceled() { + logger.debug(TAG, "Canceled"); + } + }); + lacertaSelectDirDialog.setTitle("ファイルの移動") + .setMessage("ファイルを移動するフォルダを選択してください。") + .setPositiveButtonText("移動") + .setNegativeButtonText("キャンセル"); + lacertaSelectDirDialog.show(getParentFragmentManager(), "select_dir_dialog"); return true; } else { return false;