From 495b1bd49835070ca43a523831caee0f70079604 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Wed, 19 Jul 2017 00:28:56 -0700 Subject: Dev - minor updates (#73) * 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 --- .../kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt') 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) } -- cgit v1.2.3