Skip to content

Instantly share code, notes, and snippets.

@Mugurell
Created February 27, 2023 16:54
Show Gist options
  • Save Mugurell/b3bc24384c293ead954c10f7debe85e7 to your computer and use it in GitHub Desktop.
Save Mugurell/b3bc24384c293ead954c10f7debe85e7 to your computer and use it in GitHub Desktop.
Smallest changes needed to fix the issue from Bug 1815421
Index: fenix/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt b/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt
--- a/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt (revision d4fdfa701d64b5861e7da820c47be344ffade347)
+++ b/fenix/app/src/main/java/org/mozilla/fenix/settings/logins/fragment/AddLoginFragment.kt (date 1677516765310)
@@ -50,7 +50,7 @@
private var duplicateLogin: SavedLogin? = null
private var validPassword = false
- private var validUsername = true
+ private var validUsername = false
private var validHostname = false
private var usernameChanged = false
@@ -198,9 +198,7 @@
binding.usernameText.addTextChangedListener(
object : TextWatcher {
override fun afterTextChanged(editable: Editable?) {
- // update usernameChanged to true when the text is not empty,
- // otherwise it is not changed, as this screen starts with an empty username.
- usernameChanged = editable.toString().isNotEmpty()
+ usernameChanged = true
updateUsernameField()
setSaveButtonState()
findDuplicate()
@@ -297,7 +295,7 @@
),
)
}
- else -> {
+ usernameChanged -> {
// Valid username
validUsername = true
layout.error = null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment