From dfccdd40400ddd63da959917191b15e3e71d5db0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Jun 2018 19:44:55 +0200 Subject: [PATCH] do not add group sections at horizontal scrolling for now --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/MediaActivity.kt | 6 ++++-- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3692780c0..49da96ccb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:4.3.0' + implementation 'com.simplemobiletools:commons:4.3.1' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'com.android.support:multidex:1.0.3' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index e37ca9f78..05a309f7e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -192,6 +192,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val isFolderHidden = File(mPath).containsNoMedia() menu.apply { + findItem(R.id.group).isVisible = !config.scrollHorizontally + findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll && mPath != FAVORITES findItem(R.id.unhide_folder).isVisible = isFolderHidden && !mShowAll && mPath != FAVORITES findItem(R.id.exclude_folder).isVisible = !mShowAll && mPath != FAVORITES @@ -604,7 +606,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val mThumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0 val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * mThumbnailWidth media_horizontal_fastscroller.setContentWidth(fullWidth) - media_horizontal_fastscroller.setScrollTo(media_grid.computeHorizontalScrollOffset()) + media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset()) } private fun calculateContentHeight(media: ArrayList) { @@ -631,7 +633,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight media_vertical_fastscroller.setContentHeight(fullHeight) - media_vertical_fastscroller.setScrollTo(media_grid.computeVerticalScrollOffset()) + media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset()) } private fun initZoomListener() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index c3042d0b1..fc29815ae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -342,6 +342,12 @@ class MediaFetcher(val context: Context) { return media as ArrayList } + val thumbnailItems = ArrayList() + if (context.config.scrollHorizontally) { + media.mapTo(thumbnailItems) { it } + return thumbnailItems + } + media.forEach { val key = it.getGroupingKey(currentGrouping) if (!mediumGroups.containsKey(key)) { @@ -357,7 +363,6 @@ class MediaFetcher(val context: Context) { mediumGroups[key] = value } - val thumbnailItems = ArrayList() for ((key, value) in mediumGroups) { thumbnailItems.add(ThumbnailSection(getFormattedKey(key, currentGrouping))) thumbnailItems.addAll(value)