<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".home.HomeMenuFragment">

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

        <LinearLayout
            android:id="@+id/gradient_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingHorizontal="16dp"
            android:paddingTop="20dp"
            android:paddingBottom="12dp">

            <LinearLayout
                android:id="@+id/main"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <LinearLayout
                    android:id="@+id/familyHeaderLayout"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="center_vertical"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tvCurrentFamily"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:text="@string/my_family_home"
                        android:textColor="@color/black"
                        android:textSize="20dp"
                        android:maxLines="1"
                        android:ellipsize="end"
                        android:textStyle="bold" />

                    <ImageView
                        android:id="@+id/ivFamilyArrow"
                        android:layout_width="12dp"
                        android:layout_height="6dp"
                        android:layout_marginStart="6dp"
                        android:src="@drawable/triangle" />
                </LinearLayout>

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"/>

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

                    <FrameLayout
                        android:id="@+id/message"
                        android:layout_width="38dp"
                        android:layout_height="38dp"
                        android:layout_marginEnd="10dp"
                        android:background="@drawable/bg_home_top_icon_light"
                        android:padding="7dp">

                        <ImageView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:src="@drawable/message"/>

                        <TextView
                            android:id="@+id/tvUnreadCount"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="end|top"
                            android:background="@drawable/bg_unread_dot"
                            android:minWidth="16dp"
                            android:height="16dp"
                            android:gravity="center"
                            android:textSize="10sp"
                            android:textColor="@color/white"
                            android:visibility="gone" />
                    </FrameLayout>

                    <FrameLayout
                        android:id="@+id/add_family"
                        android:layout_width="38dp"
                        android:layout_height="38dp"
                        android:layout_marginEnd="10dp"
                        android:background="@drawable/bg_home_top_icon_light"
                        android:padding="7dp">

                        <ImageView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:src="@drawable/scan_icon"/>
                    </FrameLayout>

                    <FrameLayout
                        android:id="@+id/add"
                        android:layout_width="38dp"
                        android:layout_height="38dp"
                        android:background="@drawable/bg_home_top_icon_green"
                        android:padding="7dp">

                        <ImageView
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:src="@drawable/add"/>
                    </FrameLayout>
                </LinearLayout>
            </LinearLayout>
            <TextView
                android:id="@+id/tvDeviceTitle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="14dp"
                android:layout_marginEnd="16dp"
                android:text="@string/device"
                android:textColor="@color/black"
                android:textSize="16dp"
                android:textStyle="bold" />
        </LinearLayout>

        <GridLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="16dp"
            android:layout_marginEnd="16dp"
            android:columnCount="2"
            android:orientation="vertical"
            android:rowCount="1" >
        </GridLayout>

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefreshLayout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rvDeviceList"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginStart="12dp"
                android:layout_marginTop="8dp"
                android:layout_marginEnd="12dp"
                android:clipToPadding="false"
                android:nestedScrollingEnabled="false"
                android:paddingBottom="16dp"
                tools:listitem="@layout/item_device" />
        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

        <LinearLayout
            android:id="@+id/layoutNoPermission"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="center"
            android:orientation="vertical"
            android:paddingHorizontal="32dp"
            android:background="@color/white"
            android:visibility="gone">

            <ImageView
                android:layout_width="244dp"
                android:layout_height="131dp"
                android:src="@drawable/default_page" />

        </LinearLayout>
    </LinearLayout>

    <View
        android:id="@+id/familyPopupMask"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#4D000000"
        android:clickable="true"
        android:focusable="true"
        android:visibility="gone" />

    <LinearLayout
        android:id="@+id/familyPopupCard"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="92dp"
        android:background="@drawable/bg_family_popup"
        android:elevation="12dp"
        android:orientation="vertical"
        android:visibility="gone"
        android:padding="4dp">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rvFamilyList"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:nestedScrollingEnabled="false"
            tools:listitem="@layout/item_family" />
    </LinearLayout>

</FrameLayout>