<?xml version="1.0" encoding="utf-8"?><!--
  ownCloud Android client application

  Copyright (C) 2012  Bartek Przybylski
  Copyright (C) 2016 ownCloud GmbH.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 2,
  as published by the Free Software Foundation.

  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/>.
-->
<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:id="@+id/login_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/login_background_image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop"
        android:src="@drawable/login_background_image"
        android:visibility="gone"
        tools:ignore="ContentDescription"
        tools:visibility="visible" />

    <ScrollView
        android:id="@+id/scroll"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:fillViewport="true"
        android:orientation="vertical">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/layout_login"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:gravity="center"
                android:orientation="vertical"
                android:padding="10dp"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <ImageView
                    android:id="@+id/thumbnail"
                    android:layout_width="match_parent"
                    android:layout_height="100dp"
                    android:layout_marginBottom="50dp"
                    android:contentDescription="@string/app_name"
                    android:src="@drawable/logo" />

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

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/webfinger_username_container"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:hintEnabled="false">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/webfinger_username"
                            style="@style/EditText.Authenticator"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:drawablePadding="5dp"
                            android:hint="@string/auth_username"
                            android:inputType="textNoSuggestions"
                            android:theme="@style/Theme.ownCloud.Authenticator.EditText">

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

                    <TextView
                        android:id="@+id/webfinger_status_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:contentDescription="@string/auth_testing_connection"
                        android:drawableStart="@android:drawable/stat_notify_sync"
                        android:drawablePadding="5dp"
                        android:gravity="center_vertical"
                        android:minHeight="32dp"
                        android:textColor="@color/login_connection_text_color"
                        android:visibility="gone"
                        app:drawableTint="@color/login_connection_text_color"
                        tools:text="@string/auth_testing_connection" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/webfinger_button"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:contentDescription="@string/global_proceed"
                        android:text="@string/global_proceed"
                        android:theme="@style/Button.Authenticator" />

                </LinearLayout>

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

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/centeredRefreshButton"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginBottom="10dp"
                        android:contentDescription="@string/auth_check_server"
                        android:text="@string/auth_check_server"
                        android:theme="@style/Button.Authenticator"
                        android:visibility="gone" />

                    <TextView
                        android:id="@+id/instructions_message"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="fill_horizontal"
                        android:layout_marginBottom="10dp"
                        android:contentDescription="@string/auth_expired_basic_auth_toast"
                        android:text="@string/auth_expired_basic_auth_toast"
                        android:textColor="@color/login_text_color"
                        android:visibility="gone" />

                    <FrameLayout
                        android:id="@+id/hostUrlFrame"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="0dp"
                        android:focusable="true">

                        <EditText
                            android:id="@+id/hostUrlInput"
                            style="@style/EditText.Authenticator"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_gravity="bottom"
                            android:drawablePadding="5dp"
                            android:hint="@string/auth_host_url"
                            android:inputType="textUri"
                            android:paddingEnd="55dp"
                            android:theme="@style/Theme.ownCloud.Authenticator.EditText">

                            <requestFocus />
                        </EditText>

                        <ImageButton
                            android:id="@+id/embeddedCheckServerButton"
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_gravity="center_vertical|end"
                            android:layout_marginEnd="5dp"
                            android:background="@android:color/transparent"
                            android:contentDescription="@string/auth_refresh_button"
                            android:padding="0dp"
                            android:scaleType="fitCenter"
                            android:src="@drawable/ic_arrow_right"
                            app:tint="@color/login_text_color" />

                        <ImageButton
                            android:id="@+id/embeddedRefreshButton"
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_gravity="center_vertical|end"
                            android:layout_marginEnd="5dp"
                            android:background="@android:color/transparent"
                            android:contentDescription="@string/auth_refresh_button"
                            android:padding="0dp"
                            android:scaleType="fitCenter"
                            android:src="@drawable/ic_action_refresh"
                            android:visibility="gone" />
                    </FrameLayout>

                    <TextView
                        android:id="@+id/server_status_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:contentDescription="@string/auth_testing_connection"
                        android:drawableStart="@android:drawable/stat_notify_sync"
                        android:drawablePadding="5dp"
                        android:gravity="center_vertical"
                        android:minHeight="32dp"
                        android:textColor="@color/login_connection_text_color"
                        android:visibility="invisible"
                        app:drawableTint="@color/login_connection_text_color"
                        tools:text="@string/auth_testing_connection"
                        tools:visibility="visible" />

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/account_username_container"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        app:hintEnabled="false">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/account_username"
                            style="@style/EditText.Authenticator"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:drawablePadding="5dp"
                            android:hint="@string/auth_username"
                            android:inputType="textNoSuggestions"
                            android:theme="@style/Theme.ownCloud.Authenticator.EditText">

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

                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/account_password_container"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone"
                        app:hintEnabled="false"
                        app:passwordToggleEnabled="true"
                        app:passwordToggleTint="@color/login_text_color">

                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/account_password"
                            style="@style/EditText.Authenticator"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:drawablePadding="5dp"
                            android:hint="@string/auth_password"
                            android:inputType="textPassword"
                            android:theme="@style/Theme.ownCloud.Authenticator.EditText">

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

                    <TextView
                        android:id="@+id/auth_status_text"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:contentDescription="@string/auth_unauthorized"
                        android:drawablePadding="5dp"
                        android:gravity="center_vertical"
                        android:textColor="@color/login_credentials_text_color"
                        android:visibility="gone"
                        app:drawableTint="@color/login_credentials_text_color"
                        tools:text="@string/auth_unauthorized" />

                    <androidx.appcompat.widget.AppCompatButton
                        android:id="@+id/loginButton"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:contentDescription="@string/setup_btn_login"
                        android:text="@string/setup_btn_login"
                        android:theme="@style/Button.Authenticator"
                        android:visibility="gone"
                        tools:visibility="visible" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_horizontal">

                    <Button
                        android:id="@+id/welcome_link"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@android:color/transparent"
                        android:contentDescription="@string/auth_register"
                        android:gravity="center"
                        android:paddingTop="5dp"
                        android:paddingBottom="5dp"
                        android:text="@string/auth_register"
                        android:textColor="@color/login_text_color" />
                </LinearLayout>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/standard_margin"
                android:layout_marginBottom="@dimen/standard_margin"
                android:gravity="end"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.0"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/layout_login"
                app:layout_constraintVertical_bias="1.0">

                <Button
                    android:id="@+id/settings_link"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@android:color/transparent"
                    android:contentDescription="@string/actionbar_settings"
                    android:gravity="center"
                    android:text="@string/actionbar_settings"
                    android:textColor="@color/login_text_color" />

            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>
    </ScrollView>
</FrameLayout>
