mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Manage setting to hide password #696
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
KeePassDX(3.4.0)
|
||||
* Show visual password strength indicator with entropy #631 #869
|
||||
* Dynamically save password generator configuration #618
|
||||
* Dynamically save password generator configuration #618 #696
|
||||
* Add advanced password filters #1052
|
||||
* Add editable chars fields #539
|
||||
* Add color for special password chars #454
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.kunzisoft.keepass.view
|
||||
|
||||
import android.content.Context
|
||||
import android.text.Editable
|
||||
import android.text.InputType
|
||||
import android.text.SpannableString
|
||||
import android.text.TextWatcher
|
||||
import android.util.AttributeSet
|
||||
@@ -46,6 +47,8 @@ class PasswordView @JvmOverloads constructor(context: Context,
|
||||
private val passwordStrengthProgress: LinearProgressIndicator
|
||||
private val passwordEntropy: TextView
|
||||
|
||||
private var mShowPassword: Boolean = false
|
||||
|
||||
private var mPasswordTextWatcher: MutableList<TextWatcher> = mutableListOf()
|
||||
private val passwordTextWatcher = object : TextWatcher {
|
||||
override fun beforeTextChanged(charSequence: CharSequence, i: Int, i1: Int, i2: Int) {
|
||||
@@ -68,13 +71,29 @@ class PasswordView @JvmOverloads constructor(context: Context,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
context.theme.obtainStyledAttributes(
|
||||
attrs,
|
||||
R.styleable.PasswordView,
|
||||
0, 0).apply {
|
||||
try {
|
||||
mShowPassword = getBoolean(R.styleable.PasswordView_passwordVisible,
|
||||
!PreferencesUtil.hideProtectedValue(context))
|
||||
} finally {
|
||||
recycle()
|
||||
}
|
||||
}
|
||||
|
||||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater?
|
||||
inflater?.inflate(R.layout.view_password, this)
|
||||
|
||||
passwordInputLayout = findViewById(R.id.password_input_layout)
|
||||
passwordText = findViewById(R.id.password_text)
|
||||
if (mShowPassword) {
|
||||
passwordText?.inputType = passwordText.inputType and
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD or
|
||||
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
|
||||
}
|
||||
passwordText?.applyFontVisibility()
|
||||
passwordText.addTextChangedListener(passwordTextWatcher)
|
||||
passwordStrengthProgress = findViewById(R.id.password_strength_progress)
|
||||
|
||||
@@ -177,7 +177,11 @@ class TextEditFieldView @JvmOverloads constructor(context: Context,
|
||||
fun setProtection(protection: Boolean) {
|
||||
if (protection) {
|
||||
labelView.endIconMode = TextInputLayout.END_ICON_PASSWORD_TOGGLE
|
||||
valueView.inputType = valueView.inputType or InputType.TYPE_TEXT_VARIATION_PASSWORD
|
||||
val visibilityTag = if (PreferencesUtil.hideProtectedValue(context))
|
||||
InputType.TYPE_TEXT_VARIATION_PASSWORD
|
||||
else
|
||||
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
|
||||
valueView.inputType = valueView.inputType or visibilityTag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
<com.kunzisoft.keepass.view.PasswordView
|
||||
android:id="@+id/password_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
app:passwordVisible="false"/>
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/password_repeat_input_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
<attr name="explanations" format="string" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PasswordView">
|
||||
<attr name="passwordVisible" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- Specific keyboard attributes -->
|
||||
<declare-styleable name="KeyboardView">
|
||||
<!-- Default KeyboardView style. -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
* Show visual password strength indicator with entropy #631 #869
|
||||
* Dynamically save password generator configuration #618
|
||||
* Dynamically save password generator configuration #618 #696
|
||||
* Add advanced password filters #1052
|
||||
* Add editable chars fields #539
|
||||
* Add color for special password chars #454
|
||||
@@ -1,5 +1,5 @@
|
||||
* Affichage d'un indicateur visuel de la force du mot de passe avec entropie #631 #869
|
||||
* Sauvegarde dynamique de la configuration du générateur de mots de passe #618
|
||||
* Sauvegarde dynamique de la configuration du générateur de mots de passe #618 #696
|
||||
* Ajout des filtres de mots de passe avancés #1052
|
||||
* Ajout de champs éditable de génération #539
|
||||
* Ajout des couleurs pour chaque caractère spécial de mots de passe #454
|
||||
Reference in New Issue
Block a user