Trim e-mail and username to ease the login process
Spaces aren't visible in EditText and it's possible to get authentication errors because of that invisible space.
This commit is contained in:
@@ -39,13 +39,18 @@ class AuthenticationFragment : Fragment(R.layout.fragment_authentication) {
|
||||
private fun onLoginClicked(): Unit = with(binding) {
|
||||
Timber.v("onLoginClicked() called")
|
||||
|
||||
val email: String = emailInput.checkIfInputIsEmpty(emailInputLayout, lifecycleScope) {
|
||||
getString(R.string.fragment_authentication_email_input_empty)
|
||||
} ?: return
|
||||
val email: String = emailInput.checkIfInputIsEmpty(
|
||||
inputLayout = emailInputLayout,
|
||||
lifecycleOwner = viewLifecycleOwner,
|
||||
stringId = R.string.fragment_authentication_email_input_empty,
|
||||
) ?: return
|
||||
|
||||
val pass: String = passwordInput.checkIfInputIsEmpty(passwordInputLayout, lifecycleScope) {
|
||||
getString(R.string.fragment_authentication_password_input_empty)
|
||||
} ?: return
|
||||
val pass: String = passwordInput.checkIfInputIsEmpty(
|
||||
inputLayout = passwordInputLayout,
|
||||
lifecycleOwner = viewLifecycleOwner,
|
||||
stringId = R.string.fragment_authentication_password_input_empty,
|
||||
trim = false,
|
||||
) ?: return
|
||||
|
||||
button.isClickable = false
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import by.kirich1409.viewbindingdelegate.viewBinding
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
@@ -29,9 +28,11 @@ class BaseURLFragment : Fragment(R.layout.fragment_base_url) {
|
||||
|
||||
private fun onProceedClick(view: View) {
|
||||
Timber.v("onProceedClick() called with: view = $view")
|
||||
val url = binding.urlInput.checkIfInputIsEmpty(binding.urlInputLayout, lifecycleScope) {
|
||||
getString(R.string.fragment_baseurl_url_input_empty)
|
||||
} ?: return
|
||||
val url = binding.urlInput.checkIfInputIsEmpty(
|
||||
inputLayout = binding.urlInputLayout,
|
||||
lifecycleOwner = viewLifecycleOwner,
|
||||
stringId = R.string.fragment_baseurl_url_input_empty,
|
||||
) ?: return
|
||||
viewModel.saveBaseUrl(url)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user