This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1815564 - Modify password field and asterisk added
- Loading branch information
Showing
8 changed files
with
81 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
fenix/app/src/main/java/org/mozilla/fenix/utils/view/AsteriskPasswordTransformationMethod.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.mozilla.fenix.utils.view | ||
|
||
import android.text.method.PasswordTransformationMethod | ||
import android.view.View | ||
|
||
/** | ||
* A [PasswordTransformationMethod] that replaces all characters with asterisks. | ||
*/ | ||
class AsteriskPasswordTransformationMethod : PasswordTransformationMethod() { | ||
override fun getTransformation(source: CharSequence, view: View): CharSequence { | ||
return PasswordCharSequence(source) | ||
} | ||
|
||
private class PasswordCharSequence(private val source: CharSequence) : CharSequence { | ||
override val length: Int | ||
get() = source.length | ||
|
||
override fun get(index: Int): Char { | ||
return '*' | ||
} | ||
|
||
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence { | ||
return source.subSequence(startIndex, endIndex) | ||
} | ||
|
||
override fun toString(): String { | ||
return source.toString() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters