<?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"
    tools:context=".ui.ProductSearchActivity"
    android:background="@color/background">

    <LinearLayout
        android:id="@+id/topControlLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/cardSurface"
        android:elevation="8dp"
        android:orientation="vertical"
        android:paddingBottom="16dp"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginTop="16dp"
            android:text="選擇商品"
            android:textColor="@color/black"
            android:textSize="28sp"
            android:textStyle="bold" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginTop="8dp"
            android:orientation="horizontal">

            <SearchView
                android:id="@+id/searchProductList"
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:background="@drawable/textview_border"
                android:queryHint="請輸入商品名稱來搜尋"
                android:searchIcon="@null"
                android:iconifiedByDefault="false" />

            <Button
                android:id="@+id/buttonClear"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginStart="8dp"
                android:backgroundTint="@color/warning"
                android:textColor="@color/onWarning"
                app:cornerRadius="8dp"
                android:text="清除"
                android:textSize="24sp" />
        </LinearLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginTop="8dp">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerSearchText"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone" />

            <TextView
                android:id="@+id/textSearchStatus"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
                android:text="請輸入您要搜尋的文字"
                android:textColor="@color/black"
                android:textSize="18sp"
                android:visibility="visible" />
        </FrameLayout>
    </LinearLayout>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerProductSearch"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="1dp"
        android:layout_marginBottom="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomControlLayout"
        app:layout_constraintTop_toBottomOf="@+id/topControlLayout"
        app:layout_constraintVertical_bias="1.0">

    </androidx.recyclerview.widget.RecyclerView>

    <LinearLayout
        android:id="@+id/bottomControlLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="8dp"
        android:background="@color/cardSurface"
        android:elevation="16dp"
        app:layout_constraintBottom_toBottomOf="parent">

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

            <Button
                android:id="@+id/buttonBack"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:backgroundTint="@color/gray"
                android:textColor="@color/black"
                android:layout_marginEnd="8dp"
                app:cornerRadius="8dp"
                android:text="返回"
                android:textSize="24dp" />

            <Button
                android:id="@+id/buttonOk"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginStart="8dp"
                android:backgroundTint="@color/primary"
                android:textColor="@color/onPrimary"
                android:text="確定"
                app:cornerRadius="8dp"
                android:textSize="24dp" />
        </LinearLayout>
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>