diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index dd4d9703d..081d0df72 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -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() + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 65347f4e1..838741c1f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -75,21 +75,27 @@ class MediaFetcher(val context: Context) { } fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList { - 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() + 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() + } } }