fixing some fastscroller glitches

This commit is contained in:
tibbi 2017-09-30 23:56:28 +02:00
parent 6e6af530bf
commit e4b77eacb0
3 changed files with 13 additions and 9 deletions

View File

@ -509,15 +509,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
private fun setupScrollDirection() {
val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID
directories_refresh_layout.isEnabled = !config.scrollHorizontally
directories_vertical_fastscroller.isHorizontal = false
directories_vertical_fastscroller.beGoneIf(config.scrollHorizontally)
directories_vertical_fastscroller.beGoneIf(allowHorizontalScroll)
directories_horizontal_fastscroller.isHorizontal = true
directories_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally)
directories_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll)
if (config.scrollHorizontally) {
if (allowHorizontalScroll) {
directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout)
} else {
directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout)

View File

@ -169,15 +169,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
}
private fun setupScrollDirection() {
val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFiles == VIEW_TYPE_GRID
media_refresh_layout.isEnabled = !config.scrollHorizontally
media_vertical_fastscroller.isHorizontal = false
media_vertical_fastscroller.beGoneIf(config.scrollHorizontally)
media_vertical_fastscroller.beGoneIf(allowHorizontalScroll)
media_horizontal_fastscroller.isHorizontal = true
media_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally)
media_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll)
if (config.scrollHorizontally) {
if (allowHorizontalScroll) {
media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout)
} else {
media_vertical_fastscroller.setViews(media_grid, media_refresh_layout)

View File

@ -16,6 +16,7 @@ import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.extensions.getCachedDirectories
import com.simplemobiletools.gallery.extensions.getSortedDirectories
import com.simplemobiletools.gallery.helpers.VIEW_TYPE_GRID
import com.simplemobiletools.gallery.models.Directory
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
@ -23,11 +24,12 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String,
var dialog: AlertDialog
var shownDirectories: ArrayList<Directory> = ArrayList()
var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null)
var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID
init {
(view.directories_grid.layoutManager as GridLayoutManager).apply {
orientation = if (activity.config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
spanCount = activity.config.dirColumnCnt
orientation = if (activity.config.scrollHorizontally && isGridViewType) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1
}
dialog = AlertDialog.Builder(activity)
@ -71,7 +73,7 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String,
}
}
val scrollHorizontally = activity.config.scrollHorizontally
val scrollHorizontally = activity.config.scrollHorizontally && isGridViewType
view.apply {
directories_grid.adapter = adapter