完成红绿灯逻辑
This commit is contained in:
@@ -79,7 +79,7 @@ class V2XWarningBroadcastReceiver : BroadcastReceiver() {
|
||||
ttsContent: String?,
|
||||
tag: String?
|
||||
) {
|
||||
if (v2xType == WarningTypeEnum.WARNING_RED_LIGHT) {
|
||||
if (v2xType == WarningTypeEnum.TYPE_USECASE_ID_IVP.useCaseId) {
|
||||
mIMoGoWaringProvider!!.showLimitingVelocity(1)
|
||||
}
|
||||
mIMoGoWaringProvider!!.showWarningV2X(
|
||||
|
||||
@@ -48,6 +48,28 @@ interface MoGoWarningContract {
|
||||
*/
|
||||
fun disableWarningTrafficLight()
|
||||
|
||||
/**
|
||||
* 修改红灯倒计时
|
||||
*/
|
||||
fun changeCountdownRed(redNum: Int)
|
||||
|
||||
/**
|
||||
* 修改黄灯倒计时
|
||||
*/
|
||||
fun changeCountdownYellow(yellowNum: Int)
|
||||
|
||||
/**
|
||||
* 修改绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownGreen(greenNum: Int)
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int)
|
||||
|
||||
/**
|
||||
* 展示限速预警
|
||||
*
|
||||
|
||||
@@ -121,6 +121,27 @@ class MoGoWarningFragment : MvpFragment<MoGoWarningContract.View?, WaringPresent
|
||||
viewTrafficLightVr.disableWarningTrafficLight()
|
||||
}
|
||||
|
||||
override fun changeCountdownRed(redNum: Int) {
|
||||
viewTrafficLightVr.changeCountdownRed(redNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownYellow(yellowNum: Int) {
|
||||
viewTrafficLightVr.changeCountdownYellow(yellowNum)
|
||||
}
|
||||
|
||||
override fun changeCountdownGreen(greenNum: Int) {
|
||||
viewTrafficLightVr.changeCountdownGreen(greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
override fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
viewTrafficLightVr.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum)
|
||||
}
|
||||
|
||||
/**
|
||||
* 控制展示限速标志及内容
|
||||
*/
|
||||
|
||||
@@ -63,6 +63,46 @@ class ViewTrafficLight @JvmOverloads constructor(
|
||||
ctvRedTrafficLight.isChecked = false
|
||||
ctvYellowTrafficLight.isChecked = false
|
||||
ctvGreenTrafficLight.isChecked = false
|
||||
ctvRedTrafficLight.text = ""
|
||||
ctvYellowTrafficLight.text = ""
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param readNum 红灯倒计时
|
||||
* @param yellowNum 黄灯倒计时
|
||||
* @param greenNum 绿灯倒计时
|
||||
*/
|
||||
fun changeCountdownTrafficLightNum(readNum: Int, yellowNum: Int, greenNum: Int) {
|
||||
changeCountdownGreen(readNum)
|
||||
changeCountdownYellow(yellowNum)
|
||||
changeCountdownRed(greenNum)
|
||||
}
|
||||
|
||||
fun changeCountdownGreen(readNum: Int) {
|
||||
if (readNum > 0) {
|
||||
ctvRedTrafficLight.text = "$readNum"
|
||||
} else {
|
||||
ctvRedTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownYellow(yellowNum: Int) {
|
||||
if (yellowNum > 0) {
|
||||
ctvYellowTrafficLight.text = "$yellowNum"
|
||||
} else {
|
||||
ctvYellowTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
fun changeCountdownRed(greenNum: Int) {
|
||||
if (greenNum > 0) {
|
||||
ctvGreenTrafficLight.text = "$greenNum"
|
||||
} else {
|
||||
ctvGreenTrafficLight.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -71,6 +71,25 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
|
||||
mMoGoWarningFragment.disableLimitingVelocity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownRed(int redNum) {
|
||||
mMoGoWarningFragment.changeCountdownRed(redNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownYellow(int yellowNum) {
|
||||
mMoGoWarningFragment.changeCountdownYellow(yellowNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownGreen(int greenNum) {
|
||||
mMoGoWarningFragment.changeCountdownGreen(greenNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCountdownTrafficLightNum(int readNum, int yellowNum, int greenNum) {
|
||||
mMoGoWarningFragment.changeCountdownTrafficLightNum(readNum, yellowNum, greenNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWarningV2X(int v2xType, @Nullable String alertContent, @Nullable String ttsContent, @Nullable String tag) {
|
||||
|
||||
Reference in New Issue
Block a user