<?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="voiceAIViewModel"
            type="com.atmob.voiceai.module.voiceai.VoiceAIViewModel" />

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            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/space_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/space_status_bar" />

            <View
                android:onClick="@{()-> voiceAIViewModel.onGoSubscriptionClick()}"
                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"
                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:onClick="@{()-> voiceAIViewModel.onSettingClick()}"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
                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.ConstraintLayout
                android:id="@+id/container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_constraintTop_toBottomOf="@+id/v_tool_bar">

                <Space
                    android:id="@+id/space1"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:12"
                    app:layout_constraintTop_toTopOf="parent" />

                <View
                    android:onClick="@{()-> voiceAIViewModel.onGetMoreClick()}"
                    android:id="@+id/v_free_get_bg"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
                    android:alpha="0.1"
                    android:background="@drawable/bg_voice_ai_free"
                    app:layout_constraintDimensionRatio="336:36"
                    app:layout_constraintTop_toBottomOf="@+id/space1" />


                <TextView
                    android:id="@+id/tv_generate_free_desc"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="14dp"
                    android:text="@{voiceAIViewModel.voiceProbationTxt}"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/v_free_get_bg"
                    app:layout_constraintStart_toStartOf="@+id/v_free_get_bg"
                    app:layout_constraintTop_toTopOf="@+id/v_free_get_bg"
                    tools:text="You have 3 chances today." />

                <ImageView
                    android:id="@+id/iv_get_free_arrow"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_marginEnd="8dp"
                    android:src="@drawable/icon_voice_ai_free_arrow"
                    app:layout_constraintBottom_toBottomOf="@+id/v_free_get_bg"
                    app:layout_constraintDimensionRatio="61:60"
                    app:layout_constraintEnd_toEndOf="@+id/v_free_get_bg"
                    app:layout_constraintTop_toTopOf="@+id/v_free_get_bg"
                    app:layout_constraintWidth_percent="0.0555555555555556" />

                <TextView
                    android:id="@+id/tv_get_free_txt"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/voice_ai_get_free"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/iv_get_free_arrow"
                    app:layout_constraintEnd_toStartOf="@+id/iv_get_free_arrow"
                    app:layout_constraintTop_toTopOf="@+id/iv_get_free_arrow" />

                <Space
                    android:id="@+id/sapce2"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:8"
                    app:layout_constraintTop_toBottomOf="@+id/v_free_get_bg" />


                <TextView
                    android:id="@+id/tv_your_txt_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginTop="12dp"
                    android:text="@string/voice_your_text"
                    android:textColor="@color/white"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/sapce2" />


                <View
                    android:id="@+id/v_voice_print_bg"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginTop="12dp"
                    android:background="@drawable/bg_voice_ai"
                    app:layout_constraintDimensionRatio="336:148"
                    app:layout_constraintTop_toBottomOf="@+id/tv_your_txt_title" />

                <com.atmob.voiceai.widget.IgnoreNoEnterActionEditText
                    android:id="@+id/et_voice_print"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginTop="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginBottom="8dp"
                    android:background="@null"
                    android:gravity="start"
                    android:hint="@string/voice_ai_print_hint"
                    android:maxLength="200"
                    android:text="@={voiceAIViewModel.voicePrintTxt}"
                    android:textColor="@color/white"
                    android:textColorHint="@color/white50"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toTopOf="@+id/tv_print_clear"
                    app:layout_constraintEnd_toEndOf="@+id/v_voice_print_bg"
                    app:layout_constraintStart_toStartOf="@+id/v_voice_print_bg"
                    app:layout_constraintTop_toTopOf="@+id/v_voice_print_bg" />

                <TextView
                    android:id="@+id/tv_print_clear"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="9dp"
                    android:layout_marginBottom="@dimen/app_common_page_horizontal_padding"
                    android:onClick="@{()-> voiceAIViewModel.clearPrintTxt()}"
                    android:text="@string/voice_ai_clear_txt"
                    android:textColor="@color/colorPrimaryVariant"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/v_voice_print_bg"
                    app:layout_constraintStart_toStartOf="@+id/v_voice_print_bg" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
                    android:text="@{voiceAIViewModel.voicePrintLimitTxt}"
                    android:textColor="@color/white50"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_print_clear"
                    app:layout_constraintEnd_toEndOf="@+id/v_voice_print_bg"
                    app:layout_constraintTop_toTopOf="@+id/tv_print_clear"
                    tools:text="0/200" />


                <TextView
                    android:id="@+id/tv_all_voice"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginTop="30dp"
                    android:text="@string/voice_all"
                    android:textColor="@color/white"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/v_voice_print_bg" />

                <Space
                    android:id="@+id/space6"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintTop_toBottomOf="@+id/tv_all_voice" />

                <com.google.android.material.tabs.TabLayout
                    android:id="@+id/voice_tab"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_marginStart="@dimen/app_common_page_horizontal_padding"
                    android:layout_marginTop="@dimen/app_common_page_horizontal_padding"
                    android:background="@color/colorPrimary"
                    android:fadingEdgeLength="30dp"
                    android:requiresFadingEdge="horizontal"
                    app:layout_constraintDimensionRatio="334:28"
                    app:layout_constraintTop_toBottomOf="@+id/space6"
                    app:layout_scrollFlags="noScroll"
                    app:tabIndicator="@null"
                    app:tabMinWidth="0dp"
                    app:tabMode="scrollable"
                    app:tabPaddingEnd="@dimen/app_common_page_horizontal_padding"
                    app:tabPaddingStart="0dp"
                    app:tabRippleColor="#00000000" />


                <androidx.constraintlayout.widget.Group
                    isGone="@{voiceAIViewModel.isMember || voiceAIViewModel.voiceProbationTxt == null || voiceAIViewModel.voiceProbationTxt.toString().length() == 0 }"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:constraint_referenced_ids="v_free_get_bg,tv_generate_free_desc,sapce2,iv_get_free_arrow,tv_get_free_txt" />

            </androidx.constraintlayout.widget.ConstraintLayout>


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

        </androidx.constraintlayout.widget.ConstraintLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/ry_voice_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="16dp"
                android:fadingEdge="vertical"
                android:fadingEdgeLength="10dp"
                android:requiresFadingEdge="vertical"
                android:paddingHorizontal="@dimen/app_common_page_horizontal_padding"
                tools:itemCount="10"
                tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
                tools:listitem="@layout/item_voice_ai_list"
                tools:spanCount="4" />

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

                <View
                    android:id="@+id/v_generate"
                    android:layout_width="match_parent"
                    android:layout_height="76dp"
                    android:background="@drawable/bg_voice_generate"
                    app:layout_constraintBottom_toBottomOf="parent" />

                <View
                    android:id="@+id/v_generate_btn"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_marginHorizontal="@dimen/app_common_page_horizontal_padding"
                    android:background="@drawable/bg_voice_ai_btn"
                    android:onClick="@{()-> voiceAIViewModel.onGenerateClick()}"
                    app:layout_constraintBottom_toBottomOf="@+id/v_generate"
                    app:layout_constraintDimensionRatio="336:48"
                    app:layout_constraintTop_toTopOf="@+id/v_generate" />

                <ImageView
                    isGone="@{voiceAIViewModel.isMember()}"
                    android:id="@+id/iv_ad"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:src="@drawable/icon_ad_film"
                    app:layout_constraintBottom_toBottomOf="@+id/v_generate_btn"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintHorizontal_chainStyle="packed"
                    app:layout_constraintLeft_toLeftOf="@+id/v_generate_btn"
                    app:layout_constraintRight_toLeftOf="@+id/tv_generate_txt"
                    app:layout_constraintTop_toTopOf="@+id/v_generate_btn"
                    app:layout_constraintWidth_percent="0.0388888888888889" />

                <TextView
                    android:id="@+id/tv_generate_txt"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="6dp"
                    android:text="@string/voice_ai_generate"
                    android:textColor="@color/colorPrimary"
                    android:textSize="17sp"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toBottomOf="@+id/v_generate_btn"
                    app:layout_constraintLeft_toRightOf="@+id/iv_ad"
                    app:layout_constraintRight_toRightOf="@+id/v_generate_btn"
                    app:layout_constraintTop_toTopOf="@+id/v_generate_btn" />
            </androidx.constraintlayout.widget.ConstraintLayout>

        </RelativeLayout>


    </LinearLayout>
</layout>