From 1897c4ad5fa73b3f0a36e1aa0e1e9000302a6ace Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 31 十月 2025 17:35:09 +0800
Subject: [PATCH] 2025.10.31 1. 新增巡查场景历史详情相关数据逻辑(待完成);

---
 app/src/main/java/cn/flightfeather/thirdappmodule/module/common/OfficeFileReadFragment.kt |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/module/common/OfficeFileReadFragment.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/module/common/OfficeFileReadFragment.kt
index 91c3a8d..3d8f7aa 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/module/common/OfficeFileReadFragment.kt
+++ b/app/src/main/java/cn/flightfeather/thirdappmodule/module/common/OfficeFileReadFragment.kt
@@ -14,6 +14,7 @@
 import cn.flightfeather.thirdappmodule.util.file.FileUtils
 import com.tencent.smtt.sdk.QbSdk
 import com.tencent.smtt.sdk.TbsReaderView
+import com.tencent.smtt.sdk.WebView
 import kotlinx.android.synthetic.main.fragment_office_file.*
 import org.json.JSONException
 import org.json.JSONObject
@@ -56,6 +57,7 @@
     private var fileName: String? = ""
 
     private lateinit var tbsReaderView: TbsReaderView
+    private lateinit var webView: WebView
 
     override fun getLayoutId(): Int = R.layout.fragment_office_file
 
@@ -82,12 +84,16 @@
 
     override fun onDetach() {
         super.onDetach()
-        tbsReaderView.onStop()
+//        tbsReaderView.onStop()
+//        web_view.stopLoading()
+        web_view.destroy()
     }
 
     override fun onDestroy() {
         super.onDestroy()
-        tbsReaderView.onStop()
+//        tbsReaderView.onStop()
+//        web_view.stopLoading()
+        web_view.destroy()
     }
 
     private fun init() {
@@ -107,8 +113,9 @@
     }
 
     private fun openLocalFile() {
-        tbsReaderView = TbsReaderView(context, null)
-        tbs_reader_container.addView(tbsReaderView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
+//        tbsReaderView = TbsReaderView(context, null)
+//        tbs_reader_container.addView(tbsReaderView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
+//        tbs_reader_container.addView(web_view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
         if (!filePath.isNullOrEmpty()) {
             val tempFile = File("/storage/emulated/0/TbsReaderTemp")
             if (!tempFile.exists()) {
@@ -122,10 +129,11 @@
                     "tempPath",
                     Environment.getExternalStorageDirectory().path + File.separator + "TbsReaderTemp"
             )
-            val result = tbsReaderView.preOpen(FileUtils.getExtensionName(filePath), false)
-            if (result) {
-                tbsReaderView.openFile(localBundle)
-            }
+            web_view.loadUrl(filePath)
+//            val result = tbsReaderView.preOpen(FileUtils.getExtensionName(filePath), false)
+//            if (result) {
+//                tbsReaderView.openFile(localBundle)
+//            }
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3