mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
make sure item group section titles span across the whole line
This commit is contained in:
parent
5ca95e7e35
commit
2139b19ca8
3 changed files with 14 additions and 0 deletions
|
@ -325,6 +325,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
setupZoomListener(mZoomListener)
|
setupZoomListener(mZoomListener)
|
||||||
media_grid.adapter = this
|
media_grid.adapter = this
|
||||||
}
|
}
|
||||||
|
setupLayoutManager()
|
||||||
} else {
|
} else {
|
||||||
(currAdapter as MediaAdapter).updateMedia(media)
|
(currAdapter as MediaAdapter).updateMedia(media)
|
||||||
}
|
}
|
||||||
|
@ -553,6 +554,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutManager.spanCount = config.mediaColumnCnt
|
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() {
|
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) {
|
private fun checkHideBtnVisibility(menu: Menu) {
|
||||||
var hiddenCnt = 0
|
var hiddenCnt = 0
|
||||||
var unhiddenCnt = 0
|
var unhiddenCnt = 0
|
||||||
|
|
|
@ -4,4 +4,5 @@
|
||||||
android:id="@+id/thumbnail_section"
|
android:id="@+id/thumbnail_section"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/activity_margin"
|
||||||
android:textSize="@dimen/bigger_text_size"/>
|
android:textSize="@dimen/bigger_text_size"/>
|
||||||
|
|
Loading…
Reference in a new issue