<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright © 2013 – 2016 Ricki Hirner (bitfire web engineering).
  ~ All rights reserved. This program and the accompanying materials
  ~ are made available under the terms of the GNU Public License v3.0
  ~ which accompanies this distribution, and is available at
  ~ http://www.gnu.org/licenses/gpl.html
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <!-- We don't want the keyboard up when the user arrives in this initial screen -->
    <View android:layout_height="0dp"
          android:layout_width="0dp"
          android:focusable="true"
          android:focusableInTouchMode="true"
          android:contentDescription="@null"
          android:importantForAccessibility="no" tools:ignore="UnusedAttribute">
        <requestFocus/>
    </View>

    <ScrollView android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:layout_margin="@dimen/activity_margin">

        <RadioGroup
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:animateLayoutChanges="true">

            <RadioButton
                android:id="@+id/login_type_email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/login_type_email"
                android:paddingLeft="14dp" tools:ignore="RtlSymmetry"
                style="@style/login_type_headline"/>

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

                <EditText
                    android:id="@+id/email_address"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_email_address"
                    android:inputType="textEmailAddress"/>
                <at.bitfire.davdroid.ui.widget.EditPassword
                    android:id="@+id/email_password"
                    android:hint="@string/login_password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
            </LinearLayout>

            <RadioButton
                android:id="@+id/login_type_url"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/login_type_url"
                android:layout_marginTop="16dp"
                android:paddingLeft="14dp" tools:ignore="RtlSymmetry"
                style="@style/login_type_headline"/>

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

                <EditText
                    android:id="@+id/base_url"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_base_url"
                    android:inputType="textUri"/>
                <EditText
                    android:id="@+id/user_name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_user_name"
                    android:inputType="textEmailAddress"/>
                <at.bitfire.davdroid.ui.widget.EditPassword
                    android:id="@+id/url_password"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/login_password"/>

            </LinearLayout>

        </RadioGroup>
    </ScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/stepper_nav_bar">

        <Space
            android:layout_width="0dp"
            android:layout_weight="1"
            style="@style/stepper_nav_button"/>

        <Button
            android:id="@+id/login"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:text="@string/login_login"
            style="@style/stepper_nav_button"/>

    </LinearLayout>
</LinearLayout>
