mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 22:30:30 +05:30
Merge pull request #3518 from Bnyro/master
Fix crashes in downloads fragment
This commit is contained in:
commit
c1121b0582
@ -113,6 +113,7 @@ class DownloadsFragment : Fragment() {
|
|||||||
object : RecyclerView.AdapterDataObserver() {
|
object : RecyclerView.AdapterDataObserver() {
|
||||||
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
override fun onItemRangeRemoved(positionStart: Int, itemCount: Int) {
|
||||||
super.onItemRangeRemoved(positionStart, itemCount)
|
super.onItemRangeRemoved(positionStart, itemCount)
|
||||||
|
val binding = _binding ?: return
|
||||||
if (binding.downloads.adapter?.itemCount == 0) {
|
if (binding.downloads.adapter?.itemCount == 0) {
|
||||||
binding.downloads.visibility = View.GONE
|
binding.downloads.visibility = View.GONE
|
||||||
binding.downloadsEmpty.visibility = View.VISIBLE
|
binding.downloadsEmpty.visibility = View.VISIBLE
|
||||||
@ -150,7 +151,7 @@ class DownloadsFragment : Fragment() {
|
|||||||
val index = downloads.indexOfFirst {
|
val index = downloads.indexOfFirst {
|
||||||
it.downloadItems.any { item -> item.id == id }
|
it.downloadItems.any { item -> item.id == id }
|
||||||
}
|
}
|
||||||
val view = binding.downloads.findViewHolderForAdapterPosition(index) as? DownloadsViewHolder
|
val view = _binding?.downloads?.findViewHolderForAdapterPosition(index) as? DownloadsViewHolder
|
||||||
|
|
||||||
view?.binding?.apply {
|
view?.binding?.apply {
|
||||||
when (status) {
|
when (status) {
|
||||||
|
Loading…
Reference in New Issue
Block a user