update Commons, take selected date/time format into consideration

This commit is contained in:
tibbi 2019-02-21 22:15:42 +01:00
parent 22c8bcf9df
commit e7ee126577
8 changed files with 23 additions and 21 deletions

View file

@ -61,7 +61,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.9.1' implementation 'com.simplemobiletools:commons:5.9.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.multidex:multidex:2.0.1'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'

View file

@ -1075,7 +1075,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList() 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() { private fun setupLatestMediaId() {
Thread { Thread {

View file

@ -434,7 +434,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
}, INSTANT_LOAD_DURATION) }, 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) { private fun setupThumbnail(view: View, medium: Medium) {
val isSelected = selectedKeys.contains(medium.path.hashCode()) val isSelected = selectedKeys.contains(medium.path.hashCode())

View file

@ -124,12 +124,12 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
if (scrollHorizontally) { if (scrollHorizontally) {
directories_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble directories_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
directories_horizontal_fastscroller.setViews(directories_grid) { directories_horizontal_fastscroller.setViews(directories_grid) {
directories_horizontal_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting)) directories_horizontal_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
} }
} else { } else {
directories_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble directories_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
directories_vertical_fastscroller.setViews(directories_grid) { directories_vertical_fastscroller.setViews(directories_grid) {
directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting)) directories_vertical_fastscroller.updateBubbleText(dirs[it].getBubbleText(sorting, activity))
} }
} }
} }

View file

@ -86,12 +86,12 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
if (scrollHorizontally) { if (scrollHorizontally) {
media_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble media_horizontal_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
media_horizontal_fastscroller.setViews(media_grid) { 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 { } else {
media_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble media_vertical_fastscroller.allowBubbleDisplay = activity.config.showInfoBubble
media_vertical_fastscroller.setViews(media_grid) { 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) ?: "")
} }
} }
} }

View file

@ -12,11 +12,11 @@ import java.io.File
abstract class ViewPagerFragment : Fragment() { abstract class ViewPagerFragment : Fragment() {
var listener: FragmentListener? = null var listener: FragmentListener? = null
protected var mTouchDownTime = 0L private var mTouchDownTime = 0L
protected var mTouchDownX = 0f private var mTouchDownX = 0f
protected var mTouchDownY = 0f private var mTouchDownY = 0f
protected var mCloseDownThreshold = 100f private var mCloseDownThreshold = 100f
protected var mIgnoreCloseDown = false private var mIgnoreCloseDown = false
abstract fun fullscreenToggled(isFullscreen: Boolean) abstract fun fullscreenToggled(isFullscreen: Boolean)
@ -63,7 +63,7 @@ abstract class ViewPagerFragment : Fragment() {
} }
if (detailsFlag and EXT_DATE_TAKEN != 0) { 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) { if (detailsFlag and EXT_CAMERA_MODEL != 0) {
@ -85,9 +85,9 @@ abstract class ViewPagerFragment : Fragment() {
cursor?.use { cursor?.use {
return if (cursor.moveToFirst()) { return if (cursor.moveToFirst()) {
val dateModified = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L val dateModified = cursor.getLongValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L
dateModified.formatDate() dateModified.formatDate(context!!)
} else { } else {
file.lastModified().formatDate() file.lastModified().formatDate(context!!)
} }
} }
return "" return ""

View file

@ -1,5 +1,6 @@
package com.simplemobiletools.gallery.pro.models package com.simplemobiletools.gallery.pro.models
import android.content.Context
import androidx.room.* import androidx.room.*
import com.simplemobiletools.commons.extensions.formatDate import com.simplemobiletools.commons.extensions.formatDate
import com.simplemobiletools.commons.extensions.formatSize import com.simplemobiletools.commons.extensions.formatSize
@ -29,12 +30,12 @@ data class Directory(
constructor() : this(null, "", "", "", 0, 0L, 0L, 0L, 0, 0, 0, 0) 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_NAME != 0 -> name
sorting and SORT_BY_PATH != 0 -> path sorting and SORT_BY_PATH != 0 -> path
sorting and SORT_BY_SIZE != 0 -> size.formatSize() sorting and SORT_BY_SIZE != 0 -> size.formatSize()
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate() sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context)
else -> taken.formatDate() else -> taken.formatDate(context)
} }
fun areFavorites() = path == FAVORITES fun areFavorites() = path == FAVORITES

View file

@ -1,5 +1,6 @@
package com.simplemobiletools.gallery.pro.models package com.simplemobiletools.gallery.pro.models
import android.content.Context
import androidx.room.ColumnInfo import androidx.room.ColumnInfo
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Index import androidx.room.Index
@ -45,12 +46,12 @@ data class Medium(
fun isHidden() = name.startsWith('.') 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_NAME != 0 -> name
sorting and SORT_BY_PATH != 0 -> path sorting and SORT_BY_PATH != 0 -> path
sorting and SORT_BY_SIZE != 0 -> size.formatSize() sorting and SORT_BY_SIZE != 0 -> size.formatSize()
sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate() sorting and SORT_BY_DATE_MODIFIED != 0 -> modified.formatDate(context)
else -> taken.formatDate() else -> taken.formatDate(context)
} }
fun getGroupingKey(groupBy: Int): String { fun getGroupingKey(groupBy: Int): String {