scan OTG paths only if there is an OTG device connected

This commit is contained in:
tibbi 2018-12-21 10:39:54 +01:00
parent 0a481e5d57
commit 293d8a7390

View file

@ -26,9 +26,11 @@ class MediaFetcher(val context: Context) {
} }
val curMedia = ArrayList<Medium>() val curMedia = ArrayList<Medium>()
if (curPath.startsWith(OTG_PATH)) { if (curPath.startsWith(OTG_PATH, true)) {
val newMedia = getMediaOnOTG(curPath, isPickImage, isPickVideo, filterMedia, favoritePaths, getVideoDurations) if (context.hasOTGConnected()) {
curMedia.addAll(newMedia) val newMedia = getMediaOnOTG(curPath, isPickImage, isPickVideo, filterMedia, favoritePaths, getVideoDurations)
curMedia.addAll(newMedia)
}
} else { } else {
val newMedia = getMediaInFolder(curPath, isPickImage, isPickVideo, filterMedia, getProperDateTaken, favoritePaths, getVideoDurations) val newMedia = getMediaInFolder(curPath, isPickImage, isPickVideo, filterMedia, getProperDateTaken, favoritePaths, getVideoDurations)
curMedia.addAll(newMedia) curMedia.addAll(newMedia)