<?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="historyBean"
            type="com.atmob.voiceai.data.api.bean.UserVoiceBean" />

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

        <import type="com.atmob.voiceai.utils.DateUtil" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp">


        <View
            android:id="@+id/bg_item_history"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
            android:background="@drawable/bg_history_item"
            android:onClick="@{itemClick}"
            app:layout_constraintDimensionRatio="336:84"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/iv_item_history_voice_avatar"
            imageUrl="@{historyBean.voiceAvatar}"
            radius="@{8}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            app:layout_constraintBottom_toBottomOf="@+id/bg_item_history"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="@+id/bg_item_history"
            app:layout_constraintTop_toTopOf="@+id/bg_item_history"
            app:layout_constraintWidth_percent="0.1666666666666667"
            tools:src="@drawable/icon_setting_logo" />

        <TextView
            android:id="@+id/tv_item_history_voice_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:text="@{historyBean.voiceName}"
            android:textColor="@color/white"
            android:textSize="17sp"
            android:textStyle="bold"
            app:layout_constraintStart_toEndOf="@+id/iv_item_history_voice_avatar"
            app:layout_constraintTop_toTopOf="@+id/iv_item_history_voice_avatar"
            tools:text="Taylor Swift" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="2dp"
            android:layout_marginEnd="18dp"
            android:singleLine="true"
            android:text="@{historyBean.content}"
            android:textColor="@color/white80"
            android:textSize="14sp"
            app:layout_constraintEnd_toEndOf="@+id/bg_item_history"
            app:layout_constraintStart_toStartOf="@+id/tv_item_history_voice_name"
            app:layout_constraintTop_toBottomOf="@+id/tv_item_history_voice_name"
            tools:text="Record or upload an audio file to creasdasdadasd" />

        <ImageView
            android:id="@+id/icon_create_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/icon_history_create_time"
            app:layout_constraintBottom_toBottomOf="@+id/tv_time"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toEndOf="@+id/iv_item_history_voice_avatar"
            app:layout_constraintStart_toStartOf="@+id/tv_item_history_voice_name"
            app:layout_constraintTop_toTopOf="@+id/tv_time" />

        <TextView
            android:id="@+id/tv_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="3dp"
            android:text="@{DateUtil.getUSTime(historyBean.createTime)}"
            android:textColor="@color/white50"
            android:textSize="12sp"
            app:layout_constraintBottom_toBottomOf="@+id/iv_item_history_voice_avatar"
            app:layout_constraintStart_toEndOf="@+id/icon_create_time"
            tools:text="Apr 12,2024 10:10 AM" />

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