fix #937, set Image as the default file type

This commit is contained in:
tibbi 2018-09-05 12:22:58 +02:00
parent 7c299edcd2
commit ee46cde8f3
4 changed files with 10 additions and 10 deletions

View file

@ -88,11 +88,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
val file = File(mUri.toString()) val file = File(mUri.toString())
val filename = getFilenameFromUri(mUri!!) val filename = getFilenameFromUri(mUri!!)
val type = when { val type = when {
filename.isImageFast() -> TYPE_IMAGES
filename.isVideoFast() -> TYPE_VIDEOS filename.isVideoFast() -> TYPE_VIDEOS
filename.isGif() -> TYPE_GIFS filename.isGif() -> TYPE_GIFS
filename.isRawFast() -> TYPE_RAWS filename.isRawFast() -> TYPE_RAWS
else -> TYPE_SVGS filename.isSvg() -> TYPE_SVGS
else -> TYPE_IMAGES
} }
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L) mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)

View file

@ -521,11 +521,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
dir_path?.text = "${directory.path.substringBeforeLast("/")}/" dir_path?.text = "${directory.path.substringBeforeLast("/")}/"
photo_cnt.text = directory.mediaCnt.toString() photo_cnt.text = directory.mediaCnt.toString()
val thumbnailType = when { val thumbnailType = when {
directory.tmb.isImageFast() -> TYPE_IMAGES
directory.tmb.isVideoFast() -> TYPE_VIDEOS directory.tmb.isVideoFast() -> TYPE_VIDEOS
directory.tmb.isGif() -> TYPE_GIFS directory.tmb.isGif() -> TYPE_GIFS
directory.tmb.isRawFast() -> TYPE_RAWS directory.tmb.isRawFast() -> TYPE_RAWS
else -> TYPE_SVGS directory.tmb.isSvg() -> TYPE_SVGS
else -> TYPE_IMAGES
} }
activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails)

View file

@ -237,11 +237,11 @@ class MediaFetcher(val context: Context) {
} }
val type = when { val type = when {
isImage -> TYPE_IMAGES
isVideo -> TYPE_VIDEOS isVideo -> TYPE_VIDEOS
isGif -> TYPE_GIFS isGif -> TYPE_GIFS
isRaw -> TYPE_RAWS isRaw -> TYPE_RAWS
else -> TYPE_SVGS isSvg -> TYPE_SVGS
else -> TYPE_IMAGES
} }
val isFavorite = favoritePaths.contains(path) val isFavorite = favoritePaths.contains(path)
@ -299,11 +299,11 @@ class MediaFetcher(val context: Context) {
val dateModified = file.lastModified() val dateModified = file.lastModified()
val type = when { val type = when {
isImage -> TYPE_IMAGES
isVideo -> TYPE_VIDEOS isVideo -> TYPE_VIDEOS
isGif -> TYPE_GIFS isGif -> TYPE_GIFS
isRaw -> TYPE_RAWS isRaw -> TYPE_RAWS
else -> TYPE_SVGS isSvg -> TYPE_SVGS
else -> TYPE_IMAGES
} }
val path = Uri.decode(file.uri.toString().replaceFirst("${context.config.OTGTreeUri}/document/${context.config.OTGPartition}%3A", OTG_PATH)) val path = Uri.decode(file.uri.toString().replaceFirst("${context.config.OTGTreeUri}/document/${context.config.OTGPartition}%3A", OTG_PATH))

View file

@ -22,10 +22,10 @@ class RefreshMediaReceiver : BroadcastReceiver() {
} }
private fun getFileType(path: String) = when { private fun getFileType(path: String) = when {
path.isImageFast() -> TYPE_IMAGES
path.isVideoFast() -> TYPE_VIDEOS path.isVideoFast() -> TYPE_VIDEOS
path.isGif() -> TYPE_GIFS path.isGif() -> TYPE_GIFS
path.isRawFast() -> TYPE_RAWS path.isRawFast() -> TYPE_RAWS
else -> TYPE_SVGS path.isSvg() -> TYPE_SVGS
else -> TYPE_IMAGES
} }
} }