Show volume type in MainActivity

This commit is contained in:
Matéo Duparc 2022-07-03 13:38:32 +02:00
parent a5b6de1138
commit 17c32f2144
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
7 changed files with 23 additions and 16 deletions

View File

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
import sushi.hardcore.droidfs.R
import sushi.hardcore.droidfs.SavedVolume
import sushi.hardcore.droidfs.VolumeDatabase
import sushi.hardcore.droidfs.filesystems.EncryptedVolume
class VolumeAdapter(
private val context: Context,
@ -89,13 +90,18 @@ class VolumeAdapter(
} else {
View.VISIBLE
}
itemView.findViewById<TextView>(R.id.text_read_only).apply {
visibility = if (volume.canWrite(context.filesDir.path))
View.GONE
else {
View.VISIBLE
}
}
itemView.findViewById<TextView>(R.id.text_info).text = context.getString(
if (volume.canWrite(context.filesDir.path)) {
R.string.volume_type
} else {
R.string.volume_type_read_only
},
context.getString(if (volume.type == EncryptedVolume.GOCRYPTFS_VOLUME_TYPE) {
R.string.gocryptfs
} else {
R.string.cryfs
})
)
setSelectable(itemView.findViewById<LinearLayout>(R.id.selectable_container), itemView, layoutPosition)
}
}

View File

@ -47,18 +47,16 @@
app:layout_constrainedWidth="true"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/text_read_only"
app:layout_constraintEnd_toStartOf="@id/text_info"
android:textSize="12sp"/>
<TextView
android:id="@+id/text_read_only"
android:id="@+id/text_info"
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"
android:visibility="gone"
android:textSize="12sp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -202,7 +202,6 @@
<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="no_volumes_text">ليس هنالك مجلد مشفر ، أضف واحد بالضغط على زر +</string>
<string name="fingerprint_error_msg">لم يتم التعرف على بصمة الأصبع: %s.</string>
<string name="keyguard_not_secure">حارس المفاتيح ليس آمنا</string>

View File

@ -202,7 +202,6 @@
<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="no_volumes_text">No se ha guardado ningún volumen, añada uno 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>
@ -240,4 +239,6 @@
<string name="elements_selected">%d/%d Seleccionados</string>
<string name="pin_passwords_title">Diseño de teclado numérico</string>
<string name="pin_passwords_summary">Usar el diseño de teclado numérico para ingresar las contraseñas de los volumenes</string>
<string name="volume_type">(%s)</string>
<string name="volume_type_read_only">(%s, Sólo lectura)</string>
</resources>

View File

@ -196,7 +196,6 @@
<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="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>
@ -228,4 +227,6 @@
<string name="multiple_files">%d arquivos</string>
<string name="one_folder">1 pasta</string>
<string name="multiple_folders">%d pastas</string>
<string name="volume_type">(%s)</string>
<string name="volume_type_read_only">(%s, somente leitura)</string>
</resources>

View File

@ -195,7 +195,6 @@
<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="no_volumes_text">Том не создан, добавьте его, нажав кнопку \"+\"</string>
<string name="fingerprint_error_msg">Невозможно использовать аутентификацию по отпечатку пальца: %s.</string>
<string name="keyguard_not_secure">хранилище ключей не защищено</string>
@ -233,4 +232,6 @@
<string name="elements_selected">Выбрано: %d/%d</string>
<string name="pin_passwords_title">Цифровая клавиатура</string>
<string name="pin_passwords_summary">Использовать цифровую раскладку клавиатуры при вводе паролей томов</string>
<string name="volume_type">(%s)</string>
<string name="volume_type_read_only">(%s, только для чтения)</string>
</resources>

View File

@ -203,7 +203,6 @@
<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="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>
@ -247,4 +246,6 @@
<string name="gocryptfs_disabled">Gocryptfs support has been disabled</string>
<string name="cryfs_disabled">CryFS support has been disabled</string>
<string name="file_op_delete_msg">Deleting files…</string>
<string name="volume_type">(%s)</string>
<string name="volume_type_read_only">(%s, read-only)</string>
</resources>