[6.7.0][工具箱] fix: 漫游 按钮初始化判断时机问题;
This commit is contained in:
@@ -51,6 +51,8 @@ class ToolKitTabView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
context?.also { ToolKitDataManager.checkAndAddRomaItem(it) }
|
||||
|
||||
// 设置布局管理器为GridLayoutManager,每行3列
|
||||
recyclerView.layoutManager = GridLayoutManager(context, 3)
|
||||
val adapter = ToolKitListAdapter(ToolKitDataManager.toolList)
|
||||
|
||||
@@ -100,16 +100,9 @@ object ToolKitDataManager : IToolKitItemClickListener {
|
||||
ToolTypeEnum.AI_REPORT.name,
|
||||
getDefaultItemView(ctx, "上报", R.drawable.icon_toolkit_item_ai_report)
|
||||
)
|
||||
// 按照目前RomaTaxiView添加限制:bus业务司机端,taxi业务司机端 展示漫游按钮
|
||||
if (AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isTaxiDriver(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
it += ToolKitBean(
|
||||
ToolTypeEnum.ROMA.name,
|
||||
getRoamItemView(ctx)
|
||||
)
|
||||
}
|
||||
}
|
||||
// 漫游
|
||||
checkAndAddRomaItem(ctx)
|
||||
addListener(TAG, this)
|
||||
|
||||
kotlin.runCatching {
|
||||
@@ -211,6 +204,28 @@ object ToolKitDataManager : IToolKitItemClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ToolKitDataManager基于调用方调用时机可能会很早,FunctionBuildConfig里数据可能还没设置好,在view加载
|
||||
* 时在检查一次
|
||||
*/
|
||||
fun checkAndAddRomaItem(ctx: Context) {
|
||||
if (toolList.map { it.toolTag }.contains(ToolTypeEnum.ROMA.name)) {
|
||||
Logger.i(TAG, "checkAndAddRomaItem 已经添加跳过")
|
||||
return
|
||||
}
|
||||
synchronized(toolList) {
|
||||
// 按照目前RomaTaxiView添加限制:bus业务司机端,taxi业务司机端 展示漫游按钮
|
||||
if (AppIdentityModeUtils.isBusDriver(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isTaxiDriver(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
toolList += ToolKitBean(
|
||||
ToolTypeEnum.ROMA.name,
|
||||
getRoamItemView(ctx)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun invokeItemClick(toolTag: String, ctx: Context?) {
|
||||
listeners.values.forEach { itx ->
|
||||
itx.onItemClick(toolTag, ctx)
|
||||
|
||||
Reference in New Issue
Block a user