<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ ownCloud Android client application
  ~
  ~ @author Fernando Sanz Velasco
  ~ @author Juan Carlos Garrote Gascón
  ~
  ~ Copyright (C) 2023 ownCloud GmbH.
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License version 2,
  ~ as published by the Free Software Foundation.
  ~
  ~ This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
  ~
  -->

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:filterTouchesWhenObscured="true">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".presentation.files.filelist.MainFileListFragment">

        <com.owncloud.android.presentation.files.SortOptionsView
            android:id="@+id/options_layout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            fab:layout_constraintEnd_toEndOf="parent"
            fab:layout_constraintStart_toStartOf="parent"
            fab:layout_constraintTop_toTopOf="parent" />

        <ProgressBar
            android:id="@+id/syncProgressBar"
            style="@style/Widget.ownCloud.TopProgressBar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/file_list_progress_bar_height"
            android:layout_margin="0dp"
            android:indeterminate="false"
            android:indeterminateOnly="false"
            android:visibility="visible"
            fab:layout_constraintTop_toBottomOf="@id/options_layout" />

        <View
            android:id="@+id/shadow_view"
            android:layout_width="match_parent"
            android:layout_height="@dimen/file_list_progress_bar_height"
            android:layout_margin="0dp"
            android:background="@drawable/shadow_gradient"
            fab:layout_constraintTop_toBottomOf="@id/options_layout" />

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefresh_main_file_list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/syncProgressBar">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
                    android:id="@+id/fab_refresh"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/standard_quarter_margin"
                    android:text="@string/fab_refresh_text"
                    android:textAllCaps="false"
                    android:textColor="@color/white"
                    android:theme="@style/Theme.MaterialComponents.Bridge"
                    android:visibility="gone"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:icon="@drawable/ic_action_refresh"
                    app:iconTint="@color/white"
                    app:backgroundTint="@color/primary_button_background_color"/>

                <include
                    android:id="@+id/space_header"
                    layout="@layout/space_header"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:visibility="visible"/>

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recyclerView_main_file_list"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:scrollbars="vertical"
                    tools:listitem="@layout/item_file_list"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/space_header"/>

                <include
                    android:id="@+id/empty_data_parent"
                    layout="@layout/item_empty_dataset"
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_gravity="center"
                    android:visibility="gone"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/space_header" />

            </androidx.constraintlayout.widget.ConstraintLayout>

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.getbase.floatingactionbutton.FloatingActionsMenu
        android:id="@+id/fab_main"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/standard_margin"
        android:layout_marginBottom="@dimen/standard_margin"
        android:visibility="visible"
        fab:fab_addButtonColorNormal="@color/primary_button_background_color"
        fab:fab_addButtonColorPressed="@color/owncloud_blue"
        fab:fab_addButtonPlusIconColor="@color/white"
        fab:fab_labelStyle="@style/menu_labels_style"
        fab:layout_dodgeInsetEdges="bottom">

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab_upload"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/actionbar_upload"
            fab:fab_colorNormal="@color/primary_button_background_color"
            fab:fab_colorPressed="@color/owncloud_blue"
            fab:fab_icon="@drawable/ic_action_upload"
            fab:fab_size="mini"
            fab:fab_title="@string/actionbar_upload" />

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab_mkdir"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/actionbar_mkdir"
            fab:fab_colorNormal="@color/primary_button_background_color"
            fab:fab_colorPressed="@color/owncloud_blue"
            fab:fab_icon="@drawable/ic_action_create_dir"
            fab:fab_size="mini"
            fab:fab_title="@string/actionbar_mkdir" />

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab_newfile"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/fab_new_file"
            fab:fab_colorNormal="@color/primary_button_background_color"
            fab:fab_colorPressed="@color/owncloud_blue"
            fab:fab_icon="@drawable/ic_action_create_file"
            fab:fab_size="mini"
            fab:fab_title="@string/fab_new_file" />

        <com.getbase.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab_newshortcut"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:contentDescription="@string/fab_new_shortcut"
            fab:fab_colorNormal="@color/primary_button_background_color"
            fab:fab_colorPressed="@color/owncloud_blue"
            fab:fab_icon="@drawable/ic_action_open_shortcut"
            fab:fab_size="mini"
            fab:fab_title="@string/fab_new_shortcut" />

    </com.getbase.floatingactionbutton.FloatingActionsMenu>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
