Optional folder mapping
This commit is contained in:
parent
7d5eb19eb7
commit
5951237f2c
@ -1 +1 @@
|
|||||||
Subproject commit 39af24d4e655b0228e81f3beb3266d625e6f76d3
|
Subproject commit 47c6caf2d597590c73e45e006aed0465e0fa0546
|
@ -46,6 +46,7 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
private lateinit var sortOrderEntries: Array<String>
|
private lateinit var sortOrderEntries: Array<String>
|
||||||
private lateinit var sortOrderValues: Array<String>
|
private lateinit var sortOrderValues: Array<String>
|
||||||
private var foldersFirst = true
|
private var foldersFirst = true
|
||||||
|
private var mapFolders = true
|
||||||
private var currentSortOrderIndex = 0
|
private var currentSortOrderIndex = 0
|
||||||
protected lateinit var gocryptfsVolume: GocryptfsVolume
|
protected lateinit var gocryptfsVolume: GocryptfsVolume
|
||||||
private lateinit var volumeName: String
|
private lateinit var volumeName: String
|
||||||
@ -80,6 +81,7 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
sortOrderEntries = resources.getStringArray(R.array.sort_orders_entries)
|
sortOrderEntries = resources.getStringArray(R.array.sort_orders_entries)
|
||||||
sortOrderValues = resources.getStringArray(R.array.sort_orders_values)
|
sortOrderValues = resources.getStringArray(R.array.sort_orders_values)
|
||||||
foldersFirst = sharedPrefs.getBoolean("folders_first", true)
|
foldersFirst = sharedPrefs.getBoolean("folders_first", true)
|
||||||
|
mapFolders = sharedPrefs.getBoolean("map_folders", true)
|
||||||
currentSortOrderIndex = resources.getStringArray(R.array.sort_orders_values).indexOf(sharedPrefs.getString(ConstValues.sort_order_key, "name"))
|
currentSortOrderIndex = resources.getStringArray(R.array.sort_orders_values).indexOf(sharedPrefs.getString(ConstValues.sort_order_key, "name"))
|
||||||
init()
|
init()
|
||||||
toolbar = findViewById(R.id.toolbar)
|
toolbar = findViewById(R.id.toolbar)
|
||||||
@ -221,6 +223,7 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
currentDirectoryPath = path
|
currentDirectoryPath = path
|
||||||
currentPathText.text = getString(R.string.location, currentDirectoryPath)
|
currentPathText.text = getString(R.string.location, currentDirectoryPath)
|
||||||
Thread{
|
Thread{
|
||||||
|
val totalSizeValue = if (mapFolders) {
|
||||||
var totalSize: Long = 0
|
var totalSize: Long = 0
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
for (element in explorerElements){
|
for (element in explorerElements){
|
||||||
@ -238,8 +241,12 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PathUtils.formatSize(totalSize)
|
||||||
|
} else {
|
||||||
|
getString(R.string.default_total_size)
|
||||||
|
}
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
totalSizeText.text = getString(R.string.total_size, PathUtils.formatSize(totalSize))
|
totalSizeText.text = getString(R.string.total_size, totalSizeValue)
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
sortExplorerElements()
|
sortExplorerElements()
|
||||||
}
|
}
|
||||||
|
9
app/src/main/res/drawable/icon_folder_search.xml
Normal file
9
app/src/main/res/drawable/icon_folder_search.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:pathData="M4,4C2.9,4 2,4.9 2,6L2,18C2,19.1 2.9,20 4,20L11.2949,20C11.1059,19.366 11,18.695 11,18C11,14.134 14.134,11 18,11C19.488,11 20.866,11.4678 22,12.2598L22,8C22,6.9 21.1,6 20,6L12,6L10,4L4,4zM18,13C15.2,13 13,15.2 13,18C13,20.8 15.2,23 18,23C19,23 20.0008,22.6992 20.8008,22.1992L22.5996,24L24,22.5996L22.1992,20.8008C22.6992,20.0008 23,19 23,18C23,15.2 20.8,13 18,13zM18,15C19.7,15 21,16.3 21,18C21,19.7 19.7,21 18,21C16.3,21 15,19.7 15,18C15,16.3 16.3,15 18,15z"/>
|
||||||
|
</vector>
|
@ -48,6 +48,7 @@
|
|||||||
<string name="multiple_delete_confirm">Você tem certeza de que deseja excluir estos %s itens ?</string>
|
<string name="multiple_delete_confirm">Você tem certeza de que deseja excluir estos %s itens ?</string>
|
||||||
<string name="location">Local: /%s</string>
|
<string name="location">Local: /%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 o arquivo.</string>
|
<string name="read_file_failed">Falha ao abrir o arquivo.</string>
|
||||||
<string name="volume">Volume: %s</string>
|
<string name="volume">Volume: %s</string>
|
||||||
@ -146,7 +147,6 @@
|
|||||||
<string name="take_photo">Tirar foto</string>
|
<string name="take_photo">Tirar foto</string>
|
||||||
<string name="picture_save_success">Foto salva ao %s</string>
|
<string name="picture_save_success">Foto salva ao %s</string>
|
||||||
<string name="picture_save_failed">Falha ao salvar esta imagem.</string>
|
<string name="picture_save_failed">Falha ao salvar esta imagem.</string>
|
||||||
<string name="default_total_size">N//A</string>
|
|
||||||
<string name="file_overwrite_question">%s já existe, você quer substitui-lo ?</string>
|
<string name="file_overwrite_question">%s já existe, você quer substitui-lo ?</string>
|
||||||
<string name="dir_overwrite_question">%s já existe, você quer integrar ao conteúdo ?</string>
|
<string name="dir_overwrite_question">%s já existe, você quer integrar ao conteúdo ?</string>
|
||||||
<string name="enter_new_name">Digite um novo nome</string>
|
<string name="enter_new_name">Digite um novo nome</string>
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
<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>
|
||||||
@ -143,7 +144,6 @@
|
|||||||
<string name="take_photo">Сфотографировать</string>
|
<string name="take_photo">Сфотографировать</string>
|
||||||
<string name="picture_save_success">Изображение сохранено в %s</string>
|
<string name="picture_save_success">Изображение сохранено в %s</string>
|
||||||
<string name="picture_save_failed">Невозможно сохранить изображение.</string>
|
<string name="picture_save_failed">Невозможно сохранить изображение.</string>
|
||||||
<string name="default_total_size">—</string>
|
|
||||||
<string name="file_overwrite_question">%s уже существует, переписать его?</string>
|
<string name="file_overwrite_question">%s уже существует, переписать его?</string>
|
||||||
<string name="dir_overwrite_question">%s уже существует, объединить содержимое?</string>
|
<string name="dir_overwrite_question">%s уже существует, объединить содержимое?</string>
|
||||||
<string name="enter_new_name">Введите новое имя</string>
|
<string name="enter_new_name">Введите новое имя</string>
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
<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>
|
||||||
@ -146,7 +147,6 @@
|
|||||||
<string name="take_photo">Take photo</string>
|
<string name="take_photo">Take photo</string>
|
||||||
<string name="picture_save_success">Picture saved to %s</string>
|
<string name="picture_save_success">Picture saved to %s</string>
|
||||||
<string name="picture_save_failed">Failed to save this picture.</string>
|
<string name="picture_save_failed">Failed to save this picture.</string>
|
||||||
<string name="default_total_size">N//A</string>
|
|
||||||
<string name="file_overwrite_question">%s already exists, do you want to overwrite it ?</string>
|
<string name="file_overwrite_question">%s already exists, do you want to overwrite it ?</string>
|
||||||
<string name="dir_overwrite_question">%s already exists, do you want to merge its content ?</string>
|
<string name="dir_overwrite_question">%s already exists, do you want to merge its content ?</string>
|
||||||
<string name="enter_new_name">Enter new name</string>
|
<string name="enter_new_name">Enter new name</string>
|
||||||
@ -198,4 +198,6 @@
|
|||||||
<string name="close_volume">Close volume</string>
|
<string name="close_volume">Close volume</string>
|
||||||
<string name="sort_by">Sort By</string>
|
<string name="sort_by">Sort By</string>
|
||||||
<string name="cut">Cut</string>
|
<string name="cut">Cut</string>
|
||||||
|
<string name="map_folders">Map folders</string>
|
||||||
|
<string name="map_folders_summary">Recursively map folders to calculate their sizes (you should disable this when opening large volumes)</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -42,6 +42,13 @@
|
|||||||
android:title="@string/folders_first"
|
android:title="@string/folders_first"
|
||||||
android:summary="@string/folders_first_summary"/>
|
android:summary="@string/folders_first_summary"/>
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="true"
|
||||||
|
app:icon="@drawable/icon_folder_search"
|
||||||
|
android:key="map_folders"
|
||||||
|
android:title="@string/map_folders"
|
||||||
|
android:summary="@string/map_folders_summary"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/unsafe_features">
|
<PreferenceCategory android:title="@string/unsafe_features">
|
||||||
|
Loading…
Reference in New Issue
Block a user