Skip to content
This repository was 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

@mobilewhj

Description

@mobilewhj

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions