fix bug of ui

This commit is contained in:
zhongchao
2022-10-19 14:48:16 +08:00
parent fc71e35270
commit 644789bd3b
4 changed files with 22 additions and 4 deletions

View File

@@ -4,7 +4,9 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import kotlinx.android.synthetic.main.view_vip_identification.view.*
@@ -24,8 +26,18 @@ class VipIdentificationView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val lp = this.layoutParams as LayoutParams
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top).toInt()
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_bus_passenger).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_passenger).toInt()
} else if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_taxi_passenger).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_passenger).toInt()
} else {
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top).toInt()
}
this.layoutParams = lp
invalidate()
}