Always show total size & Add some explorer info bar translations

This commit is contained in:
Matéo Duparc 2022-04-10 22:08:33 +02:00
parent 36ab66fb43
commit 1d13dfbde3
Signed by: hardcoresushi
GPG Key ID: AFE384344A45E13A
7 changed files with 14 additions and 12 deletions

View File

@ -249,8 +249,8 @@ open class BaseExplorerActivity : BaseActivity() {
invalidateOptionsMenu() invalidateOptionsMenu()
} }
private fun displayExplorerElements(totalSizeValue: String) { private fun displayExplorerElements(totalSize: Long) {
totalSizeText.text = getString(R.string.total_size, totalSizeValue) totalSizeText.text = getString(R.string.total_size, PathUtils.formatSize(totalSize))
synchronized(this) { synchronized(this) {
ExplorerElement.sortBy(sortOrderValues[currentSortOrderIndex], foldersFirst, explorerElements) ExplorerElement.sortBy(sortOrderValues[currentSortOrderIndex], foldersFirst, explorerElements)
} }
@ -311,14 +311,13 @@ open class BaseExplorerActivity : BaseActivity() {
totalSize += element.size totalSize += element.size
} }
} }
val totalSizeValue = PathUtils.formatSize(totalSize)
runOnUiThread { runOnUiThread {
displayExplorerElements(totalSizeValue) displayExplorerElements(totalSize)
onDisplayed?.invoke() onDisplayed?.invoke()
} }
}.start() }.start()
} else { } else {
displayExplorerElements(getString(R.string.default_total_size)) displayExplorerElements(explorerElements.filter { !it.isParentFolder }.sumOf { it.size })
onDisplayed?.invoke() onDisplayed?.invoke()
} }
} }

View File

@ -251,11 +251,11 @@ Java_sushi_hardcore_droidfs_GocryptfsVolume_native_1list_1dir(JNIEnv *env, jobje
struct gcf_list_dir_return elements = gcf_list_dir(sessionID, go_plain_dir); struct gcf_list_dir_return elements = gcf_list_dir(sessionID, go_plain_dir);
jclass java_ArrayList = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "java/util/ArrayList")); jclass java_ArrayList = (*env)->NewLocalRef(env, (*env)->FindClass(env, "java/util/ArrayList"));
jmethodID java_ArrayList_init = (*env)->GetMethodID(env, java_ArrayList, "<init>", "(I)V"); jmethodID java_ArrayList_init = (*env)->GetMethodID(env, java_ArrayList, "<init>", "(I)V");
jmethodID java_ArrayList_add = (*env)->GetMethodID(env, java_ArrayList, "add", "(Ljava/lang/Object;)Z"); jmethodID java_ArrayList_add = (*env)->GetMethodID(env, java_ArrayList, "add", "(Ljava/lang/Object;)Z");
jclass classExplorerElement = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "sushi/hardcore/droidfs/explorers/ExplorerElement")); jclass classExplorerElement = (*env)->NewLocalRef(env, (*env)->FindClass(env, "sushi/hardcore/droidfs/explorers/ExplorerElement"));
jmethodID explorerElement_new = (*env)->GetStaticMethodID(env, classExplorerElement, "new", "(Ljava/lang/String;SJJLjava/lang/String;)Lsushi/hardcore/droidfs/explorers/ExplorerElement;"); jmethodID explorerElement_new = (*env)->GetStaticMethodID(env, classExplorerElement, "new", "(Ljava/lang/String;SJJLjava/lang/String;)Lsushi/hardcore/droidfs/explorers/ExplorerElement;");
jobject element_list = (*env)->NewObject(env, java_ArrayList, java_ArrayList_init, elements.r2); jobject element_list = (*env)->NewObject(env, java_ArrayList, java_ArrayList_init, elements.r2);
unsigned int c = 0; unsigned int c = 0;

View File

@ -64,7 +64,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/infoBarTextView" style="@style/infoBarTextView"
android:text="@string/default_total_size"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/number_of_folders_text" app:layout_constraintStart_toEndOf="@id/number_of_folders_text"

View File

@ -41,7 +41,6 @@
<string name="multiple_delete_confirm">¿Estás seguro de que quiere borrar %s objetos?</string> <string name="multiple_delete_confirm">¿Estás seguro de que quiere borrar %s objetos?</string>
<string name="location">Ubicación: /%s</string> <string name="location">Ubicación: /%s</string>
<string name="total_size">Tamaño total: %s</string> <string name="total_size">Tamaño total: %s</string>
<string name="default_total_size">N/D</string>
<string name="import_from_other_volume">Importar desde otro volumen</string> <string name="import_from_other_volume">Importar desde otro volumen</string>
<string name="read_file_failed">No se ha podido abrir este archivo.</string> <string name="read_file_failed">No se ha podido abrir este archivo.</string>
<string name="volume">Volumen: %s</string> <string name="volume">Volumen: %s</string>
@ -233,4 +232,8 @@
<string name="invalid_number">Número inválido</string> <string name="invalid_number">Número inválido</string>
<string name="new_volume_name">Nuevo nombre del volumen:</string> <string name="new_volume_name">Nuevo nombre del volumen:</string>
<string name="volume_rename_failed">Fallo al renombrar el volumen</string> <string name="volume_rename_failed">Fallo al renombrar el volumen</string>
<string name="one_file">1 archivo</string>
<string name="multiple_files">%d archivos</string>
<string name="one_folder">1 carpeta</string>
<string name="multiple_folders">%d carpetas</string>
</resources> </resources>

View File

@ -41,7 +41,6 @@
<string name="multiple_delete_confirm">Você realmente deseja excluir estos %s itens?</string> <string name="multiple_delete_confirm">Você realmente deseja excluir estos %s itens?</string>
<string name="location">Localização: /%s</string> <string name="location">Localização: /%s</string>
<string name="total_size">Tamanho total: %s</string> <string name="total_size">Tamanho total: %s</string>
<string name="default_total_size">N/A</string>
<string name="import_from_other_volume">Importar do outro volume</string> <string name="import_from_other_volume">Importar do outro volume</string>
<string name="read_file_failed">Falha ao abrir este arquivo.</string> <string name="read_file_failed">Falha ao abrir este arquivo.</string>
<string name="volume">Volume: %s</string> <string name="volume">Volume: %s</string>
@ -228,4 +227,8 @@
<string name="invalid_number">Número inválido</string> <string name="invalid_number">Número inválido</string>
<string name="new_volume_name">Novo nome do volume:</string> <string name="new_volume_name">Novo nome do volume:</string>
<string name="volume_rename_failed">Falha ao renomear o volume</string> <string name="volume_rename_failed">Falha ao renomear o volume</string>
<string name="one_file">1 arquivo</string>
<string name="multiple_files">%d arquivos</string>
<string name="one_folder">1 pasta</string>
<string name="multiple_folders">%d pastas</string>
</resources> </resources>

View File

@ -39,7 +39,6 @@
<string name="multiple_delete_confirm">Удалить %s элементов?</string> <string name="multiple_delete_confirm">Удалить %s элементов?</string>
<string name="location">Путь: /%s</string> <string name="location">Путь: /%s</string>
<string name="total_size">Общий размер: %s</string> <string name="total_size">Общий размер: %s</string>
<string name="default_total_size"></string>
<string name="import_from_other_volume">Импорт из другого тома</string> <string name="import_from_other_volume">Импорт из другого тома</string>
<string name="read_file_failed">Невозможно открыть файл.</string> <string name="read_file_failed">Невозможно открыть файл.</string>
<string name="volume">Том: %s</string> <string name="volume">Том: %s</string>

View File

@ -41,7 +41,6 @@
<string name="multiple_delete_confirm">Are you sure you want to delete these %s items ?</string> <string name="multiple_delete_confirm">Are you sure you want to delete these %s items ?</string>
<string name="location">Location: /%s</string> <string name="location">Location: /%s</string>
<string name="total_size">Total size: %s</string> <string name="total_size">Total size: %s</string>
<string name="default_total_size">N/A</string>
<string name="import_from_other_volume">Import from another volume</string> <string name="import_from_other_volume">Import from another volume</string>
<string name="read_file_failed">Failed to open this file.</string> <string name="read_file_failed">Failed to open this file.</string>
<string name="volume">Volume: %s</string> <string name="volume">Volume: %s</string>