speed up the fastscroller date text fetching
This commit is contained in:
parent
b5edf28e37
commit
f8c80c2a5f
|
@ -71,6 +71,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
private var mLatestMediaDateId = 0L
|
||||
private var mCurrentPathPrefix = "" // used at "Group direct subfolders" for navigation
|
||||
private var mOpenedSubfolders = arrayListOf("") // used at "Group direct subfolders" for navigating Up with the back button
|
||||
private var mDateFormat = ""
|
||||
private var mTimeFormat = ""
|
||||
private var mLastMediaHandler = Handler()
|
||||
private var mTempShowHiddenHandler = Handler()
|
||||
private var mZoomListener: MyRecyclerView.MyZoomListener? = null
|
||||
|
@ -161,6 +163,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
config.isThirdPartyIntent = false
|
||||
mDateFormat = config.dateFormat
|
||||
mTimeFormat = getTimeFormat()
|
||||
|
||||
if (mStoredAnimateGifs != config.animateGifs) {
|
||||
getRecyclerAdapter()?.updateAnimateGifs(config.animateGifs)
|
||||
|
@ -1199,7 +1203,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
|
||||
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
||||
|
||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this)
|
||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this, mDateFormat, mTimeFormat)
|
||||
?: ""
|
||||
|
||||
private fun setupLatestMediaId() {
|
||||
|
|
|
@ -1169,6 +1169,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SourceLockedOrientationActivity")
|
||||
private fun checkOrientation() {
|
||||
if (!mIsOrientationLocked && config.screenRotation == ROTATE_BY_ASPECT_RATIO) {
|
||||
var flipSides = false
|
||||
|
|
|
@ -122,6 +122,8 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
|
|||
|
||||
val scrollHorizontally = activity.config.scrollHorizontally && isGridViewType
|
||||
val sorting = activity.config.directorySorting
|
||||
val dateFormat = activity.config.dateFormat
|
||||
val timeFormat = activity.getTimeFormat()
|
||||
view.apply {
|
||||
directories_grid.adapter = adapter
|
||||
|
||||
|
@ -134,12 +136,12 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
|
|||
if (scrollHorizontally) {
|
||||
directories_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
|
||||
directories_horizontal_fastscroller.setViews(directories_grid) {
|
||||
directories_horizontal_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
|
||||
directories_horizontal_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity, dateFormat, timeFormat))
|
||||
}
|
||||
} else {
|
||||
directories_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
|
||||
directories_vertical_fastscroller.setViews(directories_grid) {
|
||||
directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
|
||||
directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity, dateFormat, timeFormat))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ data class Directory(
|
|||
|
||||
constructor() : this(null, "", "", "", 0, 0L, 0L, 0L, 0, 0, "", 0, 0)
|
||||
|
||||
fun getBubbleText(sorting: Int, context: Context) = when {
|
||||
fun getBubbleText(sorting: Int, context: Context, dateFormat: String? = null, timeFormat: String? = null) = when {
|
||||
sorting and SORT_BY_NAME != 0 -> name
|
||||
sorting and SORT_BY_PATH != 0 -> path
|
||||
sorting and SORT_BY_SIZE != 0 -> size.formatSize()
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context)
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context, dateFormat, timeFormat)
|
||||
else -> taken.formatDate(context)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue