From 87f6d582dc6859b537e1c98ddb2b81e6d5d2f221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 25 Jan 2024 16:46:12 +0900 Subject: [PATCH] =?UTF-8?q?Fragment=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/SettingTagManageFragment.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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 c43bf71a..46f96a7a 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 @@ -5,19 +5,30 @@ import android.os.Bundle; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.navigation.Navigation; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; +import javax.inject.Inject; + +import dagger.hilt.android.AndroidEntryPoint; +import one.nem.lacerta.data.LacertaLibrary; + /** * A simple {@link Fragment} subclass. * Use the {@link SettingTagManageFragment#newInstance} factory method to * create an instance of this fragment. */ +@AndroidEntryPoint public class SettingTagManageFragment extends Fragment { + @Inject + LacertaLibrary lacertaLibrary; + public SettingTagManageFragment() { // Required empty public constructor } @@ -50,6 +61,20 @@ public class SettingTagManageFragment extends Fragment { @Override 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) -> { + 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(); + }); + } /**