updating commons to 5.28.3

This commit is contained in:
tibbi 2020-05-16 23:14:11 +02:00
parent bf3624aa88
commit 20c3cc617d
2 changed files with 28 additions and 28 deletions

View File

@ -58,7 +58,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:5.26.24' implementation 'com.simplemobiletools:commons:5.28.3'
implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2' implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -254,10 +254,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
intent.data = Uri.fromFile(File(path)) intent.data = Uri.fromFile(File(path))
val shortcut = ShortcutInfo.Builder(activity, path) val shortcut = ShortcutInfo.Builder(activity, path)
.setShortLabel(path.getFilenameFromPath()) .setShortLabel(path.getFilenameFromPath())
.setIcon(Icon.createWithBitmap(drawable.convertToBitmap())) .setIcon(Icon.createWithBitmap(drawable.convertToBitmap()))
.setIntent(intent) .setIntent(intent)
.build() .build()
manager.requestPinShortcut(shortcut, null) manager.requestPinShortcut(shortcut, null)
} }
@ -272,25 +272,25 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
} else { } else {
ensureBackgroundThread { ensureBackgroundThread {
val options = RequestOptions() val options = RequestOptions()
.format(DecodeFormat.PREFER_ARGB_8888) .format(DecodeFormat.PREFER_ARGB_8888)
.skipMemoryCache(true) .skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.fitCenter() .fitCenter()
val size = activity.resources.getDimension(R.dimen.shortcut_size).toInt() val size = activity.resources.getDimension(R.dimen.shortcut_size).toInt()
val builder = Glide.with(activity) val builder = Glide.with(activity)
.asDrawable() .asDrawable()
.load(getImagePathToLoad(path)) .load(getImagePathToLoad(path))
.apply(options) .apply(options)
.centerCrop() .centerCrop()
.into(size, size) .into(size, size)
try { try {
val bitmap = builder.get() val bitmap = builder.get()
drawable.findDrawableByLayerId(R.id.shortcut_folder_background).applyColorFilter(0) drawable.findDrawableByLayerId(R.id.shortcut_folder_background).applyColorFilter(0)
drawable.setDrawableByLayerId(R.id.shortcut_folder_image, bitmap) drawable.setDrawableByLayerId(R.id.shortcut_folder_image, bitmap)
} catch (e: Exception) { } catch (e: Exception) {
val fileIcon = activity.resources.getDrawable(R.drawable.ic_file_vector) val fileIcon = activity.resources.getDrawable(R.drawable.ic_file_generic)
drawable.setDrawableByLayerId(R.id.shortcut_folder_image, fileIcon) drawable.setDrawableByLayerId(R.id.shortcut_folder_image, fileIcon)
} }
@ -336,11 +336,11 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
private fun openAs() { private fun openAs() {
val res = activity.resources val res = activity.resources
val items = arrayListOf( val items = arrayListOf(
RadioItem(OPEN_AS_TEXT, res.getString(R.string.text_file)), RadioItem(OPEN_AS_TEXT, res.getString(R.string.text_file)),
RadioItem(OPEN_AS_IMAGE, res.getString(R.string.image_file)), RadioItem(OPEN_AS_IMAGE, res.getString(R.string.image_file)),
RadioItem(OPEN_AS_AUDIO, res.getString(R.string.audio_file)), RadioItem(OPEN_AS_AUDIO, res.getString(R.string.audio_file)),
RadioItem(OPEN_AS_VIDEO, res.getString(R.string.video_file)), RadioItem(OPEN_AS_VIDEO, res.getString(R.string.video_file)),
RadioItem(OPEN_AS_OTHER, res.getString(R.string.other_file))) RadioItem(OPEN_AS_OTHER, res.getString(R.string.other_file)))
RadioGroupDialog(activity, items) { RadioGroupDialog(activity, items) {
activity.tryOpenPathIntent(getFirstSelectedItemPath(), false, it as Int) activity.tryOpenPathIntent(getFirstSelectedItemPath(), false, it as Int)
@ -713,18 +713,18 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable }) val drawable = fileDrawables.getOrElse(fileName.substringAfterLast(".").toLowerCase(), { fileDrawable })
val options = RequestOptions() val options = RequestOptions()
.signature(listItem.mPath.getFileSignature()) .signature(listItem.mPath.getFileSignature())
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.error(drawable) .error(drawable)
.centerCrop() .centerCrop()
val itemToLoad = getImagePathToLoad(listItem.path) val itemToLoad = getImagePathToLoad(listItem.path)
if (!activity.isDestroyed) { if (!activity.isDestroyed) {
Glide.with(activity) Glide.with(activity)
.load(itemToLoad) .load(itemToLoad)
.transition(DrawableTransitionOptions.withCrossFade()) .transition(DrawableTransitionOptions.withCrossFade())
.apply(options) .apply(options)
.into(item_icon) .into(item_icon)
} }
} }
} }