From e7ee1265772bcb65e54c716411f74c0723181368 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Feb 2019 22:15:42 +0100 Subject: [PATCH] update Commons, take selected date/time format into consideration --- app/build.gradle | 2 +- .../gallery/pro/activities/MainActivity.kt | 2 +- .../gallery/pro/adapters/MediaAdapter.kt | 2 +- .../gallery/pro/dialogs/PickDirectoryDialog.kt | 4 ++-- .../gallery/pro/dialogs/PickMediumDialog.kt | 4 ++-- .../gallery/pro/fragments/ViewPagerFragment.kt | 16 ++++++++-------- .../gallery/pro/models/Directory.kt | 7 ++++--- .../gallery/pro/models/Medium.kt | 7 ++++--- 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 9a7d3aafe..49bf1c6b7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } 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 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' 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 7f4b17ae8..a892a9586 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 @@ -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 { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 1d01a9a25..c1f7475b9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -434,7 +434,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList 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 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt index e6d95da66..4851de9b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/models/Medium.kt @@ -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 {