diff --git a/app/build.gradle b/app/build.gradle index c8fea00eb..a0e988d2e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,7 +62,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.17.9' + implementation 'com.simplemobiletools:commons:5.17.12' 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/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 7cf212687..08e46f7c4 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 @@ -576,7 +576,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val fileDirItems = arrayListOf(FileDirItem(currPath, currPath.getFilenameFromPath())) tryCopyMoveFilesTo(fileDirItems, isCopyOperation) { - fixDateTaken(arrayListOf(currPath), false) + val newPath = "$it/${currPath.getFilenameFromPath()}" + rescanPaths(arrayListOf(newPath)) { + fixDateTaken(arrayListOf(newPath), false) + } + config.tempFolderPath = "" if (!isCopyOperation) { refreshViewPager() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index dafd0cc89..538b3ecb8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -442,7 +442,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList activity.tryCopyMoveFilesTo(fileDirItems, isCopyOperation) { - activity.fixDateTaken(paths, false) + val destinationPath = it + val newPaths = fileDirItems.map { "$destinationPath/${it.name}" }.toMutableList() as java.util.ArrayList + activity.rescanPaths(newPaths) { + activity.fixDateTaken(newPaths, false) + } + config.tempFolderPath = "" listener?.refreshItems() finishActMode() 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 f76fae3de..7c06e085d 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 @@ -326,13 +326,18 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList + activity.rescanPaths(newPaths) { + activity.fixDateTaken(newPaths, false) + } if (!isCopyOperation) { listener?.refreshItems() - activity.updateFavoritePaths(fileDirItems, it) + activity.updateFavoritePaths(fileDirItems, destinationPath) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index bb271b7ac..1ae26673f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -292,7 +292,9 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDa callback() } - fixDateTaken(newPaths, false) + rescanPaths(newPaths) { + fixDateTaken(newPaths, false) + } } } @@ -356,7 +358,8 @@ fun Activity.fixDateTaken(paths: ArrayList, showToasts: Boolean, callbac var didUpdateFile = false val operations = ArrayList() val mediumDao = galleryDB.MediumDao() - rescanPaths(paths) { + + ensureBackgroundThread { for (path in paths) { val dateTime = ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL) ?: ExifInterface(path).getAttribute(ExifInterface.TAG_DATETIME) ?: continue