修复问题

This commit is contained in:
fengge 2026-04-18 18:00:28 +08:00
parent 55841872ba
commit 820f5f11c2
6 changed files with 123 additions and 47 deletions

1
.gitignore vendored
View File

@ -25,4 +25,3 @@ local.properties
/第三方/安卓demo和说明/POC_Manual.txt /第三方/安卓demo和说明/POC_Manual.txt
/第三方/安卓demo和说明/POC_SingleCall.md /第三方/安卓demo和说明/POC_SingleCall.md
/第三方/安卓demo和说明/POC_SOS.md /第三方/安卓demo和说明/POC_SOS.md
/app/release/

5
app/.gitignore vendored
View File

@ -1,5 +1,2 @@
/build /build
/release/baselineProfiles/0/app-release.dm /release/
/release/baselineProfiles/1/app-release.dm
/release/app-release-V1.0.3.apk
/release/output-metadata.json

View File

@ -11,13 +11,13 @@ android {
applicationId = "com.stand.standapp" applicationId = "com.stand.standapp"
minSdk = 24 minSdk = 24
targetSdk = 34 targetSdk = 34
versionCode = 6 versionCode = 7
versionName = "1.0.5" versionName = "1.0.6"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
ndk { ndk {
abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a")) abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64"))
} }
} }

View File

@ -173,7 +173,7 @@ class AndroidInterface(private val activity: MainActivity) {
fun onPageFinished() { fun onPageFinished() {
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
try { try {
// activity.cancelTimeoutTimer() activity.cancelTimeoutTimer()
activity.findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.GONE activity.findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.GONE
} catch (e: Exception) { } catch (e: Exception) {
Log.e("UI", "隐藏加载布局失败", e) Log.e("UI", "隐藏加载布局失败", e)

View File

@ -13,12 +13,12 @@ import com.stand.standapp.R
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
private var mAgentWeb: AgentWeb? = null private var mAgentWeb: AgentWeb? = null
// private val mHandler = android.os.Handler(android.os.Looper.getMainLooper()) private val mHandler = android.os.Handler(android.os.Looper.getMainLooper())
// private val TIMEOUT_MS = 30000L private val TIMEOUT_MS = 30000L
//
// private val timeoutRunnable = Runnable { private val timeoutRunnable = Runnable {
// showErrorPage() showErrorPage()
// } }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -29,16 +29,15 @@ class MainActivity : AppCompatActivity() {
val container = findViewById<LinearLayout>(R.id.container) val container = findViewById<LinearLayout>(R.id.container)
if (container == null) return if (container == null) return
// findViewById<android.widget.Button>(R.id.btn_retry)?.setOnClickListener { findViewById<android.widget.Button>(R.id.btn_retry)?.setOnClickListener {
// hideErrorPage() hideErrorPage()
// mAgentWeb?.webCreator?.webView?.reload() mAgentWeb?.webCreator?.webView?.reload()
// startTimeoutTimer() startTimeoutTimer()
// } }
// 从配置中获取服务器地址 // 从配置中获取服务器地址
val serverUrl = AppConfig.getServerUrl(this) val serverUrl = AppConfig.getServerUrl(this)
val finalUrl = "$serverUrl/example/print_demo.html?t=\${System.currentTimeMillis()}" val finalUrl = "$serverUrl/example/print_demo.html?t=${System.currentTimeMillis()}"
// val finalUrl = "$serverUrl/example/print_demo.html?t=${System.currentTimeMillis()}"
Log.d("MainActivity", "Loading URL: $finalUrl") Log.d("MainActivity", "Loading URL: $finalUrl")
mAgentWeb = AgentWeb.with(this) mAgentWeb = AgentWeb.with(this)
@ -49,7 +48,7 @@ class MainActivity : AppCompatActivity() {
.ready() .ready()
.go(finalUrl) .go(finalUrl)
// startTimeoutTimer() startTimeoutTimer()
// 配置 WebView 属性以支持 SSE 和跨域 // 配置 WebView 属性以支持 SSE 和跨域
@ -120,26 +119,26 @@ class MainActivity : AppCompatActivity() {
override fun onDestroy() { override fun onDestroy() {
mAgentWeb?.webLifeCycle?.onDestroy() mAgentWeb?.webLifeCycle?.onDestroy()
// cancelTimeoutTimer() cancelTimeoutTimer()
super.onDestroy() super.onDestroy()
} }
// private fun startTimeoutTimer() { private fun startTimeoutTimer() {
// cancelTimeoutTimer() cancelTimeoutTimer()
// mHandler.postDelayed(timeoutRunnable, TIMEOUT_MS) mHandler.postDelayed(timeoutRunnable, TIMEOUT_MS)
// } }
//
// fun cancelTimeoutTimer() { fun cancelTimeoutTimer() {
// mHandler.removeCallbacks(timeoutRunnable) mHandler.removeCallbacks(timeoutRunnable)
// } }
//
// private fun showErrorPage() { private fun showErrorPage() {
// findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.GONE findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.GONE
// findViewById<android.view.View>(R.id.error_layout)?.visibility = android.view.View.VISIBLE findViewById<android.view.View>(R.id.error_layout)?.visibility = android.view.View.VISIBLE
// } }
//
// private fun hideErrorPage() { private fun hideErrorPage() {
// findViewById<android.view.View>(R.id.error_layout)?.visibility = android.view.View.GONE findViewById<android.view.View>(R.id.error_layout)?.visibility = android.view.View.GONE
// findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.VISIBLE findViewById<android.view.View>(R.id.loading_layout)?.visibility = android.view.View.VISIBLE
// } }
} }

View File

@ -1,8 +1,89 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical" />
</LinearLayout>
<!-- 加载等待页 -->
<LinearLayout
android:id="@+id/loading_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="vertical"
android:visibility="visible">
<ProgressBar
android:layout_width="60dp"
android:layout_height="60dp"
android:indeterminateTint="#004A8F" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="消防值守台系统加载中..."
android:textColor="#333333"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="正在初始化智能调度引擎..."
android:textColor="#999999"
android:textSize="14sp" />
</LinearLayout>
<!-- 异常提示页 (超时或网络错误) -->
<LinearLayout
android:id="@+id/error_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F8F9FA"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@android:drawable/stat_notify_error"
android:tint="#D62828" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="系统响应超时"
android:textColor="#333333"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="检测到网络环境不稳定或服务器未响应,请检查网络连接后重试。"
android:textColor="#666666"
android:textSize="14sp" />
<Button
android:id="@+id/btn_retry"
android:layout_width="160dp"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:backgroundTint="#004A8F"
android:text="重新加载"
android:textColor="#FFFFFF" />
</LinearLayout>
</FrameLayout>