<?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/app_list_root"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.cardview.widget.CardView
        android:id="@+id/search_card"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginEnd="0dp"
        android:layout_marginRight="0dp"
        android:layout_marginTop="16dp"
        android:layout_marginBottom="16dp"
        app:layout_constraintEnd_toStartOf="@+id/sort"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingEnd="8dp"
            android:paddingLeft="8dp"
            android:paddingRight="8dp"
            android:paddingStart="8dp">

            <ImageView
                android:id="@+id/back"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:contentDescription="@string/back"
                android:src="?attr/backButtonDrawable"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"/>

            <EditText
                android:id="@+id/search"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                android:hint="@string/search_hint"
                android:imeOptions="actionSearch"
                android:inputType="text"
                android:maxLines="1"
                android:padding="12dp"
                android:textSize="18sp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toStartOf="@+id/clear"
                app:layout_constraintStart_toEndOf="@+id/back"
                app:layout_constraintTop_toTopOf="parent"/>

            <ImageView
                android:id="@+id/clear"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:contentDescription="@string/clear_search"
                android:src="?attr/clearButtonDrawable"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"/>

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

    <ImageView
        android:id="@+id/sort"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="4dp"
        android:layout_marginRight="4dp"
        android:contentDescription="@string/sort_search"
        app:layout_constraintTop_toTopOf="@id/search_card"
        app:layout_constraintBottom_toBottomOf="@id/search_card"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/search_card"/>

    <!-- Don't center, only show it at the top because a keyboard will usually be shown at the bottom of the screen,
         covering most of this layout. -->
    <TextView
        android:id="@+id/empty_state"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/search_card"
        android:visibility="gone"
        style="@style/AppListEmptyText"
        android:text="@string/empty_search_available_app_list"/>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/app_list"
        android:layout_width="0dp"
        android:layout_height="0dp"
        tools:listitem="@layout/app_list_item"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/search_card"
        android:visibility="visible"
        android:scrollbars="vertical" />

</androidx.constraintlayout.widget.ConstraintLayout>