mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Merge pull request #3870 from kiwix/Fixes#3869
Fixed: Long clicking on Download button in epub ZIM files shows the `Open in new tab` dialog which leads to a blank page.
This commit is contained in:
commit
8e08acea4e
@ -77,7 +77,7 @@ open class CoreWebViewClient(
|
||||
}
|
||||
|
||||
@Suppress("NestedBlockDepth")
|
||||
private fun handleUnsupportedFiles(url: String): Boolean {
|
||||
fun handleUnsupportedFiles(url: String): Boolean {
|
||||
val extension = MimeTypeMap.getFileExtensionFromUrl(url)
|
||||
if (DOCUMENT_TYPES.containsKey(extension)) {
|
||||
callback.showSaveOrOpenUnsupportedFilesDialog(url, DOCUMENT_TYPES[extension])
|
||||
|
@ -54,7 +54,7 @@ open class KiwixWebView @SuppressLint("SetJavaScriptEnabled") constructor(
|
||||
attrs: AttributeSet,
|
||||
nonVideoView: ViewGroup,
|
||||
videoView: ViewGroup,
|
||||
webViewClient: CoreWebViewClient,
|
||||
private val webViewClient: CoreWebViewClient,
|
||||
val sharedPreferenceUtil: SharedPreferenceUtil
|
||||
) : VideoEnabledWebView(context, attrs) {
|
||||
|
||||
@ -108,7 +108,11 @@ open class KiwixWebView @SuppressLint("SetJavaScriptEnabled") constructor(
|
||||
override fun performLongClick(): Boolean {
|
||||
val result = hitTestResult
|
||||
if (result.type == HitTestResult.SRC_ANCHOR_TYPE) {
|
||||
result.extra?.let(callback::webViewLongClick)
|
||||
result.extra?.let {
|
||||
if (!webViewClient.handleUnsupportedFiles(it)) {
|
||||
callback.webViewLongClick(it)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
return super.performLongClick()
|
||||
|
Loading…
x
Reference in New Issue
Block a user