<?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="file"
            type="com.datarecovery.master.utils.FilesSearch.DocumentFile" />

        <variable
            name="onDetailClick"
            type="android.view.View.OnClickListener" />

        <variable
            name="onCheckClick"
            type="android.view.View.OnClickListener" />

        <import type="com.datarecovery.master.utils.DateUtil" />

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@{file.check ? @color/item_data_checked_color : @color/transparent}"
        android:paddingVertical="8dp">

        <ImageView
            android:id="@+id/iv_check"
            expandTouchSize="@{6}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:onClick="@{onCheckClick}"
            android:src="@{file.check ? @drawable/icon_recover_checked : @drawable/icon_recover_un_check_gray}"
            app:layout_constraintBottom_toBottomOf="@+id/iv_file_type"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/iv_file_type"
            app:layout_constraintWidth_percent="0.0666666666666667"
            tools:src="@drawable/icon_recover_un_check_gray" />

        <ImageView
            android:id="@+id/iv_file_type"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="12dp"
            android:src="@drawable/icon_file_audio"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toEndOf="@+id/iv_check"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintWidth_percent="0.1333333333333333" />

        <View
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:onClick="@{onDetailClick}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="@+id/iv_file_type"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tv_free_label"
            isGone="@{!file.isTrial}"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_free_label"
            android:paddingHorizontal="8dp"
            android:paddingVertical="1dp"
            android:text="@string/free"
            android:textColor="@color/white"
            android:textSize="12dp"
            app:layout_constraintBaseline_toBaselineOf="@+id/tv_file_date"
            app:layout_constraintLeft_toLeftOf="@+id/tv_file_name" />

        <Space
            isGone="@{!file.isTrial}"
            android:id="@+id/space"
            android:layout_width="4dp"
            android:layout_height="wrap_content"
            app:layout_constraintStart_toEndOf="@+id/tv_free_label"
            app:layout_constraintTop_toTopOf="@+id/tv_free_label" />

        <TextView
            android:id="@+id/tv_file_name"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="12dp"
            android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
            android:text="@{file.name}"
            android:textColor="#202020"
            android:textSize="14sp"
            app:layout_constraintBottom_toTopOf="@+id/tv_file_date"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@+id/iv_file_type"
            app:layout_constraintTop_toTopOf="@+id/iv_file_type"
            app:layout_constraintVertical_chainStyle="packed"
            tools:text="记科技以大额外的们.doc" />

        <TextView
            android:layout_marginTop="4dp"
            android:id="@+id/tv_file_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{DateUtil.formatNormalDate(DateUtil.YYYY_MM_DD_HH_MM_SS,file.lastModified)}"
            android:textColor="#A7A7A7"
            android:textSize="12sp"
            app:layout_constraintBottom_toBottomOf="@id/iv_file_type"
            app:layout_constraintStart_toEndOf="@+id/space"
            app:layout_constraintTop_toBottomOf="@+id/tv_file_name"
            tools:text="2023-12-20 14:12:55" />

        <TextView
            android:id="@+id/tv_file_size"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:text="@{file.sizeDescribe}"
            android:textColor="#A7A7A7"
            android:textSize="12sp"
            app:layout_constraintBaseline_toBaselineOf="@+id/tv_file_date"
            app:layout_constraintStart_toEndOf="@+id/tv_file_date"
            tools:text="265.37KB" />


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