[2.15.0] roma change and track color change
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.TypedArray
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -23,8 +24,15 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
@Volatile
|
||||
private var romaMode = false
|
||||
|
||||
private val openRes: Int
|
||||
private val normalRes: Int
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_roma_passenger_bg, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.RomaPassengerView, defStyleAttr, 0)
|
||||
openRes = a.getResourceId(R.styleable.RomaPassengerView_roma_open,0)
|
||||
normalRes = a.getResourceId(R.styleable.RomaPassengerView_roma_close,0)
|
||||
a.recycle()
|
||||
setOnClickListener {
|
||||
romaMode = !romaMode
|
||||
romaTrigger(romaMode)
|
||||
@@ -42,9 +50,15 @@ class RomaPassengerView @JvmOverloads constructor(
|
||||
when (String(byteArray)) {
|
||||
"0" -> {
|
||||
romaMode = true
|
||||
if(openRes != 0){
|
||||
setBackgroundResource(openRes)
|
||||
}
|
||||
}
|
||||
"1" -> {
|
||||
romaMode = false
|
||||
if(normalRes != 0){
|
||||
setBackgroundResource(normalRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,4 +80,8 @@
|
||||
<attr name="pnc_size" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="RomaPassengerView">
|
||||
<attr name="roma_open" format="reference"/>
|
||||
<attr name="roma_close" format="reference"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user