diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-04 00:19:58 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-04 00:19:58 -0700 |
commit | 6fa685433e23ce56286c3fbcae9cf1ef7a1a6e68 (patch) | |
tree | ba67706c64882f471a2f560503e1c936c615b957 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt | |
parent | 771fcb54fd3902d17f6cbad39217be3edbffa114 (diff) | |
download | frost-6fa685433e23ce56286c3fbcae9cf1ef7a1a6e68.tar.gz frost-6fa685433e23ce56286c3fbcae9cf1ef7a1a6e68.tar.bz2 frost-6fa685433e23ce56286c3fbcae9cf1ef7a1a6e68.zip |
Fix log webview and use leak canary
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt index d5fd6391..c5ac03ae 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt @@ -37,12 +37,13 @@ class FrostWebView @JvmOverloads constructor(context: Context, attrs: AttributeS inflate(getContext(), R.layout.swipe_webview, this) ButterKnife.bind(this) web.progressObservable.observeOn(AndroidSchedulers.mainThread()).subscribe { - val loaded = it == 100 - refresh.isRefreshing = !loaded - progress.visibility = if (loaded) View.INVISIBLE else View.VISIBLE + progress.visibility = if (it == 100) View.INVISIBLE else View.VISIBLE if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) progress.setProgress(it, true) else progress.progress = it } + web.refreshObservable.observeOn(AndroidSchedulers.mainThread()).subscribe { + refresh.isRefreshing = it + } refresh.setOnRefreshListener(this) addOnAttachStateChangeListener(object : OnAttachStateChangeListener { override fun onViewDetachedFromWindow(v: View) { |