<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

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

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_server_info"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold"
            android:layout_marginBottom="8dp"
            android:accessibilityHeading="true" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_server_name"
            android:labelFor="@+id/server_name_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/server_name_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

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

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pref_title_server_status"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textStyle="bold"
                android:layout_marginBottom="8dp"
                android:accessibilityHeading="true" />

            <TextView
                android:id="@+id/user_count_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pref_title_server_usercount"
                android:padding="8dp" />

            <TextView
                android:id="@+id/motd_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pref_title_server_motd"
                android:padding="8dp" />

            <TextView
                android:id="@+id/country_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/pref_title_server_country"
                android:padding="8dp"
                android:layout_marginBottom="16dp" />
        </LinearLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_server_connection"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold"
            android:layout_marginBottom="8dp"
            android:accessibilityHeading="true" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_server_address"
            android:labelFor="@+id/ip_address_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/ip_address_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:baselineAligned="false" android:orientation="horizontal"
            android:layout_marginBottom="8dp">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical"
                android:layout_marginEnd="8dp">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/pref_title_tcp_port"
                    android:labelFor="@+id/tcp_port_edit"
                    android:layout_marginBottom="4dp" />

                <com.google.android.material.textfield.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/tcp_port_edit"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="number"
                        android:maxLength="5"
                        android:text="@string/default_port"
                        android:singleLine="true"
                        android:selectAllOnFocus="true" />
                </com.google.android.material.textfield.TextInputLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:orientation="vertical"
                android:layout_marginStart="8dp">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/pref_title_udp_port"
                    android:labelFor="@+id/udp_port_edit"
                    android:layout_marginBottom="4dp" />

                <com.google.android.material.textfield.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/udp_port_edit"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:inputType="number"
                        android:maxLength="5"
                        android:text="@string/default_port"
                        android:singleLine="true"
                        android:selectAllOnFocus="true" />
                </com.google.android.material.textfield.TextInputLayout>
            </LinearLayout>
        </LinearLayout>

        <CheckBox
            android:id="@+id/encrypted_checkbox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_encription"
            android:layout_marginBottom="16dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_authentication"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold"
            android:layout_marginBottom="8dp"
            android:accessibilityHeading="true" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_username"
            android:labelFor="@+id/username_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/username_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_password"
            android:labelFor="@+id/password_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/password_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <CheckBox
            android:id="@+id/web_login_checkbox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_bearware"
            android:layout_marginBottom="8dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_nickname"
            android:labelFor="@+id/nickname_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/nickname_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_statusmsg"
            android:labelFor="@+id/statusmsg_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/statusmsg_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_join_channel"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold"
            android:layout_marginBottom="8dp"
            android:accessibilityHeading="true" />

        <CheckBox
            android:id="@+id/remember_last_channel_checkbox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_last_channel"
            android:layout_marginBottom="8dp" />

        <TextView
            android:id="@+id/channel_label"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_channel"
            android:labelFor="@+id/channel_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/channel_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/channel_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:id="@+id/channel_password_label"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_channel_password"
            android:labelFor="@+id/channel_password_edit"
            android:layout_marginBottom="4dp" />

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/channel_password_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/channel_password_edit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

        <TextView
            android:id="@+id/pref_title_joincode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/pref_title_joincode"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textStyle="bold"
            android:layout_marginBottom="8dp"
            android:accessibilityHeading="true" />

        <TextView
            android:id="@+id/text_joincode"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/text_joincode"
            android:labelFor="@+id/joincode_edit"
            android:layout_marginBottom="4dp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >
            <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/joincode_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/joincode_edit"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:selectAllOnFocus="true"
                        android:singleLine="true" />
                </com.google.android.material.textfield.TextInputLayout>
            <Button
                android:id="@+id/copy_joincode_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/text_copy" />

        </LinearLayout>

    </LinearLayout>
</ScrollView>