all: reformat
This commit is contained in:
@@ -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("/"))
|
||||
|
||||
Reference in New Issue
Block a user