<?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:custom="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/list_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ui.list.ListActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/list_appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"

        android:background="@null"
        app:elevation="0dp"

        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

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

            <ImageView
                android:id="@+id/list_settings"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:contentDescription="@string/settings"
                android:gravity="center"
                android:paddingLeft="16sp"
                android:paddingRight="16sp"
                android:src="@drawable/baseline_settings_24"
                custom:layout_constraintBottom_toBottomOf="parent"
                custom:layout_constraintStart_toStartOf="parent"
                custom:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/list_heading"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:minHeight="?actionBarSize"
                android:padding="@dimen/appbar_padding"
                android:text="@string/list_title_pick"
                android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title"
                android:textSize="30sp"
                app:layout_constraintEnd_toStartOf="@id/list_lock"
                app:layout_constraintStart_toEndOf="@id/list_settings"
                app:layout_constraintTop_toTopOf="parent" />

            <ImageView
                android:id="@+id/list_close"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                android:contentDescription="@string/content_description_close"
                android:gravity="center"
                android:includeFontPadding="true"
                android:paddingLeft="16sp"
                android:paddingRight="16sp"
                android:src="@drawable/baseline_close_24"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent" />
            <ImageView
                android:id="@+id/list_lock"
                android:contentDescription="@string/content_description_lock"
                android:visibility="gone"
                tools:visibility="visible"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:includeFontPadding="true"
                android:paddingLeft="0sp"
                android:paddingRight="0sp"
                android:src="@drawable/baseline_lock_24"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toStartOf="@id/list_close"
                app:layout_constraintTop_toTopOf="parent" />
        </androidx.constraintlayout.widget.ConstraintLayout>

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/list_tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabIndicatorColor="?attr/colorAccent"
            custom:tabTextColor="?attr/android:textColor"
            tools:ignore="SpeakableTextPresentCheck" />

    </com.google.android.material.appbar.AppBarLayout>

    <!--
    Should be replaced by androidx.viewpager2.widget.ViewPager2
    but there is an issue with opening the keyboard:
    https://github.com/jrpie/launcher/issues/130
    -->
    <androidx.viewpager.widget.ViewPager
        android:id="@+id/list_viewpager"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/list_appbar"
        app:layout_constraintVertical_bias="0.0"
        custom:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:ignore="SpeakableTextPresentCheck" />

</androidx.constraintlayout.widget.ConstraintLayout>