<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/tab_background">

    <!-- ==================== 顶部键盘详情部分 ==================== -->
    <androidx.cardview.widget.CardView
        android:id="@+id/top_section_card"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        app:cardElevation="12dp"
        app:cardCornerRadius="0dp"
        app:cardBackgroundColor="@android:color/transparent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/top_section"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="16dp"
            android:background="@color/tab_background">

            <!-- 返回按钮 -->
            <ImageView
                android:id="@+id/back"
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:layout_marginTop="5dp"
                android:paddingStart="5dp"
                android:paddingTop="10dp"
                android:paddingBottom="10dp"
                android:src="@mipmap/icon_back"
                android:tint="@color/text_color"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <!-- 标题 -->
            <com.app.wave.keyboard.utils.TextVCustom
                android:id="@+id/textview_data_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/app_name"
                android:textColor="@color/text_color"
                android:textSize="18sp"
                android:textStyle="bold"
                app:apply_font="true"
                app:layout_constraintBottom_toBottomOf="@id/back"
                app:layout_constraintEnd_toStartOf="@+id/im_like"
                app:layout_constraintStart_toEndOf="@id/back"
                app:layout_constraintTop_toTopOf="@id/back" />

            <!-- 收藏按钮 -->
            <ImageView
                android:id="@+id/im_like"
                android:layout_width="44dp"
                android:layout_height="44dp"
                android:layout_marginEnd="12dp"
                android:padding="9dp"
                android:src="@drawable/selector_collection"
                app:layout_constraintBottom_toBottomOf="@id/back"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="@id/back" />

            <!-- 键盘预览卡片 -->
            <androidx.cardview.widget.CardView
                android:id="@+id/card_viewData"
                android:layout_width="0dp"
                android:layout_height="200dp"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                app:cardCornerRadius="12dp"
                app:cardElevation="4dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/back">

                <ImageView
                    android:id="@+id/image_data"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="centerCrop" />

            </androidx.cardview.widget.CardView>

            <!-- 下载应用按钮 -->
            <LinearLayout
                android:id="@+id/layoutDownloadApply"
                android:layout_width="260dp"
                android:layout_height="48dp"
                android:layout_marginTop="22dp"
                android:background="@drawable/dialog_setkeyboard"
                android:gravity="center"
                android:orientation="horizontal"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/card_viewData">

                <ImageView
                    android:id="@+id/im_download"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:src="@mipmap/icon_download" />

                <com.app.wave.keyboard.utils.TextVCustom
                    android:id="@+id/tv_download"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:text="@string/download_apply"
                    android:textColor="@color/white"
                    android:textSize="16sp"
                    app:apply_font="true" />

            </LinearLayout>

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>

    <!-- ==================== 推荐部分 ==================== -->
    <androidx.core.widget.NestedScrollView
        android:id="@+id/nested_scroll_view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:fillViewport="true"
        android:background="@color/theme_background"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/top_section_card">

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

            <!-- 推荐标题区域 -->
            <LinearLayout
                android:id="@+id/title_container"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical"
                android:paddingTop="20dp"
                android:paddingBottom="10dp"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <!-- 左边下划线 -->
                    <View
                        android:layout_width="40dp"
                        android:layout_height="2dp"
                        android:layout_marginEnd="12dp"
                        android:background="@color/underline_color" />

                    <!-- 推荐标题 -->
                    <com.app.wave.keyboard.utils.TextVCustom
                        android:id="@+id/text_for_you"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/recommend"
                        android:textColor="@color/text_color"
                        android:textSize="18sp"
                        android:textStyle="bold"
                        app:apply_font="true" />

                    <!-- 右边下划线 -->
                    <View
                        android:layout_width="40dp"
                        android:layout_height="2dp"
                        android:layout_marginStart="12dp"
                        android:background="@color/underline_color" />

                </LinearLayout>

                <!-- 副标题 -->
                <com.app.wave.keyboard.utils.TextVCustom
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:text="@string/more_suggestions"
                    android:textColor="@color/color_primary_dark"
                    android:textSize="12sp"
                    app:apply_font="true" />

            </LinearLayout>

            <!-- 推荐键盘列表 -->
            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recommended_recycler"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="6dp"
                android:layout_marginEnd="16dp"
                android:clipToPadding="false"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/title_container" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.core.widget.NestedScrollView>

    <!-- ==================== 回到顶部按钮 ==================== -->
    <ImageView
        android:id="@+id/btn_scroll_to_top"
        android:layout_width="36dp"
        android:layout_height="36dp"
        android:layout_marginEnd="20dp"
        android:layout_marginBottom="30dp"
        android:background="@drawable/icon_bg"
        android:clickable="true"
        android:focusable="true"
        android:padding="8dp"
        android:src="@mipmap/icon_top"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <!-- ==================== 加载动画 ==================== -->
    <FrameLayout
        android:id="@+id/loading"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/bg_loading"
        android:clickable="true"
        android:focusable="true"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminateTint="@color/white" />

    </FrameLayout>

</androidx.constraintlayout.widget.ConstraintLayout>