make sure item group section titles span across the whole line
This commit is contained in:
parent
5ca95e7e35
commit
2139b19ca8
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"/>
|
||||
|
|
Loading…
Reference in New Issue