if a filename is empty, try getting it from the path

This commit is contained in:
tibbi 2017-05-20 12:59:20 +02:00
parent cc814d8d45
commit 987f333c5c

View file

@ -78,6 +78,9 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo
} }
filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: ""
if (filename.isEmpty())
filename = path.getFilenameFromPath()
val isImage = filename.isImageFast() || filename.isGif() val isImage = filename.isImageFast() || filename.isGif()
val isVideo = if (isImage) false else filename.isVideoFast() val isVideo = if (isImage) false else filename.isVideoFast()