Make Songlist more beautiful
This commit is contained in:
parent
a7fcaa0ea7
commit
c724905027
@ -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);
|
||||
});
|
||||
|
@ -41,6 +41,8 @@ public class NoteSongAdapter extends RecyclerView.Adapter<NoteSongAdapter.NoteVi
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull NoteViewHolder holder, int position) {
|
||||
holder.titleTextView.setText(noteTitles.get(position).getTitle());
|
||||
holder.yearTextView.setText(String.valueOf(noteTitles.get(position).getYear()));
|
||||
holder.compositionTextView.setText(noteTitles.get(position).getComposer());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,11 +58,14 @@ public class NoteSongAdapter extends RecyclerView.Adapter<NoteSongAdapter.NoteVi
|
||||
|
||||
public class NoteViewHolder extends RecyclerView.ViewHolder{
|
||||
TextView titleTextView;
|
||||
TextView yearTextView;
|
||||
TextView compositionTextView;
|
||||
|
||||
NoteViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
titleTextView = itemView.findViewById(R.id.note_title);
|
||||
|
||||
titleTextView = itemView.findViewById(R.id.text_title);
|
||||
yearTextView = itemView.findViewById(R.id.text_year);
|
||||
compositionTextView = itemView.findViewById(R.id.text_composition);
|
||||
titleTextView.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if(position != RecyclerView.NO_POSITION) {
|
||||
|
@ -1,13 +1,77 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="horizontal"
|
||||
android:padding="8dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/note_title"
|
||||
android:layout_width="match_parent"
|
||||
<!-- Text Section -->
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp" />
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- First Row: Year and Composition -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_year"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Year"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@android:color/darker_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_composition"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Composition"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textColor="@android:color/darker_gray" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Second Row: Title -->
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Title"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@android:color/black"
|
||||
android:paddingTop="4dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Rechte Seite mit den Buttons -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/edit_concert_button"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/edit_24dp_e8eaed_fill0_wght400_grad0_opsz24"
|
||||
app:tint="@color/teal_700"
|
||||
android:contentDescription="Edit Concert"
|
||||
android:background="?android:selectableItemBackgroundBorderless" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/delete_concert_button"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/delete"
|
||||
app:tint="@color/red"
|
||||
android:contentDescription="Delete Concert"
|
||||
android:background="?android:selectableItemBackgroundBorderless" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user