Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

xaiomi 9 about content://com.android.providers.media.documents/document/video%3A835951 #196

Open
mobilewhj opened this issue Apr 11, 2024 · 0 comments

Comments

@mobilewhj
Copy link

about use

mVideoAlbumLauncher.launch(
PickVisualMediaRequest(
ActivityResultContracts.PickVisualMedia.VideoOnly
)
)

method return uri similar to content://com.android.providers.media.documents/document/video%3A835951。
I think a fileName conversion should be done.You can refer to this example。https://github.com/iPaulPro/aFileChooser/blob/master/aFileChooser/src/com/ipaulpro/afilechooser/utils/FileUtils.java#L185
I used an extension function in the project.

fun Uri.parseFileName(context: Context): String? =
if (DocumentsContractCompat.isDocumentUri(context, this)) {
DocumentFile.fromSingleUri(context, this)?.name
} else {
pathSegments.last()
}

I think it can be more comprehensive, so please consider it, thank you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant