diff --git a/app/build.gradle b/app/build.gradle index ff9537098..d54e516a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.32.22' + implementation 'com.simplemobiletools:commons:5.32.25' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19' @@ -97,8 +97,8 @@ dependencies { kapt 'com.github.bumptech.glide:compiler:4.10.0' kapt 'androidx.room:room-compiler:2.2.6' - implementation 'androidx.room:room-runtime:2.2.5' - annotationProcessor 'androidx.room:room-compiler:2.2.5' + implementation 'androidx.room:room-runtime:2.2.6' + annotationProcessor 'androidx.room:room-compiler:2.2.6' } // Apply the PESDKPlugin diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt index 34d427655..ac34d9f3c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt @@ -167,7 +167,7 @@ class WidgetConfigureActivity : SimpleActivity() { val path = directoryDao.getDirectoryThumbnail(folderPath) if (path != null) { runOnUiThread { - loadJpg(path, config_image, config.cropThumbnails, ROUNDED_CORNERS_NONE) + loadJpg(path, config_image, config.cropThumbnails, ROUNDED_CORNERS_NONE, 0) } } } 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 f3a041c71..08b042393 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 @@ -710,7 +710,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList ROUNDED_CORNERS_BIG } - activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners) + activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners, directory.modified) } dir_pin.beVisibleIf(pinnedFolders.contains(directory.path)) 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 1f693c96c..ff0ffd1eb 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 @@ -18,10 +18,7 @@ import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.FAVORITES -import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST -import com.simplemobiletools.commons.helpers.ensureBackgroundThread -import com.simplemobiletools.commons.helpers.isOreoPlus +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView @@ -544,14 +541,16 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, callback: out?.flush() - if (fileDocument?.getItemSize(true) == copiedSize && getDoesFilePathExist(destination)) { + if (fileDocument.getItemSize(true) == copiedSize && getDoesFilePathExist(destination)) { mediaDB.updateDeleted("$RECYCLE_BIN$source", System.currentTimeMillis(), source) pathsCnt-- } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 3ecb7fe75..099c80e3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -398,17 +398,17 @@ fun Context.getFolderNameFromPath(path: String): String { } fun Context.loadImage(type: Int, path: String, target: MySquareImageView, horizontalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean, - roundCorners: Int, skipMemoryCacheAtPaths: ArrayList? = null) { + roundCorners: Int, lastModified: Long, skipMemoryCacheAtPaths: ArrayList? = null) { target.isHorizontalScrolling = horizontalScroll if (type == TYPE_IMAGES || type == TYPE_VIDEOS || type == TYPE_RAWS || type == TYPE_PORTRAITS) { if (type == TYPE_IMAGES && path.isPng()) { - loadPng(path, target, cropThumbnails, roundCorners, skipMemoryCacheAtPaths) + loadPng(path, target, cropThumbnails, roundCorners, lastModified, skipMemoryCacheAtPaths) } else { - loadJpg(path, target, cropThumbnails, roundCorners, skipMemoryCacheAtPaths) + loadJpg(path, target, cropThumbnails, roundCorners, lastModified, skipMemoryCacheAtPaths) } } else if (type == TYPE_GIFS) { if (!animateGifs) { - loadStaticGIF(path, target, cropThumbnails, roundCorners, skipMemoryCacheAtPaths) + loadStaticGIF(path, target, cropThumbnails, roundCorners, lastModified, skipMemoryCacheAtPaths) return } @@ -419,12 +419,12 @@ fun Context.loadImage(type: Int, path: String, target: MySquareImageView, horizo target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER } catch (e: Exception) { - loadStaticGIF(path, target, cropThumbnails, roundCorners, skipMemoryCacheAtPaths) + loadStaticGIF(path, target, cropThumbnails, roundCorners, lastModified, skipMemoryCacheAtPaths) } catch (e: OutOfMemoryError) { - loadStaticGIF(path, target, cropThumbnails, roundCorners, skipMemoryCacheAtPaths) + loadStaticGIF(path, target, cropThumbnails, roundCorners, lastModified, skipMemoryCacheAtPaths) } } else if (type == TYPE_SVGS) { - loadSVG(path, target, cropThumbnails, roundCorners) + loadSVG(path, target, cropThumbnails, roundCorners, lastModified) } } @@ -449,9 +449,9 @@ fun Context.getPathLocation(path: String): Int { } } -fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, skipMemoryCacheAtPaths: ArrayList? = null) { +fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, lastModified: Long, skipMemoryCacheAtPaths: ArrayList? = null) { val options = RequestOptions() - .signature(path.getFileSignature()) + .signature(path.getFileSignature(lastModified)) .skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .priority(Priority.LOW) @@ -472,9 +472,9 @@ fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boo builder.into(target) } -fun Context.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, skipMemoryCacheAtPaths: ArrayList? = null) { +fun Context.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, lastModified: Long, skipMemoryCacheAtPaths: ArrayList? = null) { val options = RequestOptions() - .signature(path.getFileSignature()) + .signature(path.getFileSignature(lastModified)) .skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true) .priority(Priority.LOW) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -494,9 +494,9 @@ fun Context.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boo builder.into(target) } -fun Context.loadStaticGIF(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, skipMemoryCacheAtPaths: ArrayList? = null) { +fun Context.loadStaticGIF(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, lastModified: Long, skipMemoryCacheAtPaths: ArrayList? = null) { val options = RequestOptions() - .signature(path.getFileSignature()) + .signature(path.getFileSignature(lastModified)) .skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true) .priority(Priority.LOW) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -516,10 +516,10 @@ fun Context.loadStaticGIF(path: String, target: MySquareImageView, cropThumbnail builder.into(target) } -fun Context.loadSVG(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int) { +fun Context.loadSVG(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, lastModified: Long) { target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER - val options = RequestOptions().signature(path.getFileSignature()) + val options = RequestOptions().signature(path.getFileSignature(lastModified)) var builder = Glide.with(applicationContext) .`as`(PictureDrawable::class.java) .listener(SvgSoftwareLayerSetter())