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() {
|
private fun hideFolder() {
|
||||||
addNoMedia(mPath) {
|
addNoMedia(mPath) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (!config.shouldShowHidden)
|
if (!config.shouldShowHidden) {
|
||||||
finish()
|
finish()
|
||||||
else
|
} else {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,21 +75,27 @@ class MediaFetcher(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList<Medium> {
|
fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList<Medium> {
|
||||||
val projection = arrayOf(MediaStore.Images.Media._ID,
|
if (curPath.startsWith(OTG_PATH)) {
|
||||||
MediaStore.Images.Media.DISPLAY_NAME,
|
val curMedia = ArrayList<Medium>()
|
||||||
MediaStore.Images.Media.DATE_TAKEN,
|
getMediaOnOTG(curPath, curMedia, isPickImage, isPickVideo, context.config.filterMedia)
|
||||||
MediaStore.Images.Media.DATE_MODIFIED,
|
return curMedia
|
||||||
MediaStore.Images.Media.DATA,
|
} else {
|
||||||
MediaStore.Images.Media.SIZE)
|
val projection = arrayOf(MediaStore.Images.Media._ID,
|
||||||
val uri = MediaStore.Files.getContentUri("external")
|
MediaStore.Images.Media.DISPLAY_NAME,
|
||||||
val selection = getSelectionQuery(curPath)
|
MediaStore.Images.Media.DATE_TAKEN,
|
||||||
val selectionArgs = getSelectionArgsQuery(curPath)
|
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 {
|
return try {
|
||||||
val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath))
|
val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath))
|
||||||
parseCursor(context, cur, isPickImage, isPickVideo, curPath)
|
parseCursor(context, cur, isPickImage, isPickVideo, curPath)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
ArrayList()
|
ArrayList()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue