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
|
media_grid.adapter = this
|
||||||
}
|
}
|
||||||
setupLayoutManager()
|
setupLayoutManager()
|
||||||
measureRecyclerViewContent(mMedia)
|
|
||||||
handleGridSpacing()
|
handleGridSpacing()
|
||||||
|
measureRecyclerViewContent(mMedia)
|
||||||
} else if (mLastSearchedText.isEmpty()) {
|
} else if (mLastSearchedText.isEmpty()) {
|
||||||
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
(currAdapter as MediaAdapter).updateMedia(mMedia)
|
||||||
|
handleGridSpacing()
|
||||||
measureRecyclerViewContent(mMedia)
|
measureRecyclerViewContent(mMedia)
|
||||||
} else {
|
} else {
|
||||||
searchQueryChanged(mLastSearchedText)
|
searchQueryChanged(mLastSearchedText)
|
||||||
|
|
|
@ -635,15 +635,12 @@ class MediaFetcher(val context: Context) {
|
||||||
return thumbnailItems
|
return thumbnailItems
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentGridPosition = 0
|
|
||||||
val mediumGroups = LinkedHashMap<String, ArrayList<Medium>>()
|
val mediumGroups = LinkedHashMap<String, ArrayList<Medium>>()
|
||||||
media.forEach {
|
media.forEach {
|
||||||
val key = it.getGroupingKey(currentGrouping)
|
val key = it.getGroupingKey(currentGrouping)
|
||||||
if (!mediumGroups.containsKey(key)) {
|
if (!mediumGroups.containsKey(key)) {
|
||||||
mediumGroups[key] = ArrayList()
|
mediumGroups[key] = ArrayList()
|
||||||
currentGridPosition = 0
|
|
||||||
}
|
}
|
||||||
it.gridPosition = currentGridPosition++
|
|
||||||
mediumGroups[key]!!.add(it)
|
mediumGroups[key]!!.add(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,8 +664,14 @@ class MediaFetcher(val context: Context) {
|
||||||
val today = formatDate(System.currentTimeMillis().toString(), true)
|
val today = formatDate(System.currentTimeMillis().toString(), true)
|
||||||
val yesterday = formatDate((System.currentTimeMillis() - DAY_SECONDS * 1000).toString(), true)
|
val yesterday = formatDate((System.currentTimeMillis() - DAY_SECONDS * 1000).toString(), true)
|
||||||
for ((key, value) in mediumGroups) {
|
for ((key, value) in mediumGroups) {
|
||||||
|
var currentGridPosition = 0
|
||||||
val sectionKey = getFormattedKey(key, currentGrouping, today, yesterday)
|
val sectionKey = getFormattedKey(key, currentGrouping, today, yesterday)
|
||||||
thumbnailItems.add(ThumbnailSection(sectionKey))
|
thumbnailItems.add(ThumbnailSection(sectionKey))
|
||||||
|
|
||||||
|
value.forEach {
|
||||||
|
it.gridPosition = currentGridPosition++
|
||||||
|
}
|
||||||
|
|
||||||
thumbnailItems.addAll(value)
|
thumbnailItems.addAll(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue