mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-27 06:57:59 +01:00
adding some search related crashfix at MediaActivity
This commit is contained in:
parent
ed0aa0b299
commit
450a9d96e4
1 changed files with 9 additions and 6 deletions
|
@ -320,12 +320,15 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
|
|
||||||
private fun searchQueryChanged(text: String) {
|
private fun searchQueryChanged(text: String) {
|
||||||
Thread {
|
Thread {
|
||||||
val filtered = mMedia.filter { it is Medium && it.name.contains(text, true) } as ArrayList
|
try {
|
||||||
filtered.sortBy { it is Medium && !it.name.startsWith(text, true) }
|
val filtered = mMedia.filter { it is Medium && it.name.contains(text, true) } as ArrayList
|
||||||
val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath)
|
filtered.sortBy { it is Medium && !it.name.startsWith(text, true) }
|
||||||
runOnUiThread {
|
val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath)
|
||||||
getMediaAdapter()?.updateMedia(grouped)
|
runOnUiThread {
|
||||||
measureRecyclerViewContent(grouped)
|
getMediaAdapter()?.updateMedia(grouped)
|
||||||
|
measureRecyclerViewContent(grouped)
|
||||||
|
}
|
||||||
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue