do not add group sections at horizontal scrolling for now

This commit is contained in:
tibbi 2018-06-24 19:44:55 +02:00
parent 73e5333eef
commit dfccdd4040
3 changed files with 11 additions and 4 deletions

View file

@ -47,7 +47,7 @@ ext {
} }
dependencies { 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.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.android.support:multidex:1.0.3' implementation 'com.android.support:multidex:1.0.3'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'

View file

@ -192,6 +192,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
val isFolderHidden = File(mPath).containsNoMedia() val isFolderHidden = File(mPath).containsNoMedia()
menu.apply { menu.apply {
findItem(R.id.group).isVisible = !config.scrollHorizontally
findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll && mPath != FAVORITES findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll && mPath != FAVORITES
findItem(R.id.unhide_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 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 mThumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0
val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * mThumbnailWidth val fullWidth = ((media.size - 1) / layoutManager.spanCount + 1) * mThumbnailWidth
media_horizontal_fastscroller.setContentWidth(fullWidth) media_horizontal_fastscroller.setContentWidth(fullWidth)
media_horizontal_fastscroller.setScrollTo(media_grid.computeHorizontalScrollOffset()) media_horizontal_fastscroller.setScrollToX(media_grid.computeHorizontalScrollOffset())
} }
private fun calculateContentHeight(media: ArrayList<ThumbnailItem>) { private fun calculateContentHeight(media: ArrayList<ThumbnailItem>) {
@ -631,7 +633,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight fullHeight += ((curSectionItems - 1) / layoutManager.spanCount + 1) * mThumbnailHeight
media_vertical_fastscroller.setContentHeight(fullHeight) media_vertical_fastscroller.setContentHeight(fullHeight)
media_vertical_fastscroller.setScrollTo(media_grid.computeVerticalScrollOffset()) media_vertical_fastscroller.setScrollToY(media_grid.computeVerticalScrollOffset())
} }
private fun initZoomListener() { private fun initZoomListener() {

View file

@ -342,6 +342,12 @@ class MediaFetcher(val context: Context) {
return media as ArrayList<ThumbnailItem> return media as ArrayList<ThumbnailItem>
} }
val thumbnailItems = ArrayList<ThumbnailItem>()
if (context.config.scrollHorizontally) {
media.mapTo(thumbnailItems) { it }
return thumbnailItems
}
media.forEach { media.forEach {
val key = it.getGroupingKey(currentGrouping) val key = it.getGroupingKey(currentGrouping)
if (!mediumGroups.containsKey(key)) { if (!mediumGroups.containsKey(key)) {
@ -357,7 +363,6 @@ class MediaFetcher(val context: Context) {
mediumGroups[key] = value mediumGroups[key] = value
} }
val thumbnailItems = ArrayList<ThumbnailItem>()
for ((key, value) in mediumGroups) { for ((key, value) in mediumGroups) {
thumbnailItems.add(ThumbnailSection(getFormattedKey(key, currentGrouping))) thumbnailItems.add(ThumbnailSection(getFormattedKey(key, currentGrouping)))
thumbnailItems.addAll(value) thumbnailItems.addAll(value)