correcting some placeholder and list visibility

This commit is contained in:
tibbi 2021-11-29 22:46:28 +01:00
parent fba4b6fc3e
commit 8887a57a6e
2 changed files with 5 additions and 23 deletions

View file

@ -862,10 +862,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
runOnUiThread {
checkPlaceholderVisibility(dirs)
val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID
/*directories_vertical_fastscroller.beVisibleIf(directories_grid.isVisible() && !allowHorizontalScroll)
directories_horizontal_fastscroller.beVisibleIf(directories_grid.isVisible() && allowHorizontalScroll)*/
setupAdapter(dirs.clone() as ArrayList<Directory>)
}
@ -947,7 +943,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
createDirectoryFromMedia(directory.path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize, noMediaFolders)
}
//mydebug("end ${System.currentTimeMillis() - time} ${directory.name}")
// we are looping through the already displayed folders looking for changes, do not do anything if nothing changed
if (directory.copy(subfoldersCount = 0, subfoldersMediaCount = 0) == newDir) {
continue
@ -1055,7 +1050,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
runOnUiThread {
directories_empty_placeholder.beGone()
directories_empty_placeholder_2.beGone()
directories_grid.beVisible()
directories_fastscroller.beVisible()
}
}
@ -1163,7 +1158,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}
directories_empty_placeholder_2.underlineText()
directories_grid.beVisibleIf(directories_empty_placeholder.isGone())
directories_fastscroller.beVisibleIf(directories_empty_placeholder.isGone())
}
private fun setupAdapter(dirs: ArrayList<Directory>, textToSearch: String = "", forceRecreate: Boolean = false) {

View file

@ -364,8 +364,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
if (grouped.isEmpty()) {
media_empty_text_placeholder.text = getString(R.string.no_items_found)
media_empty_text_placeholder.beVisible()
media_fastscroller.beGone()
} else {
media_empty_text_placeholder.beGone()
media_fastscroller.beVisible()
}
handleGridSpacing(grouped)
@ -661,11 +663,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private fun setupGridLayoutManager() {
val layoutManager = media_grid.layoutManager as MyGridLayoutManager
(media_grid.layoutParams as RelativeLayout.LayoutParams).apply {
topMargin = 0
bottomMargin = 0
}
if (config.scrollHorizontally) {
layoutManager.orientation = RecyclerView.HORIZONTAL
media_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
@ -692,13 +689,6 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
layoutManager.spanCount = 1
layoutManager.orientation = RecyclerView.VERTICAL
media_refresh_layout.layoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
val smallMargin = resources.getDimension(R.dimen.small_margin).toInt()
(media_grid.layoutParams as RelativeLayout.LayoutParams).apply {
topMargin = smallMargin
bottomMargin = smallMargin
}
mZoomListener = null
}
@ -848,12 +838,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
if (media_empty_text_placeholder.isVisible()) {
media_empty_text_placeholder.text = getString(R.string.no_media_with_filters)
}
media_grid.beVisibleIf(media_empty_text_placeholder.isGone())
media_fastscroller.beVisibleIf(media_empty_text_placeholder.isGone())
val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath)
val allowHorizontalScroll = config.scrollHorizontally && viewType == VIEW_TYPE_GRID
/*media_vertical_fastscroller.beVisibleIf(media_grid.isVisible() && !allowHorizontalScroll)
media_horizontal_fastscroller.beVisibleIf(media_grid.isVisible() && allowHorizontalScroll)*/
setupAdapter()
}