From d66546a567d5da1fa87ceba914cd6032e3e6f1c3 Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 00:44:02 +0900 Subject: [PATCH] =?UTF-8?q?CheckBox=E3=81=AE=E5=A4=89=E5=8C=96=E3=81=AB?= =?UTF-8?q?=E5=BF=9C=E3=81=98=E3=81=A6=E3=82=A4=E3=83=B3=E3=82=B9=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E5=A4=89=E6=95=B0=E3=81=AETagList=E3=82=92?= =?UTF-8?q?=E5=A4=89=E5=8C=96=E3=81=95=E3=81=9B=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/common/LacertaApplyTagDialog.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java index 913621a8..aabc81d5 100644 --- a/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java +++ b/component/common/src/main/java/one/nem/lacerta/component/common/LacertaApplyTagDialog.java @@ -98,14 +98,12 @@ public class LacertaApplyTagDialog extends DialogFragment { lacertaApplyTagAdapter.setListener(new LacertaApplyTagAdapter.LacertaApplyTagDialogListener() { @Override public void itemChecked(View view, String tagId) { - // Do something - Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show(); + applyChangeToVariable(true, tagId); } @Override public void itemUnchecked(View view, String tagId) { - // Do something - Toast.makeText(view.getContext(), tagId, Toast.LENGTH_SHORT).show(); + applyChangeToVariable(false, tagId); } }); @@ -132,6 +130,14 @@ public class LacertaApplyTagDialog extends DialogFragment { return builder.create(); } + private void applyChangeToVariable(boolean isChecked, String tagId) { + if (isChecked) { + this.registeredTags.stream().findAny().filter(tag -> tag.getId().equals(tagId)).ifPresent(tag -> this.appliedTags.add(tag)); + } else { + this.appliedTags.stream().findAny().filter(tag -> tag.getId().equals(tagId)).ifPresent(tag -> this.appliedTags.remove(tag)); + } + } + private CompletableFuture> getDocumentTagArrayList(String documentId) { return CompletableFuture.supplyAsync(() -> { ArrayList documentTagArrayList = new ArrayList<>();