Compressor icon indicating copy to clipboard operation
Compressor copied to clipboard

support for uri

Open shrastiRisor opened this issue 5 years ago • 4 comments

shrastiRisor avatar May 10 '20 14:05 shrastiRisor

Duplicated. #149

jeziellago avatar May 11 '20 17:05 jeziellago

@jeziellago #149 has been closed. Could you please review this one?

shrastiRisor avatar May 15 '20 05:05 shrastiRisor

It is required to add a check for an existing file, if it was created by your app locally and is not registered with resolver. (Got NPE cursor is null)

fun getFileName(context: Context, uri: Uri): String {
    uri.path?.let {
        val file = File(it)
        if (file.exists()) return file.name
    }

    val resolver = context.contentResolver
    val cursor = resolver.query(...)

hikkidev avatar Sep 29 '20 17:09 hikkidev

Perhaps the code that I posted can be used to resolve the issues here and get it working. I use my code to compress any files on Android 10. https://github.com/zetbaitsu/Compressor/issues/163#issuecomment-755061994

extorn avatar Jan 06 '21 09:01 extorn