LightCompressor icon indicating copy to clipboard operation
LightCompressor copied to clipboard

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

Open mobilewhj opened this issue 4 months ago • 0 comments

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.

mobilewhj avatar Apr 11 '24 11:04 mobilewhj