[dev_arch_opt_3.0]

[Change]
[
1、修复清扫车红绿灯View初始化异常
]

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2023-01-31 17:11:33 +08:00
parent 0a10c1876c
commit c591a30752
2 changed files with 13 additions and 11 deletions

View File

@@ -14,15 +14,17 @@ import com.mogo.eagle.core.function.call.v2x.CallerViewLimitingVelocityListenerM
import com.mogo.och.sweeper.R
import kotlinx.android.synthetic.main.sweeper_limiting_speed.view.*
class SweeperLimitingVelocityView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) :
LinearLayout(context, attrs, defStyleAttr), ILimitingVelocityListener, IViewControlListener {
class SweeperLimitingVelocityView(
context: Context,
attrs: AttributeSet? = null,
) : LinearLayout(context, attrs), ILimitingVelocityListener, IViewControlListener {
companion object {
private const val TAG = "SweeperLimitingVelocityView"
}
init {
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this)
LayoutInflater.from(context).inflate(R.layout.sweeper_limiting_speed, this, true)
}
override fun onAttachedToWindow() {
@@ -33,16 +35,16 @@ class SweeperLimitingVelocityView(context: Context?, attrs: AttributeSet?, defSt
override fun onLimitingVelocityChange(limitingVelocity: Int, sourceType: DataSourceType) {
if (limitingVelocity > 0) {
tvLimitingVelocity.visibility = View.VISIBLE
this.visibility = View.VISIBLE
tvLimitingVelocity.text = "$limitingVelocity"
} else {
tvLimitingVelocity.visibility = View.GONE
this.visibility = View.GONE
}
}
override fun visible(v: Int) {
super.visible(v)
tvLimitingVelocity.visibility = v
this.visibility = v
}
override fun onDetachedFromWindow() {

View File

@@ -41,23 +41,23 @@ public class SweeperTrafficDataView extends ConstraintLayout
private SweeperLimitingVelocityView sweeperLimitingVelocity;//限速
public SweeperTrafficDataView(@NonNull Context context) {
super(context);
this(context,null);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
this(context, attrs,0);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this(context, attrs, defStyleAttr,0);
}
public SweeperTrafficDataView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initView(context);
}
private void initView(@NonNull Context context) {
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_data, this);
LayoutInflater.from(context).inflate(R.layout.sweeper_traffic_data, this,true);
tapPositionView = findViewById(R.id.sweeperTrafficPosition);
speedImage = findViewById(R.id.sweeperSpeedImage);
speedTextView = findViewById(R.id.sweeperSpeedText);