show an info bubble at fastscroller dragging

This commit is contained in:
tibbi 2017-12-05 23:45:09 +01:00
parent 2341d0f009
commit da2db79913
6 changed files with 25 additions and 7 deletions

View file

@ -43,7 +43,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.1.3' implementation 'com.simplemobiletools:commons:3.1.4'
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

@ -583,7 +583,9 @@ 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.setViews(directories_grid, directories_refresh_layout) directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) {
directories_vertical_fastscroller.updateBubbleText(mDirs[it].getBubbleText())
}
} }
} }

View file

@ -203,7 +203,9 @@ 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.setViews(media_grid, media_refresh_layout) media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) {
media_vertical_fastscroller.updateBubbleText(mMedia[it].getBubbleText())
}
} }
} }

View file

@ -45,7 +45,7 @@ abstract class ViewPagerFragment : Fragment() {
} }
if (detailsFlag and EXT_LAST_MODIFIED != 0) { if (detailsFlag and EXT_LAST_MODIFIED != 0) {
file.lastModified().formatLastModified().let { if (it.isNotEmpty()) details.appendln(it) } file.lastModified().formatDate().let { if (it.isNotEmpty()) details.appendln(it) }
} }
if (detailsFlag and EXT_DATE_TAKEN != 0) { if (detailsFlag and EXT_DATE_TAKEN != 0) {

View file

@ -1,5 +1,7 @@
package com.simplemobiletools.gallery.models package com.simplemobiletools.gallery.models
import com.simplemobiletools.commons.extensions.formatDate
import com.simplemobiletools.commons.extensions.formatSize
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
import java.io.Serializable import java.io.Serializable
@ -37,4 +39,11 @@ data class Directory(val path: String, val tmb: String, val name: String, var me
} }
return result return result
} }
fun getBubbleText() = when {
sorting and SORT_BY_SIZE != 0 -> size.formatSize()
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate()
sorting and SORT_BY_DATE_TAKEN != 0 -> taken.formatDate()
else -> name
}
} }

View file

@ -1,8 +1,6 @@
package com.simplemobiletools.gallery.models package com.simplemobiletools.gallery.models
import com.simplemobiletools.commons.extensions.getMimeTypeFromPath import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.extensions.isGif
import com.simplemobiletools.commons.extensions.isPng
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
import java.io.Serializable import java.io.Serializable
@ -48,4 +46,11 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo
} }
return result return result
} }
fun getBubbleText() = when {
sorting and SORT_BY_SIZE != 0 -> size.formatSize()
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate()
sorting and SORT_BY_DATE_TAKEN != 0 -> taken.formatDate()
else -> name
}
} }