diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 93887d220..ebe559cf0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -654,16 +654,36 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun calculateContentWidth(directories: ArrayList) { val layoutManager = directories_grid.layoutManager as MyGridLayoutManager - val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 - val fullWidth = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailWidth + + val fullWidth = if (config.folderStyle == FOLDER_STYLE_SQUARE) { + val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 + ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailWidth + } else { + val thumbnailWidth = (layoutManager.getChildAt(0)?.width ?: 0) + resources.getDimension(R.dimen.medium_margin).toInt() * 2 + val columnCount = (directories.size - 1) / layoutManager.spanCount + 1 + columnCount * thumbnailWidth + } + directories_horizontal_fastscroller.setContentWidth(fullWidth) directories_horizontal_fastscroller.setScrollToX(directories_grid.computeHorizontalScrollOffset()) } private fun calculateContentHeight(directories: ArrayList) { val layoutManager = directories_grid.layoutManager as MyGridLayoutManager - val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0 - val fullHeight = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight + + val fullHeight = if (config.folderStyle == FOLDER_STYLE_SQUARE) { + val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0 + ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight + } else { + var thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0) + if (config.viewTypeFolders == VIEW_TYPE_GRID) { + thumbnailHeight += resources.getDimension(R.dimen.medium_margin).toInt() * 2 + } + + val rowCount = (directories.size - 1) / layoutManager.spanCount + 1 + rowCount * thumbnailHeight + } + directories_vertical_fastscroller.setContentHeight(fullHeight) directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index c672f54ca..d59bd4eab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -9,6 +9,7 @@ import android.graphics.drawable.Icon import android.view.Menu import android.view.View import android.view.ViewGroup +import android.widget.RelativeLayout import com.bumptech.glide.Glide import com.google.gson.Gson import com.simplemobiletools.commons.activities.BaseSimpleActivity @@ -61,7 +62,14 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList ROUNDED_CORNERS_SMALL + config.folderStyle == FOLDER_STYLE_SQUARE -> ROUNDED_CORNERS_NONE + else -> ROUNDED_CORNERS_BIG + } + activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners) }