aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-03 00:22:10 -0700
committerAllan Wang <me@allanwang.ca>2017-06-03 00:22:10 -0700
commit5796566137995c8d244720f87ba85bce0e0d2f00 (patch)
tree1736e12182c7cf2769ad953029dc6a645b803802 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
parentbc197ad5769ee792d930ac5b634e1e9000230689 (diff)
downloadfrost-5796566137995c8d244720f87ba85bce0e0d2f00.tar.gz
frost-5796566137995c8d244720f87ba85bce0e0d2f00.tar.bz2
frost-5796566137995c8d244720f87ba85bce0e0d2f00.zip
css updates and beginning login migration
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
index 03659908..b2260b6f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
@@ -10,12 +10,13 @@ import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.webkit.WebView
-import com.pitchedapps.frost.events.WebEvent
+import com.pitchedapps.frost.events.FbAccountEvent
import com.pitchedapps.frost.utils.ObservableContainer
import io.reactivex.subjects.BehaviorSubject
import io.reactivex.subjects.Subject
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
/**
* Created by Allan Wang on 2017-05-29.
@@ -35,6 +36,7 @@ class FrostWebViewCore @JvmOverloads constructor(
private var nestedOffsetY: Int = 0
override val progressObservable: Subject<Int> //TODO see if we need this
var baseUrl: String? = null
+ var position: Int = -1
init {
isNestedScrollingEnabled = true
@@ -47,7 +49,7 @@ class FrostWebViewCore @JvmOverloads constructor(
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
setLayerType(View.LAYER_TYPE_HARDWARE, null)
- setWebViewClient(FrostWebViewClient())
+ setWebViewClient(FrostWebViewClient({position}))
setWebChromeClient(FrostChromeClient(progressObservable))
}
@@ -56,6 +58,8 @@ class FrostWebViewCore @JvmOverloads constructor(
super.loadUrl(url)
}
+ fun loadBaseUrl() = loadUrl(baseUrl)
+
override fun onTouchEvent(ev: MotionEvent): Boolean {
val event = MotionEvent.obtain(ev)
val action = MotionEventCompat.getActionMasked(event)
@@ -106,8 +110,8 @@ class FrostWebViewCore @JvmOverloads constructor(
super.onDetachedFromWindow()
}
- @Subscribe
- fun webEvent(event: WebEvent) = event.execute(this)
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ fun webEvent(event: FbAccountEvent) = event.execute(this)
// Nested Scroll implements
override fun setNestedScrollingEnabled(enabled: Boolean) {