Fix a nasty bug with playlists

This commit is contained in:
Matéo Duparc 2021-09-01 19:58:51 +02:00
parent b65ac79175
commit 52eab2a2df
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E

View File

@ -14,6 +14,7 @@ import sushi.hardcore.droidfs.widgets.ColoredAlertDialogBuilder
abstract class FileViewerActivity: BaseActivity() { abstract class FileViewerActivity: BaseActivity() {
protected lateinit var gocryptfsVolume: GocryptfsVolume protected lateinit var gocryptfsVolume: GocryptfsVolume
protected lateinit var filePath: String protected lateinit var filePath: String
private lateinit var originalParentPath: String
private var isFinishingIntentionally = false private var isFinishingIntentionally = false
private var usf_keep_open = false private var usf_keep_open = false
private var foldersFirst = true private var foldersFirst = true
@ -24,6 +25,7 @@ abstract class FileViewerActivity: BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
filePath = intent.getStringExtra("path")!! filePath = intent.getStringExtra("path")!!
originalParentPath = PathUtils.getParentPath(filePath)
val sessionID = intent.getIntExtra("sessionID", -1) val sessionID = intent.getIntExtra("sessionID", -1)
gocryptfsVolume = GocryptfsVolume(sessionID) gocryptfsVolume = GocryptfsVolume(sessionID)
usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false) usf_keep_open = sharedPrefs.getBoolean("usf_keep_open", false)
@ -102,7 +104,7 @@ abstract class FileViewerActivity: BaseActivity() {
protected fun createPlaylist() { protected fun createPlaylist() {
if (!wasMapped){ if (!wasMapped){
for (e in gocryptfsVolume.recursiveMapFiles(PathUtils.getParentPath(filePath))){ for (e in gocryptfsVolume.recursiveMapFiles(originalParentPath)) {
if (e.isRegularFile) { if (e.isRegularFile) {
if (ConstValues.isExtensionType(getFileType(), e.name) || filePath == e.fullPath) { if (ConstValues.isExtensionType(getFileType(), e.name) || filePath == e.fullPath) {
mappedPlaylist.add(e) mappedPlaylist.add(e)