<?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"
    tools:viewBindingIgnore="true"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@color/signal_colorBackground"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/signal_m3_toolbar_height"
            android:minHeight="@dimen/signal_m3_toolbar_height"
            app:layout_scrollFlags="scroll|enterAlways"
            app:titleTextAppearance="@style/Signal.Text.TitleLarge"
            app:titleTextColor="@color/media_overview_toolbar_foreground"
            tools:title="Media Overview" />

        <org.thoughtcrime.securesms.components.ControllableTabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/signal_colorBackground"
            app:tabIndicatorColor="@color/signal_inverse_primary"
            app:tabIndicatorFullWidth="false"
            app:tabMode="scrollable"
            app:tabSelectedTextColor="@color/signal_text_primary"
            app:tabTextAppearance="@style/TextAppearance.Signal.Body2"
            app:tabTextColor="@color/signal_text_secondary" />

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

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@id/sorting"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/appBarLayout">

        <TextView
            android:id="@+id/sort_order"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/dsl_settings_gutter"
            android:layout_marginTop="24dp"
            android:layout_marginBottom="12dp"
            android:gravity="center_vertical"
            android:textAppearance="@style/TextAppearance.Signal.Body1.Bold"
            android:textColor="@color/signal_inverse_primary"
            android:textStyle="bold"
            app:layout_constraintStart_toStartOf="@+id/sorting"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="@string/MediaOverviewActivity_Storage_used" />

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/sort_order_arrow"
            android:layout_width="16dp"
            android:layout_height="16dp"
            android:layout_marginStart="8dp"
            android:importantForAccessibility="no"
            android:tint="@color/signal_inverse_primary"
            app:layout_constraintBottom_toBottomOf="@+id/sort_order"
            app:layout_constraintStart_toEndOf="@+id/sort_order"
            app:layout_constraintTop_toTopOf="@+id/sort_order"
            app:srcCompat="@drawable/ic_arrow_down_14" />


        <org.thoughtcrime.securesms.components.AnimatingToggle
            android:id="@+id/grid_list_toggle"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_gravity="center"
            android:layout_marginEnd="@dimen/media_overview_toggle_gutter"
            android:gravity="center"
            app:layout_constraintBottom_toBottomOf="@+id/sort_order_arrow"
            app:layout_constraintEnd_toEndOf="@+id/sorting"
            app:layout_constraintTop_toTopOf="@+id/sort_order_arrow">

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/view_grid"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/circle_touch_highlight_background"
                android:clickable="true"
                android:contentDescription="@string/MediaOverviewActivity_Grid_view_description"
                android:focusable="true"
                android:gravity="center_vertical"
                android:tint="@color/signal_inverse_primary"
                android:visibility="visible"
                app:srcCompat="@drawable/ic_grid_20" />

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/view_detail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/circle_touch_highlight_background"
                android:clickable="true"
                android:contentDescription="@string/MediaOverviewActivity_List_view_description"
                android:focusable="true"
                android:gravity="center_vertical"
                android:tint="@color/signal_inverse_primary"
                android:visibility="gone"
                app:srcCompat="@drawable/ic_list_20" />

        </org.thoughtcrime.securesms.components.AnimatingToggle>


    </androidx.constraintlayout.widget.ConstraintLayout>


    <org.thoughtcrime.securesms.components.ControllableViewPager
        android:id="@+id/pager"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/sorting" />

</androidx.constraintlayout.widget.ConstraintLayout>
