refactor(server_item): remove databinding

This commit is contained in:
Jarne Demeulemeester 2023-07-31 23:46:44 +02:00
parent 012a597157
commit 6ffc761972
No known key found for this signature in database
GPG key ID: 1E5C6AFBD622E9F5
2 changed files with 42 additions and 54 deletions

View file

@ -15,8 +15,7 @@ class ServerGridAdapter(
class ServerViewHolder(private var binding: ServerItemBinding) : class ServerViewHolder(private var binding: ServerItemBinding) :
RecyclerView.ViewHolder(binding.root) { RecyclerView.ViewHolder(binding.root) {
fun bind(server: Server) { fun bind(server: Server) {
binding.server = server binding.serverName.text = server.name
binding.executePendingBindings()
} }
} }

View file

@ -1,16 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools"
<data>
<variable
name="server"
type="dev.jdtech.jellyfin.models.Server" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clickable="true" android:clickable="true"
@ -47,7 +38,6 @@
android:id="@+id/server_name" android:id="@+id/server_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@{server.name}"
android:textAlignment="center" android:textAlignment="center"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium" android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
@ -56,4 +46,3 @@
app:layout_constraintTop_toBottomOf="@id/server_icon" app:layout_constraintTop_toBottomOf="@id/server_icon"
tools:text="JDTech" /> tools:text="JDTech" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout>