<?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="model"
            type="com.lukouguoji.module_base.model.BluetoothDialogModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/backgroud_gray"
        android:orientation="vertical">

        <com.lukouguoji.module_base.ui.weight.StatusView
            android:layout_width="match_parent"
            android:background="@color/black"
            android:layout_height="40dp"/>

        <include
            layout="@layout/title_tool_bar" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="15dp"
            android:text="已配对设备"
            android:textColor="@color/text_normal"
            android:textSize="16sp"
            android:textStyle="bold" />

        <LinearLayout
            visible="@{model.currentBluetooth}"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginTop="1dp"
            android:background="@color/white"
            android:gravity="center_vertical"
            android:paddingHorizontal="15dp">

            <TextView
                android:id="@+id/tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{model.currentBluetooth.blueName}"
                tools:text="打印机信息" />

            <View
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()-> model.disconnect()}"
                android:text="取消配对" />

        </LinearLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="15dp"
            android:text="可用设备"
            android:textColor="@color/text_normal"
            android:textSize="16sp"
            android:textStyle="bold" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
            tools:listitem="@layout/item_bluetooth" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/color_bottom_layout"
            android:gravity="end">

            <TextView
                android:layout_width="120dp"
                android:layout_height="match_parent"
                android:background="@color/colorPrimary"
                android:gravity="center"
                android:onClick="@{()->model.printClick()}"
                android:text="打印"
                android:textColor="@color/white"
                android:textSize="16sp"
                android:textStyle="bold" />

        </LinearLayout>

    </LinearLayout>
</layout>