aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/fragments
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-13 00:42:31 -0700
committerAllan Wang <me@allanwang.ca>2017-06-13 00:42:31 -0700
commite4377fed20ce1e3f4a0b236271eecdb1fe573b7a (patch)
treeaa0b14e328daa4ece41f65cfed5a4422f2c9e898 /app/src/main/kotlin/com/pitchedapps/frost/fragments
parenta7a37f8f5b1955f006a83d4713a2c6af500c28af (diff)
downloadfrost-e4377fed20ce1e3f4a0b236271eecdb1fe573b7a.tar.gz
frost-e4377fed20ce1e3f4a0b236271eecdb1fe573b7a.tar.bz2
frost-e4377fed20ce1e3f4a0b236271eecdb1fe573b7a.zip
Created js base for facebook menu
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/fragments')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
index 40f37189..0f56592c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
@@ -9,6 +9,8 @@ import android.view.View
import android.view.ViewGroup
import ca.allanwang.kau.utils.withBundle
import com.pitchedapps.frost.MainActivity
+import com.pitchedapps.frost.facebook.FbTab
+import com.pitchedapps.frost.injectors.JsAssets
import com.pitchedapps.frost.web.FrostWebView
import com.pitchedapps.frost.web.FrostWebViewCore
import io.reactivex.android.schedulers.AndroidSchedulers
@@ -23,14 +25,21 @@ class WebFragment : Fragment() {
companion object {
private const val ARG_URL = "arg_url"
+ private const val ARG_ID = "arg_id"
operator fun invoke(url: String) = WebFragment().withBundle {
putString(ARG_URL, url)
}
+
+ operator fun invoke(data: FbTab) = WebFragment().withBundle {
+ putString(ARG_URL, data.url)
+ if (data.javascript != null) putSerializable(ARG_ID, data.javascript)
+ }
}
// val refresh: SwipeRefreshLayout by lazy { frostWebView.refresh }
val web: FrostWebViewCore by lazy { frostWebView.web }
lateinit var url: String
+ var baseJavascript: JsAssets? = null
lateinit private var frostWebView: FrostWebView
private var firstLoad = true
private var refreshDisposable: Disposable? = null
@@ -38,12 +47,14 @@ class WebFragment : Fragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
url = arguments.getString(ARG_URL)
+ baseJavascript = arguments.getSerializable(ARG_ID) as? JsAssets
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
super.onCreateView(inflater, container, savedInstanceState)
frostWebView = FrostWebView(context)
- frostWebView.baseUrl = url
+ frostWebView.web.baseUrl = url
+ frostWebView.web.baseJavascript = baseJavascript
return frostWebView
}