add some helper functions for getting fastscroller bubble text

This commit is contained in:
tibbi 2018-02-19 18:08:26 +01:00
parent 5b4a0f63f9
commit 0e60aca74c
2 changed files with 8 additions and 4 deletions

View file

@ -619,16 +619,18 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
if (allowHorizontalScroll) { if (allowHorizontalScroll) {
directories_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble
directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_horizontal_fastscroller.updateBubbleText(mDirs[it].getBubbleText()) directories_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it))
} }
} else { } else {
directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_vertical_fastscroller.updateBubbleText(mDirs[it].getBubbleText()) directories_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it))
} }
} }
} }
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().dirs.getOrNull(index)?.getBubbleText() ?: ""
private fun checkLastMediaChanged() { private fun checkLastMediaChanged() {
if (isActivityDestroyed()) if (isActivityDestroyed())
return return

View file

@ -334,16 +334,18 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
if (allowHorizontalScroll) { if (allowHorizontalScroll) {
media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble
media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) { media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) {
media_horizontal_fastscroller.updateBubbleText(mMedia[it].getBubbleText()) media_horizontal_fastscroller.updateBubbleText(getBubbleTextItem(it))
} }
} else { } else {
media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) { media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) {
media_vertical_fastscroller.updateBubbleText(mMedia[it].getBubbleText()) media_vertical_fastscroller.updateBubbleText(getBubbleTextItem(it))
} }
} }
} }
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().media.getOrNull(index)?.getBubbleText() ?: ""
private fun checkLastMediaChanged() { private fun checkLastMediaChanged() {
if (isActivityDestroyed()) if (isActivityDestroyed())
return return