updating commons to 5.13.14

This commit is contained in:
tibbi 2019-06-14 15:19:57 +02:00
parent 995550e105
commit b474ea7397
5 changed files with 15 additions and 14 deletions

View file

@ -61,7 +61,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.13.12' implementation 'com.simplemobiletools:commons:5.13.14'
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

@ -383,7 +383,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.exists() && newFolder.isDirectory) {
if (newFolder.list()?.isEmpty() == true) { if (newFolder.list()?.isEmpty() == true) {
toast(String.format(getString(R.string.deleting_folder), config.tempFolderPath), Toast.LENGTH_LONG) toast(String.format(getString(R.string.deleting_folder), config.tempFolderPath), Toast.LENGTH_LONG)
tryDeleteFileDirItem(newFolder.toFileDirItem(applicationContext), true, true) tryDeleteFileDirItem(newFolder.toFileDirItem(), true, true)
} }
} }
config.tempFolderPath = "" config.tempFolderPath = ""
@ -554,7 +554,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
(it.isGif() && filter and TYPE_GIFS != 0) || (it.isGif() && filter and TYPE_GIFS != 0) ||
(it.isRawFast() && filter and TYPE_RAWS != 0) || (it.isRawFast() && filter and TYPE_RAWS != 0) ||
(it.isSvg() && filter and TYPE_SVGS != 0)) (it.isSvg() && filter and TYPE_SVGS != 0))
}?.mapTo(itemsToDelete) { it.toFileDirItem(this) } }?.mapTo(itemsToDelete) { it.toFileDirItem() }
} }
if (config.useRecycleBin) { if (config.useRecycleBin) {

View file

@ -168,7 +168,7 @@ fun BaseSimpleActivity.removeNoMedia(path: String, callback: (() -> Unit)? = nul
return return
} }
tryDeleteFileDirItem(file.toFileDirItem(applicationContext), false, false) { tryDeleteFileDirItem(file.toFileDirItem(), false, false) {
callback?.invoke() callback?.invoke()
} }
} }

View file

@ -1,18 +1,10 @@
package com.simplemobiletools.gallery.pro.extensions package com.simplemobiletools.gallery.pro.extensions
import android.media.MediaMetadataRetriever import android.media.MediaMetadataRetriever
import com.bumptech.glide.signature.ObjectKey
import com.simplemobiletools.gallery.pro.helpers.NOMEDIA import com.simplemobiletools.gallery.pro.helpers.NOMEDIA
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
fun String.getFileSignature() = ObjectKey(getFileKey())
fun String.getFileKey(): String {
val file = File(this)
return "${file.absolutePath}${file.lastModified()}"
}
fun String.isThisOrParentIncluded(includedPaths: MutableSet<String>) = includedPaths.any { startsWith(it, true) } fun String.isThisOrParentIncluded(includedPaths: MutableSet<String>) = includedPaths.any { startsWith(it, true) }
fun String.isThisOrParentExcluded(excludedPaths: MutableSet<String>) = excludedPaths.any { startsWith(it, true) } fun String.isThisOrParentExcluded(excludedPaths: MutableSet<String>) = excludedPaths.any { startsWith(it, true) }

View file

@ -10,12 +10,16 @@ import android.widget.RemoteViews
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.extensions.getFileSignature
import com.simplemobiletools.commons.extensions.setBackgroundColor import com.simplemobiletools.commons.extensions.setBackgroundColor
import com.simplemobiletools.commons.extensions.setText import com.simplemobiletools.commons.extensions.setText
import com.simplemobiletools.commons.extensions.setVisibleIf import com.simplemobiletools.commons.extensions.setVisibleIf
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.activities.MediaActivity import com.simplemobiletools.gallery.pro.activities.MediaActivity
import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.extensions.directoryDB
import com.simplemobiletools.gallery.pro.extensions.getFolderNameFromPath
import com.simplemobiletools.gallery.pro.extensions.widgetsDB
import com.simplemobiletools.gallery.pro.models.Widget import com.simplemobiletools.gallery.pro.models.Widget
class MyWidgetProvider : AppWidgetProvider() { class MyWidgetProvider : AppWidgetProvider() {
@ -44,7 +48,12 @@ class MyWidgetProvider : AppWidgetProvider() {
val options = RequestOptions() val options = RequestOptions()
.signature(path.getFileSignature()) .signature(path.getFileSignature())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
if (context.config.cropThumbnails) options.centerCrop() else options.fitCenter()
if (context.config.cropThumbnails) {
options.centerCrop()
} else {
options.fitCenter()
}
val density = context.resources.displayMetrics.density val density = context.resources.displayMetrics.density
val appWidgetOptions = appWidgetManager.getAppWidgetOptions(appWidgetIds.first()) val appWidgetOptions = appWidgetManager.getAppWidgetOptions(appWidgetIds.first())