opt
This commit is contained in:
@@ -39,6 +39,7 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
fun setBrakeLight(brakeLight: Int) {
|
||||
if (brakeLight == 1) { //刹车灯亮
|
||||
if (!isBrake) {
|
||||
isBrake = true
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
var appearAnimation = AlphaAnimation(0f, 1f)
|
||||
appearAnimation.duration = 300
|
||||
@@ -48,7 +49,6 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
layout_brake.visibility = View.VISIBLE
|
||||
image_brake.visibility = View.VISIBLE
|
||||
tv_brake.visibility = View.VISIBLE
|
||||
isBrake = true
|
||||
}
|
||||
}
|
||||
} else { //不踩刹车,就消失
|
||||
@@ -56,7 +56,6 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
isBrake = false
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
scaleImageAndTv()
|
||||
|
||||
var disappearAnimation = AlphaAnimation(1f, 0f)
|
||||
disappearAnimation.duration = 1200
|
||||
layout_brake.startAnimation(disappearAnimation)
|
||||
|
||||
@@ -47,10 +47,10 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
*/
|
||||
fun setTurnLight(directionLight: Int) {
|
||||
if (!isShowNormalBg && (directionLight == 1 || directionLight == 2)) {
|
||||
isShowNormalBg = true
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
showNormalAnimation()
|
||||
}
|
||||
isShowNormalBg = true
|
||||
}
|
||||
|
||||
if (directionLight == 1 || directionLight == 2) {
|
||||
@@ -63,27 +63,28 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
|
||||
if (directionLight == 1) { //左转向
|
||||
if (!isLeftLight) {
|
||||
isLeftLight = true
|
||||
isRightLight = false
|
||||
isDisappare = false
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
left_select_image.visibility = View.VISIBLE
|
||||
right_select_image.visibility = View.GONE
|
||||
right_select_image.clearAnimation()
|
||||
setAnimation(left_select_image)
|
||||
}
|
||||
isLeftLight = true
|
||||
isRightLight = false
|
||||
isDisappare = false
|
||||
|
||||
}
|
||||
} else if (directionLight == 2) { //右转向
|
||||
if (!isRightLight) {
|
||||
isRightLight = true
|
||||
isLeftLight = false
|
||||
isDisappare = false
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.VISIBLE
|
||||
left_select_image.clearAnimation()
|
||||
setAnimation(right_select_image)
|
||||
}
|
||||
isRightLight = true
|
||||
isLeftLight = false
|
||||
isDisappare = false
|
||||
}
|
||||
|
||||
} else { //消失
|
||||
@@ -92,13 +93,13 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
CallerVisualAngleManager.changeVisualAngle(Default())
|
||||
}
|
||||
if (!isDisappare) {
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
animationDisappear()
|
||||
}
|
||||
isDisappare = true
|
||||
isShowNormalBg = false
|
||||
isLeftLight = false
|
||||
isRightLight = false
|
||||
GlobalScope.launch(Dispatchers.Main) {
|
||||
animationDisappear()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user