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/util/tbs/Tbs.kt |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/util/tbs/Tbs.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/util/tbs/Tbs.kt
index fa73526..88819e3 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/util/tbs/Tbs.kt
+++ b/app/src/main/java/cn/flightfeather/thirdappmodule/util/tbs/Tbs.kt
@@ -1,8 +1,10 @@
 package cn.flightfeather.thirdappmodule.util.tbs
 
 import android.content.Context
+import android.util.Log
 import com.tencent.smtt.sdk.QbSdk
-
+import com.tencent.smtt.sdk.TbsDownloader
+import com.tencent.smtt.sdk.TbsListener
 
 
 /**
@@ -13,6 +15,7 @@
 class Tbs {
 
     companion object {
+        private const val TAG = "Tbs"
 
         fun init(applicationContext: Context) {
             //鎼滈泦鏈湴tbs鍐呮牳淇℃伅骞朵笂鎶ユ湇鍔″櫒锛屾湇鍔″櫒杩斿洖缁撴灉鍐冲畾浣跨敤鍝釜鍐呮牳銆�
@@ -22,14 +25,47 @@
                 override fun onViewInitFinished(arg0: Boolean) {
                     // TODO Auto-generated method stub
                     //x5鍏ф牳鍒濆鍖栧畬鎴愮殑鍥炶皟锛屼负true琛ㄧずx5鍐呮牳鍔犺浇鎴愬姛锛屽惁鍒欒〃绀簒5鍐呮牳鍔犺浇澶辫触锛屼細鑷姩鍒囨崲鍒扮郴缁熷唴鏍搞��
-
+                    println("QbSdk.initX5Environment---$arg0")
                 }
 
                 override fun onCoreInitFinished() {
                     // TODO Auto-generated method stub
+                    println("QbSdk.initX5Environment---finished")
                 }
             }
             //x5鍐呮牳鍒濆鍖栨帴鍙�
+            QbSdk.setDownloadWithoutWifi(true)
+
+            /* SDK鍐呮牳鍒濆鍖栧懆鏈熷洖璋冿紝鍖呮嫭 涓嬭浇銆佸畨瑁呫�佸姞杞� */
+            QbSdk.setTbsListener(object : TbsListener {
+                /**
+                 * @param stateCode 鐢ㄦ埛鍙鐞嗛敊璇爜璇峰弬鑰僛com.tencent.smtt.sdk.TbsCommonCode]
+                 */
+                override fun onDownloadFinish(stateCode: Int) {
+                    Log.i(TAG, "onDownloadFinished: $stateCode")
+                }
+
+                /**
+                 * @param stateCode 鐢ㄦ埛鍙鐞嗛敊璇爜璇峰弬鑰僛com.tencent.smtt.sdk.TbsCommonCode]
+                 */
+                override fun onInstallFinish(stateCode: Int) {
+                    Log.i(TAG, "onInstallFinished: $stateCode")
+                }
+
+                /**
+                 * 棣栨瀹夎搴旂敤锛屼細瑙﹀彂鍐呮牳涓嬭浇锛屾鏃朵細鏈夊唴鏍镐笅杞界殑杩涘害鍥炶皟銆�
+                 * @param progress 0 - 100
+                 */
+                override fun onDownloadProgress(progress: Int) {
+                    Log.i(TAG, "Core Downloading: $progress")
+                }
+            })
+
+            val needDownLoad = TbsDownloader.needDownload(applicationContext, TbsDownloader.DOWNLOAD_OVERSEA_TBS)
+            if (needDownLoad) {
+                TbsDownloader.startDownload(applicationContext)
+            }
+
             QbSdk.initX5Environment(applicationContext, cb)
         }
     }

--
Gitblit v1.9.3