<?xml version="1.0" encoding="utf-8"?>
<!--
  ~     Pupil, Hitomi.la viewer for Android
  ~     Copyright (C) 2020  tom5079
  ~
  ~     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 3 of the License, or
  ~     (at your option) any later version.
  ~
  ~     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.
  ~
  ~     You should have received a copy of the GNU General Public License
  ~     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:padding="16dp">

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="16dp"
        style="@style/TextAppearance.AppCompat.Large"
        android:text="@string/settings_proxy_title"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>

    <TextView
        android:id="@+id/type_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        android:text="@string/proxy_dialog_type"
        android:textAppearance="?android:attr/listSeparatorTextViewStyle"/>

    <Spinner
        android:id="@+id/type_selector"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/type_text"/>

    <TextView
        android:id="@+id/server_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/type_selector"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        android:text="@string/proxy_dialog_server"
        android:textAppearance="?android:attr/listSeparatorTextViewStyle"/>

    <LinearLayout
        android:id="@+id/address_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/server_text">

        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/addr"
            android:layout_width="0dp"
            android:layout_weight="2"
            android:layout_height="wrap_content"
            android:hint="@string/proxy_dialog_addr_hint"/>

        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/port"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:hint="@string/proxy_dialog_port_hint"/>

    </LinearLayout>

    <androidx.appcompat.widget.AppCompatEditText
        android:id="@+id/username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/address_layout"
        android:hint="@string/proxy_dialog_username_hint"
        android:enabled="false"/>

    <androidx.appcompat.widget.AppCompatEditText
        android:id="@+id/password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/username"
        android:hint="@string/proxy_dialog_password_hint"
        android:enabled="false"/>

    <Button
        android:id="@+id/cancel_button"
        style="?borderlessButtonStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@android:string/cancel"
        app:layout_constraintTop_toBottomOf="@id/password"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@id/ok_button"
        app:layout_constraintRight_toLeftOf="@id/ok_button"/>

    <Button
        android:id="@+id/ok_button"
        style="?borderlessButtonStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@android:string/ok"
        app:layout_constraintTop_toBottomOf="@id/password"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintRight_toRightOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>