<?xml version="1.0" encoding="utf-8"?>
<layout 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">

    <data>

        <variable
            name="familyData"
            type="com.rdiot.yx485.bean.FamilyData" />

        <variable
            name="editMode"
            type="Boolean" />

        <import type="android.view.View" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".ui.family.FamilyInfoFragment">

        <View
            android:id="@+id/v"
            android:layout_width="match_parent"
            android:layout_height="0dp" />

        <com.rdiot.yx485.view.ZNavbar
            android:id="@+id/nb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:zRightText="@string/edit"
            app:zTitle="@string/family_info_edit" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingStart="20dp"
            android:paddingEnd="20dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="@string/basic_info"
                android:textColor="@color/main_text_color"
                android:textSize="15sp"
                android:textStyle="bold" />

            <!--家庭名称-->
            <LinearLayout
                android:id="@+id/ll_family_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20dp"
                    android:layout_marginBottom="20dp"
                    android:maxLines="1"
                    android:text="@string/family_name"
                    android:textColor="@color/main_text_color"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="10dp"
                    android:layout_weight="1"
                    android:ellipsize="end"
                    android:gravity="end"
                    android:maxLines="1"
                    android:text="@{familyData.name}"
                    android:textColor="@{editMode?@color/main_text_color:@color/main_sub_text_color}"
                    android:textSize="15sp"
                    tools:text="我的家" />

                <ImageView
                    android:id="@+id/iv_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:rotation="180"
                    android:visibility="@{editMode?View.VISIBLE:View.GONE}"
                    app:srcCompat="@mipmap/icon_back" />

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/dividing_line_color" />

            <!--所在地区-->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20dp"
                    android:layout_marginBottom="20dp"
                    android:text="@string/location"
                    android:textColor="@color/main_text_color"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end"
                    android:text="@{familyData.city}"
                    android:textColor="@color/main_sub_text_color"
                    android:textSize="15sp"
                    tools:text="佛山市" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:alpha="0.5"
                    android:rotation="180"
                    android:visibility="gone"
                    app:srcCompat="@mipmap/icon_back" />

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/dividing_line_color" />

            <!--主控序列号-->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:gravity="center"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="20dp"
                    android:layout_marginBottom="20dp"
                    android:text="@string/serial_number"
                    android:textColor="@color/main_text_color"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:gravity="end"
                    android:text="@{familyData.gateway}"
                    android:textColor="@color/main_sub_text_color"
                    android:textSize="15sp"

                    tools:text="105564786541" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="12dp"
                    android:alpha="0.5"
                    android:rotation="180"
                    android:visibility="gone"
                    app:srcCompat="@mipmap/icon_back" />

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/dividing_line_color" />
        </LinearLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="20dp"
            android:layout_marginTop="20dp"
            android:text="@string/family_member"
            android:textColor="@color/main_text_color"
            android:textSize="15sp"
            android:textStyle="bold" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginStart="10dp"
            android:layout_weight="1"
            tools:itemCount="1"
            tools:listitem="@layout/item_member" />


            <androidx.appcompat.widget.AppCompatButton
                android:id="@+id/btn_del_family"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="30dp"
                android:layout_marginEnd="30dp"
                android:layout_marginBottom="55dp"
                android:background="@drawable/bg_del_family_btn"
                android:outlineProvider="none"
                android:text="@string/delete_family"
                android:textColor="@color/warning"
                android:textSize="16sp"
                android:textStyle="bold"
                android:visibility="@{editMode?View.VISIBLE:View.GONE}" />
    </LinearLayout>
</layout>