This commit is contained in:
r-ca 2024-01-29 01:12:51 +09:00
parent 141c91e1d7
commit 4ed8d96caa
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -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<Void> 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<Void> 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<Void> 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();
});
}
}