mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03:15 +00:00
fix
This commit is contained in:
parent
d07e63f534
commit
71f9be77cd
|
@ -17,6 +17,8 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
import one.nem.lacerta.data.Document;
|
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;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,11 +32,7 @@ import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
public class HomeTopFragment extends Fragment {
|
public class HomeTopFragment extends Fragment {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Document document;
|
LacertaLibrary lacertaLibrary;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Rename parameter arguments, choose names that match
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
@ -86,15 +84,17 @@ public class HomeTopFragment extends Fragment {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
View view = inflater.inflate(R.layout.fragment_home_top, container, false);
|
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 recyclerView = view.findViewById(R.id.item_recycler_view);
|
||||||
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
|
||||||
MyAdapter myAdapter = new MyAdapter(metas);
|
MyAdapter myAdapter = new MyAdapter(listItems);
|
||||||
|
|
||||||
recyclerView.setAdapter(myAdapter);
|
recyclerView.setAdapter(myAdapter);
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,21 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import one.nem.lacerta.model.ListItem;
|
||||||
import one.nem.lacerta.model.document.DocumentMeta;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
|
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolder> {
|
||||||
|
|
||||||
List<DocumentMeta> documentMetas;
|
ArrayList<ListItem> listItems;
|
||||||
|
|
||||||
public MyAdapter(List<DocumentMeta> documentMeta) {
|
public MyAdapter(ArrayList<ListItem> ListItem) {
|
||||||
this.documentMetas = documentMeta;
|
// this.listItem = listItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -31,8 +33,8 @@ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolde
|
||||||
public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull MyAdapterViewHolder holder, int position) {
|
||||||
|
|
||||||
|
|
||||||
holder.title.setText(documentMetas.get(position).getTitle());
|
holder.title.setText(listItems.get(position).getTitle());
|
||||||
holder.description.setText(documentMetas.get(position).getId());
|
holder.description.setText(listItems.get(position).getDescription());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyAdapterViewHolde
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return documentMetas.size();
|
return listItems.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MyAdapterViewHolder extends RecyclerView.ViewHolder {
|
public class MyAdapterViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user