properly show OTG subfolder thumbnails

This commit is contained in:
tibbi 2018-02-20 14:35:35 +01:00
parent 771e59b5cf
commit a0bdc0b46b
2 changed files with 23 additions and 16 deletions

View file

@ -425,13 +425,14 @@ 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()
} }
} }
} }
}
private fun unhideFolder() { private fun unhideFolder() {
removeNoMedia(mPath) { removeNoMedia(mPath) {

View file

@ -75,6 +75,11 @@ 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> {
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, val projection = arrayOf(MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATE_TAKEN, MediaStore.Images.Media.DATE_TAKEN,
@ -92,6 +97,7 @@ class MediaFetcher(val context: Context) {
ArrayList() ArrayList()
} }
} }
}
private fun getSelectionQuery(path: String): String? { private fun getSelectionQuery(path: String): String? {
val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?" val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?"