class PortalWebViewActivity() : AppCompatActivity() {
private lateinit var portal: Portal
private lateinit var webView: PortalWebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_portal_webview)
portal = (application as PortalApplication).getPortal()
val url = "https://app.uniswap.org"
webView = portal.createWebView(url) // This returns an instance of PortalWebView
// Add the PortalWebView Fragment to the view
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(R.id.webViewContainer, webView)
transaction.commit()
}
fun goBack() {
if (webView.canGoBack()) {
webView.goBack() // Navigates the WebView to the previous page
}
}
fun goForward() {
if (webView.canGoForward()) {
webView.goForward() // Navigates the WebView to the next page
}
}
fun reload() {
webView.reload()
}
}