LoginActivity: rework the login form design
authorDa Risk <da_risk@geekorum.com>
Fri, 12 Apr 2019 14:03:01 -0700
changeset 108 849c50d5d2b3
parent 107 3fa8423d4de4
child 109 eb12523cbc81
LoginActivity: rework the login form design
app/src/main/java/com/geekorum/ttrss/accounts/LoginViewModel.kt
app/src/main/res/drawable/ic_person_24dp.xml
app/src/main/res/drawable/ic_vpn_key_24dp.xml
app/src/main/res/drawable/ic_web_24dp.xml
app/src/main/res/layout/include_form_login.xml
app/src/main/res/values/strings.xml
app/src/main/res/values/styles.xml
app/src/test/java/com/geekorum/ttrss/network/TinyrssApiModuleTest.kt
--- a/app/src/main/java/com/geekorum/ttrss/accounts/LoginViewModel.kt	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/java/com/geekorum/ttrss/accounts/LoginViewModel.kt	Fri Apr 12 14:03:01 2019 -0700
@@ -1,4 +1,4 @@
-/**
+/*
  * Geekttrss is a RSS feed reader application on the Android Platform.
  *
  * Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
--- a/app/src/main/res/drawable/ic_person_24dp.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/drawable/ic_person_24dp.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -1,3 +1,25 @@
+<!--
+
+    Geekttrss is a RSS feed reader application on the Android Platform.
+
+    Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
+
+    This file is part of Geekttrss.
+
+    Geekttrss 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.
+
+    Geekttrss 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 Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
--- a/app/src/main/res/drawable/ic_vpn_key_24dp.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/drawable/ic_vpn_key_24dp.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -1,3 +1,25 @@
+<!--
+
+    Geekttrss is a RSS feed reader application on the Android Platform.
+
+    Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
+
+    This file is part of Geekttrss.
+
+    Geekttrss 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.
+
+    Geekttrss 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 Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
--- a/app/src/main/res/drawable/ic_web_24dp.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/drawable/ic_web_24dp.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -1,3 +1,25 @@
+<!--
+
+    Geekttrss is a RSS feed reader application on the Android Platform.
+
+    Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
+
+    This file is part of Geekttrss.
+
+    Geekttrss 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.
+
+    Geekttrss 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 Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+
+-->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
         android:width="24dp"
         android:height="24dp"
--- a/app/src/main/res/layout/include_form_login.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/layout/include_form_login.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -28,6 +28,7 @@
 
     <data>
         <import type="com.geekorum.ttrss.accounts.LoginViewModel" />
+        <import type="android.view.View"/>
         <variable name="viewModel" type="com.geekorum.ttrss.accounts.LoginViewModel" />
     </data>
 
@@ -127,32 +128,24 @@
 
             </com.google.android.material.textfield.TextInputLayout>
 
-            <com.google.android.material.button.MaterialButton
-                    android:id="@+id/btn_advanced_option"
+            <com.google.android.material.switchmaterial.SwitchMaterial
+                    android:id="@+id/use_http_auth"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:layout_marginTop="16dp"
-                    app:layout_constraintStart_toStartOf="@+id/url_field"
-                    app:layout_constraintEnd_toEndOf="@+id/url_field"
+                    app:layout_constraintStart_toStartOf="@id/url_field"
+                    app:layout_constraintEnd_toEndOf="@id/url_field"
                     app:layout_constraintTop_toBottomOf="@+id/password_field"
-                    android:text="Advanced options"
-                    android:textAllCaps="false"
-                    android:gravity="bottom|start"
-                    app:icon="@drawable/view_account_menu_line_handle_closed"
-                    app:iconGravity="start"
-                    android:textColor="?colorControlNormal"
-                    app:iconTint="?colorControlNormal"
-                    style="@style/Widget.MaterialComponents.Button.TextButton"/>
-
-
+                    android:text="@string/lbl_use_http_authentication"
+                    android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
+                    />
 
             <com.google.android.material.textfield.TextInputLayout
                     android:id="@+id/http_username_field"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    app:layout_constraintStart_toStartOf="@+id/url_field"
-                    app:layout_constraintEnd_toEndOf="@+id/url_field"
-                    app:layout_constraintTop_toBottomOf="@+id/btn_advanced_option"
+                    app:layout_constraintStart_toStartOf="@id/url_field"
+                    app:layout_constraintEnd_toEndOf="@id/url_field"
+                    app:layout_constraintTop_toBottomOf="@+id/use_http_auth"
                     android:layout_marginTop="@dimen/activity_vertical_margin"
                     android:hint="@string/prompt_username"
                     app:startIconDrawable="@drawable/ic_person_24dp"
@@ -175,8 +168,8 @@
                     android:id="@+id/http_password_field"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    app:layout_constraintStart_toStartOf="@+id/url_field"
-                    app:layout_constraintEnd_toEndOf="@+id/url_field"
+                    app:layout_constraintStart_toStartOf="@id/url_field"
+                    app:layout_constraintEnd_toEndOf="@id/url_field"
                     app:layout_constraintTop_toBottomOf="@+id/http_username_field"
                     android:layout_marginTop="@dimen/activity_vertical_margin"
                     android:hint="@string/prompt_password"
@@ -205,7 +198,7 @@
                     app:layout_constraintStart_toStartOf="@+id/url_field"
                     app:layout_constraintEnd_toEndOf="@+id/url_field"
                     app:layout_constraintTop_toBottomOf="@+id/http_password_field"
-                    android:layout_marginTop="16dp"
+                    android:layout_marginTop="@dimen/activity_vertical_margin"
                     android:text="@string/action_sign_in"
                     android:enabled="@{safeUnbox(viewModel.areFieldsCorrect)}"
                     android:onClickListener="@{() -> viewModel.confirmLogin()}"
@@ -224,6 +217,14 @@
                     app:layout_constraintVertical_bias="0.1"
                     android:visibility="gone" />
 
+            <androidx.constraintlayout.widget.Group
+                    android:id="@+id/use_http_auth_group"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    app:constraint_referenced_ids="http_username_field,http_password_field"
+                    android:visibility="@{useHttpAuth.checked ? View.VISIBLE : View.GONE}"
+                    tools:visibility="gone"
+                    />
         </androidx.constraintlayout.widget.ConstraintLayout>
     </ScrollView>
 </layout>
--- a/app/src/main/res/values/strings.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/values/strings.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -31,6 +31,7 @@
     <string name="prompt_url">Tiny Tiny RSS server url</string>
     <string name="prompt_username">Username</string>
     <string name="prompt_password">Password</string>
+    <string name="lbl_use_http_authentication">Use Http authentication</string>
     <string name="action_sign_in">Login</string>
     <string name="action_sign_in_short">Login</string>
     <string name="error_field_required">This field is required</string>
--- a/app/src/main/res/values/styles.xml	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/main/res/values/styles.xml	Fri Apr 12 14:03:01 2019 -0700
@@ -70,7 +70,7 @@
         <item name="colorButtonNormal">@android:color/transparent</item>
     </style>
 
-    <style name="LoginForm.TextInputStyle" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
+    <style name="LoginForm.TextInputStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
         <item name="errorEnabled">true</item>
     </style>
 
--- a/app/src/test/java/com/geekorum/ttrss/network/TinyrssApiModuleTest.kt	Thu Apr 11 15:21:41 2019 -0700
+++ b/app/src/test/java/com/geekorum/ttrss/network/TinyrssApiModuleTest.kt	Fri Apr 12 14:03:01 2019 -0700
@@ -1,3 +1,23 @@
+/*
+ * Geekttrss is a RSS feed reader application on the Android Platform.
+ *
+ * Copyright (C) 2017-2018 by Frederic-Charles Barthelery.
+ *
+ * This file is part of Geekttrss.
+ *
+ * Geekttrss 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.
+ *
+ * Geekttrss 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 Geekttrss.  If not, see <http://www.gnu.org/licenses/>.
+ */
 package com.geekorum.ttrss.network
 
 import com.geekorum.ttrss.accounts.ServerInformation