add a toggle for showing info bubble at fastscroller

This commit is contained in:
tibbi 2017-12-06 14:42:17 +01:00
parent da2db79913
commit 04f1bbaffe
7 changed files with 46 additions and 5 deletions

View file

@ -43,7 +43,7 @@ ext {
} }
dependencies { 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.davemorrissey.labs:subsampling-scale-image-view:3.8.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'

View file

@ -57,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private var mStoredCropThumbnails = true private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true private var mStoredScrollHorizontally = true
private var mStoredShowMediaCount = true private var mStoredShowMediaCount = true
private var mStoredShowInfoBubble = true
private var mStoredTextColor = 0 private var mStoredTextColor = 0
private var mLoadedInitialPhotos = false private var mLoadedInitialPhotos = false
private var mIsPasswordProtectionPending = false private var mIsPasswordProtectionPending = false
@ -113,7 +114,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount) getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount)
} }
if (mStoredScrollHorizontally != config.scrollHorizontally) { if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) {
getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally) getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally)
setupScrollDirection() setupScrollDirection()
} }
@ -200,6 +201,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mStoredCropThumbnails = cropThumbnails mStoredCropThumbnails = cropThumbnails
mStoredScrollHorizontally = scrollHorizontally mStoredScrollHorizontally = scrollHorizontally
mStoredShowMediaCount = showMediaCount mStoredShowMediaCount = showMediaCount
mStoredShowInfoBubble = showInfoBubble
mStoredTextColor = textColor mStoredTextColor = textColor
} }
} }
@ -583,6 +585,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
if (allowHorizontalScroll) { if (allowHorizontalScroll) {
directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout)
} else { } else {
directories_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) { directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_vertical_fastscroller.updateBubbleText(mDirs[it].getBubbleText()) directories_vertical_fastscroller.updateBubbleText(mDirs[it].getBubbleText())
} }

View file

@ -53,6 +53,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private var mStoredAnimateGifs = true private var mStoredAnimateGifs = true
private var mStoredCropThumbnails = true private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true private var mStoredScrollHorizontally = true
private var mStoredShowInfoBubble = true
private var mStoredTextColor = 0 private var mStoredTextColor = 0
private var mLastDrawnHashCode = 0 private var mLastDrawnHashCode = 0
private var mLatestMediaId = 0L private var mLatestMediaId = 0L
@ -100,7 +101,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
getMediaAdapter()?.updateCropThumbnails(config.cropThumbnails) getMediaAdapter()?.updateCropThumbnails(config.cropThumbnails)
} }
if (mStoredScrollHorizontally != config.scrollHorizontally) { if (mStoredScrollHorizontally != config.scrollHorizontally || mStoredShowInfoBubble != config.showInfoBubble) {
getMediaAdapter()?.updateScrollHorizontally(config.viewTypeFiles != VIEW_TYPE_LIST || !config.scrollHorizontally) getMediaAdapter()?.updateScrollHorizontally(config.viewTypeFiles != VIEW_TYPE_LIST || !config.scrollHorizontally)
setupScrollDirection() setupScrollDirection()
} }
@ -140,6 +141,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mStoredAnimateGifs = animateGifs mStoredAnimateGifs = animateGifs
mStoredCropThumbnails = cropThumbnails mStoredCropThumbnails = cropThumbnails
mStoredScrollHorizontally = scrollHorizontally mStoredScrollHorizontally = scrollHorizontally
mStoredShowInfoBubble = showInfoBubble
mStoredTextColor = textColor mStoredTextColor = textColor
mShowAll = showAll mShowAll = showAll
} }
@ -203,6 +205,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
if (allowHorizontalScroll) { if (allowHorizontalScroll) {
media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout)
} else { } else {
media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble
media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) { media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) {
media_vertical_fastscroller.updateBubbleText(mMedia[it].getBubbleText()) media_vertical_fastscroller.updateBubbleText(mMedia[it].getBubbleText())
} }

View file

@ -55,6 +55,7 @@ class SettingsActivity : SimpleActivity() {
setupAllowVideoGestures() setupAllowVideoGestures()
setupShowMediaCount() setupShowMediaCount()
setupKeepLastModified() setupKeepLastModified()
setupShowInfoBubble()
setupShowExtendedDetails() setupShowExtendedDetails()
setupManageExtendedDetails() setupManageExtendedDetails()
updateTextColors(settings_holder) 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() { private fun setupScreenRotation() {
settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation.text = getScreenRotationText()
settings_screen_rotation_holder.setOnClickListener { settings_screen_rotation_holder.setOnClickListener {

View file

@ -86,7 +86,10 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
if (scrollHorizontally) { if (scrollHorizontally) {
directories_horizontal_fastscroller.setViews(directories_grid) directories_horizontal_fastscroller.setViews(directories_grid)
} else { } 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())
}
} }
} }
} }

View file

@ -76,7 +76,10 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
if (scrollHorizontally) { if (scrollHorizontally) {
media_horizontal_fastscroller.setViews(media_grid) media_horizontal_fastscroller.setViews(media_grid)
} else { } 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())
}
} }
} }
} }

View file

@ -408,6 +408,26 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_info_bubble_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_show_info_bubble"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/show_info_bubble"/>
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_show_extended_details_holder" android:id="@+id/settings_show_extended_details_holder"
android:layout_width="match_parent" android:layout_width="match_parent"