<?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="subscriptionViewModel"
            type="com.atmob.voiceai.module.subscription.SubscriptionPageViewModel" />

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

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

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:src="@drawable/bg_subscription_page"
            app:layout_constraintDimensionRatio="1080:2400"
            app:layout_constraintTop_toTopOf="parent" />


        <androidx.core.widget.NestedScrollView
            android:id="@+id/scroll_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constrainedHeight="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintBottom_toTopOf="@id/space_sub"
            app:layout_constraintTop_toTopOf="parent">

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

                <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" />

                <Space
                    android:id="@+id/space1"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:58"
                    app:layout_constraintTop_toBottomOf="@+id/space_status_bar" />

                <TextView
                    android:id="@+id/tv_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_title"
                    android:textColor="@color/white"
                    android:textSize="24sp"
                    android:textStyle="bold"
                    app:layout_constraintHorizontal_chainStyle="packed"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@+id/tv_pro"
                    app:layout_constraintTop_toBottomOf="@+id/space1" />

                <TextView
                    android:id="@+id/tv_pro"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_marginStart="7dp"
                    android:background="@drawable/bg_sub_pro"
                    android:gravity="center"
                    android:text="@string/sub_pro"
                    android:textColor="@color/white"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_title"
                    app:layout_constraintDimensionRatio="48:23"
                    app:layout_constraintLeft_toRightOf="@+id/tv_title"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@+id/tv_title"
                    app:layout_constraintWidth_percent="0.1333333333333333" />

                <TextView
                    android:id="@+id/tv_sub_desc"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:text="@string/sub_unlock_features"
                    android:textColor="@color/white80"
                    android:textSize="14sp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/tv_title" />

                <Space
                    android:id="@+id/space2"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:16"
                    app:layout_constraintTop_toBottomOf="@+id/tv_sub_desc" />

                <Space
                    android:id="@+id/space3"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:5"
                    app:layout_constraintTop_toBottomOf="@+id/space2" />

                <View
                    android:id="@+id/v_sub_card"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_marginHorizontal="16dp"
                    android:background="@drawable/bg_sub_pro_card"
                    app:layout_constraintBottom_toBottomOf="@+id/iv_sub"
                    app:layout_constraintTop_toBottomOf="@+id/space3" />

                <View
                    android:id="@+id/v_sub_line"
                    android:layout_width="0dp"
                    android:layout_height="1dp"
                    android:layout_marginHorizontal="12dp"
                    android:background="@drawable/bg_sub_line"
                    app:layout_constraintBottom_toBottomOf="@+id/v_sub_card"
                    app:layout_constraintEnd_toEndOf="@id/v_sub_card"
                    app:layout_constraintStart_toStartOf="@id/v_sub_card"
                    app:layout_constraintTop_toTopOf="@id/v_sub_card"
                    app:layout_constraintVertical_bias="0.1546762589928058" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_basic"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/v_sub_line"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/space_guideline"
                    app:layout_constraintTop_toTopOf="@id/v_sub_card" />

                <TextView
                    android:id="@+id/tv_function1"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_generation_times"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toTopOf="@+id/tv_function2"
                    app:layout_constraintEnd_toEndOf="@id/space_guideline"
                    app:layout_constraintStart_toEndOf="@+id/space_line_start"
                    app:layout_constraintTop_toTopOf="@+id/v_sub_line" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="3/Day"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function1"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/tv_function1"
                    app:layout_constraintTop_toTopOf="@+id/tv_function1" />


                <TextView
                    android:id="@+id/tv_function2"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_quantity"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toTopOf="@+id/tv_function3"
                    app:layout_constraintEnd_toEndOf="@id/space_guideline"
                    app:layout_constraintStart_toStartOf="@+id/tv_function1"
                    app:layout_constraintTop_toBottomOf="@id/tv_function1" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:text="5"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function2"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/tv_function2"
                    app:layout_constraintTop_toTopOf="@+id/tv_function2" />

                <TextView
                    android:id="@+id/tv_function3"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_clone_voice"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toTopOf="@+id/tv_function4"
                    app:layout_constraintEnd_toEndOf="@id/space_guideline"
                    app:layout_constraintStart_toStartOf="@+id/tv_function1"
                    app:layout_constraintTop_toBottomOf="@id/tv_function2" />

                <View
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:background="@drawable/bg_sub_no"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function3"
                    app:layout_constraintDimensionRatio="15:3"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/tv_function3"
                    app:layout_constraintTop_toTopOf="@+id/tv_function3"
                    app:layout_constraintWidth_percent="0.0416666666666667" />

                <TextView
                    android:id="@+id/tv_function4"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_faster_processing"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toTopOf="@+id/tv_function5"
                    app:layout_constraintEnd_toEndOf="@id/space_guideline"
                    app:layout_constraintStart_toStartOf="@+id/tv_function1"
                    app:layout_constraintTop_toBottomOf="@id/tv_function3" />

                <View
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:background="@drawable/bg_sub_no"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function4"
                    app:layout_constraintDimensionRatio="15:3"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/tv_function4"
                    app:layout_constraintTop_toTopOf="@+id/tv_function4"
                    app:layout_constraintWidth_percent="0.0416666666666667" />

                <TextView
                    android:id="@+id/tv_function5"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_remove_ads"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@id/v_sub_card"
                    app:layout_constraintEnd_toEndOf="@id/space_guideline"
                    app:layout_constraintStart_toStartOf="@+id/tv_function1"
                    app:layout_constraintTop_toBottomOf="@id/tv_function4" />


                <View
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:background="@drawable/bg_sub_no"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function5"
                    app:layout_constraintDimensionRatio="15:3"
                    app:layout_constraintEnd_toStartOf="@id/iv_sub"
                    app:layout_constraintStart_toEndOf="@+id/tv_function5"
                    app:layout_constraintTop_toTopOf="@+id/tv_function5"
                    app:layout_constraintWidth_percent="0.0416666666666667" />

                <Space
                    android:id="@+id/space_guideline"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    app:layout_constraintStart_toStartOf="@+id/v_sub_card"
                    app:layout_constraintTop_toTopOf="@+id/v_sub_card"
                    app:layout_constraintWidth_percent="0.45" />

                <Space
                    android:id="@+id/space_line_start"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    app:layout_constraintStart_toStartOf="@+id/v_sub_card"
                    app:layout_constraintTop_toTopOf="@+id/v_sub_card"
                    app:layout_constraintWidth_percent="0.0777777777777778" />


                <ImageView
                    android:id="@+id/iv_sub"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_marginEnd="16dp"
                    android:src="@drawable/bg_sub_rectangle"
                    app:layout_constraintDimensionRatio="291:849"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/space2"
                    app:layout_constraintWidth_percent="0.2694444444444444" />

                <ImageView
                    android:id="@+id/iv_vip"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:src="@drawable/icon_vip"
                    app:layout_constraintBottom_toBottomOf="@+id/iv_sub"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintHorizontal_chainStyle="packed"
                    app:layout_constraintLeft_toLeftOf="@+id/iv_sub"
                    app:layout_constraintRight_toLeftOf="@+id/tv_sub_pro"
                    app:layout_constraintTop_toTopOf="@+id/iv_sub"
                    app:layout_constraintVertical_bias="0.060377358490566"
                    app:layout_constraintWidth_percent="0.05" />

                <TextView
                    android:id="@+id/tv_sub_pro"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="5dp"
                    android:text="@string/sub_pro"
                    android:textColor="@color/colorPrimaryVariant"
                    android:textSize="16sp"
                    app:layout_constraintBottom_toBottomOf="@+id/iv_vip"
                    app:layout_constraintLeft_toRightOf="@+id/iv_vip"
                    app:layout_constraintRight_toRightOf="@+id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/iv_vip" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_unlimited"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function1"
                    app:layout_constraintEnd_toEndOf="@+id/iv_sub"
                    app:layout_constraintStart_toStartOf="@id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/tv_function1" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/sub_unlimited"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function2"
                    app:layout_constraintEnd_toEndOf="@+id/iv_sub"
                    app:layout_constraintStart_toStartOf="@id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/tv_function2" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:src="@drawable/icon_sub_allow"
                    android:textColor="@color/white"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function3"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintEnd_toEndOf="@+id/iv_sub"
                    app:layout_constraintStart_toStartOf="@id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/tv_function3" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:src="@drawable/icon_sub_allow"
                    android:textColor="@color/white"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function4"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintEnd_toEndOf="@+id/iv_sub"
                    app:layout_constraintStart_toStartOf="@id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/tv_function4" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:src="@drawable/icon_sub_allow"
                    android:textColor="@color/white"
                    app:layout_constraintBottom_toBottomOf="@+id/tv_function5"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintEnd_toEndOf="@+id/iv_sub"
                    app:layout_constraintStart_toStartOf="@id/iv_sub"
                    app:layout_constraintTop_toTopOf="@+id/tv_function5" />

                <Space
                    android:id="@+id/space4"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    app:layout_constraintDimensionRatio="360:15"
                    app:layout_constraintTop_toBottomOf="@id/v_sub_card" />

                <Space
                    android:id="@+id/space_ry_top"
                    android:layout_width="match_parent"
                    android:layout_height="12.5dp"
                    app:layout_constraintTop_toTopOf="@+id/rv_goods_list" />

                <ProgressBar
                    isGone="@{!subscriptionViewModel.showQuerySubLoading}"
                    android:id="@+id/common_loading_progress"
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:indeterminate="true"
                    android:layout_marginTop="30dp"
                    android:indeterminateDrawable="@drawable/progress_common_loading"
                    app:layout_constraintDimensionRatio="1:1"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@+id/space_ry_top"
                    app:layout_constraintVertical_chainStyle="packed"
                    app:layout_constraintWidth_percent="0.0916666666666667" />

                <View
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:background="@drawable/bg_sub_goods_list"
                    app:layout_constraintBottom_toBottomOf="@+id/rv_goods_list"
                    app:layout_constraintEnd_toEndOf="@+id/rv_goods_list"
                    app:layout_constraintStart_toStartOf="@+id/rv_goods_list"
                    app:layout_constraintTop_toBottomOf="@+id/space_ry_top" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_goods_list"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginHorizontal="16dp"
                    android:overScrollMode="never"
                    app:layout_constraintTop_toBottomOf="@+id/space4"
                    tools:itemCount="3"
                    tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    tools:listitem="@layout/item_sub_goods_list"
                    tools:orientation="vertical" />

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

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.core.widget.NestedScrollView>

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

        <View
            android:id="@+id/v_menu"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:alpha="0"
            android:background="@color/colorPrimary"
            app:layout_constraintDimensionRatio="360:65"
            app:layout_constraintTop_toBottomOf="@+id/v_status_bar" />

        <TextView
            android:id="@+id/tv_bar_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:alpha="0"
            android:text="@string/sub_bar_title"
            android:textColor="@color/white"
            android:textSize="17sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toBottomOf="@+id/v_menu"
            app:layout_constraintEnd_toEndOf="@+id/v_menu"
            app:layout_constraintStart_toStartOf="@+id/v_menu"
            app:layout_constraintTop_toTopOf="@+id/v_menu" />

        <ImageView
            android:id="@+id/iv_back"
            isGone="@{!subscriptionViewModel.isShowCloseBtn}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginStart="14dp"
            android:background="@drawable/bg_ripple_common_oval_mask"
            android:onClick="@{()-> subscriptionViewModel.onBackClick()}"
            android:src="@drawable/icon_subscription_back"
            app:layout_constraintBottom_toBottomOf="@+id/v_menu"
            app:layout_constraintDimensionRatio="1:1"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/v_menu"
            app:layout_constraintWidth_percent="0.1" />

        <TextView
            expandTouchSize="@{5}"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/app_common_page_horizontal_padding"
            android:onClick="@{()-> subscriptionViewModel.onRestoreClick()}"
            android:text="@string/sub_restore"
            android:textColor="@color/white"
            android:textSize="14sp"
            app:layout_constraintBottom_toBottomOf="@+id/iv_back"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@+id/iv_back" />

        <Space
            android:id="@+id/space_sub"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="360:110" />

        <TextView
            android:id="@+id/tv_sub_now"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@drawable/bg_voice_ai_btn"
            android:gravity="center"
            android:onClick="@{()-> subscriptionViewModel.onSubNowClick()}"
            android:text="@string/sub_now"
            android:textColor="@color/colorPrimary"
            android:textSize="17sp"
            android:textStyle="bold"
            app:layout_constraintBottom_toTopOf="@+id/tv_auto_renewable"
            app:layout_constraintDimensionRatio="336:48"
            app:layout_constraintEnd_toEndOf="@+id/space_sub"
            app:layout_constraintStart_toStartOf="@+id/space_sub"
            app:layout_constraintTop_toTopOf="@+id/space_sub"
            app:layout_constraintVertical_chainStyle="packed"
            app:layout_constraintWidth_percent="0.9333333333333333" />

        <TextView
            android:id="@+id/tv_auto_renewable"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="16dp"
            android:layout_marginTop="6dp"
            android:gravity="center"
            android:text="@{subscriptionViewModel.autoRenewableText}"
            android:textColor="@color/white80"
            android:textSize="12sp"
            app:layout_constraintBottom_toTopOf="@+id/tv_cancel_txt"
            app:layout_constraintEnd_toEndOf="@+id/space_sub"
            app:layout_constraintStart_toStartOf="@+id/space_sub"
            app:layout_constraintTop_toBottomOf="@+id/tv_sub_now"
            tools:text="Subscription is auto-renewable." />


        <TextView
            android:id="@+id/tv_cancel_txt"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="16dp"
            android:gravity="center"
            android:text="@{subscriptionViewModel.subCancelTxt}"
            android:textColor="@color/white80"
            android:textSize="12sp"
            app:layout_constraintBottom_toBottomOf="@+id/space_sub"
            app:layout_constraintEnd_toEndOf="@+id/space_sub"
            app:layout_constraintStart_toStartOf="@+id/space_sub"
            app:layout_constraintTop_toBottomOf="@+id/tv_auto_renewable"
            tools:text="You can cancel your subscription at any time." />

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