feat: update folder selection to use SafInitialUris for improved document access

This commit is contained in:
2026-05-24 06:37:46 +02:00
parent 848f5919c8
commit eb61437f34
2 changed files with 17 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import at.lockstep.jukebox.db.TrackRow
import at.lockstep.player.LockstepViewModel
import at.lockstep.player.R
import at.lockstep.player.util.SafInitialUris
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -149,7 +150,7 @@ fun PairingScreen(
) {
item {
Button(
onClick = { openTree.launch(null) },
onClick = { openTree.launch(SafInitialUris.internalDocuments()) },
modifier = Modifier.fillMaxWidth(),
) {
Text(context.getString(R.string.pairing_choose_folder))

View File

@@ -0,0 +1,15 @@
package at.lockstep.player.util
import android.net.Uri
import android.provider.DocumentsContract
object SafInitialUris {
private const val EXTERNAL_STORAGE_AUTHORITY = "com.android.externalstorage.documents"
/** Internal-storage Documents — avoids the blocked volume root shown on Pixel devices. */
fun internalDocuments(): Uri =
DocumentsContract.buildDocumentUri(
EXTERNAL_STORAGE_AUTHORITY,
"primary:Documents",
)
}