Sort and display explorer elements only after recursive mapping
This commit is contained in:
parent
652fc98ba4
commit
401449d40a
@ -21,7 +21,7 @@ import java.util.*
|
|||||||
|
|
||||||
class ExplorerElementAdapter(private val context: Context) : BaseAdapter() {
|
class ExplorerElementAdapter(private val context: Context) : BaseAdapter() {
|
||||||
private val dateFormat: DateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.getDefault())
|
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)
|
private val inflater: LayoutInflater = LayoutInflater.from(context)
|
||||||
val selectedItems: MutableList<Int> = ArrayList()
|
val selectedItems: MutableList<Int> = ArrayList()
|
||||||
private val themeColor = ThemeColor.getThemeColor(context)
|
private val themeColor = ThemeColor.getThemeColor(context)
|
||||||
@ -113,7 +113,7 @@ class ExplorerElementAdapter(private val context: Context) : BaseAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setExplorerElements(explorer_elements: List<ExplorerElement>) {
|
fun setExplorerElements(explorer_elements: List<ExplorerElement>) {
|
||||||
unSelectAll()
|
|
||||||
this.explorerElements = explorer_elements
|
this.explorerElements = explorer_elements
|
||||||
|
unSelectAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -216,11 +216,6 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
protected fun setCurrentPath(path: String) {
|
protected fun setCurrentPath(path: String) {
|
||||||
explorerElements = gocryptfsVolume.listDir(path)
|
explorerElements = gocryptfsVolume.listDir(path)
|
||||||
textDirEmpty.visibility = if (explorerElements.size == 0) View.VISIBLE else View.INVISIBLE
|
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
|
currentDirectoryPath = path
|
||||||
currentPathText.text = getString(R.string.location, currentDirectoryPath)
|
currentPathText.text = getString(R.string.location, currentDirectoryPath)
|
||||||
Thread{
|
Thread{
|
||||||
@ -241,7 +236,14 @@ open class BaseExplorerActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
totalSizeText.text = getString(R.string.total_size, PathUtils.formatSize(totalSize))
|
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()
|
}.start()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user