diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 8da857d18..6ca984710 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -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() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 46c64ef55..75d4f965d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt index cf8f0b89e..4cad9e85c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt @@ -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)) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Directory.kt index f68ae3171..4f37ea010 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Directory.kt @@ -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) }