<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (c) 2019 Hemanth Savarala.
  ~
  ~ Licensed under the GNU General Public License v3
  ~
  ~ This 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.
  ~
  ~ This software 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.
  -->

<LinearLayout 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/main_fragment_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/colorSurface"
    android:orientation="vertical">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:elevation="0dp"
            app:elevation="0dp"
            app:liftOnScroll="true">

            <com.google.android.material.appbar.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                app:contentScrim="@android:color/transparent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed"
                app:statusBarScrim="@color/md_black_1000"
                app:titleEnabled="false">

                <FrameLayout
                    android:id="@+id/imageContainer"
                    android:layout_width="match_parent"
                    android:layout_height="258dp"
                    app:layout_collapseMode="parallax">

                    <androidx.appcompat.widget.AppCompatImageView
                        android:id="@+id/bannerImage"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:scaleType="centerCrop"
                        app:layout_collapseMode="parallax"
                        tools:background="@color/md_red_400"
                        tools:ignore="ContentDescription"
                        tools:srcCompat="@tools:sample/backgrounds/scenic[9]" />

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="24dp"
                        android:layout_gravity="bottom"
                        android:background="@drawable/shadow_up_full_theme"
                        android:backgroundTint="?colorPrimary" />
                </FrameLayout>


                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    app:layout_collapseMode="pin"
                    app:layout_scrollFlags="scroll|enterAlways">

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

                        <include layout="@layout/status_bar" />
                    </FrameLayout>

                    <com.google.android.material.card.MaterialCardView
                        android:id="@+id/toolbarContainer"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="@dimen/toolbar_margin_horizontal"
                        android:layout_marginTop="@dimen/toolbar_margin_vertical"
                        android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
                        android:layout_marginBottom="@dimen/toolbar_margin_vertical"
                        app:cardBackgroundColor="@android:color/transparent"
                        app:cardCornerRadius="8dp"
                        app:cardElevation="6dp"
                        app:cardUseCompatPadding="true"
                        app:layout_collapseMode="pin"
                        app:layout_scrollFlags="scroll|enterAlways">

                        <com.google.android.material.appbar.MaterialToolbar
                            android:id="@+id/toolbar"
                            android:layout_width="match_parent"
                            android:layout_height="@dimen/toolbar_height"
                            android:background="?colorSurface"
                            app:contentInsetStart="0dp"
                            app:contentInsetStartWithNavigation="0dp"
                            app:popupTheme="?toolbarPopupTheme"
                            app:title="@string/search_hint"
                            app:titleMarginStart="0dp"
                            app:titleTextAppearance="@style/ToolbarTextAppearanceSearch"
                            tools:ignore="UnusedAttribute" />
                    </com.google.android.material.card.MaterialCardView>
                </LinearLayout>
            </com.google.android.material.appbar.CollapsingToolbarLayout>
        </com.google.android.material.appbar.AppBarLayout>

        <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:behavior_overlapTop="52dp"
            app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="@dimen/toolbar_margin_horizontal"
                android:layout_marginEnd="@dimen/toolbar_margin_horizontal"
                app:cardBackgroundColor="?colorPrimary"
                app:cardElevation="8dp"
                app:shapeAppearanceOverlay="@style/TopCornerCardView">

                <include layout="@layout/home_content" />
            </com.google.android.material.card.MaterialCardView>
        </androidx.core.widget.NestedScrollView>
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>