<?xml version="1.0" encoding="utf-8"?>
<!--
 Copyright 2019 Jeremy Jamet / Kunzisoft.

 This file is part of KeePassDX.

  KeePassDX is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  KeePassDX is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with KeePassDX.  If not, see <http://www.gnu.org/licenses/>.
-->
<androidx.drawerlayout.widget.DrawerLayout
    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/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:filterTouchesWhenObscured="true">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/activity_group_container_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/activity_group_header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toTopOf="parent">
            <com.kunzisoft.keepass.view.ToolbarSpecial
                android:id="@+id/special_mode_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_constraintTop_toTopOf="parent" />

            <com.google.android.material.appbar.MaterialToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:title="@string/app_name"
                app:layout_constraintTop_toBottomOf="@+id/special_mode_view">
                <TextView
                    android:id="@+id/database_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:layout_marginLeft="12dp"
                    android:maxLines="2"
                    android:ellipsize="end"
                    tools:text="Database"
                    style="@style/KeepassDXStyle.Title.OnSurface" />
            </com.google.android.material.appbar.MaterialToolbar>

            <FrameLayout
                android:layout_width="48dp"
                android:layout_height="wrap_content"
                android:layout_marginStart="48dp"
                android:layout_marginLeft="48dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/special_mode_view"
                app:layout_constraintBottom_toBottomOf="parent">
                <ImageView
                    android:id="@+id/database_color"
                    android:layout_width="12dp"
                    android:layout_height="12dp"
                    android:layout_gravity="center_vertical|start"
                    android:visibility="gone"
                    android:src="@drawable/background_rounded_square"
                    android:contentDescription="@string/content_description_database_color"/>
                <ImageView
                    android:id="@+id/database_modified"
                    android:layout_width="12dp"
                    android:layout_height="12dp"
                    android:layout_gravity="center_vertical|start"
                    android:visibility="gone"
                    android:src="@drawable/ic_modified_white_12dp"
                    android:contentDescription="@string/save"/>
            </FrameLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:id="@+id/group_coordinator"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/activity_group_header">

            <com.google.android.material.appbar.AppBarLayout
                android:id="@+id/app_bar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <FrameLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="?attr/colorSurface"
                    app:layout_scrollFlags="scroll|snap|enterAlways">

                    <androidx.recyclerview.widget.RecyclerView
                        android:id="@+id/breadcrumb_list"
                        android:layout_width="match_parent"
                        android:layout_height="64dp"
                        android:paddingHorizontal="12dp"
                        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                        android:orientation="horizontal" />

                    <com.kunzisoft.keepass.view.SearchFiltersView
                        android:id="@+id/search_filters"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"/>
                </FrameLayout>

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

            <FrameLayout
                android:id="@+id/nodes_list_fragment_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior"
                android:background="?android:attr/windowBackground"
                android:layout_below="@+id/toolbar" />
        </androidx.coordinatorlayout.widget.CoordinatorLayout>

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/activity_group_footer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent">

            <com.kunzisoft.keepass.view.ToolbarAction
                android:id="@+id/toolbar_action"
                android:layout_width="match_parent"
                android:layout_height="64dp"
                android:visibility="gone"
                app:layout_constraintBottom_toTopOf="@+id/screenshot_mode_banner" />

            <com.kunzisoft.keepass.view.AddNodeButtonView
                android:id="@+id/add_node_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toTopOf="@+id/screenshot_mode_banner"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_anchor="@+id/nodes_list_fragment_container"
                app:layout_anchorGravity="end|bottom" />

            <include
                layout="@layout/view_button_lock"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:layout_constraintBottom_toTopOf="@+id/screenshot_mode_banner"
                app:layout_constraintStart_toStartOf="parent" />

            <include layout="@layout/view_screenshot_mode_banner" />

        </androidx.constraintlayout.widget.ConstraintLayout>

        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:id="@+id/error_coordinator"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintBottom_toTopOf="@+id/screenshot_mode_banner"/>

        <ProgressBar
            android:id="@+id/loading"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:indeterminate="true"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.kunzisoft.keepass.view.NavigationDatabaseView
        android:id="@+id/database_nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        style="@style/Widget.Material3.NavigationView" />

</androidx.drawerlayout.widget.DrawerLayout>
