From ca4b424174133cd33b99496f6be009a6d0c04426 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Mon, 22 Nov 2021 00:32:39 +0100 Subject: [PATCH] Fix login activity layout --- .../bou/readerforselfoss/LoginActivity.kt | 20 ++-- app/src/main/res/layout/activity_login.xml | 107 +++++++----------- 2 files changed, 47 insertions(+), 80 deletions(-) diff --git a/app/src/main/java/apps/amine/bou/readerforselfoss/LoginActivity.kt b/app/src/main/java/apps/amine/bou/readerforselfoss/LoginActivity.kt index b66f713..3295497 100644 --- a/app/src/main/java/apps/amine/bou/readerforselfoss/LoginActivity.kt +++ b/app/src/main/java/apps/amine/bou/readerforselfoss/LoginActivity.kt @@ -14,7 +14,6 @@ import android.view.MenuItem import android.view.View import android.view.inputmethod.EditorInfo import android.widget.TextView -import android.widget.Toast import apps.amine.bou.readerforselfoss.api.selfoss.SelfossApi import apps.amine.bou.readerforselfoss.api.selfoss.SuccessResponse import apps.amine.bou.readerforselfoss.databinding.ActivityLoginBinding @@ -22,7 +21,6 @@ import apps.amine.bou.readerforselfoss.themes.AppColors import apps.amine.bou.readerforselfoss.utils.Config import apps.amine.bou.readerforselfoss.utils.isBaseUrlValid import apps.amine.bou.readerforselfoss.utils.network.isNetworkAccessible -import com.mikepenz.aboutlibraries.Libs import com.mikepenz.aboutlibraries.LibsBuilder import retrofit2.Call import retrofit2.Callback @@ -91,16 +89,16 @@ class LoginActivity : AppCompatActivity() { isWithLogin = !isWithLogin val visi: Int = if (b) View.VISIBLE else View.GONE - binding.loginLayout.visibility = visi - binding.passwordLayout.visibility = visi + binding.loginView.visibility = visi + binding.passwordView.visibility = visi } binding.withHttpLogin.setOnCheckedChangeListener { _, b -> isWithHTTPLogin = !isWithHTTPLogin val visi: Int = if (b) View.VISIBLE else View.GONE - binding.httpLoginInput.visibility = visi - binding.httpPasswordInput.visibility = visi + binding.httpLoginView.visibility = visi + binding.httpPasswordView.visibility = visi } } @@ -111,9 +109,8 @@ class LoginActivity : AppCompatActivity() { alertDialog.setMessage(getString(R.string.base_url_error)) alertDialog.setButton( AlertDialog.BUTTON_NEUTRAL, - "OK", - { dialog, _ -> dialog.dismiss() } - ) + "OK" + ) { dialog, _ -> dialog.dismiss() } alertDialog.show() } } @@ -154,9 +151,8 @@ class LoginActivity : AppCompatActivity() { alertDialog.setMessage(getString(R.string.text_wrong_url)) alertDialog.setButton( AlertDialog.BUTTON_NEUTRAL, - "OK", - { dialog, _ -> dialog.dismiss() } - ) + "OK" + ) { dialog, _ -> dialog.dismiss() } alertDialog.show() inValidCount = 0 } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index b631400..f0b705b 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -45,98 +45,69 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:hint="@string/prompt_url" + android:imeOptions="actionUnspecified" + android:importantForAutofill="no" + android:inputType="textUri" + android:maxLines="1" /> - - - - - - + android:autofillHints="username" + android:hint="@string/prompt_login" + android:inputType="text" + android:maxLines="1" + android:visibility="gone" /> - - - - - + android:autofillHints="password" + android:hint="@string/prompt_password" + android:inputType="textPassword" + android:maxLines="1" + android:visibility="gone" /> - - - - - - + android:layout_height="wrap_content" + android:autofillHints="username" + android:hint="@string/prompt_http_login" + android:inputType="text" + android:visibility="gone" /> - - - - + android:layout_height="wrap_content" + android:autofillHints="password" + android:hint="@string/prompt_http_password" + android:inputType="textPassword" + android:visibility="gone" /> - - - -