<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (c) 2022 Proton AG
  ~
  ~ This file is part of Proton Mail.
  ~
  ~ Proton Mail 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.
  ~
  ~ Proton Mail 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 Proton Mail. If not, see https://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"
    tools:context=".mailbox.presentation.MailboxActivity">

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

        <include
            android:id="@+id/toolbar"
            layout="@layout/toolbar_mailbox"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <include
            android:id="@+id/mailboxStatusLayout"
            layout="@layout/layout_mailbox_status_view"
            android:layout_width="0dp"
            android:layout_height="@dimen/mailbox_status_view_height"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/toolbar" />

        <!-- TODO: Should be removed and replaced with MAILAND-1503 -->
        <ch.protonmail.android.views.alerts.StorageLimitAlert
            android:id="@+id/storageLimitAlert"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:visibility="gone"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/mailboxStatusLayout" />

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/mailboxSwipeRefreshLayout"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toTopOf="@id/mailboxActionsView"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/storageLimitAlert">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <ch.protonmail.android.mailbox.presentation.ui.EmptyMailboxView
                    android:id="@+id/include_mailbox_no_messages"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:visibility="gone" />

                <include
                    android:id="@+id/include_mailbox_error"
                    layout="@layout/layout_mailbox_error_state"
                    android:visibility="gone"
                    app:layout_constraintBottom_toTopOf="@id/mailboxActionsView"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/storageLimitAlert" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/mailboxRecyclerView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    tools:listitem="@layout/list_item_mailbox" />

            </FrameLayout>

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        <!-- TODO: Should be removed and replaced with MAILAND-1497 -->
        <FrameLayout
            android:id="@+id/layout_no_connectivity_info"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toTopOf="@id/mailboxActionsView"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent" />

        <ch.protonmail.android.views.messageDetails.BottomActionsView
            android:id="@+id/mailboxActionsView"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:visibility="invisible"
            android:elevation="@dimen/elevation_m"
            android:background="@color/background_norm"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent" />

        <View
            android:id="@+id/screenProtectorView"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:background="@android:color/transparent"
            android:clickable="true"
            android:focusable="true"
            app:layout_constraintBottom_toBottomOf="@id/mailboxSwipeRefreshLayout"
            app:layout_constraintLeft_toLeftOf="@id/mailboxSwipeRefreshLayout"
            app:layout_constraintRight_toRightOf="@id/mailboxSwipeRefreshLayout"
            app:layout_constraintTop_toTopOf="@id/mailboxSwipeRefreshLayout" />

    </androidx.constraintlayout.widget.ConstraintLayout>

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

</androidx.drawerlayout.widget.DrawerLayout>
