mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
#1520 review fixes
This commit is contained in:
parent
7fbbf842fd
commit
9b4ca6cfaf
@ -148,12 +148,12 @@ object FileUtils {
|
||||
}
|
||||
|
||||
@JvmStatic fun getLocalFilePathByUri(
|
||||
ctx: Context,
|
||||
context: Context,
|
||||
uri: Uri
|
||||
): String? {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
|
||||
DocumentsContract.isDocumentUri(ctx, uri)
|
||||
DocumentsContract.isDocumentUri(context, uri)
|
||||
) {
|
||||
if ("com.android.externalstorage.documents" == uri.authority) {
|
||||
val documentId = DocumentsContract.getDocumentId(uri)
|
||||
@ -164,12 +164,12 @@ object FileUtils {
|
||||
}
|
||||
} else if ("com.android.providers.downloads.documents" == uri.authority)
|
||||
return try {
|
||||
documentProviderContentQuery(ctx, uri)
|
||||
documentProviderContentQuery(context, uri)
|
||||
} catch (ignore: IllegalArgumentException) {
|
||||
null
|
||||
}
|
||||
} else if ("content".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
return contentQuery(ctx, uri)
|
||||
return contentQuery(context, uri)
|
||||
} else if ("file".equals(uri.scheme!!, ignoreCase = true)) {
|
||||
return uri.path
|
||||
}
|
||||
@ -177,9 +177,9 @@ object FileUtils {
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES.KITKAT)
|
||||
private fun documentProviderContentQuery(ctx: Context, uri: Uri) =
|
||||
private fun documentProviderContentQuery(context: Context, uri: Uri) =
|
||||
contentQuery(
|
||||
ctx,
|
||||
context,
|
||||
ContentUris.withAppendedId(
|
||||
Uri.parse("content://downloads/public_downloads"),
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user