Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Bug 1815564 - Modify password field text to using Roboto monospace and Added Asterisk over Bullet on password fields. #864

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.fenix.settings.logins.fragment

import android.content.res.ColorStateList
import android.graphics.Typeface
import android.os.Bundle
import android.text.Editable
import android.text.InputType
Expand Down Expand Up @@ -39,6 +40,7 @@ import org.mozilla.fenix.settings.logins.SavedLogin
import org.mozilla.fenix.settings.logins.controller.SavedLoginsStorageController
import org.mozilla.fenix.settings.logins.createInitialLoginsListState
import org.mozilla.fenix.settings.logins.interactor.AddLoginInteractor
import org.mozilla.fenix.settings.logins.togglePasswordReveal

/**
* Displays the editable new login information for a single website
Expand Down Expand Up @@ -102,13 +104,17 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login), MenuProvider {
binding.hostnameText.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
binding.usernameText.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS

// TODO: extend PasswordTransformationMethod() to change bullets to asterisks
binding.passwordText.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD

binding.passwordText.compoundDrawablePadding =
requireContext().resources
.getDimensionPixelOffset(R.dimen.saved_logins_end_icon_drawable_padding)
binding.passwordText.typeface = Typeface.MONOSPACE

// disabling the clear and reveal text buttons until text is entered
binding.clearPasswordTextButton.isVisible = false
binding.revealPasswordButton.isVisible = false
}

private fun setUpClickListeners() {
Expand Down Expand Up @@ -138,6 +144,10 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login), MenuProvider {
binding.inputLayoutPassword.hasFocus()
it.isEnabled = false
}

binding.revealPasswordButton.setOnClickListener {
togglePasswordReveal(binding.passwordText, binding.revealPasswordButton)
}
}

private fun setUpTextListeners() {
Expand Down Expand Up @@ -230,12 +240,14 @@ class AddLoginFragment : Fragment(R.layout.fragment_add_login), MenuProvider {
when {
p.toString().isEmpty() -> {
binding.clearPasswordTextButton.isVisible = false
binding.revealPasswordButton.isVisible = false
setPasswordError()
}
else -> {
validPassword = true
binding.inputLayoutPassword.error = null
binding.inputLayoutPassword.errorIconDrawable = null
binding.revealPasswordButton.isVisible = true
binding.clearPasswordTextButton.isVisible = true
binding.clearPasswordTextButton.isEnabled = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.fenix.settings.logins.fragment

import android.content.res.ColorStateList
import android.graphics.Typeface
import android.os.Bundle
import android.text.Editable
import android.text.InputType
Expand Down Expand Up @@ -113,12 +114,12 @@ class EditLoginFragment : Fragment(R.layout.fragment_edit_login), MenuProvider {
binding.hostnameText.isClickable = false
binding.hostnameText.isFocusable = false
binding.usernameText.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
// TODO: extend PasswordTransformationMethod() to change bullets to asterisks
binding.passwordText.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
binding.passwordText.compoundDrawablePadding =
requireContext().resources
.getDimensionPixelOffset(R.dimen.saved_logins_end_icon_drawable_padding)
binding.passwordText.typeface = Typeface.MONOSPACE
}

private fun setUpClickListeners() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.fenix.settings.logins.fragment

import android.content.DialogInterface
import android.graphics.Typeface
import android.os.Build
import android.os.Bundle
import android.text.InputType
Expand Down Expand Up @@ -130,6 +131,7 @@ class LoginDetailFragment : SecureFragment(R.layout.fragment_login_detail), Menu
binding.passwordText.inputType =
InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
binding.revealPasswordButton.increaseTapArea(BUTTON_INCREASE_DPS)
binding.passwordText.typeface = Typeface.MONOSPACE
binding.revealPasswordButton.setOnClickListener {
togglePasswordReveal(binding.passwordText, binding.revealPasswordButton)
}
Expand Down
41 changes: 27 additions & 14 deletions fenix/app/src/main/res/layout/fragment_add_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@
android:textColor="?attr/textPrimary"
android:letterSpacing="0.05"
app:layout_constraintBottom_toTopOf="@id/inputLayoutUsername"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@id/clearUsernameTextButton"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inputLayoutHostname"
app:layout_constraintVertical_chainStyle="packed" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/inputLayoutUsername"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:colorControlHighlight="?attr/textPrimary"
android:colorControlActivated="?attr/textPrimary"
android:textColor="?attr/textPrimary"
android:contentDescription="@string/saved_login_username_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/usernameHeader"
app:layout_constraintStart_toStartOf="@id/usernameHeader"
app:layout_constraintTop_toBottomOf="@id/usernameHeader"
app:layout_constraintVertical_chainStyle="packed"
app:hintEnabled="false">
Expand Down Expand Up @@ -146,7 +146,9 @@
<ImageButton
android:id="@+id/clearUsernameTextButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_height="30dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="10dp"
android:background="@null"
android:contentDescription="@string/saved_login_clear_username"
android:visibility="invisible"
Expand All @@ -169,23 +171,23 @@
android:text="@string/preferences_passwords_saved_logins_password"
android:textColor="?attr/textPrimary"
app:layout_constraintBottom_toTopOf="@id/inputLayoutPassword"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/clearPasswordTextButton"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/inputLayoutUsername"
app:layout_constraintVertical_chainStyle="packed" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/inputLayoutPassword"
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:colorControlActivated="?attr/textPrimary"
android:colorControlHighlight="?attr/textPrimary"
android:contentDescription="@string/saved_login_password_description"
android:paddingBottom="11dp"
android:textColor="?attr/textPrimary"
app:hintEnabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="@id/passwordHeader"
app:layout_constraintStart_toStartOf="@id/passwordHeader"
app:layout_constraintTop_toBottomOf="@id/passwordHeader"
app:layout_constraintVertical_chainStyle="packed">

Expand Down Expand Up @@ -214,16 +216,27 @@
tools:ignore="Autofill" />
</com.google.android.material.textfield.TextInputLayout>

<ImageButton
android:id="@+id/revealPasswordButton"
android:layout_width="48dp"
android:layout_height="30dp"
android:layout_marginTop="3dp"
android:background="@null"
android:contentDescription="@string/saved_login_reveal_password"
app:tint="?attr/textPrimary"
app:layout_constraintEnd_toStartOf="@id/clearPasswordTextButton"
app:layout_constraintTop_toTopOf="@id/inputLayoutPassword"
app:srcCompat="@drawable/mozac_ic_eye_24" />
Comment on lines +219 to +229
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if I missing something. I don't see anything about adding a reveal password functionality in the original requirements.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwzilla Could you clarify your intention from mozilla-mobile/fenix#28609? Were we suppose to add a button to reveal the password when adding a login?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct, would like to add the eye icon to reveal/hide password on the password field on the Add a Login screen.


<ImageButton
android:id="@+id/clearPasswordTextButton"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_height="30dp"
android:background="@null"
android:contentDescription="@string/saved_logins_clear_password"
android:visibility="invisible"
app:tint="@color/saved_login_clear_edit_text_tint"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/inputLayoutPassword"
app:srcCompat="@drawable/mozac_ic_cross_circle_fill_24"
app:tint="@color/saved_login_clear_edit_text_tint" />
app:layout_constraintTop_toTopOf="@id/revealPasswordButton"
app:srcCompat="@drawable/mozac_ic_cross_circle_fill_24" />

</androidx.constraintlayout.widget.ConstraintLayout>