From 3013b813e5df6977c0be921928f73b1a3adde290 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 02 七月 2025 15:52:04 +0800
Subject: [PATCH] ### 一、巡查模块相关
---
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