<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    tools:context=".ui.HomeFragment">

    <TextView
        android:id="@+id/textConnectionStatus"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:background="@drawable/rounded_background"
        android:backgroundTint="@color/connection_status_background"
        android:enabled="true"
        android:gravity="center"
        android:padding="8dp"
        android:textColor="@android:color/white"
        android:visibility="gone"
        tools:text="@string/internet_connection_available" />

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

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

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="4dp"
                app:cardCornerRadius="16dp"
                app:contentPadding="8dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/imageLocalServer"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:layout_margin="4dp"
                        android:src="@drawable/ic_local_server"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/headerLocalServer"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:lines="1"
                        android:layout_marginStart="8dp"
                        android:text="@string/settings_local_server"
                        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
                        app:layout_constraintBottom_toBottomOf="@id/imageLocalServer"
                        app:layout_constraintStart_toEndOf="@id/imageLocalServer"
                        app:layout_constraintEnd_toStartOf="@+id/switchUseLocalServer"
                        app:layout_constraintTop_toTopOf="@id/imageLocalServer" />

                    <androidx.appcompat.widget.SwitchCompat
                        android:id="@+id/switchUseLocalServer"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="8dp"
                        app:layout_constraintBottom_toBottomOf="@id/imageLocalServer"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintTop_toTopOf="@id/imageLocalServer" />

                    <GridLayout
                        android:id="@+id/layoutLocalServer"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="4dp"
                        android:columnCount="2"
                        android:visibility="gone"
                        tools:visibility="visible"
                        app:layout_constraintEnd_toEndOf="@+id/switchUseLocalServer"
                        app:layout_constraintStart_toEndOf="@id/imageLocalServer"
                        app:layout_constraintTop_toBottomOf="@id/headerLocalServer">

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/local_address" />

                        <TextView
                            android:id="@+id/textLocalIP"
                            style="@style/HomeCardValue"
                            android:text="@string/dots"
                            tools:text="127.0.0.1:8080" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/public_address" />

                        <TextView
                            android:id="@+id/textPublicIP"
                            style="@style/HomeCardValue"
                            android:text="@string/dots"
                            tools:text="127.0.0.1:8080" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/label_username" />

                        <TextView
                            android:id="@+id/textLocalUsername"
                            style="@style/HomeCardValue"
                            tools:text="sms" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/label_password" />

                        <TextView
                            android:id="@+id/textLocalPassword"
                            style="@style/HomeCardValue"
                            tools:text="1q2w3e4r" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/device_id" />

                        <TextView
                            android:id="@+id/textLocalDeviceId"
                            style="@style/HomeCardValue"
                            tools:text="device-123" />
                    </GridLayout>
                </androidx.constraintlayout.widget.ConstraintLayout>

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

            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="4dp"
                app:cardCornerRadius="16dp"
                app:contentPadding="8dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:id="@+id/imageRemoteServer"
                        android:layout_width="24dp"
                        android:layout_height="24dp"
                        android:layout_margin="4dp"
                        android:src="@drawable/ic_cloud_server"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/headerRemoteServer"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:lines="1"
                        android:layout_margin="8dp"
                        android:text="@string/cloud_server"
                        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
                        app:layout_constraintBottom_toBottomOf="@id/imageRemoteServer"
                        app:layout_constraintStart_toEndOf="@id/imageRemoteServer"
                        app:layout_constraintEnd_toStartOf="@+id/switchUseRemoteServer"
                        app:layout_constraintTop_toTopOf="@id/imageRemoteServer" />

                    <androidx.appcompat.widget.SwitchCompat
                        android:id="@+id/switchUseRemoteServer"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="8dp"
                        app:layout_constraintBottom_toBottomOf="@id/imageRemoteServer"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintTop_toTopOf="@id/imageRemoteServer" />

                    <GridLayout
                        android:id="@+id/layoutRemoteServer"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="4dp"
                        android:columnCount="2"
                        android:visibility="gone"
                        tools:visibility="visible"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toEndOf="@id/imageRemoteServer"
                        app:layout_constraintTop_toBottomOf="@id/headerRemoteServer">


                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/server_address" />

                        <TextView
                            android:id="@+id/textRemoteAddress"
                            style="@style/HomeCardValue"
                            android:autoLink="web"
                            android:text="@string/dots"
                            tools:text="@string/settings_address_is_sms_capcom_me" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/label_username" />

                        <TextView
                            android:id="@+id/textRemoteUsername"
                            style="@style/HomeCardValue"
                            tools:text="1Q2W3E" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/label_password" />

                        <TextView
                            android:id="@+id/textRemotePassword"
                            style="@style/HomeCardValue"
                            tools:text="1q2w3e4r" />

                        <TextView
                            style="@style/HomeCardLabel"
                            android:text="@string/device_id" />

                        <TextView
                            android:id="@+id/textRemoteDeviceId"
                            style="@style/HomeCardValue"
                            tools:text="device-456" />
                    </GridLayout>
                </androidx.constraintlayout.widget.ConstraintLayout>

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

        </LinearLayout>

    </ScrollView>

    <androidx.appcompat.widget.SwitchCompat
        android:id="@+id/switchAutostart"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:text="@string/settings_start_on_boot" />

    <Space
        android:layout_width="match_parent"
        android:layout_height="8dp" />

    <ToggleButton
        android:id="@+id/buttonStart"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textOff="@string/settings_offline"
        android:textOn="@string/settings_online" />
</androidx.appcompat.widget.LinearLayoutCompat>