From c724905027b9271dd080232cd485b21bef29d83b Mon Sep 17 00:00:00 2001 From: sebastian Date: Fri, 1 Nov 2024 17:29:11 +0100 Subject: [PATCH] Make Songlist more beautiful --- .../core/notevault/ui/home/HomeFragment.java | 4 + .../notevault/ui/home/NoteSongAdapter.java | 9 +- app/src/main/res/layout/item_song.xml | 82 +++++++++++++++++-- 3 files changed, 84 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/core/notevault/ui/home/HomeFragment.java b/app/src/main/java/core/notevault/ui/home/HomeFragment.java index 99cf7dd..34d62ac 100644 --- a/app/src/main/java/core/notevault/ui/home/HomeFragment.java +++ b/app/src/main/java/core/notevault/ui/home/HomeFragment.java @@ -15,6 +15,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.floatingactionbutton.FloatingActionButton; @@ -53,6 +54,9 @@ public class HomeFragment extends Fragment { recyclerView.setAdapter(noteSongAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), LinearLayoutManager.VERTICAL); + recyclerView.addItemDecoration(dividerItemDecoration); + homeViewModel.getNoteTitles().observe(getViewLifecycleOwner(), songs -> { noteSongAdapter.updateSongTitles(songs); }); diff --git a/app/src/main/java/core/notevault/ui/home/NoteSongAdapter.java b/app/src/main/java/core/notevault/ui/home/NoteSongAdapter.java index 6289b3e..c6ce44f 100644 --- a/app/src/main/java/core/notevault/ui/home/NoteSongAdapter.java +++ b/app/src/main/java/core/notevault/ui/home/NoteSongAdapter.java @@ -41,6 +41,8 @@ public class NoteSongAdapter extends RecyclerView.Adapter { int position = getAdapterPosition(); if(position != RecyclerView.NO_POSITION) { diff --git a/app/src/main/res/layout/item_song.xml b/app/src/main/res/layout/item_song.xml index 4c373e2..6633b08 100644 --- a/app/src/main/res/layout/item_song.xml +++ b/app/src/main/res/layout/item_song.xml @@ -1,13 +1,77 @@ - + - + + android:layout_weight="1" + android:orientation="vertical"> + + + + + + + + + + + + + + + + + + + + +