AppliedTagをクラス変数で持つように

This commit is contained in:
r-ca 2024-01-29 00:35:51 +09:00
parent 04e0c9c05a
commit bf58f25cd5
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -49,6 +49,7 @@ public class LacertaApplyTagDialog extends DialogFragment {
private String negativeButtonText;
private String documentId;
private LacertaApplyTagDialogListener listener;
private ArrayList<DocumentTag> appliedTags;
// Setter
@ -133,11 +134,11 @@ public class LacertaApplyTagDialog extends DialogFragment {
return CompletableFuture.supplyAsync(() -> {
ArrayList<DocumentTagApplyTagDialogExtendedModel> documentTagArrayList = new ArrayList<>();
lacertaLibrary.getTagList().thenAccept(documentTags -> {
ArrayList<DocumentTag> 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;
});
}
}