mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
give proper folder names to OTG subfolders
This commit is contained in:
@ -49,7 +49,13 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||||||
context.internalStoragePath -> context.getString(R.string.internal)
|
context.internalStoragePath -> context.getString(R.string.internal)
|
||||||
context.sdCardPath -> context.getString(R.string.sd_card)
|
context.sdCardPath -> context.getString(R.string.sd_card)
|
||||||
OTG_PATH -> context.getString(R.string.otg)
|
OTG_PATH -> context.getString(R.string.otg)
|
||||||
else -> parentDir.getFilenameFromPath()
|
else -> {
|
||||||
|
if (parentDir.startsWith(OTG_PATH)) {
|
||||||
|
parentDir.getParentPath().trimEnd('/').substringAfterLast('/')
|
||||||
|
} else {
|
||||||
|
parentDir.getFilenameFromPath()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File(parentDir).containsNoMedia()) {
|
if (File(parentDir).containsNoMedia()) {
|
||||||
|
@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.helpers
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
@ -349,7 +350,7 @@ class MediaFetcher(val context: Context) {
|
|||||||
else -> TYPE_GIF
|
else -> TYPE_GIF
|
||||||
}
|
}
|
||||||
|
|
||||||
val path = file.uri.toString().replaceFirst("${context.config.OTGBasePath}%3A", OTG_PATH)
|
val path = Uri.decode(file.uri.toString().replaceFirst("${context.config.OTGBasePath}%3A", OTG_PATH))
|
||||||
val medium = Medium(filename, path, dateModified, dateTaken, size, type)
|
val medium = Medium(filename, path, dateModified, dateTaken, size, type)
|
||||||
val isAlreadyAdded = curMedia.any { it.path == path }
|
val isAlreadyAdded = curMedia.any { it.path == path }
|
||||||
if (!isAlreadyAdded) {
|
if (!isAlreadyAdded) {
|
||||||
|
Reference in New Issue
Block a user