fix ui problem of vip icon

This commit is contained in:
zhongchao
2022-05-10 19:34:48 +08:00
parent 6411eb1cd1
commit 6084078161
5 changed files with 27 additions and 7 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.*
@@ -21,6 +23,20 @@ class VipIdentificationView @JvmOverloads constructor(
LayoutInflater.from(context).inflate(R.layout.view_vip_identification, this, true)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val lp = this.layoutParams as LayoutParams
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_bus).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_bus).toInt()
} else {
lp.marginStart = resources.getDimension(R.dimen.module_vip_margin_left_taxi).toInt()
lp.topMargin = resources.getDimension(R.dimen.module_vip_margin_top_taxi).toInt()
}
this.layoutParams = lp
invalidate()
}
fun setVipIdentificationVisible(visible: Boolean) {
UiThreadHandler.post {
ivVipIdentification.visibility = visibility

View File

@@ -44,8 +44,6 @@
android:id="@+id/flVipIdentificationView"
android:layout_width="@dimen/module_vip_width"
android:layout_height="@dimen/module_vip_height"
android:layout_marginStart="@dimen/module_vip_margin_left"
android:layout_marginTop="@dimen/module_vip_margin_top"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />