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 aefa9cf6..14508239 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 @@ -49,6 +49,7 @@ public class LacertaApplyTagDialog extends DialogFragment { private String negativeButtonText; private String documentId; private LacertaApplyTagDialogListener listener; + private ArrayList appliedTags; // Setter @@ -133,11 +134,11 @@ public class LacertaApplyTagDialog extends DialogFragment { return CompletableFuture.supplyAsync(() -> { ArrayList documentTagArrayList = new ArrayList<>(); lacertaLibrary.getTagList().thenAccept(documentTags -> { - ArrayList appliedTags = lacertaLibrary.getAppliedTagList(documentId).join(); + setAppliedTagList(documentId); for (int i = 0; i < documentTags.size(); i++) { boolean isChecked = false; - for (int j = 0; j < appliedTags.size(); j++) { - if (documentTags.get(i).getId().equals(appliedTags.get(j).getId())) { + for (int j = 0; j < this.appliedTags.size(); j++) { + if (documentTags.get(i).getId().equals(this.appliedTags.get(j).getId())) { isChecked = true; break; } @@ -151,4 +152,10 @@ public class LacertaApplyTagDialog extends DialogFragment { }); } + private void setAppliedTagList(String documentId) { + lacertaLibrary.getAppliedTagList(documentId).thenAccept(documentTags -> { + this.appliedTags = documentTags; + }); + } + }