mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
fixing some grid spacing related glitches
This commit is contained in:
parent
b5c993ed51
commit
8bd9ee1c95
2 changed files with 8 additions and 4 deletions
|
@ -418,10 +418,11 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
media_grid.adapter = this
|
||||
}
|
||||
setupLayoutManager()
|
||||
measureRecyclerViewContent(mMedia)
|
||||
handleGridSpacing()
|
||||
measureRecyclerViewContent(mMedia)
|
||||
} else if (mLastSearchedText.isEmpty()) {
|
||||
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
||||
handleGridSpacing()
|
||||
measureRecyclerViewContent(mMedia)
|
||||
} else {
|
||||
searchQueryChanged(mLastSearchedText)
|
||||
|
|
|
@ -635,15 +635,12 @@ class MediaFetcher(val context: Context) {
|
|||
return thumbnailItems
|
||||
}
|
||||
|
||||
var currentGridPosition = 0
|
||||
val mediumGroups = LinkedHashMap<String, ArrayList<Medium>>()
|
||||
media.forEach {
|
||||
val key = it.getGroupingKey(currentGrouping)
|
||||
if (!mediumGroups.containsKey(key)) {
|
||||
mediumGroups[key] = ArrayList()
|
||||
currentGridPosition = 0
|
||||
}
|
||||
it.gridPosition = currentGridPosition++
|
||||
mediumGroups[key]!!.add(it)
|
||||
}
|
||||
|
||||
|
@ -667,8 +664,14 @@ class MediaFetcher(val context: Context) {
|
|||
val today = formatDate(System.currentTimeMillis().toString(), true)
|
||||
val yesterday = formatDate((System.currentTimeMillis() - DAY_SECONDS * 1000).toString(), true)
|
||||
for ((key, value) in mediumGroups) {
|
||||
var currentGridPosition = 0
|
||||
val sectionKey = getFormattedKey(key, currentGrouping, today, yesterday)
|
||||
thumbnailItems.add(ThumbnailSection(sectionKey))
|
||||
|
||||
value.forEach {
|
||||
it.gridPosition = currentGridPosition++
|
||||
}
|
||||
|
||||
thumbnailItems.addAll(value)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue