opt animation
This commit is contained in:
@@ -46,7 +46,7 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
} else { //不踩刹车,就消失
|
||||
scaleImageAndTv()
|
||||
var disappearAnimation = AlphaAnimation(1f, 0f)
|
||||
disappearAnimation.duration = 1500
|
||||
disappearAnimation.duration = 1200
|
||||
layout_brake.startAnimation(disappearAnimation)
|
||||
image_brake.startAnimation(disappearAnimation)
|
||||
tv_brake.startAnimation(disappearAnimation)
|
||||
@@ -62,6 +62,8 @@ class BrakeViewStatus @JvmOverloads constructor(
|
||||
layout_brake.visibility = View.GONE
|
||||
image_brake.visibility = View.GONE
|
||||
tv_brake.visibility = View.GONE
|
||||
|
||||
stopAnimate()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
val appearAnimation = AlphaAnimation(0f, 1.0f)
|
||||
appearAnimation.duration = 600
|
||||
val appearAnimationImage = AlphaAnimation(0f, 1.0f)
|
||||
appearAnimation.duration = 900
|
||||
appearAnimation.duration = 1000
|
||||
turn_light_layout.startAnimation(appearAnimation)
|
||||
left_nor_image.startAnimation(appearAnimationImage)
|
||||
right_nor_image.startAnimation(appearAnimationImage)
|
||||
@@ -47,15 +47,16 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
left_nor_image.visibility = View.VISIBLE
|
||||
right_nor_image.visibility = View.VISIBLE
|
||||
|
||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度 TODO
|
||||
Log.d("liyz", "directionLight = $directionLight")
|
||||
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
|
||||
if (directionLight == 1) { //左转向
|
||||
left_select_image.visibility = View.VISIBLE
|
||||
right_select_image.visibility = View.GONE
|
||||
right_select_image.clearAnimation()
|
||||
setAnimation(left_select_image)
|
||||
} else if (directionLight == 2) { //右转向
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.VISIBLE
|
||||
left_select_image.clearAnimation()
|
||||
setAnimation(right_select_image)
|
||||
} else { //消失
|
||||
animationDisappear()
|
||||
@@ -68,34 +69,44 @@ class TurnLightViewStatus @JvmOverloads constructor(
|
||||
left_select_image.visibility = View.GONE
|
||||
right_select_image.visibility = View.GONE
|
||||
val disappearAnimationLeft = AlphaAnimation(1.0f, 0f)
|
||||
disappearAnimationLeft.duration = 150
|
||||
disappearAnimationLeft.duration = 200
|
||||
|
||||
val disappearAnimationBg = AlphaAnimation(1.0f, 0f)
|
||||
disappearAnimationBg.duration = 900
|
||||
disappearAnimationBg.duration = 1000
|
||||
turn_light_layout.startAnimation(disappearAnimationBg)
|
||||
left_nor_image.startAnimation(disappearAnimationLeft)
|
||||
right_nor_image.startAnimation(disappearAnimationLeft)
|
||||
|
||||
//TODO
|
||||
disappearAnimationBg.setAnimationListener(object: Animation.AnimationListener{
|
||||
disappearAnimationLeft.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationRepeat(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
turn_light_layout.visibility = View.GONE
|
||||
left_nor_image.visibility = View.GONE
|
||||
right_nor_image.visibility = View.GONE
|
||||
}
|
||||
|
||||
override fun onAnimationStart(p0: Animation?) {
|
||||
}
|
||||
} )
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
left_nor_image.visibility = View.GONE
|
||||
right_nor_image.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
|
||||
disappearAnimationBg.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationRepeat(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationStart(p0: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(p0: Animation?) {
|
||||
turn_light_layout.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//实现图片闪烁效果
|
||||
private fun setAnimation(imageView: ImageView) {
|
||||
val animation = AlphaAnimation(1.0f, 0f)
|
||||
animation.duration = 800
|
||||
animation.duration = 600
|
||||
animation.interpolator = LinearInterpolator()
|
||||
animation.repeatCount = Animation.INFINITE
|
||||
animation.repeatMode = Animation.REVERSE
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_marginLeft="15px"
|
||||
android:layout_marginTop="3px"
|
||||
android:layout_marginLeft="10px"
|
||||
android:layout_marginTop="5px"
|
||||
android:src="@drawable/module_arrow_left_select_nor"
|
||||
android:visibility="gone" />
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginTop="3px"
|
||||
android:layout_marginRight="15px"
|
||||
android:layout_marginTop="5px"
|
||||
android:layout_marginRight="10px"
|
||||
android:src="@drawable/module_arrow_right_select_nor"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
Reference in New Issue
Block a user