Fragmentの処理を実装 WIP

This commit is contained in:
ろむねこ 2024-01-25 16:46:12 +09:00
parent 885f1b40c8
commit 87f6d582dc
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -5,19 +5,30 @@ import android.os.Bundle;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation; import androidx.navigation.Navigation;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast; import android.widget.Toast;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.LacertaLibrary;
/** /**
* A simple {@link Fragment} subclass. * A simple {@link Fragment} subclass.
* Use the {@link SettingTagManageFragment#newInstance} factory method to * Use the {@link SettingTagManageFragment#newInstance} factory method to
* create an instance of this fragment. * create an instance of this fragment.
*/ */
@AndroidEntryPoint
public class SettingTagManageFragment extends Fragment { public class SettingTagManageFragment extends Fragment {
@Inject
LacertaLibrary lacertaLibrary;
public SettingTagManageFragment() { public SettingTagManageFragment() {
// Required empty public constructor // Required empty public constructor
} }
@ -50,6 +61,20 @@ public class SettingTagManageFragment extends Fragment {
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, 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();
});
} }
/** /**