diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-27 02:15:10 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-12-27 02:15:10 -0500 |
commit | e6dcbd7b32dc49b11184b6beca598819c3f071fd (patch) | |
tree | a02691a1eaf1b1506930c7e50c5f43f6f0fc953a /app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | |
parent | 7d85262ada198501d2d5844e1196c9b45f4a38f5 (diff) | |
download | frost-e6dcbd7b32dc49b11184b6beca598819c3f071fd.tar.gz frost-e6dcbd7b32dc49b11184b6beca598819c3f071fd.tar.bz2 frost-e6dcbd7b32dc49b11184b6beca598819c3f071fd.zip |
Begin replacing observables with channels
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | 12 |
1 files changed, 7 insertions, 5 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 12df8000..1f8118da 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt @@ -43,8 +43,9 @@ import io.reactivex.subjects.Subject */ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { - private val progress: Subject<Int> = web.parent.progressObservable - private val title: BehaviorSubject<String> = web.parent.titleObservable + private val progress = web.parent.progressChannel + private val title = web.parent.titleChannel + private var prevTitle: String? = null private val activity = (web.context as? ActivityContract) private val context = web.context!! @@ -55,13 +56,14 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { override fun onReceivedTitle(view: WebView, title: String) { super.onReceivedTitle(view, title) - if (title.startsWith("http") || this.title.value == title) return - this.title.onNext(title) + if (title.startsWith("http") || prevTitle == title) return + prevTitle = title + this.title.offer(title) } override fun onProgressChanged(view: WebView, newProgress: Int) { super.onProgressChanged(view, newProgress) - progress.onNext(newProgress) + progress.offer(newProgress) } override fun onShowFileChooser( |