<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_marginBottom="75dp"
    android:background="@color/white">

    <!--    margin Bottom of 75dp above is important for the home appearance-->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="10"
        >

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="3"
            app:srcCompat="@drawable/ic_cg_dash_bg"
            android:contentDescription="@string/background"
            android:scaleType="fitXY"
            />

    </LinearLayout>

    <RelativeLayout
        android:id="@+id/top_head"
        android:layout_width="match_parent"
        android:layout_height="?android:attr/actionBarSize">

        <RelativeLayout
            android:id="@+id/notifications"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_marginHorizontal="15dp"
            >

            <ImageView
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:contentDescription="@string/notification"
                app:srcCompat="@drawable/ic_notification_home"
                app:tint="@color/black"
                android:layout_alignParentEnd="true"
                android:layout_marginEnd="5dp"
                />

            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                >

                <TextView
                    android:id="@+id/notification_count"
                    android:layout_width="@dimen/_15sdp"
                    android:layout_height="@dimen/_15sdp"

                    android:background="@drawable/round_corners"
                    android:backgroundTint="@android:color/holo_red_light"

                    android:visibility="gone"

                    tools:text="9"
                    android:fontFamily="@font/nunito_regular"
                    android:textColor="@color/white"
                    android:textSize="11sp"
                    android:gravity="center"

                    android:layout_marginStart="7dp"

                    android:maxLength="2"
                    android:singleLine="true"

                    />

            </RelativeLayout>

        </RelativeLayout>

    </RelativeLayout>

    <ScrollView
        android:layout_below="@id/top_head"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:overScrollMode="always"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:orientation="vertical">

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:strokeWidth="1dp"
                app:strokeColor="@color/color_accent"

                app:cardCornerRadius="15dp"
                app:cardElevation="5dp"

                android:layout_marginHorizontal="15dp"
                android:layout_marginBottom="15dp"

                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginHorizontal="15dp"
                    android:layout_marginVertical="10dp"
                    android:orientation="vertical">

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

                        <TextView
                            android:id="@+id/patient_name"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/none"
                            android:fontFamily="@font/nunito_semibold"
                            android:textColor="@color/black"
                            android:textSize="@dimen/_16ssp"

                            android:maxLines="1"
                            android:ellipsize="end"
                            android:layout_centerVertical="true"
                            />

                        <ImageView
                            android:id="@+id/refresh_btn"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:src="@drawable/ic_refresh"
                            android:contentDescription="@string/refresh"
                            android:layout_alignParentEnd="true"
                            android:layout_centerVertical="true"
                            android:visibility="visible"
                            />

                        <ProgressBar
                            android:id="@+id/refresh_progress"
                            android:visibility="gone"
                            android:layout_width="20dp"
                            android:layout_height="20dp"
                            android:layout_centerVertical="true"
                            android:layout_alignParentEnd="true"
                            android:indeterminateTint="@color/color_primary_dark"
                            android:indeterminate="true"
                            />


                    </RelativeLayout>

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"

                        android:background="@color/color_primary"
                        android:layout_marginVertical="5dp"
                        android:layout_marginEnd="75dp"
                        />

                    <fragment
                        android:id="@+id/home_map"
                        android:name="com.google.android.gms.maps.SupportMapFragment"
                        android:layout_marginVertical="15dp"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/_100sdp"/>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:visibility="gone"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <ImageView
                            android:id="@+id/activity_gif"
                            android:layout_width="20dp"
                            android:layout_height="25dp"
                            />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/on_going_activity"
                            android:fontFamily="@font/nunito_semibold"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:layout_marginStart="5dp"

                            />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <ImageView
                            android:layout_width="5dp"
                            android:layout_height="5dp"

                            android:src="@drawable/ic_white_dot"

                            android:layout_marginStart="10dp"
                            android:layout_marginEnd="5dp"

                            app:tint="@color/black" />

                        <TextView
                            android:id="@+id/on_going_activity"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/no_data"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_12ssp"
                            android:textColor="@color/black"

                            android:maxLines="1"
                            android:ellipsize="end"

                            android:layout_marginStart="5dp"

                            />

                    </LinearLayout>

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="1dp"

                        android:background="@color/color_primary"
                        android:layout_marginVertical="10dp"
                        />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <ImageView
                            android:id="@+id/up_coming_gif"
                            android:layout_width="20dp"
                            android:layout_height="25dp"
                            />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/upcoming_activity"
                            android:fontFamily="@font/nunito_semibold"
                            android:textSize="@dimen/_14ssp"
                            android:textColor="@color/black"

                            android:layout_marginStart="5dp"

                            />

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <ImageView
                            android:layout_width="5dp"
                            android:layout_height="5dp"

                            android:src="@drawable/ic_white_dot"

                            android:layout_marginStart="10dp"
                            android:layout_marginEnd="5dp"

                            app:tint="@color/black" />

                        <TextView
                            android:id="@+id/upcoming_activity"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/no_data"
                            android:fontFamily="@font/nunito_regular"
                            android:textSize="@dimen/_12ssp"
                            android:textColor="@color/black"

                            android:maxLines="1"
                            android:ellipsize="end"

                            android:layout_marginStart="5dp"

                            />

                    </LinearLayout>

                    <androidx.cardview.widget.CardView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:cardElevation="0dp"
                        app:cardCornerRadius="5dp"
                        android:layout_marginTop="15dp"
                        >

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical">

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:background="@color/color_accent"
                                android:paddingHorizontal="15dp"
                                android:paddingVertical="10dp"
                                android:orientation="horizontal">

                                <TextView
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"

                                    android:text="@string/next_medication_schedule"
                                    android:fontFamily="@font/nunito_semibold"
                                    android:textColor="@color/black"
                                    android:textSize="@dimen/_14ssp"

                                    android:gravity="center_vertical"

                                    android:maxLines="1"
                                    android:ellipsize="end"

                                    android:drawablePadding="10dp"

                                    app:drawableStartCompat="@drawable/ic_dash_small"
                                    app:drawableTint="@color/color_primary_dark" />

                            </LinearLayout>

                            <LinearLayout
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:background="@color/color_primary_dark_2"
                                android:paddingHorizontal="15dp"
                                android:paddingVertical="10dp"
                                android:orientation="horizontal">

                                <TextView
                                    android:id="@+id/nearest_reminder"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"

                                    android:text="@string/no_data"
                                    android:fontFamily="@font/nunito_semibold"
                                    android:textColor="@color/white"
                                    android:textSize="@dimen/_14ssp"

                                    android:gravity="center_vertical"

                                    android:maxLines="1"
                                    android:ellipsize="end"

                                    android:drawablePadding="15dp"

                                    app:drawableStartCompat="@drawable/ic_pill"
                                    app:drawableTint="@color/white" />

                            </LinearLayout>

                        </LinearLayout>

                    </androidx.cardview.widget.CardView>

                </LinearLayout>

            </com.google.android.material.card.MaterialCardView>

            <com.google.android.material.card.MaterialCardView
                android:id="@+id/article_view"
                android:visibility="gone"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:strokeColor="@color/color_accent"
                app:strokeWidth="1dp"

                app:cardCornerRadius="15dp"
                android:layout_marginHorizontal="15dp"
                android:layout_marginBottom="35dp"

                app:cardElevation="5dp"
                >

                <androidx.cardview.widget.CardView
                    android:id="@+id/article_card"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"

                    app:cardElevation="0dp"

                    app:cardCornerRadius="10dp"
                    android:layout_margin="5dp"
                    >

                    <ImageView
                        android:id="@+id/article_img"
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/_180sdp"

                        android:src="@drawable/ic_sub_1"
                        android:background="@color/color_accent"

                        android:scaleType="fitXY"

                        />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/_180sdp"
                        android:orientation="vertical"
                        android:gravity="bottom"
                        android:background="@drawable/article_home_tint"
                        >

                        <TextView
                            android:id="@+id/article_title"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"

                            android:text="What are the treatments for Dementia?"
                            android:fontFamily="@font/nunito_bold"
                            android:textColor="@color/white"
                            android:textSize="@dimen/_16ssp"

                            android:layout_marginHorizontal="15dp"

                            android:maxLines="2"
                            android:ellipsize="end"

                            />

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="15dp"
                            android:layout_marginBottom="5dp"
                            android:layout_marginHorizontal="15dp"
                            android:gravity="center_vertical"
                            android:orientation="horizontal">

                            <de.hdodenhof.circleimageview.CircleImageView
                                android:id="@+id/author_img"
                                android:layout_width="@dimen/_20sdp"
                                android:layout_height="@dimen/_20sdp"

                                android:src="@drawable/static_3"

                                />

                            <TextView
                                android:id="@+id/article_author_name"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"

                                tools:text="@string/aditya_gaikwad"
                                android:fontFamily="@font/nunito_regular"
                                android:textColor="@color/white"
                                android:textSize="@dimen/_12ssp"

                                android:layout_marginStart="15dp"

                                android:maxLines="1"
                                android:ellipsize="end"
                                android:ems="4"

                                />

                            <ImageView
                                android:layout_width="5dp"
                                android:layout_height="5dp"

                                android:src="@drawable/ic_white_dot"

                                android:layout_marginStart="10dp"
                                android:layout_marginEnd="5dp"

                                app:tint="@color/white" />

                            <TextView
                                android:id="@+id/article_created_at"
                                android:visibility="visible"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"

                                android:text="02 sep 23, 11;23 am"
                                android:fontFamily="@font/nunito_regular"
                                android:textColor="@color/white"
                                android:textSize="@dimen/_12ssp"

                                android:layout_marginStart="5dp"

                                />

                        </LinearLayout>

                        <TextView
                            android:id="@+id/view_more_article"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"

                            android:text="@string/view_more"
                            android:fontFamily="@font/nunito_regular"
                            android:textColor="@color/white"
                            android:textSize="@dimen/_12ssp"

                            android:layout_gravity="end"

                            android:layout_marginBottom="5dp"
                            android:layout_marginEnd="10dp"

                            android:padding="5dp"
                            />

                    </LinearLayout>

                </androidx.cardview.widget.CardView>

            </com.google.android.material.card.MaterialCardView>

        </LinearLayout>

    </ScrollView>

</RelativeLayout>