diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-08 03:03:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-08 03:03:55 -0400 |
commit | b10a745c7f0f46f4f014e1ba7fa71172d7442b83 (patch) | |
tree | ef2516b69fb04ec0f565c5bb569fd5d80b7bd262 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | |
parent | 6adfc496374eb88919f70a240eb15a726d2c18e0 (diff) | |
download | frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.gz frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.tar.bz2 frost-b10a745c7f0f46f4f014e1ba7fa71172d7442b83.zip |
Dev-1.1.7 (#39) - feature overload + context menuv1.2
* Address some crashlytics issues
* Add text scaling
* Kau fixes and cleanup
* WIP formatter
* Create in house url formatter
* Update context menu
* Update themes
* Test proguard without R
* Implement sharing and clean up context menu
* Disable viewpager swipe on long press
* Test keeping lib strings
* Update changelog and proguard
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt index 68163333..3340e7d2 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -2,8 +2,10 @@ package com.pitchedapps.frost.web import android.content.Context import android.webkit.JavascriptInterface +import ca.allanwang.kau.logging.KL import com.pitchedapps.frost.MainActivity import com.pitchedapps.frost.dbflow.CookieModel +import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.utils.* import io.reactivex.subjects.Subject @@ -11,7 +13,7 @@ import io.reactivex.subjects.Subject /** * Created by Allan Wang on 2017-06-01. */ -class FrostJSI(val context: Context, val webView: FrostWebViewCore, val contextMenu: FrostWebContextMenu) { +class FrostJSI(val context: Context, val webView: FrostWebViewCore) { val headerObservable: Subject<String>? = (context as? MainActivity)?.headerBadgeObservable @@ -33,8 +35,17 @@ class FrostJSI(val context: Context, val webView: FrostWebViewCore, val contextM } @JavascriptInterface - fun contextMenu(url: String) { - contextMenu.post { contextMenu.show(url) } + fun contextMenu(url: String, text: String) { + webView.post { webView.context.showWebContextMenu(WebContext(url.formattedFbUrl, text)) } + } + + /** + * Get notified when a stationary long click starts or ends + * This will be used to toggle the main activities viewpager swipe + */ + @JavascriptInterface + fun longClick(start: Boolean) { + (webView.context as? MainActivity)?.viewPager?.enableSwipe = !start } @JavascriptInterface @@ -44,12 +55,12 @@ class FrostJSI(val context: Context, val webView: FrostWebViewCore, val contextM @JavascriptInterface fun emit(flag: Int) { - webView.post { webView.frostWebClient!!.emit(flag) } + webView.post { webView.frostWebClient.emit(flag) } } @JavascriptInterface fun handleHtml(html: String) { - webView.post { webView.frostWebClient!!.handleHtml(html) } + webView.post { webView.frostWebClient.handleHtml(html) } } @JavascriptInterface |