refactor(web): 优化 WebActivity 状态栏控制逻辑并清理无用参数
- 新增 hideStatus 参数,支持健康银行H5以全屏无状态栏模式打开 - 移除 startWebActivity 的 source 绿色主题参数及相关逻辑 - 注释 WebActivity.onConfigurationChanged 横竖屏状态栏切换逻辑 - 移除 AndroidInterface.finishActivity() 中多余的 WebReloadEvent 发送 - 健康银行H5入口改为 isFull=true、hideStatus=true 模式打开 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
dc55c65b87
commit
967aff4103
@@ -180,7 +180,7 @@ class HomeFragment :
|
||||
showToast("网络错误")
|
||||
return
|
||||
}
|
||||
requireContext().startWebActivity(UrlConfig.HOME_BANK_H5+"?param="+ value, myTitle = "健康银行")
|
||||
requireContext().startWebActivity(UrlConfig.HOME_BANK_H5+"?param="+ value,isFull=true,myTitle = "健康银行",hideStatus=true)
|
||||
} else {
|
||||
startLoginActivity(requireContext())
|
||||
}
|
||||
@@ -386,6 +386,7 @@ class HomeFragment :
|
||||
if (DataStoreManager.isLogin()) {
|
||||
mViewModel.getHomeNoticeListRepeat()
|
||||
mViewModel.getHomeWatchInfo(DataStoreManager.getUserId())
|
||||
mViewModel.getSysEnCryptInfo(UrlConfig.getHomeBankH5Url())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -793,16 +793,16 @@ fun startEmergencySeekDoctorDetailsActivity(context: Context, id: String, sessio
|
||||
//}
|
||||
//
|
||||
/**
|
||||
* Web页面 source == 1 绿色主题 darkStyle=false 白色顶部
|
||||
* Web页面 darkStyle=false 白色顶部
|
||||
*/
|
||||
fun Context.startWebActivity(url: String, scale: Boolean = false,myTitle:String="", source: Int = 0,darkStyle: Boolean = true,isFull:Boolean=false) {
|
||||
fun Context.startWebActivity(url: String, scale: Boolean = false,myTitle:String="",darkStyle: Boolean = true,isFull:Boolean=false,hideStatus:Boolean=false) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("url", url)
|
||||
bundle.putBoolean("Scale", scale)
|
||||
bundle.putInt("source", source)
|
||||
bundle.putString("title", myTitle)
|
||||
bundle.putBoolean("darkStyle", darkStyle)//主题
|
||||
bundle.putBoolean("isFull", isFull)//是否全屏
|
||||
bundle.putBoolean("hideStatus", hideStatus)//是否隐藏状态栏
|
||||
startActivity(this, bundle = bundle, targetClass = WebActivity::class.java)
|
||||
}
|
||||
///**
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.xjjk.healthyclients.ui.activity
|
||||
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
@@ -70,20 +68,20 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
}
|
||||
|
||||
override fun dataBindingFinish() {
|
||||
val source = intent.getIntExtra("source", 0)
|
||||
customTitle = intent.getStringExtra("title")
|
||||
if (source == 1) {//深绿色
|
||||
mBinding.toolbarLay.rlTitleLay.setBackgroundColor(Color.parseColor("#117474"))
|
||||
}
|
||||
mBinding.toolbarLay.darkStyle = intent.getBooleanExtra("darkStyle", true)
|
||||
if (intent.getBooleanExtra("isFull", false)) {
|
||||
mBinding.toolbarLay.root.visibility = View.GONE
|
||||
mBinding.statusView.visibility = View.VISIBLE
|
||||
|
||||
val statusBarHeight = StatusbarUtil.getStatusBarHeight(this)
|
||||
val layoutParams = mBinding.statusView.layoutParams
|
||||
layoutParams.height = statusBarHeight
|
||||
mBinding.statusView.layoutParams = layoutParams
|
||||
if (intent.getBooleanExtra("hideStatus", false)) {
|
||||
mBinding.statusView.visibility = View.GONE
|
||||
setTransparentStatusBar(true,false)
|
||||
} else {
|
||||
mBinding.statusView.visibility = View.VISIBLE
|
||||
val statusBarHeight = StatusbarUtil.getStatusBarHeight(this)
|
||||
val layoutParams = mBinding.statusView.layoutParams
|
||||
layoutParams.height = statusBarHeight
|
||||
mBinding.statusView.layoutParams = layoutParams
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,14 +96,14 @@ class WebActivity : BaseVMBActivity<WebViewModel, ActivityWebBinding>(R.layout.a
|
||||
/**
|
||||
* 监听横竖屏切换改变状态栏,页面本身设置为强制竖屏模式,触发切换只存在于H5中视频的全屏播放,全屏播放时需要为透明状态栏
|
||||
*/
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {//横屏
|
||||
setTransparentStatusBar(isTransparent = true, isStatusBarDarkFont = false)
|
||||
} else {//竖屏
|
||||
setTransparentStatusBar(isTransparent = false, isStatusBarDarkFont = false)
|
||||
}
|
||||
}
|
||||
// override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
// super.onConfigurationChanged(newConfig)
|
||||
// if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {//横屏
|
||||
// setTransparentStatusBar(isTransparent = true, isStatusBarDarkFont = false)
|
||||
// } else {//竖屏
|
||||
// setTransparentStatusBar(isTransparent = false, isStatusBarDarkFont = false)
|
||||
// }
|
||||
// }
|
||||
|
||||
override fun onBackEvent() {
|
||||
if (!mAgentWeb.back()) {
|
||||
|
||||
@@ -56,7 +56,6 @@ class AndroidInterface(val agentWeb: AgentWeb, val context: Activity) {
|
||||
@JavascriptInterface
|
||||
fun finishActivity() {
|
||||
context.runOnUiThread {
|
||||
EventBus.getDefault().post(WebReloadEvent())
|
||||
context.finish()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user