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 {
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'

View file

@ -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())
}

View file

@ -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())
}

View file

@ -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 {

View file

@ -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())
}
}
}
}

View file

@ -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())
}
}
}
}

View file

@ -408,6 +408,26 @@
</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
android:id="@+id/settings_show_extended_details_holder"
android:layout_width="match_parent"