<?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="fileRecoverViewModel"
            type="com.datarecovery.master.module.filerecover.FileRecoverViewModel" />
    </data>

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

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/tool_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toTopOf="parent"
            app:navigationIcon="@drawable/icon_back">

            <TextView
                style="@style/Tool_Bar_Title_Txt"
                android:text="@string/file_recover_title" />


            <ImageView
                imageDraw="@{fileRecoverViewModel.getCheckAll(fileRecoverViewModel.checkPosition) ? @drawable/icon_image_recover_checked : @drawable/icon_image_recover_uncheck}"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
                android:background="?android:attr/selectableItemBackgroundBorderless"
                android:onClick="@{()->fileRecoverViewModel.onCheckAllClick(!fileRecoverViewModel.getCheckAll(fileRecoverViewModel.checkPosition))}"
                tools:src="@drawable/icon_image_recover_uncheck" />
        </androidx.appcompat.widget.Toolbar>


        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:40"
            app:layout_constraintTop_toBottomOf="@+id/tool_bar"
            app:tabIndicator="@null"
            app:tabIndicatorHeight="0dp"
            app:tabRippleColor="@color/transparent" />

        <include
            android:id="@+id/layout_trial"
            layout="@layout/layout_trial"
            progress="@{10}"
            recoverClick="@{()->fileRecoverViewModel.onViewTrialRecoverClick()}"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toBottomOf="@id/tab_layout" />

        <androidx.viewpager2.widget.ViewPager2
            android:id="@+id/file_view_pager"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="#F8F8F8"
            app:layout_constraintBottom_toTopOf="@+id/v_bottom"
            app:layout_constraintTop_toBottomOf="@+id/layout_trial"
            tools:itemCount="6"
            tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
            tools:listitem="@layout/item_data_file"
            tools:spanCount="3" />

        <View
            android:id="@+id/v_go_recover"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:layout_marginBottom="12dp"
            android:background="@drawable/bg_go_recover_card"
            android:onClick="@{()->fileRecoverViewModel.onViewTrialRecoverClick()}"
            app:layout_constraintBottom_toTopOf="@+id/v_bottom"
            app:layout_constraintDimensionRatio="255:36"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintWidth_percent="0.7083333333333333" />

        <ImageView
            android:id="@+id/iv_go_recover"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="5dp"
            android:src="@drawable/icon_go_recover"
            app:layout_constraintBottom_toBottomOf="@+id/v_go_recover"
            app:layout_constraintDimensionRatio="58:26"
            app:layout_constraintLeft_toLeftOf="@+id/v_go_recover"
            app:layout_constraintTop_toTopOf="@+id/v_go_recover"
            app:layout_constraintWidth_percent="0.1611111111111111" />

        <TextView
            android:id="@+id/tv_go_recover"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="5dp"
            android:text="@string/trial_go_recover_txt"
            android:textColor="#333333"
            android:textSize="12dp"
            app:layout_constraintBottom_toBottomOf="@id/v_go_recover"
            app:layout_constraintStart_toEndOf="@+id/iv_go_recover"
            app:layout_constraintTop_toTopOf="@+id/v_go_recover" />

        <ImageView
            android:id="@+id/iv_go_recover_right"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginEnd="9dp"
            android:src="@drawable/icon_recover_right"
            app:layout_constraintBottom_toBottomOf="@+id/v_go_recover"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintEnd_toEndOf="@+id/v_go_recover"
            app:layout_constraintTop_toTopOf="@+id/v_go_recover"
            app:layout_constraintWidth_percent="0.05" />


        <View
            android:id="@+id/v_bottom"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="@color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="360:72" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@{fileRecoverViewModel.selectedList.size() > 0 ? @drawable/bg_common_btn : @drawable/bg_common_disable_btn}"
            android:gravity="center"
            android:onClick="@{()->fileRecoverViewModel.onExportClick()}"
            android:text="@{fileRecoverViewModel.selectedCountTxt}"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@id/v_bottom"
            app:layout_constraintDimensionRatio="328:44"
            app:layout_constraintEnd_toEndOf="@+id/v_bottom"
            app:layout_constraintStart_toStartOf="@id/v_bottom"
            app:layout_constraintTop_toTopOf="@id/v_bottom"
            app:layout_constraintWidth_percent="0.9111111111111111"
            tools:background="@drawable/bg_common_btn"
            tools:text="立即导出" />

        <androidx.constraintlayout.widget.Group
            isGone="@{!fileRecoverViewModel.showTrialView}"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:constraint_referenced_ids="layout_trial,v_go_recover,iv_go_recover,tv_go_recover,iv_go_recover_right" />


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