package com.sybotan.android.demo.activities

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import com.sybotan.android.demo.R

class Scene3DActivity : AppCompatActivity() {
    private lateinit var webview: WebView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_scene3_dactivity)
        webview = findViewById(R.id.webview)
        val settings: WebSettings = webview.getSettings()
        settings.javaScriptEnabled = true
        settings.defaultTextEncodingName = "utf-8"
        settings.builtInZoomControls = true
        settings.loadsImagesAutomatically = true
        settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN
        webview.webViewClient = MyWebViewClient()
        webview.loadUrl("http://60.205.177.43:8000/APP/#/?PageType=2")
    }

    class MyWebViewClient : WebViewClient() {
        //兼容低版本
        override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
            view.loadUrl(url)
            return true
        }

        override fun onPageFinished(view: WebView, url: String) {
            super.onPageFinished(view, url)
        }
    }
}