mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
give proper folder names to OTG subfolders
This commit is contained in:
parent
0419ef90a7
commit
d5496e04ba
2 changed files with 9 additions and 2 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue