From ee46cde8f3a319fbe356c168615b14ab375b7ca3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 5 Sep 2018 12:22:58 +0200 Subject: [PATCH] fix #937, set Image as the default file type --- .../gallery/activities/PhotoVideoActivity.kt | 4 ++-- .../gallery/adapters/DirectoryAdapter.kt | 4 ++-- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 8 ++++---- .../gallery/receivers/RefreshMediaReceiver.kt | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 602130cac..9ae24e5d8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -88,11 +88,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList val file = File(mUri.toString()) val filename = getFilenameFromUri(mUri!!) val type = when { - filename.isImageFast() -> TYPE_IMAGES filename.isVideoFast() -> TYPE_VIDEOS filename.isGif() -> TYPE_GIFS 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) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index b419b121c..1c6f525f0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -521,11 +521,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList TYPE_IMAGES directory.tmb.isVideoFast() -> TYPE_VIDEOS directory.tmb.isGif() -> TYPE_GIFS 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) 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 41b5f899d..7b7a08997 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -237,11 +237,11 @@ class MediaFetcher(val context: Context) { } val type = when { - isImage -> TYPE_IMAGES isVideo -> TYPE_VIDEOS isGif -> TYPE_GIFS isRaw -> TYPE_RAWS - else -> TYPE_SVGS + isSvg -> TYPE_SVGS + else -> TYPE_IMAGES } val isFavorite = favoritePaths.contains(path) @@ -299,11 +299,11 @@ class MediaFetcher(val context: Context) { val dateModified = file.lastModified() val type = when { - isImage -> TYPE_IMAGES isVideo -> TYPE_VIDEOS isGif -> TYPE_GIFS 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)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt index 010aa8c27..d9ece1f20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt @@ -22,10 +22,10 @@ class RefreshMediaReceiver : BroadcastReceiver() { } private fun getFileType(path: String) = when { - path.isImageFast() -> TYPE_IMAGES path.isVideoFast() -> TYPE_VIDEOS path.isGif() -> TYPE_GIFS path.isRawFast() -> TYPE_RAWS - else -> TYPE_SVGS + path.isSvg() -> TYPE_SVGS + else -> TYPE_IMAGES } }