mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
update Commons, take selected date/time format into consideration
This commit is contained in:
@ -1075,7 +1075,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||
|
||||
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
||||
|
||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting) ?: ""
|
||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this) ?: ""
|
||||
|
||||
private fun setupLatestMediaId() {
|
||||
Thread {
|
||||
|
@ -434,7 +434,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
|
||||
}, INSTANT_LOAD_DURATION)
|
||||
}
|
||||
|
||||
fun getItemBubbleText(position: Int, sorting: Int) = (media[position] as? Medium)?.getBubbleText(sorting)
|
||||
fun getItemBubbleText(position: Int, sorting: Int) = (media[position] as? Medium)?.getBubbleText(sorting, activity)
|
||||
|
||||
private fun setupThumbnail(view: View, medium: Medium) {
|
||||
val isSelected = selectedKeys.contains(medium.path.hashCode())
|
||||
|
@ -124,12 +124,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))
|
||||
directories_horizontal_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
|
||||
}
|
||||
} else {
|
||||
directories_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
|
||||
directories_vertical_fastscroller.setViews(directories_grid) {
|
||||
directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting))
|
||||
directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
||||
if (scrollHorizontally) {
|
||||
media_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
|
||||
media_horizontal_fastscroller.setViews(media_grid) {
|
||||
media_horizontal_fastscroller.updateBubbleText((media[it] as? Medium)?.getBubbleText(sorting) ?: "")
|
||||
media_horizontal_fastscroller.updateBubbleText((media[it] as? Medium)?.getBubbleText(sorting, activity) ?: "")
|
||||
}
|
||||
} else {
|
||||
media_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
|
||||
media_vertical_fastscroller.setViews(media_grid) {
|
||||
media_vertical_fastscroller.updateBubbleText((media[it] as? Medium)?.getBubbleText(sorting) ?: "")
|
||||
media_vertical_fastscroller.updateBubbleText((media[it] as? Medium)?.getBubbleText(sorting, activity) ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ import java.io.File
|
||||
abstract class ViewPagerFragment : Fragment() {
|
||||
var listener: FragmentListener? = null
|
||||
|
||||
protected var mTouchDownTime = 0L
|
||||
protected var mTouchDownX = 0f
|
||||
protected var mTouchDownY = 0f
|
||||
protected var mCloseDownThreshold = 100f
|
||||
protected var mIgnoreCloseDown = false
|
||||
private var mTouchDownTime = 0L
|
||||
private var mTouchDownX = 0f
|
||||
private var mTouchDownY = 0f
|
||||
private var mCloseDownThreshold = 100f
|
||||
private var mIgnoreCloseDown = false
|
||||
|
||||
abstract fun fullscreenToggled(isFullscreen: Boolean)
|
||||
|
||||
@ -63,7 +63,7 @@ abstract class ViewPagerFragment : Fragment() {
|
||||
}
|
||||
|
||||
if (detailsFlag and EXT_DATE_TAKEN != 0) {
|
||||
path.getExifDateTaken(exif).let { if (it.isNotEmpty()) details.appendln(it) }
|
||||
path.getExifDateTaken(exif, context!!).let { if (it.isNotEmpty()) details.appendln(it) }
|
||||
}
|
||||
|
||||
if (detailsFlag and EXT_CAMERA_MODEL != 0) {
|
||||
@ -85,9 +85,9 @@ abstract class ViewPagerFragment : Fragment() {
|
||||
cursor?.use {
|
||||
return if (cursor.moveToFirst()) {
|
||||
val dateModified = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L
|
||||
dateModified.formatDate()
|
||||
dateModified.formatDate(context!!)
|
||||
} else {
|
||||
file.lastModified().formatDate()
|
||||
file.lastModified().formatDate(context!!)
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.simplemobiletools.gallery.pro.models
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.*
|
||||
import com.simplemobiletools.commons.extensions.formatDate
|
||||
import com.simplemobiletools.commons.extensions.formatSize
|
||||
@ -29,12 +30,12 @@ data class Directory(
|
||||
|
||||
constructor() : this(null, "", "", "", 0, 0L, 0L, 0L, 0, 0, 0, 0)
|
||||
|
||||
fun getBubbleText(sorting: Int) = when {
|
||||
fun getBubbleText(sorting: Int, context: Context) = 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()
|
||||
else -> taken.formatDate()
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context)
|
||||
else -> taken.formatDate(context)
|
||||
}
|
||||
|
||||
fun areFavorites() = path == FAVORITES
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.simplemobiletools.gallery.pro.models
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Index
|
||||
@ -45,12 +46,12 @@ data class Medium(
|
||||
|
||||
fun isHidden() = name.startsWith('.')
|
||||
|
||||
fun getBubbleText(sorting: Int) = when {
|
||||
fun getBubbleText(sorting: Int, context: Context) = 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()
|
||||
else -> taken.formatDate()
|
||||
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context)
|
||||
else -> taken.formatDate(context)
|
||||
}
|
||||
|
||||
fun getGroupingKey(groupBy: Int): String {
|
||||
|
Reference in New Issue
Block a user