From b9c1c521cfeec657b36d7cbf063fca6f90a67025 Mon Sep 17 00:00:00 2001 From: r-ca Date: Sun, 28 Jan 2024 13:43:56 +0900 Subject: [PATCH] =?UTF-8?q?combine=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, 21 insertions(+) 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 e365c66c..542fced8 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 @@ -19,6 +19,7 @@ import com.google.android.material.textfield.TextInputLayout; import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.component.common.picker.LacertaFilePickerDialog; import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.document.page.Page; @@ -156,6 +157,9 @@ public class ViewerContainerFragment extends Fragment { } else if (item.getItemId() == R.id.action_move) { Toast.makeText(getContext(), "Work in progress", Toast.LENGTH_SHORT).show(); return true; + } else if (item.getItemId() == R.id.action_combine) { + combineDocument(); + return true; } else { return false; } @@ -163,6 +167,23 @@ public class ViewerContainerFragment extends Fragment { }); } + private void combineDocument() { + LacertaFilePickerDialog lacertaFilePickerDialog = new LacertaFilePickerDialog(); + lacertaFilePickerDialog.setListener((fileName, selectedId) -> { + lacertaLibrary.combineDocument(documentId, selectedId).thenAccept(aVoid -> { + getActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "結合しました", Toast.LENGTH_SHORT).show(); + getActivity().finish(); // TODO-rca: 終了させずにUIを更新したい + }); + }); + }); + lacertaFilePickerDialog + .setTitle("ファイルの結合") + .setMessage("結合するファイルを選択してください") + .setNegativeButtonText("キャンセル") + .show(getChildFragmentManager(), "LacertaFilePickerDialog"); + } + /** * ドキュメント名を変更する */