From 21b198bc35c10d75d39e42a05237d3134770f5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 26 Jan 2024 15:28:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=B0=E3=83=AA=E3=82=B9=E3=83=88?= =?UTF-8?q?=E3=81=AE=E6=9B=B4=E6=96=B0=E3=82=92=E5=88=87=E3=82=8A=E5=87=BA?= =?UTF-8?q?=E3=81=97,=20=E8=BF=BD=E5=8A=A0=E5=BE=8C=E3=81=AB=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/SettingTagManageFragment.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java index 2211a60c..f01d82f3 100644 --- a/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java +++ b/feature/setting/src/main/java/one/nem/lacerta/setting/SettingTagManageFragment.java @@ -32,6 +32,10 @@ public class SettingTagManageFragment extends Fragment { @Inject LacertaLibrary lacertaLibrary; + private RecyclerView recyclerView; + + private TagListItemAdapter adapter; + public SettingTagManageFragment() { // Required empty public constructor } @@ -65,19 +69,22 @@ public class SettingTagManageFragment extends Fragment { public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - RecyclerView recyclerView = view.findViewById(R.id.tag_item_recycler_view); - TagListItemAdapter adapter = new TagListItemAdapter((tagId, tagName, tagColor) -> { + this.recyclerView = view.findViewById(R.id.tag_item_recycler_view); + this.adapter = new TagListItemAdapter((tagId, tagName, tagColor) -> { Toast.makeText(getContext(), "Tag Clicked", Toast.LENGTH_SHORT).show(); }); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - lacertaLibrary.getTagList().thenAccept(documentTags -> { - adapter.setDocumentTags(documentTags); - adapter.notifyDataSetChanged(); - }); + updateTagList(); + } + private void updateTagList() { + lacertaLibrary.getTagList().thenAccept(documentTags -> { + this.adapter.setDocumentTags(documentTags); + this.adapter.notifyDataSetChanged(); + }); } /** @@ -114,6 +121,7 @@ public class SettingTagManageFragment extends Fragment { newTag.setName(tagName); newTag.setColor(tagColor); lacertaLibrary.createTag(newTag).join(); + updateTagList(); } @Override