<?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="historyViewModel"
            type="com.atmob.voiceai.module.history.HistoryViewModel" />

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

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorPrimary">

        <ImageView
            android:id="@+id/iv_header_bg"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:src="@drawable/bg_voice_ai_header_top_bg"
            app:layout_constraintDimensionRatio="836:556"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintWidth_percent="0.5083333333333333" />

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

        <View
            android:id="@+id/v_tool_bar"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintDimensionRatio="360:44"
            app:layout_constraintTop_toBottomOf="@+id/v_status_bar" />

        <View
            android:id="@+id/v_vip_bg"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
            android:background="@drawable/bg_voice_ai_vip"
            android:onClick="@{()-> historyViewModel.onGoSubscriptionClick()}"
            app:layout_constraintBottom_toBottomOf="@+id/v_tool_bar"
            app:layout_constraintDimensionRatio="58:28"
            app:layout_constraintStart_toStartOf="@+id/v_tool_bar"
            app:layout_constraintTop_toTopOf="@+id/v_tool_bar"
            app:layout_constraintWidth_percent="0.1611111111111111" />

        <ImageView
            android:id="@+id/iv_vip"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:src="@drawable/icon_vip"
            app:layout_constraintBottom_toBottomOf="@+id/v_vip_bg"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintHorizontal_chainStyle="packed"
            app:layout_constraintLeft_toLeftOf="@+id/v_vip_bg"
            app:layout_constraintRight_toLeftOf="@+id/tv_vip_title"
            app:layout_constraintTop_toTopOf="@+id/v_vip_bg"
            app:layout_constraintWidth_percent="0.0444444444444444" />

        <TextView
            android:id="@+id/tv_vip_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:text="@string/voice_pro"
            android:textColor="@color/colorPrimaryVariant"
            android:textSize="14dp"
            app:layout_constraintBottom_toBottomOf="@+id/v_vip_bg"
            app:layout_constraintLeft_toRightOf="@+id/iv_vip"
            app:layout_constraintRight_toRightOf="@+id/v_vip_bg"
            app:layout_constraintTop_toTopOf="@+id/v_vip_bg" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/voice_ai"
            android:textColor="@color/white"
            android:textSize="18sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@+id/v_tool_bar"
            app:layout_constraintEnd_toEndOf="@+id/v_tool_bar"
            app:layout_constraintStart_toStartOf="@+id/v_tool_bar"
            app:layout_constraintTop_toTopOf="@+id/v_tool_bar" />

        <ImageView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
            android:onClick="@{()-> historyViewModel.onSettingClick()}"
            android:src="@drawable/icon_voice_ai_menu"
            app:layout_constraintBottom_toBottomOf="@+id/v_tool_bar"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintEnd_toEndOf="@+id/v_tool_bar"
            app:layout_constraintTop_toTopOf="@+id/v_tool_bar"
            app:layout_constraintWidth_percent="0.0666666666666667" />

        <androidx.constraintlayout.widget.Group
            isGone="@{historyViewModel.isMember}"
            app:constraint_referenced_ids="v_vip_bg,iv_vip,tv_vip_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />


        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipe_history_layout"
            android:paddingTop="10dp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constrainedHeight="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/v_tool_bar">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rv_history"
                isGone="@{historyViewModel.voiceHistoryList.size() == 0}"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        <ImageView
            android:id="@+id/iv_no_data"
            isGone="@{historyViewModel.voiceHistoryList.size() > 0}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:src="@drawable/icon_history_no_data"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="504:301"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/v_tool_bar"
            app:layout_constraintVertical_bias="0.3197115384615385"
            app:layout_constraintWidth_percent="0.4666666666666667" />

        <TextView
            isGone="@{historyViewModel.voiceHistoryList.size() > 0}"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/history_no_data"
            android:textColor="@color/white80"
            android:textSize="14sp"
            app:layout_constraintEnd_toEndOf="@+id/iv_no_data"
            app:layout_constraintStart_toStartOf="@+id/iv_no_data"
            app:layout_constraintTop_toBottomOf="@+id/iv_no_data" />


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