<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="paymentWayName"
            type="String" />

        <variable
            name="paymentWayIcon"
            type="android.graphics.drawable.Drawable" />

        <variable
            name="position"
            type="Integer" />

        <variable
            name="selectedPosition"
            type="androidx.lifecycle.LiveData&lt;Integer>" />

    </data>


    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bg_ripple_common_mask">

        <Space
            android:id="@+id/space1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:10"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/item_payment_icon"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:src="@{paymentWayIcon}"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/space1"
            app:layout_constraintWidth_percent="0.0666666666666667"
            tools:src="@drawable/icon_wechat_payment" />

        <Space
            android:id="@+id/space2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:10"
            app:layout_constraintTop_toBottomOf="@+id/item_payment_icon" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:text="@{paymentWayName}"
            android:textColor="#202020"
            android:textSize="14sp"
            app:layout_constraintBottom_toBottomOf="@id/item_payment_icon"
            app:layout_constraintLeft_toRightOf="@id/item_payment_icon"
            app:layout_constraintTop_toTopOf="@id/item_payment_icon"
            tools:text="微信支付" />

        <ImageView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginEnd="20dp"
            android:src="@{position == selectedPosition ? @drawable/icon_login_check_box_checked : @drawable/icon_login_check_box_unchecked}"
            app:layout_constraintBottom_toBottomOf="@+id/item_payment_icon"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="@+id/item_payment_icon"
            app:layout_constraintWidth_percent="0.0555555555555556"
            tools:src="@drawable/icon_login_check_box_checked" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>