<!--
  ~ Copyright (c) 2015. Ncomz. All Rights Reserved
  -->

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/llPageRoot"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/color_body_01"
        android:fitsSystemWindows="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:orientation="vertical">

    <include layout="@layout/app_toolbar"/>

    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

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

            <android.support.v4.widget.SwipeRefreshLayout
                    android:id="@+id/swiperefreshlayou"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:visibility="visible">

                <com.ntels.onecable.common.widget.CustomScrollView
                        android:id="@+id/svBody"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:fadingEdge="none"
                        android:overScrollMode="never"
                        android:fillViewport="true">

                    <LinearLayout
                            android:id="@+id/llSvbody"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical"
                            android:background="@drawable/color_bg_01">

                        <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:orientation="horizontal"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="76dp"
                                    android:paddingTop="18dp"
                                    android:paddingBottom="18dp"
                                    android:gravity="center_vertical">
                                <TextView
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:textStyle="bold"
                                        android:text="@string/layout_rules_detail_02"
                                        style="@style/list_detail_text" android:id="@+id/textView3"/>
                            </LinearLayout>

                            <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:background="@drawable/color_bg_01"
                                    android:orientation="horizontal"
                                    android:paddingBottom="18dp"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="76dp">

                                <TextView
                                        android:id="@+id/tvRulesName"
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_weight="1"
                                        android:maxLength="40"
                                        android:singleLine="true"
                                        android:textStyle="bold"
                                        style="@style/list_detail_text_color"/>
                                <ImageView
                                        android:id="@+id/ivRulesNameAdd"
                                        android:layout_width="40dp"
                                        android:layout_height="40dp"
                                        android:layout_marginLeft="18dp"
                                        android:layout_marginTop="4dp"
                                        android:layout_marginBottom="4dp"
                                        android:duplicateParentState="false"
                                        android:background="@drawable/d_common_list_btn_add"
                                        android:visibility="gone"/>
                                <Button
                                        android:id="@+id/btnRulesNameOk"
                                        android:layout_width="60dp"
                                        android:layout_height="42dp"
                                        android:layout_marginLeft="18dp"
                                        android:layout_marginTop="4dp"
                                        android:layout_marginBottom="4dp"
                                        android:text="@string/layout_ok"
                                        android:textColor="@color/color_text_05"
                                        android:background="@drawable/d_img_btn_common2"
                                        android:visibility="gone"/>
                            </LinearLayout>
                        </LinearLayout>

                        <View style="@style/width_Divider_01"/>

                        <LinearLayout
                                android:id="@+id/llTrigger"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">

                            <LinearLayout
                                    android:id="@+id/llTriggerTitle"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:gravity="center_vertical"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="18dp"
                                    android:background="@drawable/d_common_bg_list1">

                                <TextView
                                        android:id="@+id/tvTriggerTitle"
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_weight="1"
                                        android:layout_marginTop="18dp"
                                        android:layout_marginBottom="18dp"
                                        android:textStyle="bold"
                                        android:text="@string/layout_rules_detail_03"
                                        style="@style/list_detail_text"/>

                                <ImageView
                                        android:id="@+id/ivTriggerAdd"
                                        android:layout_width="wrap_content"
                                        android:layout_height="40dp"
                                        android:layout_marginLeft="18dp"
                                        android:duplicateParentState="true"
                                        android:background="@drawable/d_common_list_btn_add"
                                        android:visibility="invisible"/>
                            </LinearLayout>


                            <LinearLayout
                                    android:id="@+id/llTriggerBody"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginLeft="9dp"
                                    android:layout_marginRight="9dp"
                                    android:orientation="vertical">
                            </LinearLayout>
                        </LinearLayout>

                        <LinearLayout
                                android:id="@+id/llAction"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">

                            <LinearLayout
                                    android:id="@+id/llActionTitle"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:gravity="center_vertical"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="18dp"
                                    android:background="@drawable/d_common_bg_list1">

                                <TextView
                                        android:id="@+id/tvActionTitle"
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_weight="1"
                                        android:layout_marginTop="18dp"
                                        android:layout_marginBottom="18dp"
                                        android:textStyle="bold"
                                        android:text="@string/layout_rules_detail_04"
                                        style="@style/list_detail_text"/>

                                <ImageView
                                        android:id="@+id/ivActionAdd"
                                        android:layout_width="40dp"
                                        android:layout_height="40dp"
                                        android:layout_marginLeft="18dp"
                                        android:duplicateParentState="true"
                                        android:background="@drawable/d_common_list_btn_add"
                                        android:visibility="invisible"/>
                            </LinearLayout>


                            <LinearLayout
                                    android:id="@+id/llActionBody"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:layout_marginLeft="9dp"
                                    android:layout_marginRight="9dp"
                                    android:orientation="vertical">
                            </LinearLayout>
                        </LinearLayout>

                        <LinearLayout
                                android:id="@+id/llAlarm"
                                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:orientation="horizontal"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="76dp"
                                    android:paddingTop="18dp"
                                    android:paddingBottom="18dp"
                                    android:gravity="center_vertical">
                                <TextView
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:textStyle="bold"
                                        android:text="@string/layout_rules_detail_05"
                                        style="@style/list_detail_text"/>
                            </LinearLayout>

                            <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:background="@drawable/color_bg_01"
                                    android:gravity="center_vertical"
                                    android:orientation="horizontal"
                                    android:paddingBottom="15dp"
                                    android:paddingLeft="10dp"
                                    android:paddingRight="18dp">

                                <TextView
                                        android:id="@+id/tvAlarmMsg"
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_gravity="center_vertical"
                                        android:layout_weight="1"
                                        android:includeFontPadding="false"
                                        android:maxHeight="107dp"
                                        android:scrollbars="vertical"
                                        style="@style/common_input_edittext"/>
                                <ImageView
                                        android:id="@+id/ivAlarmMsgAdd"
                                        android:layout_width="40dp"
                                        android:layout_height="40dp"
                                        android:layout_marginLeft="18dp"
                                        android:layout_marginTop="4dp"
                                        android:layout_marginBottom="4dp"
                                        android:duplicateParentState="false"
                                        android:background="@drawable/d_common_list_btn_add"
                                        android:visibility="gone"/>
                                <Button
                                        android:id="@+id/btnAlarmMsgOk"
                                        android:layout_width="60dp"
                                        android:layout_height="42dp"
                                        android:layout_marginLeft="18dp"
                                        android:layout_marginTop="4dp"
                                        android:layout_marginBottom="4dp"
                                        android:text="@string/layout_ok"
                                        android:textColor="@color/color_text_05"
                                        android:background="@drawable/d_img_btn_common2"
                                        android:visibility="gone"/>
                            </LinearLayout>
                        </LinearLayout>

                        <View style="@style/width_Divider_01"/>

                        <LinearLayout
                                android:id="@+id/llCondition"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="vertical">

                            <LinearLayout
                                    android:id="@+id/llConditionTitle"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="horizontal"
                                    android:gravity="center_vertical"
                                    android:paddingLeft="15dp"
                                    android:paddingRight="18dp"
                                    android:background="@drawable/d_common_bg_list1"
                                    android:visibility="gone">

                                <TextView
                                        android:id="@+id/tvConditionTitle"
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_weight="1"
                                        android:textStyle="bold"
                                        android:text="@string/layout_rules_edit_07"
                                        style="@style/list_detail_text"/>

                                <ImageView
                                        android:id="@+id/ivConditionAdd"
                                        android:layout_width="40dp"
                                        android:layout_height="40dp"
                                        android:layout_marginLeft="18dp"
                                        android:layout_marginTop="8dp"
                                        android:layout_marginBottom="8dp"
                                        android:duplicateParentState="true"
                                        android:background="@drawable/d_common_list_btn_add"
                                        android:visibility="invisible"/>
                            </LinearLayout>


                            <LinearLayout
                                    android:id="@+id/llConditionBody"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:orientation="vertical"
                                    android:visibility="visible">

                                <LinearLayout
                                        android:id="@+id/llConditionBody1Title"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:gravity="center_vertical"
                                        android:paddingBottom="8dp"
                                        android:paddingLeft="15dp"
                                        android:paddingRight="15dp"
                                        android:paddingTop="10dp"
                                        android:visibility="gone">

                                    <TextView
                                            android:id="@+id/tvAddCondition1"
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:includeFontPadding="false"
                                            android:text="@string/layout_rules_detail_06"
                                            android:textColor="@color/color_text_03"
                                            android:textSize="@dimen/size_font_04"
                                            android:textStyle="bold"
                                            style="@style/list_detail_text"
                                    />

                                    <ImageView
                                            android:id="@+id/ivConditionBody1TitleAdd"
                                            android:layout_width="30dp"
                                            android:layout_height="30dp"
                                            android:layout_marginLeft="20dp"
                                            android:background="@drawable/d_common_list_btn_add"
                                            android:visibility="gone"/>
                                </LinearLayout>

                                <LinearLayout
                                        android:id="@+id/llConditionBody1"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="9dp"
                                        android:layout_marginRight="9dp"
                                        android:orientation="vertical">
                                </LinearLayout>

                                <LinearLayout
                                        android:id="@+id/llConditionBody2Title"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:gravity="center_vertical"
                                        android:paddingBottom="8dp"
                                        android:paddingLeft="15dp"
                                        android:paddingRight="15dp"
                                        android:paddingTop="10dp"
                                        android:visibility="gone">

                                    <TextView
                                            android:id="@+id/tvAddCondition2"
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:includeFontPadding="false"
                                            android:text="@string/layout_rules_detail_07"
                                            android:textColor="@color/color_text_03"
                                            android:textSize="@dimen/size_font_04"
                                            android:textStyle="bold"
                                    />

                                    <ImageView
                                            android:id="@+id/ivConditionBody2TitleAdd"
                                            android:layout_width="30dp"
                                            android:layout_height="30dp"
                                            android:layout_marginLeft="20dp"
                                            android:background="@drawable/d_common_list_btn_add"
                                            android:visibility="gone"/>
                                </LinearLayout>

                                <LinearLayout
                                        android:id="@+id/llConditionBody2"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="9dp"
                                        android:layout_marginRight="9dp"
                                        android:orientation="vertical">
                                </LinearLayout>

                                <LinearLayout
                                        android:id="@+id/llConditionBody3Title"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:gravity="center_vertical"
                                        android:paddingBottom="8dp"
                                        android:paddingLeft="15dp"
                                        android:paddingRight="15dp"
                                        android:paddingTop="10dp"
                                        android:visibility="gone">

                                    <TextView
                                            android:id="@+id/tvAddCondition3"
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:includeFontPadding="false"
                                            android:text="@string/layout_rules_detail_08"
                                            android:textColor="@color/color_text_03"
                                            android:textSize="@dimen/size_font_04"
                                            android:textStyle="bold"
                                    />

                                    <ImageView
                                            android:id="@+id/ivConditionBody3TitleAdd"
                                            android:layout_width="30dp"
                                            android:layout_height="30dp"
                                            android:layout_marginLeft="20dp"
                                            android:background="@drawable/d_common_list_btn_add"
                                            android:visibility="gone"/>
                                </LinearLayout>

                                <LinearLayout
                                        android:id="@+id/llConditionBody3"
                                        android:layout_width="match_parent"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="9dp"
                                        android:layout_marginRight="9dp"
                                        android:orientation="vertical">
                                </LinearLayout>
                            </LinearLayout>
                        </LinearLayout>
                        <LinearLayout
                                android:id="@+id/llState"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal"
                                android:paddingLeft="15dp"
                                android:paddingRight="18dp"
                                android:paddingTop="12dp"
                                android:paddingBottom="12dp"
                                android:gravity="center_vertical">

                            <TextView
                                    android:layout_width="0dp"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:textStyle="bold"
                                    android:text="@string/layout_rules_detail_09"
                                    style="@style/list_detail_text"/>
                            <com.kyleduo.switchbutton.SwitchButton
                                    android:id="@+id/sbOnOff"
                                    android:layout_width="54dp"
                                    android:layout_height="wrap_content"
                                    android:gravity="center_vertical"
                                    app:kswThumbWidth="32dp"
                                    app:kswThumbHeight="32dp"
                                    app:kswBackRadius="32dp"
                                    app:kswBackColor="@drawable/d_common_toggle_btn_back"
                                    app:kswThumbColor="@color/rule_toggle_switch_thumb"/>
                        </LinearLayout>

                        <TextView
                                android:id="@+id/tvNotice"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:paddingLeft="15dp"
                                android:paddingRight="18dp"
                                android:layout_marginBottom="18dp"
                                android:text="@string/layout_rules_detail_11"
                                android:textStyle="bold"
                                style="@style/list_detail_text_color"
                                android:visibility="gone"/>

                        <LinearLayout
                                android:id="@+id/llLastActionTime"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal"
                                android:paddingLeft="15dp"
                                android:paddingRight="18dp"
                                android:paddingTop="18dp"
                                android:paddingBottom="18dp"
                                android:gravity="center_vertical">
                            <TextView
                                    android:layout_width="0dp"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:textStyle="bold"
                                    android:text="@string/layout_rules_detail_10"
                                    style="@style/list_detail_text"/>
                            <TextView
                                    android:id="@+id/tvLastActionTime"
                                    android:layout_width="0dp"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:textStyle="bold"
                                    android:gravity="right"
                                    android:textColor="@color/color_text_03"
                                    style="@style/list_detail_text"/>
                        </LinearLayout>
                    </LinearLayout>
                </com.ntels.onecable.common.widget.CustomScrollView>
            </android.support.v4.widget.SwipeRefreshLayout>
        </LinearLayout>
    </RelativeLayout>

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

        <View
                style="@style/width_Divider_02"/>

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

            <View
                    style="@style/width_Divider_02"/>

            <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    android:layout_gravity="center_horizontal"
                    android:background="@drawable/color_bg_01"
                    android:gravity="center">

                <LinearLayout
                        android:id="@+id/llBtn1"
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:gravity="center">

                    <TextView
                            android:id="@+id/tvBtn1"
                            android:text="@string/layout_close"
                            style="@style/bottom_button_text_no"/>
                </LinearLayout>

            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>