<?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="roomData"
            type="com.rdiot.yx485.bean.RoomData" />

        <import type="android.view.View" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <View
            android:id="@+id/v"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintTop_toTopOf="parent" />

        <com.rdiot.yx485.view.ZNavbar
            android:id="@+id/nb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:zRightIcon="@mipmap/icon_edit"
            app:zTitle="@string/room" />


        <!--模式按钮-->


        <HorizontalScrollView
            android:id="@+id/hsv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:scrollbars="none">

            <!--<androidx.constraintlayout.widget.ConstraintLayout-->
            <!--    android:layout_width="match_parent"-->
            <!--    android:layout_height="wrap_content"-->
            <!--    android:layout_marginStart="25dp"-->
            <!--    android:layout_marginEnd="25dp"-->
            <!--    tools:context="ui.ctrl.RoomCtrlFragment">-->
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">


                <LinearLayout
                    android:id="@+id/ll_zhi_leng"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 1? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toStartOf="@id/ll_zhi_re"
                    app:layout_constraintHorizontal_chainStyle="spread_inside"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 1? `icon_refrigeration_sel` :`icon_refrigeration`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_refrigeration" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_zhi_re"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 2? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toStartOf="@id/ll_chu_shi"
                    app:layout_constraintStart_toEndOf="@id/ll_zhi_leng"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18"
                    tools:background="@drawable/bg_device_ctrl_btn_sel">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 2? `icon_heating_sel` :`icon_heating`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_heating_sel" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_chu_shi"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 3? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toStartOf="@id/ll_song_feng"
                    app:layout_constraintStart_toEndOf="@id/ll_zhi_re"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 3? `icon_dehumidification_sel` :`icon_dehumidification`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_dehumidification" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_song_feng"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 4? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/ll_chu_shi"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 4? `icon_wind_sel` :`icon_wind`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_wind" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_xin_feng"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 5? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/ll_chu_shi"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 5? `icon_fresh_air_sel` :`icon_fresh_air`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_fresh_air" />

                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_jia_shi"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginStart="20dp"
                    android:layout_marginEnd="20dp"
                    android:background="@{roomData.power &amp;&amp; roomData.mode == 6? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                    android:gravity="center"
                    app:layout_constraintDimensionRatio="h,1:1"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/ll_chu_shi"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintWidth_percent="0.18">

                    <androidx.appcompat.widget.AppCompatImageView
                        srcString="@{roomData.power &amp;&amp; roomData.mode == 6? `icon_humidify_sel` :`icon_humidify`}"
                        android:layout_width="70dp"
                        android:layout_height="70dp"
                        tools:srcCompat="@mipmap/icon_humidify" />

                </LinearLayout>


            </LinearLayout>


        </HorizontalScrollView>


        <!--控制-->
        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <com.king.view.arcseekbar.ArcSeekBar
                android:id="@+id/arc_seek_bar"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginTop="40dp"
                android:padding="10dp"
                app:arcMax="14"
                app:arcNormalColor="@color/device_ctrl_panel_bg_color"
                app:arcProgressColor="@color/device_ctrl_panel_progress_color"
                app:arcShowLabel="false"
                app:arcStartAngle="140"
                app:arcStrokeWidth="20dp"
                app:arcSweepAngle="260"
                app:arcThumbColor="@color/white"
                app:arcThumbInnerDotWidth="10dp"
                app:arcThumbShadowColor="#20000000"
                app:arcThumbShadowRadius="5dp"
                app:arcThumbWidth="18dp"
                app:layout_constraintDimensionRatio="h,1:1"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintWidth_percent="0.7" />

            <TextView
                android:id="@+id/tv_temp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="30dp"
                android:includeFontPadding="false"
                android:text="@{String.format(`%d`,roomData.setTemp)}"
                android:textColor="@color/main_text_color"
                android:textSize="72sp"
                android:textStyle="bold"
                app:layout_constraintBottom_toBottomOf="@id/arc_seek_bar"
                app:layout_constraintEnd_toEndOf="@id/arc_seek_bar"
                app:layout_constraintStart_toStartOf="@id/arc_seek_bar"
                app:layout_constraintTop_toTopOf="@id/arc_seek_bar"
                tools:text="28" />

            <TextView
                android:id="@+id/tv_mark"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="12sp"
                android:includeFontPadding="false"
                android:text="℃"
                android:textColor="@color/main_text_color"
                android:textSize="25sp"
                android:textStyle="bold"
                app:layout_constraintStart_toEndOf="@id/tv_temp"
                app:layout_constraintTop_toTopOf="@id/tv_temp" />

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/iv_less"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:layout_constraintBottom_toBottomOf="@id/arc_seek_bar"
                app:layout_constraintDimensionRatio="h,1:1"
                app:layout_constraintStart_toStartOf="@id/arc_seek_bar"
                app:layout_constraintWidth_percent="0.1"
                app:srcCompat="@mipmap/icon_reduce" />


            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/iv_add"
                android:layout_width="0dp"
                android:layout_height="0dp"
                app:layout_constraintBottom_toBottomOf="@id/arc_seek_bar"
                app:layout_constraintDimensionRatio="h,1:1"
                app:layout_constraintEnd_toEndOf="@id/arc_seek_bar"
                app:layout_constraintWidth_percent="0.1"
                app:srcCompat="@mipmap/icon_add_1" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="风阀：开"
                android:textColor="@color/main_text_color"
                android:textSize="16sp"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="@id/tv_temp"
                app:layout_constraintStart_toStartOf="@id/tv_temp"
                app:layout_constraintTop_toBottomOf="@id/tv_temp" />


            <!--室内温度-->
            <TextView
                android:id="@+id/tv_home_temp_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="25dp"
                android:layout_marginEnd="35dp"
                android:text="@string/room_temperature"
                android:textColor="@color/main_text_color"
                android:textSize="12sp"
                app:layout_constraintEnd_toStartOf="@id/v_line"
                app:layout_constraintTop_toBottomOf="@id/arc_seek_bar" />

            <TextView
                android:id="@+id/tv_home_temp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                android:text="@{String.format(`%d℃`,roomData.temperature)}"
                android:textColor="@color/main_text_color"
                android:textSize="20sp"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="@id/tv_home_temp_title"
                app:layout_constraintStart_toStartOf="@id/tv_home_temp_title"
                app:layout_constraintTop_toBottomOf="@id/tv_home_temp_title"
                tools:text="13℃" />

            <View
                android:id="@+id/v_line"
                android:layout_width="1dp"
                android:layout_height="0dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                android:background="@color/dividing_line_color"
                app:layout_constraintBottom_toBottomOf="@id/tv_home_temp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="@id/tv_home_temp_title" />


            <!--室内温度-->
            <TextView
                android:id="@+id/tv_home_humidity_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="35dp"
                android:layout_marginTop="25dp"
                android:text="@string/current_humidity"
                android:textColor="@color/main_text_color"
                android:textSize="12sp"
                app:layout_constraintStart_toEndOf="@id/v_line"
                app:layout_constraintTop_toBottomOf="@id/arc_seek_bar" />

            <TextView
                android:id="@+id/tv_home_humidity"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                android:text="@{String.format(`%d%%`,roomData.humidity)}"
                android:textColor="@color/main_text_color"
                android:textSize="20sp"
                android:textStyle="bold"
                app:layout_constraintEnd_toEndOf="@id/tv_home_humidity_title"
                app:layout_constraintStart_toStartOf="@id/tv_home_humidity_title"
                app:layout_constraintTop_toBottomOf="@id/tv_home_humidity_title"
                tools:text="55%" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="25dp"
                android:layout_marginTop="20dp"
                android:layout_marginEnd="25dp"
                android:background="@drawable/bg_device_ctrl_btn"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintHorizontal_chainStyle="spread_inside"
                app:layout_constraintTop_toBottomOf="@id/tv_home_temp">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_marginStart="10dp"
                    android:layout_marginTop="25dp"
                    android:layout_marginBottom="25dp"
                    app:srcCompat="@mipmap/icon_fan" />

                <com.jaygoo.widget.RangeSeekBar
                    android:id="@+id/range_seek_bar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="3dp"
                    android:layout_marginEnd="6dp"
                    app:rsb_gravity="center"
                    app:rsb_max="5"
                    app:rsb_min="0"
                    app:rsb_mode="single"
                    app:rsb_progress_color="@color/device_ctrl_seek_bar_progress_color"
                    app:rsb_progress_default_color="@color/device_ctrl_seek_bar_progress_default_color"
                    app:rsb_progress_height="12dp"
                    app:rsb_progress_radius="10dp"
                    app:rsb_step_auto_bonding="true"
                    app:rsb_step_color="@color/white"
                    app:rsb_step_height="8dp"
                    app:rsb_step_radius="4dp"
                    app:rsb_step_width="1dp"
                    app:rsb_steps="5"
                    app:rsb_thumb_height="18dp"
                    app:rsb_thumb_scale_ratio="1.2"
                    app:rsb_thumb_width="18dp"
                    app:rsb_tick_mark_gravity="center"
                    app:rsb_tick_mark_mode="other"
                    app:rsb_tick_mark_number="6" />


            </LinearLayout>


        </androidx.constraintlayout.widget.ConstraintLayout>

        <!--开关、定时-->
        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="26dp"
            android:layout_marginEnd="26dp"
            android:layout_marginBottom="30dp">

            <LinearLayout
                android:id="@+id/ll_switch"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:background="@{roomData.power? @drawable/bg_device_ctrl_btn_sel :@drawable/bg_device_ctrl_btn}"
                android:gravity="center"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintWidth_percent="0.6"
                tools:background="@drawable/bg_device_ctrl_btn_sel">

                <androidx.appcompat.widget.AppCompatImageView
                    srcString="@{roomData.power ? `icon_on_sel` :`icon_on_sel_1`}"
                    android:layout_width="46dp"
                    android:layout_height="46dp"
                    android:layout_marginTop="22dp"
                    android:layout_marginBottom="22dp"
                    tools:srcCompat="@mipmap/icon_on_sel" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ll_timer"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginStart="17dp"
                android:background="@{roomData.timerStatus?@drawable/bg_device_ctrl_btn_sel:@drawable/bg_device_ctrl_btn}"
                android:gravity="center"
                app:layout_constraintBottom_toBottomOf="@id/ll_switch"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/ll_switch"
                app:layout_constraintTop_toTopOf="@id/ll_switch"
                tools:background="@drawable/bg_device_ctrl_btn_sel">

                <androidx.appcompat.widget.AppCompatImageView
                    android:layout_width="46dp"
                    android:layout_height="46dp"
                    android:visibility="@{roomData.timerStatus?View.GONE:View.VISIBLE}"
                    app:srcCompat="@mipmap/icon_time"
                    tools:visibility="gone" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:orientation="vertical"
                    android:visibility="@{roomData.timerStatus?View.VISIBLE:View.GONE}">

                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="40dp"
                        android:layout_height="40dp"
                        app:srcCompat="@mipmap/icon_time_sel" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{@string/timing_off(String.format(`%.1f`,roomData.duration).replace(`.0`,``))}"
                        android:textColor="@color/white"
                        android:textSize="14sp"
                        tools:text="OFF\u0020\u00201 h" />

                </LinearLayout>


            </LinearLayout>


        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>
</layout>