refresh mime types list on some menu actions

This commit is contained in:
tibbi 2021-10-13 16:50:09 +02:00
parent 98a5c5969e
commit 226040e26b
1 changed files with 26 additions and 11 deletions

View File

@ -51,10 +51,7 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
) )
ensureBackgroundThread { ensureBackgroundThread {
getProperFileDirItems { fileDirItems -> reFetchItems()
val listItems = getListItemsFromFileDirItems(fileDirItems)
setupAdapter(listItems)
}
} }
} }
@ -104,7 +101,9 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
return true return true
} }
override fun refreshFragment() {} override fun refreshFragment() {
recreateList()
}
override fun deleteFiles(files: ArrayList<FileDirItem>) {} override fun deleteFiles(files: ArrayList<FileDirItem>) {}
@ -118,9 +117,11 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
override fun toggleFilenameVisibility() { override fun toggleFilenameVisibility() {
config.displayFilenames = !config.displayFilenames config.displayFilenames = !config.displayFilenames
getRecyclerAdapter()?.updateDisplayFilenamesInGrid()
} }
override fun increaseColumnCount() {} override fun increaseColumnCount() {
}
override fun reduceColumnCount() {} override fun reduceColumnCount() {}
@ -257,15 +258,28 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
private fun showSortingDialog() { private fun showSortingDialog() {
ChangeSortingDialog(this, currentMimeType) { ChangeSortingDialog(this, currentMimeType) {
val listItems = getRecyclerAdapter()?.listItems recreateList()
if (listItems != null) {
setupAdapter(listItems as ArrayList<ListItem>)
}
} }
} }
private fun changeViewType() { private fun changeViewType() {
ChangeViewTypeDialog(this, currentMimeType, true) { } ChangeViewTypeDialog(this, currentMimeType, true) {
recreateList()
}
}
private fun reFetchItems() {
getProperFileDirItems { fileDirItems ->
val listItems = getListItemsFromFileDirItems(fileDirItems)
setupAdapter(listItems)
}
}
private fun recreateList() {
val listItems = getRecyclerAdapter()?.listItems
if (listItems != null) {
setupAdapter(listItems as ArrayList<ListItem>)
}
} }
private fun tryToggleTemporarilyShowHidden() { private fun tryToggleTemporarilyShowHidden() {
@ -280,5 +294,6 @@ class MimeTypesActivity : SimpleActivity(), ItemOperationsListener {
private fun toggleTemporarilyShowHidden(show: Boolean) { private fun toggleTemporarilyShowHidden(show: Boolean) {
config.temporarilyShowHidden = show config.temporarilyShowHidden = show
reFetchItems()
} }
} }