<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:duplicateParentState="false"
    android:orientation="vertical">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|enterAlways"
            app:titleEnabled="false">

            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                android:elevation="4dp"
                android:theme="?actionBarTheme"
                android:touchscreenBlocksFocus="false"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.DayNight"
                app:title="@string/app_name" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:paddingTop="56dp">

                <com.google.android.material.card.MaterialCardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"
                    app:cardElevation="2dp">

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:padding="8dp">

                        <com.google.android.material.chip.ChipGroup
                            android:id="@+id/bypassGroup"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="4dp"
                            app:selectionRequired="true"
                            app:singleLine="true"
                            app:singleSelection="true">

                            <com.google.android.material.chip.Chip
                                android:id="@+id/appProxyModeDisable"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/off" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/appProxyModeOn"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/route_proxy" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/appProxyModeBypass"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:checked="true"
                                android:text="@string/bypass_apps" />

                        </com.google.android.material.chip.ChipGroup>

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

                            <com.google.android.material.chip.Chip
                                android:id="@+id/show_system_apps"
                                style="@style/Widget.MaterialComponents.Chip.Filter"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginEnd="8dp"
                                android:layout_marginBottom="4dp"
                                android:text="@string/show_system_apps" />

                            <com.google.android.material.chip.Chip
                                android:id="@+id/autoSelectProxyApps"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:checkable="false"
                                android:text="@string/auto_select_proxy_apps" />

                        </LinearLayout>

                        <com.google.android.material.textfield.TextInputLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="@string/search_apps">

                            <com.google.android.material.textfield.TextInputEditText
                                android:id="@+id/search"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content" />

                        </com.google.android.material.textfield.TextInputLayout>


                    </LinearLayout>

                </com.google.android.material.card.MaterialCardView>

            </LinearLayout>

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

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

    <LinearLayout
        android:id="@+id/loading"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <com.google.android.material.progressindicator.CircularProgressIndicator
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminate="true" />

    </LinearLayout>

    <com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
        android:id="@+id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:scrollbarSize="0dp"
        android:visibility="gone"
        app:fastScrollAutoHide="true"
        app:fastScrollPopupTextColor="?colorPrimary"
        app:fastScrollThumbColor="?colorPrimary"
        app:fastScrollThumbInactiveColor="?colorPrimary"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        tools:listitem="@layout/layout_apps_item" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
