aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-23 18:51:01 -0800
committerAllan Wang <me@allanwang.ca>2020-02-23 18:51:01 -0800
commit4b92fca5db45f1c5477995056bb6b11a2c876e76 (patch)
treebef94ce46160b13e82afa6a39ab1a6e316b62040 /app/src/main/kotlin/com
parent896e51b99855e8801fe16e335215ea699f937046 (diff)
downloadfrost-4b92fca5db45f1c5477995056bb6b11a2c876e76.tar.gz
frost-4b92fca5db45f1c5477995056bb6b11a2c876e76.tar.bz2
frost-4b92fca5db45f1c5477995056bb6b11a2c876e76.zip
Update theme and alert cancellation
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
index bdaf22ba..43b7071e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
@@ -48,6 +48,7 @@ import kotlinx.coroutines.channels.SendChannel
*/
class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
+ private val refresh: SendChannel<Boolean> = web.parent.refreshChannel
private val progress: SendChannel<Int> = web.parent.progressChannel
private val title: SendChannel<String> = web.parent.titleChannel
private val activity = (web.context as? ActivityContract)
@@ -83,6 +84,12 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
return activity != null
}
+ private fun JsResult.frostCancel() {
+ cancel()
+ refresh.offer(false)
+ progress.offer(100)
+ }
+
override fun onJsAlert(
view: WebView,
url: String,
@@ -93,7 +100,7 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- onDismiss { result.cancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -108,8 +115,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -124,8 +131,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
title(text = url)
message(text = message)
positiveButton { result.confirm() }
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}
@@ -144,8 +151,8 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() {
result.confirm(charSequence.toString())
}
// positive button added through input
- negativeButton { result.cancel() }
- onDismiss { result.cancel() }
+ negativeButton { result.frostCancel() }
+ onDismiss { result.frostCancel() }
}
return true
}