feat: update folder selection to use SafInitialUris for improved document access
This commit is contained in:
@@ -37,6 +37,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||||||
import at.lockstep.jukebox.db.TrackRow
|
import at.lockstep.jukebox.db.TrackRow
|
||||||
import at.lockstep.player.LockstepViewModel
|
import at.lockstep.player.LockstepViewModel
|
||||||
import at.lockstep.player.R
|
import at.lockstep.player.R
|
||||||
|
import at.lockstep.player.util.SafInitialUris
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -149,7 +150,7 @@ fun PairingScreen(
|
|||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
Button(
|
Button(
|
||||||
onClick = { openTree.launch(null) },
|
onClick = { openTree.launch(SafInitialUris.internalDocuments()) },
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
Text(context.getString(R.string.pairing_choose_folder))
|
Text(context.getString(R.string.pairing_choose_folder))
|
||||||
|
|||||||
15
app/src/main/java/at/lockstep/player/util/SafInitialUris.kt
Normal file
15
app/src/main/java/at/lockstep/player/util/SafInitialUris.kt
Normal 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",
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user