mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 14:37:59 +01:00
properly show OTG subfolder thumbnails
This commit is contained in:
parent
771e59b5cf
commit
a0bdc0b46b
2 changed files with 23 additions and 16 deletions
|
@ -425,10 +425,11 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
private fun hideFolder() {
|
||||
addNoMedia(mPath) {
|
||||
runOnUiThread {
|
||||
if (!config.shouldShowHidden)
|
||||
if (!config.shouldShowHidden) {
|
||||
finish()
|
||||
else
|
||||
} else {
|
||||
invalidateOptionsMenu()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,21 +75,27 @@ class MediaFetcher(val context: Context) {
|
|||
}
|
||||
|
||||
fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList<Medium> {
|
||||
val projection = arrayOf(MediaStore.Images.Media._ID,
|
||||
MediaStore.Images.Media.DISPLAY_NAME,
|
||||
MediaStore.Images.Media.DATE_TAKEN,
|
||||
MediaStore.Images.Media.DATE_MODIFIED,
|
||||
MediaStore.Images.Media.DATA,
|
||||
MediaStore.Images.Media.SIZE)
|
||||
val uri = MediaStore.Files.getContentUri("external")
|
||||
val selection = getSelectionQuery(curPath)
|
||||
val selectionArgs = getSelectionArgsQuery(curPath)
|
||||
if (curPath.startsWith(OTG_PATH)) {
|
||||
val curMedia = ArrayList<Medium>()
|
||||
getMediaOnOTG(curPath, curMedia, isPickImage, isPickVideo, context.config.filterMedia)
|
||||
return curMedia
|
||||
} else {
|
||||
val projection = arrayOf(MediaStore.Images.Media._ID,
|
||||
MediaStore.Images.Media.DISPLAY_NAME,
|
||||
MediaStore.Images.Media.DATE_TAKEN,
|
||||
MediaStore.Images.Media.DATE_MODIFIED,
|
||||
MediaStore.Images.Media.DATA,
|
||||
MediaStore.Images.Media.SIZE)
|
||||
val uri = MediaStore.Files.getContentUri("external")
|
||||
val selection = getSelectionQuery(curPath)
|
||||
val selectionArgs = getSelectionArgsQuery(curPath)
|
||||
|
||||
return try {
|
||||
val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath))
|
||||
parseCursor(context, cur, isPickImage, isPickVideo, curPath)
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
return try {
|
||||
val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath))
|
||||
parseCursor(context, cur, isPickImage, isPickVideo, curPath)
|
||||
} catch (e: Exception) {
|
||||
ArrayList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue