adding some search related crashfix at MediaActivity

This commit is contained in:
tibbi 2019-01-08 13:47:23 +01:00
parent ed0aa0b299
commit 450a9d96e4

View file

@ -320,6 +320,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private fun searchQueryChanged(text: String) { private fun searchQueryChanged(text: String) {
Thread { Thread {
try {
val filtered = mMedia.filter { it is Medium && it.name.contains(text, true) } as ArrayList val filtered = mMedia.filter { it is Medium && it.name.contains(text, true) } as ArrayList
filtered.sortBy { it is Medium && !it.name.startsWith(text, true) } filtered.sortBy { it is Medium && !it.name.startsWith(text, true) }
val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath) val grouped = MediaFetcher(applicationContext).groupMedia(filtered as ArrayList<Medium>, mPath)
@ -327,6 +328,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
getMediaAdapter()?.updateMedia(grouped) getMediaAdapter()?.updateMedia(grouped)
measureRecyclerViewContent(grouped) measureRecyclerViewContent(grouped)
} }
} catch (ignored: Exception) {
}
}.start() }.start()
} }