<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".EditTransportActivity">

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

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/content_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:animateLayoutChanges="true">

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline_root_start_shifted"
                android:layout_width="wrap_content"
                android:layout_height="16dp"
                android:orientation="vertical"
                app:layout_constraintGuide_begin="14dp" />

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline_root_start"
                android:layout_width="wrap_content"
                android:layout_height="16dp"
                android:orientation="vertical"
                app:layout_constraintGuide_begin="16dp" />

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline_root_end"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_end="16dp" />

            <androidx.legacy.widget.Space
                android:id="@+id/fab_spacer"
                android:layout_width="wrap_content"
                android:layout_height="28dp" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/email"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/fab_spacer">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/email_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/email_address"
                    android:inputType="textEmailAddress" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/password"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/email">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/password_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/existing_password"
                    android:inputType="textPassword" />

            </com.google.android.material.textfield.TextInputLayout>

            <LinearLayout
                android:id="@+id/provider_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:layout_marginTop="12dp"
                android:orientation="vertical"
                android:visibility="gone"
                app:layout_constraintTop_toBottomOf="@id/password">

                <TextView
                    android:id="@+id/provider_hint"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="12dp"
                    android:textSize="16sp" />

                <TextView
                    android:id="@+id/provider_link"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingLeft="12dp"
                    android:paddingRight="12dp"
                    android:paddingBottom="12dp"
                    android:textSize="16sp"
                    android:text="@string/more_info_desktop"
                    android:textStyle="bold" />

            </LinearLayout>

            <TextView
                android:id="@+id/no_servers_hint"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:gravity="left"
                android:padding="16dp"
                android:text="@string/login_advanced_hint"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/provider_layout" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/advanced_group"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone"
                tools:visibility="visible"
                app:constraint_referenced_ids="inbox, imap_login, imap_server, imap_port, imap_security_label, imap_security, outbox_view_spacer_top,
            outbox, smtp_login, smtp_password, smtp_server, smtp_port, smtp_security_label, smtp_security, cert_check_label, cert_check, view_log_button, enforce_e2ee_switch" />

            <ImageView
                android:id="@+id/advanced_icon"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:contentDescription="@null"
                android:paddingTop="8dp"
                android:paddingBottom="8dp"
                android:src="@drawable/ic_close_white_24dp"
                android:tint="?attr/colorAccent"
                app:layout_constraintHorizontal_chainStyle="packed"
                app:layout_constraintStart_toStartOf="@+id/guideline_root_start_shifted"
                app:layout_constraintTop_toBottomOf="@id/no_servers_hint" />

            <TextView
                android:id="@+id/advanced_text"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:padding="8dp"
                android:gravity="start|center_vertical"
                android:text="@string/menu_more_options"
                android:textColor="?attr/colorAccent"
                android:textSize="16sp"
                app:layout_constraintHorizontal_chainStyle="packed"
                app:layout_constraintStart_toEndOf="@id/advanced_icon"
                app:layout_constraintTop_toBottomOf="@id/no_servers_hint" />

            <TextView
                android:id="@+id/inbox"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:gravity="center"
                android:layout_marginTop="8dp"
                android:text="@string/login_inbox"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/advanced_text" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/imap_login"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/inbox">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/imap_login_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textWebEmailAddress|textNoSuggestions"
                    android:hint="@string/login_imap_login" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/imap_server"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/imap_login">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/imap_server_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_imap_server"
                    android:inputType="textUri|textNoSuggestions" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/imap_port"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/imap_server">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/imap_port_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_imap_port"
                    android:inputType="number" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/imap_folder"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/imap_port">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/imap_folder_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:enabled="false"
                    android:hint="IMAP folder" />

            </com.google.android.material.textfield.TextInputLayout>

            <TextView
                android:id="@+id/imap_security_label"
                style="@style/TextAppearance.AppCompat.Caption"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/login_imap_security"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/imap_folder" />

            <Spinner
                android:id="@+id/imap_security"
                android:layout_width="0dp"
                android:layout_height="48dp"
                android:entries="@array/server_security"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/imap_security_label" />

            <androidx.legacy.widget.Space
                android:id="@+id/outbox_view_spacer_top"
                android:layout_width="wrap_content"
                android:layout_height="16dp"
                app:layout_constraintTop_toBottomOf="@id/imap_security" />

            <TextView
                android:id="@+id/outbox"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:gravity="center"
                android:text="@string/login_outbox"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/outbox_view_spacer_top" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/smtp_login"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/outbox">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/smtp_login_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textWebEmailAddress|textNoSuggestions"
                    android:hint="@string/login_smtp_login" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/smtp_password"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_login">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/smtp_password_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_smtp_password"
                    android:inputType="textPassword" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/smtp_server"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_password">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/smtp_server_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_smtp_server"
                    android:inputType="textUri|textNoSuggestions" />

            </com.google.android.material.textfield.TextInputLayout>

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/smtp_port"
                android:layout_width="0dp"
                android:layout_height="58dp"
                app:errorEnabled="true"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_server">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/smtp_port_text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_smtp_port"
                    android:inputType="number" />

            </com.google.android.material.textfield.TextInputLayout>

            <TextView
                android:id="@+id/smtp_security_label"
                style="@style/TextAppearance.AppCompat.Caption"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/login_smtp_security"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_port" />

            <Spinner
                android:id="@+id/smtp_security"
                android:layout_width="0dp"
                android:layout_height="48dp"
                android:entries="@array/server_security"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_security_label" />

            <TextView
                android:id="@+id/cert_check_label"
                style="@style/TextAppearance.AppCompat.Caption"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/login_certificate_checks"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/smtp_security" />

            <Spinner
                android:id="@+id/cert_check"
                android:layout_width="0dp"
                android:layout_height="48dp"
                android:entries="@array/pref_dc_certck_entries"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/cert_check_label" />

            <androidx.appcompat.widget.SwitchCompat
                android:id="@+id/enforce_e2ee_switch"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:paddingTop="16dp"
                android:paddingBottom="16dp"
                android:text="@string/enforce_e2ee"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/cert_check" />

            <TextView
                android:id="@+id/view_log_button"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/pref_view_log"
                android:textColor="?attr/colorAccent"
                android:textSize="16sp"
                android:textStyle="normal"
                android:typeface="sans"
                android:paddingTop="16dp"
                android:paddingBottom="32dp"
                app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
                app:layout_constraintStart_toStartOf="@id/guideline_root_start"
                app:layout_constraintTop_toBottomOf="@id/enforce_e2ee_switch" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </ScrollView>

</FrameLayout>
