Skip to content

Commit

Permalink
fix: visibility of UI elements in Downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-conder committed Aug 4, 2024
1 parent b437cf2 commit ef02225
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class DownloadsFragment : DynamicLayoutManagerFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.deleteAll.isInvisible = true
binding.sortType.isInvisible = true
binding.shuffleBackground.isInvisible = true
var selectedSortType =
PreferenceHelper.getInt(PreferenceKeys.SELECTED_DOWNLOAD_SORT_TYPE, 0)
val filterOptions = resources.getStringArray(R.array.downloadSortOptions)
Expand Down Expand Up @@ -170,16 +172,29 @@ class DownloadsFragment : DynamicLayoutManagerFragment() {
if (binding.downloads.adapter?.itemCount == 0) {
binding.downloads.isGone = true
binding.downloadsEmpty.isVisible = true
binding.sortType.isInvisible = true
binding.deleteAll.isInvisible = true
binding.shuffleBackground.isInvisible = true
} else {
binding.downloads.isGone = false
binding.downloadsEmpty.isGone = true
binding.shuffleBackground.isVisible = true
}
}
}
)

if (dbDownloads.isNotEmpty()) {
binding.sortType.isVisible = true
binding.deleteAll.isVisible = true
binding.shuffleBackground.isVisible = true
binding.deleteAll.setOnClickListener {
showDeleteAllDialog(binding.root.context, adapter)
}
} else {
binding.sortType.isInvisible = true
binding.deleteAll.isInvisible = true
binding.shuffleBackground.isInvisible = true
}

binding.shuffleBackground.setOnClickListener {
Expand Down

0 comments on commit ef02225

Please sign in to comment.