Compare commits

...

2 Commits

5 changed files with 15 additions and 13 deletions

View File

@ -21,7 +21,7 @@ import java.util.*
class ExplorerElementAdapter(private val context: Context) : BaseAdapter() {
private val dateFormat: DateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.getDefault())
private lateinit var explorerElements: List<ExplorerElement>
private var explorerElements = listOf<ExplorerElement>()
private val inflater: LayoutInflater = LayoutInflater.from(context)
val selectedItems: MutableList<Int> = ArrayList()
private val themeColor = ThemeColor.getThemeColor(context)
@ -113,7 +113,7 @@ class ExplorerElementAdapter(private val context: Context) : BaseAdapter() {
}
fun setExplorerElements(explorer_elements: List<ExplorerElement>) {
unSelectAll()
this.explorerElements = explorer_elements
unSelectAll()
}
}

View File

@ -216,11 +216,6 @@ open class BaseExplorerActivity : BaseActivity() {
protected fun setCurrentPath(path: String) {
explorerElements = gocryptfsVolume.listDir(path)
textDirEmpty.visibility = if (explorerElements.size == 0) View.VISIBLE else View.INVISIBLE
sortExplorerElements()
if (path.isNotEmpty()) { //not root
explorerElements.add(0, ExplorerElement("..", (-1).toShort(), -1, -1, currentDirectoryPath))
}
explorerAdapter.setExplorerElements(explorerElements)
currentDirectoryPath = path
currentPathText.text = getString(R.string.location, currentDirectoryPath)
Thread{
@ -241,7 +236,14 @@ open class BaseExplorerActivity : BaseActivity() {
}
runOnUiThread {
totalSizeText.text = getString(R.string.total_size, PathUtils.formatSize(totalSize))
explorerAdapter.notifyDataSetChanged()
sortExplorerElements()
if (path.isNotEmpty()) { //not root
explorerElements.add(
0,
ExplorerElement("..", (-1).toShort(), -1, -1, currentDirectoryPath)
)
}
explorerAdapter.setExplorerElements(explorerElements)
}
}.start()
}

View File

@ -1,8 +1,8 @@
<resources>
<string-array name="sort_orders_entries">
<item>Nome</item>
<item>Data</item>
<item>Tamanho</item>
<item>Data</item>
<item>Nome (decr)</item>
<item>Tamanho (desc)</item>
<item>Data (decr)</item>

View File

@ -2,10 +2,10 @@
<resources>
<string-array name="sort_orders_entries">
<item>Имя</item>
<item>Дата</item>
<item>Размер</item>
<item>Дата</item>
<item>Имя (по убыванию)</item>
<item>Дата (по убыванию)</item>
<item>Размер (по убыванию)</item>
<item>Дата (по убыванию)</item>
</string-array>
</resources>

View File

@ -1,8 +1,8 @@
<resources>
<string-array name="sort_orders_entries">
<item>Name</item>
<item>Date</item>
<item>Size</item>
<item>Date</item>
<item>Name (desc)</item>
<item>Size (desc)</item>
<item>Date (desc)</item>
@ -11,8 +11,8 @@
<!-- don't translate the following otherwise the app will crash -->
<string-array name="sort_orders_values">
<item>name</item>
<item>date</item>
<item>size</item>
<item>date</item>
<item>name_desc</item>
<item>size_desc</item>
<item>date_desc</item>