refactor(server_item): remove databinding
This commit is contained in:
parent
012a597157
commit
6ffc761972
2 changed files with 42 additions and 54 deletions
|
@ -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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,48 @@
|
||||||
<?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"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:foreground="@drawable/ripple_background"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingStart="12dp"
|
||||||
|
android:paddingEnd="12dp"
|
||||||
|
android:paddingBottom="24dp">
|
||||||
|
|
||||||
<data>
|
<FrameLayout
|
||||||
|
android:id="@+id/server_icon"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:background="@drawable/button_setup_background"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/server_name"
|
||||||
|
app:layout_constraintDimensionRatio="w,1:1"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<variable
|
<ImageView
|
||||||
name="server"
|
android:layout_width="wrap_content"
|
||||||
type="dev.jdtech.jellyfin.models.Server" />
|
android:layout_height="wrap_content"
|
||||||
</data>
|
android:layout_gravity="center"
|
||||||
|
android:importantForAccessibility="no"
|
||||||
|
app:srcCompat="@drawable/ic_server"
|
||||||
|
app:tint="?attr/colorOnPrimary" />
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
</FrameLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
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:clickable="true"
|
android:textAlignment="center"
|
||||||
android:focusable="true"
|
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
|
||||||
android:foreground="@drawable/ripple_background"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:orientation="vertical"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:paddingStart="12dp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:paddingEnd="12dp"
|
app:layout_constraintTop_toBottomOf="@id/server_icon"
|
||||||
android:paddingBottom="24dp">
|
tools:text="JDTech" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/server_icon"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:background="@drawable/button_setup_background"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/server_name"
|
|
||||||
app:layout_constraintDimensionRatio="w,1:1"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
app:srcCompat="@drawable/ic_server"
|
|
||||||
app:tint="?attr/colorOnPrimary" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/server_name"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@{server.name}"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/server_icon"
|
|
||||||
tools:text="JDTech" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</layout>
|
|
Loading…
Reference in a new issue