This commit is contained in:
Fuchimoto1234 2024-01-17 12:58:25 +09:00
parent d07e63f534
commit 71f9be77cd
2 changed files with 16 additions and 14 deletions

View File

@ -17,6 +17,8 @@ import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.LacertaLibrary;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.document.DocumentMeta;
@ -30,11 +32,7 @@ import one.nem.lacerta.model.document.DocumentMeta;
public class HomeTopFragment extends Fragment {
@Inject
Document document;
LacertaLibrary lacertaLibrary;
// TODO: Rename parameter arguments, choose names that match
@ -86,15 +84,17 @@ public class HomeTopFragment extends Fragment {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
List<DocumentMeta> metas = document.getAllDocumentMetas(100);
// List<DocumentMeta> metas = document.getAllDocumentMetas(100);
Log.d("docs", Integer.toString(metas.size()));
List<ListItem> listItem = lacertaLibrary.getRecentDocument(100).getListItems();
Log.d("docs", Integer.toString(listItem.size()));
RecyclerView recyclerView = view.findViewById(R.id.item_recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
MyAdapter myAdapter = new MyAdapter(metas);
MyAdapter myAdapter = new MyAdapter(listItems);
recyclerView.setAdapter(myAdapter);

View File

@ -5,19 +5,21 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import one.nem.lacerta.model.ListItem;
import one.nem.lacerta.model.document.DocumentMeta;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
List<DocumentMeta> documentMetas;
ArrayList<ListItem> listItems;
public MyAdapter(List<DocumentMeta> documentMeta) {
this.documentMetas = documentMeta;
public MyAdapter(ArrayList<ListItem> ListItem) {
// this.listItem = listItem;
}
@NonNull
@ -31,8 +33,8 @@ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolde
public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) {
holder.title.setText(documentMetas.get(position).getTitle());
holder.description.setText(documentMetas.get(position).getId());
holder.title.setText(listItems.get(position).getTitle());
holder.description.setText(listItems.get(position).getDescription());
@ -46,7 +48,7 @@ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolde
@Override
public int getItemCount() {
return documentMetas.size();
return listItems.size();
}
public class MyAdapterViewHolder extends RecyclerView.ViewHolder {