diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-19 00:28:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-19 00:28:56 -0700 |
commit | 495b1bd49835070ca43a523831caee0f70079604 (patch) | |
tree | 7b8d56aa22fcf3a9fd1bf566a17fe1997180288a /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | |
parent | e4679b1663fa78a99c6c8225e454595c6c6f4e38 (diff) | |
download | frost-495b1bd49835070ca43a523831caee0f70079604.tar.gz frost-495b1bd49835070ca43a523831caee0f70079604.tar.bz2 frost-495b1bd49835070ca43a523831caee0f70079604.zip |
Dev - minor updates (#73)v1.3.3
* Add lint
* Add new libs
* Update libs and add friends tab
* Aggressively hide nonrecent posts
* Update dependencies
* Add php to most recents
* Add full size image downloader
* Fix css cleaner
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index 3e6ddd06..89eef258 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -79,6 +79,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient internal fun injectAndFinish() { L.d("Page finished reveal") webCore.jsInject(CssHider.HEADER, + CssHider.NON_RECENT.maybe(webCore.url.contains("?sk=h_chr")), Prefs.themeInjector, callback = { refreshObservable.onNext(false) @@ -104,15 +105,25 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient * returns true to override the url */ private fun launchRequest(request: WebResourceRequest): Boolean { - L.d("Launching ${request.url}") + L.d("Launching Url", request.url.toString()) webCore.context.launchWebOverlay(request.url.toString()) return true } + private fun launchImage(request: WebResourceRequest, text: String? = null): Boolean { + L.d("Launching Image", request.url.toString()) + webCore.context.launchImageActivity(request.url.toString(), text) + if (webCore.canGoBack()) webCore.goBack() + return true + } + override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { L.i("Url Loading ${request.url}") val path = request.url.path ?: return super.shouldOverrideUrlLoading(view, request) + L.v("Url Loading Path $path") if (path.startsWith("/composer/")) return launchRequest(request) + if (request.url.toString().contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png"))) + return launchImage(request) return super.shouldOverrideUrlLoading(view, request) } |