mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
properly handle file thumbnails at search
This commit is contained in:
parent
146cb1a052
commit
b5c993ed51
1 changed files with 22 additions and 0 deletions
|
@ -26,7 +26,12 @@ import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener
|
||||||
import com.simplemobiletools.gallery.pro.models.Medium
|
import com.simplemobiletools.gallery.pro.models.Medium
|
||||||
import com.simplemobiletools.gallery.pro.models.ThumbnailItem
|
import com.simplemobiletools.gallery.pro.models.ThumbnailItem
|
||||||
import com.simplemobiletools.gallery.pro.models.ThumbnailSection
|
import com.simplemobiletools.gallery.pro.models.ThumbnailSection
|
||||||
|
import kotlinx.android.synthetic.main.activity_media.*
|
||||||
import kotlinx.android.synthetic.main.activity_search.*
|
import kotlinx.android.synthetic.main.activity_search.*
|
||||||
|
import kotlinx.android.synthetic.main.activity_search.media_empty_text_placeholder
|
||||||
|
import kotlinx.android.synthetic.main.activity_search.media_grid
|
||||||
|
import kotlinx.android.synthetic.main.activity_search.media_horizontal_fastscroller
|
||||||
|
import kotlinx.android.synthetic.main.activity_search.media_vertical_fastscroller
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
|
@ -120,6 +125,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
getMediaAdapter()?.updateMedia(grouped)
|
getMediaAdapter()?.updateMedia(grouped)
|
||||||
|
handleGridSpacing(grouped)
|
||||||
measureRecyclerViewContent(grouped)
|
measureRecyclerViewContent(grouped)
|
||||||
}
|
}
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
|
@ -139,9 +145,11 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
media_grid.adapter = this
|
media_grid.adapter = this
|
||||||
}
|
}
|
||||||
setupLayoutManager()
|
setupLayoutManager()
|
||||||
|
handleGridSpacing(mAllMedia)
|
||||||
measureRecyclerViewContent(mAllMedia)
|
measureRecyclerViewContent(mAllMedia)
|
||||||
} else if (mLastSearchedText.isEmpty()) {
|
} else if (mLastSearchedText.isEmpty()) {
|
||||||
(currAdapter as MediaAdapter).updateMedia(mAllMedia)
|
(currAdapter as MediaAdapter).updateMedia(mAllMedia)
|
||||||
|
handleGridSpacing(mAllMedia)
|
||||||
measureRecyclerViewContent(mAllMedia)
|
measureRecyclerViewContent(mAllMedia)
|
||||||
} else {
|
} else {
|
||||||
textChanged(mLastSearchedText)
|
textChanged(mLastSearchedText)
|
||||||
|
@ -150,6 +158,20 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
setupScrollDirection()
|
setupScrollDirection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleGridSpacing(media: ArrayList<ThumbnailItem>) {
|
||||||
|
if (media_grid.itemDecorationCount > 0) {
|
||||||
|
media_grid.removeItemDecorationAt(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
val viewType = config.getFolderViewType(SHOW_ALL)
|
||||||
|
if (viewType == VIEW_TYPE_GRID) {
|
||||||
|
val spanCount = config.mediaColumnCnt
|
||||||
|
val spacing = config.thumbnailSpacing
|
||||||
|
val decoration = GridSpacingItemDecoration(spanCount, spacing, config.scrollHorizontally, config.fileRoundedCorners, media, true)
|
||||||
|
media_grid.addItemDecoration(decoration)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter
|
private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter
|
||||||
|
|
||||||
private fun toggleFilenameVisibility() {
|
private fun toggleFilenameVisibility() {
|
||||||
|
|
Loading…
Reference in a new issue