app/src/main/res/layout/activity_login_account.xml
changeset 0 14443efede32
child 62 c9d5f3546fc1
equal deleted inserted replaced
-1:000000000000 0:14443efede32
       
     1 <!--
       
     2 
       
     3     Geekttrss is a RSS feed reader application on the Android Platform.
       
     4 
       
     5     Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
       
     6 
       
     7     This file is part of Geekttrss.
       
     8 
       
     9     Geekttrss is free software: you can redistribute it and/or modify
       
    10     it under the terms of the GNU General Public License as published by
       
    11     the Free Software Foundation, either version 3 of the License, or
       
    12     (at your option) any later version.
       
    13 
       
    14     Geekttrss is distributed in the hope that it will be useful,
       
    15     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    17     GNU General Public License for more details.
       
    18 
       
    19     You should have received a copy of the GNU General Public License
       
    20     along with Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
       
    21 
       
    22 -->
       
    23 <layout xmlns:android="http://schemas.android.com/apk/res/android"
       
    24         xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto">
       
    25 
       
    26     <data>
       
    27         <import type="com.geekorum.ttrss.accounts.LoginViewModel" />
       
    28         <variable name="viewModel" type="com.geekorum.ttrss.accounts.LoginViewModel" />
       
    29     </data>
       
    30 
       
    31 <androidx.constraintlayout.widget.ConstraintLayout
       
    32     android:layout_width="match_parent"
       
    33     android:layout_height="match_parent"
       
    34     android:paddingBottom="@dimen/activity_vertical_margin"
       
    35     android:paddingLeft="@dimen/activity_horizontal_margin"
       
    36     android:paddingRight="@dimen/activity_horizontal_margin"
       
    37     android:paddingTop="@dimen/activity_vertical_margin"
       
    38     tools:context="com.geekorum.ttrss.accounts.LoginActivity">
       
    39 
       
    40     <!-- Login progress -->
       
    41     <ProgressBar
       
    42             android:id="@+id/login_progress"
       
    43             style="?android:attr/progressBarStyleLarge"
       
    44             android:layout_width="wrap_content"
       
    45             android:layout_height="wrap_content"
       
    46             app:layout_constraintStart_toStartOf="parent"
       
    47             app:layout_constraintEnd_toEndOf="parent"
       
    48             app:layout_constraintTop_toTopOf="parent"
       
    49             app:layout_constraintBottom_toBottomOf="parent"
       
    50             app:layout_constraintVertical_bias="0.1"
       
    51             android:visibility="gone" />
       
    52 
       
    53     <ScrollView
       
    54         android:id="@+id/login_form"
       
    55         android:layout_width="0dp"
       
    56         android:layout_height="match_parent"
       
    57         app:layout_constraintStart_toStartOf="parent"
       
    58         app:layout_constraintEnd_toEndOf="parent"
       
    59         app:layout_constraintWidth_max="320dp"  >
       
    60 
       
    61         <LinearLayout
       
    62             android:id="@+id/username_login_form"
       
    63             android:layout_width="match_parent"
       
    64             android:layout_height="wrap_content"
       
    65             android:orientation="vertical">
       
    66 
       
    67             <com.google.android.material.textfield.TextInputLayout
       
    68                     android:layout_width="match_parent"
       
    69                     android:layout_height="wrap_content">
       
    70 
       
    71                 <EditText
       
    72                         android:id="@+id/url"
       
    73                         android:layout_width="match_parent"
       
    74                         android:layout_height="wrap_content"
       
    75                         android:hint="@string/prompt_url"
       
    76                         android:inputType="textUri"
       
    77                         android:maxLines="1"
       
    78                         android:text="@={LoginViewModel.convertHttpUrlToString(viewModel.httpUrl)}"
       
    79                         android:afterTextChanged="@{viewModel::checkValidUrl}"
       
    80                         android:enabled="@{viewModel.canChangeUsernameOrUrl}"
       
    81                         android:autofillHints="text"
       
    82                         tools:ignore="UnusedAttribute" />
       
    83 
       
    84             </com.google.android.material.textfield.TextInputLayout>
       
    85 
       
    86             <com.google.android.material.textfield.TextInputLayout
       
    87                 android:layout_width="match_parent"
       
    88                 android:layout_height="wrap_content">
       
    89 
       
    90                 <EditText
       
    91                     android:id="@+id/username"
       
    92                     android:layout_width="match_parent"
       
    93                     android:layout_height="wrap_content"
       
    94                     android:hint="@string/prompt_username"
       
    95                     android:inputType="textPersonName"
       
    96                     android:maxLines="1"
       
    97                     android:text="@={viewModel.username}"
       
    98                     android:afterTextChanged="@{viewModel::checkNonEmptyUsername}"
       
    99                     android:enabled="@{viewModel.canChangeUsernameOrUrl}"
       
   100                     android:autofillHints="username"
       
   101                     tools:ignore="UnusedAttribute" />
       
   102 
       
   103             </com.google.android.material.textfield.TextInputLayout>
       
   104 
       
   105             <com.google.android.material.textfield.TextInputLayout
       
   106                 android:layout_width="match_parent"
       
   107                 android:layout_height="wrap_content">
       
   108 
       
   109                 <EditText
       
   110                     android:id="@+id/password"
       
   111                     android:layout_width="match_parent"
       
   112                     android:layout_height="wrap_content"
       
   113                     android:hint="@string/prompt_password"
       
   114                     android:imeActionId="@integer/ime_action_done"
       
   115                     android:imeActionLabel="@string/action_sign_in_short"
       
   116                     android:imeOptions="actionUnspecified"
       
   117                     android:inputType="textPassword"
       
   118                     android:maxLines="1"
       
   119                     android:text="@={viewModel.password}"
       
   120                     android:afterTextChanged="@{viewModel::checkNonEmptyPassword}"
       
   121                     android:onEditorAction="@{(view, actionId, keyEvent) -> viewModel.confirmLogin(actionId)}"
       
   122                     android:autofillHints="password"
       
   123                     tools:ignore="UnusedAttribute" />
       
   124 
       
   125             </com.google.android.material.textfield.TextInputLayout>
       
   126 
       
   127             <Button
       
   128                 android:id="@+id/email_sign_in_button"
       
   129                 style="?android:textAppearanceSmall"
       
   130                 android:layout_width="match_parent"
       
   131                 android:layout_height="wrap_content"
       
   132                 android:layout_marginTop="16dp"
       
   133                 android:text="@string/action_sign_in"
       
   134                 android:textStyle="bold"
       
   135                 android:enabled="@{safeUnbox(viewModel.areFieldsCorrect)}"
       
   136                 android:onClickListener="@{() -> viewModel.confirmLogin()}"
       
   137                 />
       
   138 
       
   139         </LinearLayout>
       
   140     </ScrollView>
       
   141 </androidx.constraintlayout.widget.ConstraintLayout>
       
   142 </layout>