<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/item_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activities.ItemActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collapsing_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">

            <ImageView
                android:id="@+id/collapsing_layout_image"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax" />

            <View
                android:id="@+id/collapsing_layout_scrim"
                android:layout_width="match_parent"
                android:layout_height="160dp"
                android:layout_gravity="bottom"
                android:background="@drawable/toolbar_scrim" />

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/collapsing_layout_toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin" />

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

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

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/activity_item_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:clickable="true"
        android:focusable="true"
        android:src="@drawable/ic_open_in_browser_white"
        app:layout_anchor="@id/app_bar_layout"
        app:layout_anchorGravity="bottom|right|end" />

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical|horizontal"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="10dp">

            <RelativeLayout
                android:id="@+id/activity_item_details_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <RelativeLayout
                    android:id="@+id/activity_item_date_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/item_date_background"
                    android:paddingStart="8dp"
                    android:paddingTop="1dp"
                    android:paddingEnd="8dp"
                    android:paddingBottom="1dp">

                    <TextView
                        android:id="@+id/activity_item_date"
                        style="@style/Base.TextAppearance.AppCompat.Body1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textColor="@color/colorBackground"
                        tools:text="10 feb 2019" />

                </RelativeLayout>

                <TextView
                    android:id="@+id/activity_item_title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/activity_item_date_layout"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginTop="6dp"
                    android:textAppearance="@style/Base.TextAppearance.AppCompat.Headline"
                    tools:text="This is a title" />

                <TextView
                    android:id="@+id/activity_item_author"
                    style="@style/Base.TextAppearance.AppCompat.Body1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/activity_item_title"
                    android:layout_alignParentStart="true"
                    android:layout_marginTop="6dp"
                    android:layout_toStartOf="@id/activity_item_readtime_layout"
                    android:ellipsize="end"
                    android:maxLines="1"
                    android:minLines="1"
                    android:textStyle="italic"
                    android:visibility="gone"
                    tools:text="By Santa Klaus"
                    tools:visibility="visible" />

                <RelativeLayout
                    android:id="@+id/activity_item_readtime_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/activity_item_title"
                    android:layout_alignParentEnd="true"
                    android:layout_marginStart="6dp"
                    android:layout_marginTop="6dp"
                    android:visibility="gone"
                    tools:visibility="visible">

                    <ImageView
                        android:id="@+id/activity_item_readtime_icon"
                        android:layout_width="16dp"
                        android:layout_height="16dp"
                        android:layout_alignParentStart="true"
                        android:layout_centerVertical="true"
                        android:src="@drawable/ic_reading_time" />

                    <TextView
                        android:id="@+id/activity_item_readtime"
                        style="@style/Base.TextAppearance.AppCompat.Body1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_marginStart="4dp"
                        android:layout_toEndOf="@id/activity_item_readtime_icon"
                        tools:text="3 min" />
                </RelativeLayout>

            </RelativeLayout>

            <com.readrops.app.utils.ReadropsWebView
                android:id="@+id/item_webview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/activity_item_details_layout"
                android:layout_marginTop="15dp"
                app:backgroundColor="?android:attr/colorBackground"
                app:textColor="?android:attr/textColorPrimary" />

        </RelativeLayout>

    </androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>