diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index bb8bfc37f..38946513c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -9,9 +9,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.getHumanizedFilename import com.simplemobiletools.gallery.extensions.getLongValue import com.simplemobiletools.gallery.extensions.getStringValue -import com.simplemobiletools.gallery.helpers.Config -import com.simplemobiletools.gallery.helpers.SORT_BY_NAME -import com.simplemobiletools.gallery.helpers.SORT_DESCENDING +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import java.io.File import java.util.* @@ -28,13 +26,14 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va override fun doInBackground(vararg params: Void): ArrayList { val directories = LinkedHashMap() val invalidFiles = ArrayList() + val showMedia = mConfig.showMedia for (i in 0..1) { - if ((isPickVideo) && i == 0) + if (i == 0 && (isPickVideo || showMedia == VIDEOS)) continue var uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI if (i == 1) { - if (isPickImage) + if (isPickImage || showMedia == IMAGES) continue uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 34401195e..b3217a41d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -8,6 +8,8 @@ import com.simplemobiletools.filepicker.extensions.scanFiles import com.simplemobiletools.gallery.extensions.getLongValue import com.simplemobiletools.gallery.extensions.getStringValue import com.simplemobiletools.gallery.helpers.Config +import com.simplemobiletools.gallery.helpers.IMAGES +import com.simplemobiletools.gallery.helpers.VIDEOS import com.simplemobiletools.gallery.models.Medium import java.io.File import java.util.* @@ -25,13 +27,14 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo override fun doInBackground(vararg params: Void): ArrayList { val media = ArrayList() val invalidFiles = ArrayList() + val showMedia = mConfig.showMedia for (i in 0..1) { - if (isPickVideo && i == 0) + if (i == 0 && (isPickVideo || showMedia == VIDEOS)) continue var uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI if (i == 1) { - if (isPickImage) + if (isPickImage || showMedia == IMAGES) continue uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI