make sure item group section titles span across the whole line

This commit is contained in:
tibbi 2018-06-22 11:16:45 +02:00
parent 5ca95e7e35
commit 2139b19ca8
3 changed files with 14 additions and 0 deletions

View file

@ -325,6 +325,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
setupZoomListener(mZoomListener)
media_grid.adapter = this
}
setupLayoutManager()
} else {
(currAdapter as MediaAdapter).updateMedia(media)
}
@ -553,6 +554,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
}
layoutManager.spanCount = config.mediaColumnCnt
val adapter = getMediaAdapter()
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return if (adapter?.isASectionTitle(position) == true) {
layoutManager.spanCount
} else {
1
}
}
}
}
private fun initZoomListener() {

View file

@ -160,6 +160,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
}
}
fun isASectionTitle(position: Int) = thumbnailItems.getOrNull(position) is ThumbnailSection
private fun checkHideBtnVisibility(menu: Menu) {
var hiddenCnt = 0
var unhiddenCnt = 0

View file

@ -4,4 +4,5 @@
android:id="@+id/thumbnail_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/activity_margin"
android:textSize="@dimen/bigger_text_size"/>