Show a fingerprint icon when password hash is saved

This commit is contained in:
Matéo Duparc 2022-04-18 14:55:59 +02:00
parent 55b0ac0daa
commit 72cce1d7e1
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
6 changed files with 32 additions and 22 deletions

View File

@ -84,20 +84,16 @@ class VolumeAdapter(
context.getString(R.string.hidden_volume)
else
volume.name
val canWrite = volume.canWrite(context.filesDir.path)
val infoString: String? = if (volume.encryptedHash == null)
if (canWrite) null else '(' + context.getString(R.string.read_only) + ')'
else
'(' +
(if (canWrite) "" else context.getString(R.string.read_only) + ", ") +
context.getString(R.string.password_hash_saved) +
')'
itemView.findViewById<TextView>(R.id.text_info).apply {
if (infoString == null)
visibility = View.GONE
itemView.findViewById<ImageView>(R.id.icon_fingerprint).visibility = if (volume.encryptedHash == null) {
View.GONE
} else {
View.VISIBLE
}
itemView.findViewById<TextView>(R.id.text_read_only).apply {
visibility = if (volume.canWrite(context.filesDir.path))
View.GONE
else {
text = infoString
visibility = View.VISIBLE
View.VISIBLE
}
}
setSelectable(itemView.findViewById<LinearLayout>(R.id.selectable_container), itemView, layoutPosition)

View File

@ -5,7 +5,7 @@
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
<RelativeLayout
android:id="@+id/selectable_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -20,7 +20,9 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:layout_toEndOf="@id/image_icon"
android:layout_toStartOf="@id/icon_fingerprint">
<TextView
android:id="@+id/text_volume_name"
@ -45,13 +47,14 @@
app:layout_constrainedWidth="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/text_info"
app:layout_constraintEnd_toStartOf="@id/text_read_only"
android:textSize="12sp"/>
<TextView
android:id="@+id/text_info"
android:id="@+id/text_read_only"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/read_only"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/text_path"
app:layout_constraintEnd_toEndOf="parent"
@ -62,6 +65,17 @@
</LinearLayout>
</LinearLayout>
<ImageView
android:id="@+id/icon_fingerprint"
android:layout_width="26dp"
android:layout_height="26dp"
android:src="@drawable/icon_fingerprint"
android:contentDescription="@string/password_hash_saved"
android:visibility="gone"
android:layout_alignParentEnd="true"
android:layout_marginTop="11dp"
android:layout_marginEnd="5dp"/>
</RelativeLayout>
</LinearLayout>

View File

@ -203,7 +203,7 @@
<string name="password_confirmation_label">Repite la contraseña:</string>
<string name="password_confirmation_hint">Contraseña (confirmación)</string>
<string name="password_hash_saved">hash de la contraseña guardada</string>
<string name="read_only">Sólo lectura</string>
<string name="read_only">(Sólo lectura)</string>
<string name="no_volumes_text">No se ha guardado el volumen, añada algo haciendo clic en el botón +.</string>
<string name="fingerprint_error_msg">La autenticación por huella dactilar no puede ser utilizada: %s.</string>
<string name="keyguard_not_secure">keyguard no seguro</string>

View File

@ -198,7 +198,7 @@
<string name="password_confirmation_label">Repita a senha:</string>
<string name="password_confirmation_hint">Senha (confirmação)</string>
<string name="password_hash_saved">O hash da senha foi salvo</string>
<string name="read_only">somente leitura</string>
<string name="read_only">(somente leitura)</string>
<string name="no_volumes_text">Nenhum volume salvo, adicione algum clicando no botão +</string>
<string name="fingerprint_error_msg">A autenticação por impressão digital não pode ser usada: %s.</string>
<string name="keyguard_not_secure">chave de segurança não é segura</string>

View File

@ -196,7 +196,7 @@
<string name="password_confirmation_label">Повтор пароля:</string>
<string name="password_confirmation_hint">Подтверждение пароля</string>
<string name="password_hash_saved">хеш пароля сохранён</string>
<string name="read_only">только для чтения</string>
<string name="read_only">(только для чтения)</string>
<string name="no_volumes_text">Том не создан, добавьте его, нажав кнопку \"+\"</string>
<string name="fingerprint_error_msg">Невозможно использовать аутентификацию по отпечатку пальца: %s.</string>
<string name="keyguard_not_secure">хранилище ключей не защищено</string>

View File

@ -204,7 +204,7 @@
<string name="password_confirmation_label">Repeat the password:</string>
<string name="password_confirmation_hint">Password (confirmation)</string>
<string name="password_hash_saved">password hash saved</string>
<string name="read_only">read-only</string>
<string name="read_only">(read-only)</string>
<string name="no_volumes_text">No volume saved, add some by clicking on the + button</string>
<string name="fingerprint_error_msg">Fingerprint authentication can\'t be used: %s.</string>
<string name="keyguard_not_secure">keyguard not secure</string>