|
@@ -0,0 +1,43 @@
|
|
|
+package com.zaojiao.app.feat.webview
|
|
|
+
|
|
|
+import android.content.Context
|
|
|
+import android.content.Intent
|
|
|
+import android.net.Uri
|
|
|
+import android.os.Bundle
|
|
|
+import android.webkit.WebView
|
|
|
+import android.widget.ImageView
|
|
|
+import android.widget.LinearLayout
|
|
|
+import android.widget.TextView
|
|
|
+import androidx.appcompat.app.AppCompatActivity
|
|
|
+
|
|
|
+class WebViewActivity : AppCompatActivity() {
|
|
|
+ companion object {
|
|
|
+ fun start(context: Context, url: String) {
|
|
|
+ val intent = Intent(context, WebViewActivity::class.java)
|
|
|
+ intent.data = Uri.parse(url)
|
|
|
+ context.startActivity(intent)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private lateinit var actionBar: LinearLayout
|
|
|
+ private lateinit var actionBack: ImageView
|
|
|
+ private lateinit var actionTitle: TextView
|
|
|
+ private lateinit var webView: WebView
|
|
|
+
|
|
|
+ private lateinit var handler: WebViewHandler
|
|
|
+
|
|
|
+
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ setContentView(R.layout.layout_webview)
|
|
|
+
|
|
|
+ actionBar = findViewById(R.id.action_bar)
|
|
|
+ actionBack = findViewById(R.id.action_back)
|
|
|
+ actionTitle = findViewById(R.id.action_title)
|
|
|
+ webView = findViewById(R.id.content_webview)
|
|
|
+
|
|
|
+ handler = WebViewHandler(webView)
|
|
|
+
|
|
|
+ webView.loadUrl(intent.data.toString())
|
|
|
+ }
|
|
|
+}
|