From 04f1bbaffec620fab540da82735bec6816c82508 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Dec 2017 14:42:17 +0100 Subject: [PATCH] add a toggle for showing info bubble at fastscroller --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 5 ++++- .../gallery/activities/MediaActivity.kt | 5 ++++- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/dialogs/PickDirectoryDialog.kt | 5 ++++- .../gallery/dialogs/PickMediumDialog.kt | 5 ++++- app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 7 files changed, 46 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d54939b3c..6870b205f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,7 +43,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.1.4' + implementation 'com.simplemobiletools:commons:3.1.7' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.android.support:multidex:1.0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index aca94dfc4..af6e3b8ee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -57,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mStoredShowMediaCount = true + private var mStoredShowInfoBubble = true private var mStoredTextColor = 0 private var mLoadedInitialPhotos = false private var mIsPasswordProtectionPending = false @@ -113,7 +114,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount) } - if (mStoredScrollHorizontally != config.scrollHorizontally) { + if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) { getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally) setupScrollDirection() } @@ -200,6 +201,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredShowMediaCount = showMediaCount + mStoredShowInfoBubble = showInfoBubble mStoredTextColor = textColor } } @@ -583,6 +585,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { if (allowHorizontalScroll) { directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) } else { + directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_vertical_fastscroller.updateBubbleText(mDirs[it].getBubbleText()) } 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 4f231fd42..0ec644665 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -53,6 +53,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true + private var mStoredShowInfoBubble = true private var mStoredTextColor = 0 private var mLastDrawnHashCode = 0 private var mLatestMediaId = 0L @@ -100,7 +101,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { getMediaAdapter()?.updateCropThumbnails(config.cropThumbnails) } - if (mStoredScrollHorizontally != config.scrollHorizontally) { + if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) { getMediaAdapter()?.updateScrollHorizontally(config.viewTypeFiles != VIEW_TYPE_LIST || !config.scrollHorizontally) setupScrollDirection() } @@ -140,6 +141,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredAnimateGifs = animateGifs mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally + mStoredShowInfoBubble = showInfoBubble mStoredTextColor = textColor mShowAll = showAll } @@ -203,6 +205,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (allowHorizontalScroll) { media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) } else { + media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) { media_vertical_fastscroller.updateBubbleText(mMedia[it].getBubbleText()) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 4bb90d013..6309dd18e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -55,6 +55,7 @@ class SettingsActivity : SimpleActivity() { setupAllowVideoGestures() setupShowMediaCount() setupKeepLastModified() + setupShowInfoBubble() setupShowExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) @@ -254,6 +255,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupShowInfoBubble() { + settings_show_info_bubble.isChecked = config.showInfoBubble + settings_show_info_bubble_holder.setOnClickListener { + settings_show_info_bubble.toggle() + config.showInfoBubble = settings_show_info_bubble.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index 937f98e07..97c04955c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -86,7 +86,10 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri if (scrollHorizontally) { directories_horizontal_fastscroller.setViews(directories_grid) } else { - directories_vertical_fastscroller.setViews(directories_grid) + directories_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble + directories_vertical_fastscroller.setViews(directories_grid) { + directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText()) + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index ad579e02c..0a80c0316 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -76,7 +76,10 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c if (scrollHorizontally) { media_horizontal_fastscroller.setViews(media_grid) } else { - media_vertical_fastscroller.setViews(media_grid) + media_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble + media_vertical_fastscroller.setViews(media_grid) { + media_vertical_fastscroller.updateBubbleText(media[it].getBubbleText()) + } } } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 509679282..a204da6cb 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -408,6 +408,26 @@ + + + + + +