properly show photo thumbnail at OTG files
This commit is contained in:
parent
0467112cc7
commit
5d3466b565
2 changed files with 10 additions and 3 deletions
|
@ -45,7 +45,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.12.17'
|
||||
implementation 'com.simplemobiletools:commons:3.12.18'
|
||||
|
||||
implementation files('../libs/RootTools.jar')
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
private lateinit var folderDrawable: Drawable
|
||||
private lateinit var fileDrawable: Drawable
|
||||
private var currentItemsHash = fileDirItems.hashCode()
|
||||
private val hasOTGConnected = activity.hasOTGConnected()
|
||||
|
||||
init {
|
||||
initDrawables()
|
||||
|
@ -484,7 +485,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
.error(fileDrawable)
|
||||
.centerCrop()
|
||||
|
||||
val itemToLoad = if (fileDirItem.name.endsWith(".apk", true)) {
|
||||
var itemToLoad = if (fileDirItem.name.endsWith(".apk", true)) {
|
||||
val packageInfo = context.packageManager.getPackageArchiveInfo(path, PackageManager.GET_ACTIVITIES)
|
||||
if (packageInfo != null) {
|
||||
val appInfo = packageInfo.applicationInfo
|
||||
|
@ -497,7 +498,13 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
} else {
|
||||
path
|
||||
}
|
||||
Glide.with(activity).load(itemToLoad).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(item_icon)
|
||||
|
||||
if (!activity.isActivityDestroyed()) {
|
||||
if (hasOTGConnected && itemToLoad is String && itemToLoad.startsWith(OTG_PATH)) {
|
||||
itemToLoad = itemToLoad.getOTGPublicPath(activity)
|
||||
}
|
||||
Glide.with(activity).load(itemToLoad).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(item_icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue