mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed display issue in media grid
This commit is contained in:
parent
121f400732
commit
4fe0487eaf
1 changed files with 9 additions and 1 deletions
|
|
@ -108,10 +108,18 @@ class ConversationMediaListFragment : SlidingPaneChildFragment() {
|
||||||
}
|
}
|
||||||
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
||||||
override fun getSpanSize(position: Int): Int {
|
override fun getSpanSize(position: Int): Int {
|
||||||
|
// If not the latest item
|
||||||
if (position < adapter.currentList.size - 1) {
|
if (position < adapter.currentList.size - 1) {
|
||||||
// Have last item of month takes all remaining horizontal space to have a "line break"
|
// Have last item of month takes all remaining horizontal space to have a "line break"
|
||||||
if (adapter.displayHeaderForPosition(position + 1)) {
|
if (adapter.displayHeaderForPosition(position + 1)) {
|
||||||
return spanCount - (position % spanCount)
|
// Check index that marks the start of the previous section
|
||||||
|
for (i in position downTo 0) {
|
||||||
|
if (adapter.displayHeaderForPosition(i)) {
|
||||||
|
// Compute span size depending on position in row
|
||||||
|
val diff = position - i
|
||||||
|
return spanCount - diff % spanCount
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue