all: reformat

This commit is contained in:
Alexander Capehart
2026-01-17 09:40:54 -07:00
parent ef3bd6e3cf
commit 5e3e57cdf1
4 changed files with 12 additions and 5 deletions
@@ -292,8 +292,7 @@ class LocationsDialog : ViewBindingMaterialDialogFragment<DialogMusicLocationsBi
private fun onNewLocation(launcher: ActivityResultLauncher<Uri?>?) {
L.d("Opening launcher")
val launcher =
requireNotNull(launcher) { "Document tree launcher was not available" }
val launcher = requireNotNull(launcher) { "Document tree launcher was not available" }
try {
launcher.launch(null)
@@ -61,7 +61,10 @@ sealed class Location(val uri: Uri, val path: Path) {
companion object {
fun from(context: Context, uri: Uri) =
Unopened(uri, getTreePath(context, uri) ?: Path(Volume.ThirdParty(uri), Components.root()))
Unopened(
uri,
getTreePath(context, uri) ?: Path(Volume.ThirdParty(uri), Components.root()),
)
private fun getTreePath(context: Context, uri: Uri): Path? {
if (!DocumentsContract.isTreeUri(uri)) return null
@@ -80,6 +80,7 @@ sealed interface Volume {
data class ThirdParty(val uri: Uri) : Volume {
override val mediaStoreName: String? = null
override val components: Components? = null
override fun resolveName(context: Context) = uri.toString()
}
}
@@ -94,7 +94,9 @@ private class ExternalPlaylistManagerImpl(
private val m3u: M3U,
) : ExternalPlaylistManager {
override suspend fun import(uri: Uri): ImportedPlaylist? {
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: Path(Volume.ThirdParty(uri), Components.root())
val filePath =
documentPathFactory.unpackDocumentUri(uri)
?: Path(Volume.ThirdParty(uri), Components.root())
return try {
context.contentResolverSafe.openInputStream(uri)?.use {
@@ -119,7 +121,9 @@ private class ExternalPlaylistManagerImpl(
}
override suspend fun export(playlist: Playlist, uri: Uri, config: ExportConfig): Boolean {
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: Path(Volume.ThirdParty(uri), Components.root())
val filePath =
documentPathFactory.unpackDocumentUri(uri)
?: Path(Volume.ThirdParty(uri), Components.root())
val workingDirectory =
if (config.absolute) {
Path(filePath.volume, Components.parseUnix("/"))