diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java new file mode 100644 index 00000000..12b4fdef --- /dev/null +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/DocumentAdapter.java @@ -0,0 +1,46 @@ +package one.nem.lacerta.feature.library; + +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +public class DocumentAdapter extends RecyclerView.Adapter { + + private List documentList; + + public DocumentAdapter(List documentList) { + this.documentList = documentList; + } + + @NonNull + @Override + public DocumentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_library_menu, parent, false); + return new DocumentViewHolder(view); + } + + @Override + public void onBindViewHolder(@NonNull DocumentViewHolder holder, int position) { + holder.title.setText(documentList.get(position)); + } + + @Override + public int getItemCount() { + return documentList.size(); + } + + class DocumentViewHolder extends RecyclerView.ViewHolder { + TextView title; + + DocumentViewHolder(View itemView) { + super(itemView); + title = itemView.findViewById(R.id.debug_menu_item_title); + } + } +} \ No newline at end of file diff --git a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java index 1af45258..866b2521 100644 --- a/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java +++ b/feature/library/src/main/java/one/nem/lacerta/feature/library/LibraryTopFragment.java @@ -65,45 +65,6 @@ public class LibraryTopFragment extends Fragment { } - public class DocumentAdapter extends RecyclerView.Adapter { - - private List documentList; - - public DocumentAdapter(List documentList) { - this.documentList = documentList; - } - - @NonNull - @Override - public DocumentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { - View view = LayoutInflater.from(parent.getContext()).inflate(android.R.layout.simple_list_item_1, parent, false); - return new DocumentViewHolder(view); - } - - @Override - public void onBindViewHolder(@NonNull DocumentViewHolder holder, int position) { - holder.bind(documentList.get(position)); - } - - @Override - public int getItemCount() { - return documentList.size(); - } - - class DocumentViewHolder extends RecyclerView.ViewHolder { - private final TextView textView; - - DocumentViewHolder(View itemView) { - super(itemView); - textView = itemView.findViewById(android.R.id.text1); - } - - void bind(String document) { - textView.setText(document); - } - } - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment @@ -112,6 +73,9 @@ public class LibraryTopFragment extends Fragment { // Use view.findViewById instead of findViewById RecyclerView documentRecyclerView = view.findViewById(R.id.document_list); + LinearLayoutManager layoutManager = new LinearLayoutManager(getContext()); + documentRecyclerView.setLayoutManager(layoutManager); + List documentList = new ArrayList<>(); documentList.add("Document A"); documentList.add("Document B"); @@ -122,8 +86,6 @@ public class LibraryTopFragment extends Fragment { documentRecyclerView.setAdapter(adapter); // Use a LinearLayoutManager to specify the layout - LinearLayoutManager layoutManager = new LinearLayoutManager(requireContext()); - documentRecyclerView.setLayoutManager(layoutManager); return view; } } diff --git a/feature/library/src/main/res/layout/fragment_library_top.xml b/feature/library/src/main/res/layout/fragment_library_top.xml index dcb7edf9..b0d824e5 100644 --- a/feature/library/src/main/res/layout/fragment_library_top.xml +++ b/feature/library/src/main/res/layout/fragment_library_top.xml @@ -1,23 +1,24 @@ - + app:layout_constraintTop_toTopOf="parent" + app:title="Library" + app:titleTextColor="@color/colorOnPrimaryContainer" /> + app:layout_constraintTop_toBottomOf="@+id/tool_bar" /> - \ No newline at end of file + \ No newline at end of file diff --git a/feature/library/src/main/res/layout/list_item_library_menu.xml b/feature/library/src/main/res/layout/list_item_library_menu.xml new file mode 100644 index 00000000..277da422 --- /dev/null +++ b/feature/library/src/main/res/layout/list_item_library_menu.xml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file