From 4ed8d96caa2d64a737f60bfe1af08ed02c2801cd Mon Sep 17 00:00:00 2001 From: r-ca Date: Mon, 29 Jan 2024 01:12:51 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/LacertaApplyTagDialog.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 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 61fbdcdb..51439f9a 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 @@ -24,6 +24,7 @@ import javax.inject.Inject; import dagger.hilt.android.AndroidEntryPoint; import one.nem.lacerta.component.common.model.DocumentTagApplyTagDialogExtendedModel; +import one.nem.lacerta.data.Document; import one.nem.lacerta.data.LacertaLibrary; import one.nem.lacerta.model.document.tag.DocumentTag; import one.nem.lacerta.utils.LacertaLogger; @@ -162,26 +163,25 @@ public class LacertaApplyTagDialog extends DialogFragment { }); } - private CompletableFuture setAppliedTagList(String documentId) { - return CompletableFuture.supplyAsync(() -> { - lacertaLibrary.getAppliedTagList(documentId).thenAccept(documentTags -> { - if (documentTags == null) { - this.appliedTags = new ArrayList<>(); - } else { - this.appliedTags = documentTags; - } - }); - return null; - }); - } - private CompletableFuture setRegisteredTagList() { - return CompletableFuture.supplyAsync(() -> { - lacertaLibrary.getTagList().thenAccept(documentTags -> { - this.registeredTags = documentTags; - }); - return null; + return CompletableFuture.runAsync(() -> { + this.registeredTags = new ArrayList<>(); + this.lacertaLibrary.getTagList().thenAccept(documentTagList -> { + for (int i = 0; i < documentTagList.size(); i++) { + this.registeredTags.add(new DocumentTag(documentTagList.get(i).getId(), documentTagList.get(i).getName(), documentTagList.get(i).getColor())); + } + }).join(); }); } + private CompletableFuture setAppliedTagList(String documentId) { + return CompletableFuture.runAsync(() -> { + this.appliedTags = new ArrayList<>(); + this.lacertaLibrary.getAppliedTagList(documentId).thenAccept(documentTagList -> { + for (int i = 0; i < documentTagList.size(); i++) { + this.appliedTags.add(new DocumentTag(documentTagList.get(i).getId(), documentTagList.get(i).getName(), documentTagList.get(i).getColor())); + } + }).join(); + }); + } }