From f673954befc1471508eaa00f046959ba4235407f Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 02:37:16 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=83=8D=E3=83=BC=E3=83=A0=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/viewer/ViewerContainerFragment.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 5ee47489..5c3a67a8 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 @@ -147,14 +147,14 @@ public class ViewerContainerFragment extends Fragment { ImageButton imageButton = customView.findViewById(R.id.tab_modify); imageButton.setOnClickListener(v -> { - renameCombinedDocument(viewerViewPagerAdapter.getFragmentTargetId(position), viewerViewPagerAdapter.getFragmentTitle(position)); + renameCombinedDocument(this.documentId, viewerViewPagerAdapter.getFragmentTargetId(position), viewerViewPagerAdapter.getFragmentTitle(position)); }); tab.setCustomView(customView); }).attach(); } - private void renameCombinedDocument(String documentId, String current) { + private void renameCombinedDocument(String parentId, String childId, String current) { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getContext()); builder.setTitle("アイテム名の変更"); builder.setMessage("アイテム名を入力してください"); @@ -167,11 +167,14 @@ public class ViewerContainerFragment extends Fragment { builder.setView(view); builder.setPositiveButton("変更", (dialog, which) -> { - document.renameDocument(documentId, textInputEditText.getText().toString()).thenAccept(aVoid -> { - getActivity().runOnUiThread(() -> { - this.documentName = textInputEditText.getText().toString(); + document.renameDocument(childId, textInputEditText.getText().toString()).thenCombine( + lacertaLibrary.updateTitleCache(parentId, childId, textInputEditText.getText().toString()), (aVoid, aVoid2) -> { + getActivity().runOnUiThread(() -> { + Toast.makeText(getContext(), "変更しました", Toast.LENGTH_SHORT).show(); + dialog.dismiss(); + }); + return null; }); - }); }); builder.setNegativeButton("キャンセル", (dialog, which) -> { dialog.cancel();