<?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="loginViewModel"
            type="com.datarecovery.master.module.login.LoginViewModel" />

        <import type="com.atmob.common.ui.SizeUtil" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:src="@drawable/bg_mine_background"
            app:layout_constraintDimensionRatio="1080:648"
            app:layout_constraintTop_toTopOf="parent" />

        <Space
            android:id="@+id/space_status_bar"
            android:layout_width="match_parent"
            android:layout_height="@{SizeUtil.getStatusBarHeight(), default=@dimen/app_status_bar_height}"
            app:layout_constraintTop_toTopOf="parent" />

        <Space
            android:id="@+id/space1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:22"
            app:layout_constraintTop_toBottomOf="@+id/space_status_bar" />

        <ImageView
            android:id="@+id/iv_back"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:background="?android:attr/selectableItemBackgroundBorderless"
            android:onClick="@{()->loginViewModel.onBackClick()}"
            android:src="@drawable/icon_back"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/space1"
            app:layout_constraintWidth_percent="0.0666666666666667" />

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

        <TextView
            android:id="@+id/tv_pleasure"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="26dp"
            android:text="@string/login_pleasure"
            android:textColor="#202020"
            android:textSize="30sp"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/space2" />

        <Space
            android:id="@+id/space3"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:8.75"
            app:layout_constraintTop_toBottomOf="@+id/tv_pleasure" />

        <TextView
            android:id="@+id/tv_desc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="26dp"
            android:text="@string/login_pleasure_desc"
            android:textColor="#404040"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/space3" />

        <Space
            android:id="@+id/space4"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:36.5"
            app:layout_constraintTop_toBottomOf="@+id/tv_desc" />

        <View
            android:id="@+id/v_phone"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginHorizontal="24dp"
            android:background="@drawable/bg_login_print"
            app:layout_constraintDimensionRatio="312:48"
            app:layout_constraintTop_toBottomOf="@+id/space4" />

        <TextView
            android:id="@+id/tv_nation"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:text="@string/login_nation"
            android:textColor="#404040"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@+id/v_phone"
            app:layout_constraintStart_toStartOf="@+id/v_phone"
            app:layout_constraintTop_toTopOf="@+id/v_phone" />

        <View
            android:id="@+id/v_line"
            android:layout_width="1dp"
            android:layout_height="20dp"
            android:layout_marginStart="9dp"
            android:background="#E2E2E2"
            app:layout_constraintBottom_toBottomOf="@+id/tv_nation"
            app:layout_constraintStart_toEndOf="@+id/tv_nation"
            app:layout_constraintTop_toTopOf="@+id/tv_nation" />

        <EditText
            android:id="@+id/et_phone"
            isBold="@{loginViewModel.phoneNum.length() > 0}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginHorizontal="25dp"
            android:background="@color/transparent"
            android:gravity="center_vertical"
            android:hint="@string/login_phone_hint"
            android:inputType="phone"
            android:lines="1"
            android:maxLength="11"
            android:text="@={loginViewModel.phoneNum}"
            android:textColor="@color/common_txt_color"
            android:textColorHint="#A7A7A7"
            android:textSize="16sp"
            app:layout_constraintBottom_toBottomOf="@+id/v_phone"
            app:layout_constraintEnd_toEndOf="@id/v_phone"
            app:layout_constraintStart_toEndOf="@+id/v_line"
            app:layout_constraintTop_toTopOf="@+id/v_phone" />

        <Space
            android:id="@+id/space5"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:11"
            app:layout_constraintTop_toBottomOf="@+id/v_phone" />

        <View
            android:id="@+id/v_code"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginHorizontal="24dp"
            android:background="@drawable/bg_login_print"
            app:layout_constraintDimensionRatio="312:48"
            app:layout_constraintTop_toBottomOf="@+id/space5" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_common_btn"
            android:gravity="center"
            android:onClick="@{()-> loginViewModel.onGetCodeClick()}"
            android:text="@string/login_send_code"
            android:textColor="@color/white"
            android:textSize="14sp"
            app:isGone="@{loginViewModel.isRequestCodeCountdown}"
            app:layout_constraintBottom_toBottomOf="@+id/v_code"
            app:layout_constraintDimensionRatio="90:32"
            app:layout_constraintEnd_toEndOf="@+id/v_code"
            app:layout_constraintHorizontal_bias="0.9459459459459459"
            app:layout_constraintStart_toStartOf="@+id/v_code"
            app:layout_constraintTop_toTopOf="@+id/v_code"
            app:layout_constraintWidth_percent="0.25" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_login_send_code"
            android:gravity="center"
            android:text="@{@string/login_request_code_countdown_format(loginViewModel.requestCodeCountdown)}"
            android:textColor="@color/white"
            android:textSize="14sp"
            app:isGone="@{!loginViewModel.isRequestCodeCountdown}"
            app:layout_constraintBottom_toBottomOf="@+id/v_code"
            app:layout_constraintDimensionRatio="90:32"
            app:layout_constraintEnd_toEndOf="@+id/v_code"
            app:layout_constraintHorizontal_bias="0.9459459459459459"
            app:layout_constraintStart_toStartOf="@+id/v_code"
            app:layout_constraintTop_toTopOf="@+id/v_code"
            app:layout_constraintWidth_percent="0.25"
            tools:visibility="gone" />

        <EditText
            android:id="@+id/et_code"
            isBold="@{loginViewModel.verificationCode.length() > 0}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:maxLength="6"
            android:layout_marginHorizontal="12dp"
            android:background="@color/transparent"
            android:gravity="center_vertical"
            android:hint="@string/login_code_hint"
            android:inputType="number"
            android:text="@={loginViewModel.verificationCode}"
            android:textColor="@color/common_txt_color"
            android:textColorHint="#A7A7A7"
            android:textSize="16sp"
            app:layout_constraintBottom_toBottomOf="@+id/v_code"
            app:layout_constraintStart_toStartOf="@+id/v_code"
            app:layout_constraintTop_toTopOf="@+id/v_code"
            app:layout_constraintWidth_percent="0.4166666666666667" />

        <Space
            android:id="@+id/space6"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:12"
            app:layout_constraintTop_toBottomOf="@+id/et_code" />

        <CheckBox
            android:id="@+id/login_agree_check_box"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_login_agree_check_box"
            android:button="@null"
            android:checked="@={loginViewModel.isCheckedAgreement}"
            app:expandTouchSize="@{10}"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="@+id/et_code"
            app:layout_constraintTop_toBottomOf="@+id/space6"
            app:layout_constraintWidth_percent="0.0555555555555556"
            tools:checked="true" />

        <TextView
            android:id="@+id/login_agree_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:textColor="#A7A7A7"
            android:textSize="12sp"
            app:layout_constraintBottom_toBottomOf="@+id/login_agree_check_box"
            app:layout_constraintStart_toEndOf="@+id/login_agree_check_box"
            app:layout_constraintTop_toTopOf="@+id/login_agree_check_box"
            tools:text="@string/login_agree_text" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@{loginViewModel.isCanLogin(loginViewModel.phoneNum,loginViewModel.verificationCode) ? @drawable/bg_common_btn : @drawable/bg_common_disable_btn}"
            android:gravity="center"
            android:onClick="@{()-> loginViewModel.onLoginClick()}"
            android:text="@string/login_go"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="280:44"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/space_status_bar"
            app:layout_constraintVertical_bias="0.8947368421052632"
            app:layout_constraintWidth_percent="0.7777777777777778"
            tools:background="@drawable/bg_common_btn" />


    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>