<!--
  ~ 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.constraintlayout.widget.ConstraintLayout 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/layout_contacts_main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".contacts.ContactsActivity">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/coordinatorLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar_contacts"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/background_norm"
            android:translationZ="@dimen/elevation_m"
            app:layout_constraintTop_toTopOf="parent">

            <include
                android:id="@+id/toolbar_contacts"
                layout="@layout/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tablayout_contacts"
                style="@style/CustomTabLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="?attr/actionBarSize"
                app:tabGravity="fill"
                app:tabIndicatorColor="@color/interaction_strong"
                app:tabMode="fixed" />

        </com.google.android.material.appbar.AppBarLayout>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/viewpager_contacts"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/coordinatorLayout" />

    <FrameLayout
        android:id="@+id/layout_no_connectivity_info"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/coordinatorLayout" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/layout_progress_contacts"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background_norm"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:visibility="visible">

        <ProgressBar
            android:id="@+id/progress_bar_contacts"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            style="@style/Proton.Text.Default.Weak"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/fields_default_space_small"
            android:text="@string/fetching_contacts"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/progress_bar_contacts" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_contacts_add_contact"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/margin_m"
        app:srcCompat="@drawable/ic_proton_user_plus"
        app:backgroundTint="@color/interaction_strong"
        app:fabSize="mini"
        app:layout_constraintBottom_toBottomOf="@id/fab_contacts_add_menu"
        app:layout_constraintEnd_toEndOf="@id/fab_contacts_add_menu"
        app:layout_constraintStart_toStartOf="@id/fab_contacts_add_menu"
        app:layout_constraintTop_toTopOf="@id/fab_contacts_add_menu"
        app:rippleColor="?attr/brand_norm"
        app:tint="@color/icon_inverted"
        tools:ignore="VectorDrawableCompat" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_contacts_add_contact_group"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/margin_m"
        app:srcCompat="@drawable/ic_proton_users_plus"
        app:backgroundTint="@color/interaction_strong"
        app:fabSize="mini"
        app:layout_constraintBottom_toBottomOf="@id/fab_contacts_add_menu"
        app:layout_constraintEnd_toEndOf="@id/fab_contacts_add_menu"
        app:layout_constraintStart_toStartOf="@id/fab_contacts_add_menu"
        app:layout_constraintTop_toTopOf="@id/fab_contacts_add_menu"
        app:rippleColor="?attr/brand_norm"
        app:tint="@color/icon_inverted"
        tools:ignore="VectorDrawableCompat" />

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_contacts_add_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@drawable/ic_proton_plus"
        app:backgroundTint="@color/interaction_strong"
        app:fabSize="normal"
        app:layout_collapseMode="parallax"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:rippleColor="?attr/brand_norm"
        app:tint="@color/icon_inverted" />

</androidx.constraintlayout.widget.ConstraintLayout>