<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2016 Tobias Brunner
    HSR Hochschule fuer Technik Rapperswil

    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="10dp"
        android:animateLayoutChanges="true" >

        <androidx.core.widget.ContentLoadingProgressBar
            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
            android:id="@+id/progress_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:indeterminate="true" />

        <TextView
            android:id="@+id/exists_warning"
            android:background="@drawable/state_background"
            android:padding="8dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:drawableLeft="@android:drawable/ic_dialog_alert"
            android:drawableStart="@android:drawable/ic_dialog_alert"
            android:drawablePadding="8dp"
            android:textStyle="bold"
            android:text="@string/profile_import_exists"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="?android:attr/textColorPrimary" />

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

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textSize="12sp"
                android:text="@string/profile_name_label_simple" />

            <TextView
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="?android:attr/textColorPrimary" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textSize="12sp"
                android:text="@string/profile_gateway_label" />

            <TextView
                android:id="@+id/gateway"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="?android:attr/textColorPrimary" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textSize="12sp"
                android:text="@string/profile_vpn_type_label" />

            <TextView
                android:id="@+id/vpn_type"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:layout_marginLeft="4dp"
                android:layout_marginStart="4dp"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="?android:attr/textColorPrimary" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/username_password_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="6dp">

            <org.strongswan.android.ui.widget.TextInputLayoutHelper
                android:id="@+id/username_wrap"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/profile_username_label" >

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/username"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:inputType="textNoSuggestions" />

            </org.strongswan.android.ui.widget.TextInputLayoutHelper>

            <org.strongswan.android.ui.widget.TextInputLayoutHelper
                android:id="@+id/password_wrap"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:hint="@string/profile_password_label"
                app:helper_text="@string/profile_password_hint" >

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

            </org.strongswan.android.ui.widget.TextInputLayoutHelper>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/user_certificate_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="4dp"
            android:orientation="vertical" >

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:layout_marginLeft="4dp"
                android:textSize="12sp"
                android:text="@string/profile_user_certificate_label" />

            <include
                android:id="@+id/select_user_certificate"
                layout="@layout/two_line_button" />

            <Button
                android:id="@+id/import_user_certificate"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dp"
                android:layout_marginRight="4dp"
                android:text="@string/profile_cert_import" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/remote_certificate_group"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="4dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4dp"
                android:textSize="12sp"
                android:text="@string/profile_ca_label" />

            <include
                android:id="@+id/remote_certificate"
                layout="@layout/two_line_button" />
        </LinearLayout>

    </LinearLayout>

</ScrollView>
