[Android] Avoid drawing a header at position 0 if no header exists
Nicolas Pomepuy
git at videolan.org
Fri Dec 6 12:33:36 CET 2019
vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Dec 6 09:59:22 2019 +0100| [232a703b1c8e6d09b9bfdc900b8a2f0b8072009e] | committer: Geoffrey Métais
Avoid drawing a header at position 0 if no header exists
> https://code.videolan.org/videolan/vlc-android/commit/232a703b1c8e6d09b9bfdc900b8a2f0b8072009e
---
.../org/videolan/vlc/gui/view/RecyclerSectionItemDecoration.kt | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemDecoration.kt b/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemDecoration.kt
index a381abd95..44840d12f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemDecoration.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/view/RecyclerSectionItemDecoration.kt
@@ -45,11 +45,13 @@ class RecyclerSectionItemDecoration(private val headerOffset: Int, private val s
if (sticky && previousChild != null) {
val position = parent.getChildAdapterPosition(previousChild)
val sectionPosition = provider.getPositionForSection(position)
- previousSectionPosition = sectionPosition
+ if (provider.getHeaderForPostion(sectionPosition) != null) {
+ previousSectionPosition = sectionPosition
- val title = provider.getSectionforPosition(sectionPosition)
- header.text = title
- drawHeader(c, parent.getChildAt(0), headerView)
+ val title = provider.getSectionforPosition(sectionPosition)
+ header.text = title
+ drawHeader(c, parent.getChildAt(0), headerView)
+ }
}
val drawnPositions = ArrayList<Int>()
More information about the Android
mailing list