<?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="vm"
            type="com.rdiot.yx485.ui.login.model.LoginViewModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/main_bg_color"
        android:orientation="vertical"
        tools:context=".ui.login.LoginSmsFragment">

        <com.rdiot.yx485.view.ZNavbar
            android:id="@+id/nb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:zRightText="@string/password_login" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="30dp"
                android:layout_marginTop="60dp"
                android:text="@string/mobile_number_quick_login"
                android:textColor="@color/main_text_color"
                android:textSize="30sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="30dp"
                android:text="@string/auto_register"
                android:textColor="@color/main_sub_text_color"
                android:textSize="13sp" />

            <!--输入框-->
            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="30dp"
                android:layout_marginTop="55dp"
                android:layout_marginEnd="30dp">

                <androidx.appcompat.widget.AppCompatEditText
                    android:id="@+id/et_phone"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@null"
                    android:hint="@string/enter_phone"
                    android:inputType="number"
                    android:maxLength="11"
                    android:text="@={vm.phone}"
                    android:textColor="@color/main_text_color"
                    android:textColorHint="@color/main_sub_text_color"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    app:layout_constraintTop_toTopOf="parent" />

                <View
                    android:id="@+id/line_1"
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginTop="8dp"
                    android:background="@color/dividing_line_color"
                    app:layout_constraintTop_toBottomOf="@id/et_phone" />

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/et_code"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="40dp"
                    android:background="@null"
                    android:hint="@string/enter_code"
                    android:inputType="number"
                    android:maxLength="6"
                    android:text="@={vm.smsCode}"
                    android:textColor="@color/main_text_color"
                    android:textColorHint="@color/main_sub_text_color"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    app:layout_constraintTop_toBottomOf="@id/line_1" />

                <View
                    android:id="@+id/line_2"
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_marginTop="8dp"
                    android:background="@color/dividing_line_color"
                    app:layout_constraintTop_toBottomOf="@id/et_code" />


                <Button
                    android:id="@+id/btn_get_sms"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:background="@drawable/sel_login_get_sms_btn"
                    android:enabled="@{(vm.phone.length() == 11 &amp;&amp; vm.lessTimeSecond == 0)}"
                    android:minWidth="0dp"
                    android:minHeight="0dp"
                    android:paddingStart="15dp"
                    android:paddingTop="5dp"
                    android:paddingEnd="15dp"
                    android:paddingBottom="5dp"
                    android:text="@{vm.lessTimeSecond!=0? String.format(`%d`,vm.lessTimeSecond):@string/get_sms_code}"
                    android:textColor="@drawable/sel_login_get_sms_btn_text"
                    android:textSize="12sp"
                    app:layout_constraintBottom_toBottomOf="@id/et_code"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="@id/et_code"
                    app:layout_constraintWidth_percent="0.32"
                    tools:text="@string/get_sms_code" />

            </androidx.constraintlayout.widget.ConstraintLayout>
            <!--登录按钮-->
            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/btn_login"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="30dp"
                android:layout_marginTop="55dp"
                android:layout_marginEnd="30dp"
                android:background="@drawable/bg_login_btn"
                android:outlineProvider="none"
                android:text="@string/logIn"
                android:textColor="@color/white"
                android:textSize="16sp"
                android:textStyle="bold" />
        </LinearLayout>


        <LinearLayout
            android:id="@+id/ll_read_policy"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="36dp"
            android:padding="8dp"
            android:orientation="horizontal">

            <androidx.appcompat.widget.AppCompatImageView
                srcString="@{vm.isRead().booleanValue() ? `@mipmap/icon_check_sel`:`@mipmap/icon_check`}"
                android:layout_width="16dp"
                android:layout_height="16dp"
                tools:srcCompat="@mipmap/icon_check" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="6dp"
                android:text="@string/i_agree"
                android:textColor="@color/main_text_color"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_sa"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/user_services_agreement"
                android:textColor="@color/login_btn_color"
                android:textSize="12sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/and"
                android:textColor="@color/main_text_color"
                android:textSize="12sp" />

            <TextView
                android:id="@+id/tv_pp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/privacy_policy"
                android:textColor="@color/login_btn_color"
                android:textSize="12sp" />

        </LinearLayout>

    </LinearLayout>
</layout>