diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt index 2718a68851..e26df7d504 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt @@ -26,8 +26,6 @@ class PM2DrivingInfoFragment : } override fun initViews() { - //设置红绿灯代理 - // CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView); } override fun initViews(savedInstanceState: Bundle?) { diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2TrafficLightView.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2TrafficLightView.kt deleted file mode 100644 index 1eff6c781f..0000000000 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2TrafficLightView.kt +++ /dev/null @@ -1,148 +0,0 @@ -package com.mogo.och.bus.passenger.ui.widget - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.ImageView -import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight -import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import com.mogo.och.bus.passenger.R -import com.mogo.och.common.module.wigets.OCHGradientTextView - -/** - * @author: wangmingjun - * @date: 2023/2/2 - */ -class M2TrafficLightView(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) - : IViewTrafficLight(context, - attrs, defStyleAttr){ - - private var mLightIconIV: ImageView? = null - private var mLightTimeTV: OCHGradientTextView? = null - private var mCurrentLightId = 0 - - private fun init(context: Context) { - LayoutInflater.from(context).inflate(R.layout.p_m2_traffic_light_view, this, true) - mLightIconIV = findViewById(R.id.bus_traffic_light_iv) - mLightTimeTV = findViewById(R.id.bus_traffic_light_time_tv) - } - - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 - */ - override fun showWarningTrafficLight(checkLightId: Int, lightSource: Int) { - super.showWarningTrafficLight(checkLightId, lightSource) - mCurrentLightId = checkLightId - updateTrafficLightIcon(checkLightId) - } - - /** - * 关闭红绿灯预警展示,并重制灯态 - */ - override fun disableWarningTrafficLight() { - super.disableWarningTrafficLight() - UiThreadHandler.post { - mCurrentLightId = 0 - visibility = GONE - } - } - - /** - * @param redNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) { - super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum) - when (mCurrentLightId) { - 1 -> changeCountdownRed(redNum) - 2 -> changeCountdownYellow(yellowNum) - 3 -> changeCountdownGreen(greenNum) - else -> UiThreadHandler.post { - mLightTimeTV!!.text = "" - } - } - } - - override fun changeCountdownRed(redNum: Int) { - super.changeCountdownRed(redNum) - UiThreadHandler.post { - if (redNum > 0) { - mLightTimeTV!!.setVertrial(true) - mLightTimeTV!!.setmColorList( - intArrayOf( - resources.getColor(R.color.bus_traffic_light_red_color_up), - resources.getColor(R.color.bus_traffic_light_red_color_down) - ) - ) - mLightTimeTV!!.text = redNum.toString() - } else { - mLightTimeTV!!.text = "" - } - } - } - - override fun changeCountdownGreen(greenNum: Int) { - super.changeCountdownGreen(greenNum) - UiThreadHandler.post { - if (greenNum > 0) { - mLightTimeTV!!.setVertrial(true) - mLightTimeTV!!.setmColorList( - intArrayOf( - resources.getColor(R.color.bus_traffic_light_green_color_up), - resources.getColor(R.color.bus_traffic_light_green_color_down) - ) - ) - mLightTimeTV!!.text = greenNum.toString() - } else { - mLightTimeTV!!.text = "" - } - } - } - - override fun changeCountdownYellow(yellowNum: Int) { - super.changeCountdownYellow(yellowNum) - UiThreadHandler.post { - if (yellowNum > 0) { - mLightTimeTV!!.setVertrial(true) - mLightTimeTV!!.setmColorList( - intArrayOf( - resources.getColor(R.color.bus_traffic_light_yellow_color_up), - resources.getColor(R.color.bus_traffic_light_yellow_color_down) - ) - ) - mLightTimeTV!!.text = yellowNum.toString() - } else { - mLightTimeTV!!.text = "" - } - } - } - - /** - * 更新红绿灯icon - * - * @param lightId 0-都是默认,1-红,2-黄,3-绿 - */ - private fun updateTrafficLightIcon(lightId: Int) { - UiThreadHandler.post { - when (lightId) { - 1 -> { - mLightIconIV!!.setBackgroundResource(R.drawable.bus_light_red_nor) - visibility = VISIBLE - } - 2 -> { - mLightIconIV!!.setBackgroundResource(R.drawable.bus_lightyellow_nor) - visibility = VISIBLE - } - 3 -> { - mLightIconIV!!.setBackgroundResource(R.drawable.bus_light_green_nor) - visibility = VISIBLE - } - else -> visibility = GONE - } - } - } -} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml index 50ef28ea18..f6f684c318 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml @@ -4,6 +4,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + - + + + + + + + + + + - + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_traffic_light_view.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_traffic_light_view.xml deleted file mode 100644 index fee055a60f..0000000000 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_traffic_light_view.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - \ No newline at end of file