diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java index 06018ca373..65724e8c34 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/WaringConst.java @@ -23,6 +23,8 @@ public class WaringConst { public static String BROADCAST_V2X_TRAFFIC_LIGHT_IS_SHOW__EXTRA_KEY = "trafficLightIsShow"; // 选中的交通等类型,red、yellow、green public static String BROADCAST_V2X_TRAFFIC_LIGHT_CHECK_TYPE_EXTRA_KEY = "trafficLightCheckType"; + // 倒计时 + public static String BROADCAST_V2X_TRAFFIC_LIGHT_COUNT_DOWN_TYPE_EXTRA_KEY = "trafficLightCountDown"; // 限速标志 // 是否展示:true-展示,false-关闭 diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt index b6f6bf2c32..1ac84d9300 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/receiver/V2XTrafficLightBroadcastReceiver.kt @@ -32,10 +32,15 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() { WaringConst.BROADCAST_V2X_TRAFFIC_LIGHT_CHECK_TYPE_EXTRA_KEY, 0 ) + val trafficLightCountDown = + intent.getIntExtra( + WaringConst.BROADCAST_V2X_TRAFFIC_LIGHT_COUNT_DOWN_TYPE_EXTRA_KEY, + 0 + ) if (trafficLightIsShow) { // 分发场景 - dispatchShowWaring(trafficLightCheckType) + dispatchShowWaring(trafficLightCheckType, trafficLightCountDown) } else { dispatchCloseWaring() } @@ -44,14 +49,22 @@ class V2XTrafficLightBroadcastReceiver : BroadcastReceiver() { } } - /** * 展示交通灯 * * @param trafficLightCheckType 选中的交通的灯 0-都是默认,1-红,2-黄,3-绿 + * @param trafficLightCountDown 对应交通灯倒计时,如果倒计时为0,则disable */ - private fun dispatchShowWaring(trafficLightCheckType: Int) { + private fun dispatchShowWaring(trafficLightCheckType: Int, trafficLightCountDown: Int) { CallerHmiManager.showWarningTrafficLight(trafficLightCheckType) + if(trafficLightCountDown == 0 ){ + CallerHmiManager.disableWarningTrafficLightCountDown() + } + when(trafficLightCheckType){ + 1 -> CallerHmiManager.changeCountdownRed(trafficLightCountDown) + 2 -> CallerHmiManager.changeCountdownYellow(trafficLightCountDown) + 3 -> CallerHmiManager.changeCountdownGreen(trafficLightCountDown) + } } /** diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index b9cb896454..dec6be311d 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -541,6 +541,13 @@ class MoGoHmiFragment : MvpFragment mViewTrafficLight?.disableWarningTrafficLight() } + /** + * 关闭红绿灯倒计时 + */ + override fun disableWarningTrafficLightCountDown() { + mViewTrafficLight?.disableCountdown() + } + override fun changeCountdownRed(redNum: Int) { mViewTrafficLight?.changeCountdownRed(redNum) } diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/GradientTextView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/GradientTextView.kt new file mode 100644 index 0000000000..a2f8390494 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/GradientTextView.kt @@ -0,0 +1,100 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.content.Context +import android.graphics.* +import android.util.AttributeSet +import androidx.appcompat.widget.AppCompatTextView +import java.lang.RuntimeException + +class GradientTextView @JvmOverloads constructor( + context: Context?, + attrs: AttributeSet? = null +) : AppCompatTextView(context!!, attrs) { + private var mLinearGradient: LinearGradient? = null + private var mPaint: Paint? = null + private var mViewWidth = 0 //文字的宽度 + private var mViewHeight = 0 //文字的高度 + private val mTextBound = Rect() + private var mColorList : IntArray?//存放颜色的数组 + private var isVertical = false//默认是横向 + + private var mRadius = 0f + private var mdx = 0f + private var mdy = 0f + private var mColor = 0 + + init { + //设置默认的颜色 + mColorList = intArrayOf(-0x1, 0xFFFFFFF) + } + + override fun onDraw(canvas: Canvas) { + if (isVertical) { + mViewHeight = measuredHeight + } else { + mViewWidth = measuredWidth + } + mPaint = paint + val mTipText = text.toString() + setStyle() + mPaint!!.getTextBounds(mTipText, 0, mTipText.length, mTextBound) + mPaint!!.setShadowLayer(mRadius, mdx, mdy, mColor) + + //画出文字 + canvas.drawText( + mTipText, + (measuredWidth / 2 - mTextBound.width() / 2).toFloat(), + (measuredHeight / 2 + mTextBound.height() / 2).toFloat(), + mPaint!! + ) + } + + /** + * true表示纵向渐变,false变身横向渐变 + * + * @param vertical 纵向 + */ + fun setVertical(vertical: Boolean) { + isVertical = vertical + } + + /** + * 设置渐变的颜色 + * + * @param mColorList + */ + fun setColorList(mColorList: IntArray?) { + if (mColorList != null && mColorList.size < 2) { + throw RuntimeException("ColorList's length must be > 2") + } else { + this.mColorList = mColorList + } + } + + private fun setStyle() { + mPaint!!.isAntiAlias = true + mPaint!!.isDither = true + mPaint!!.isFilterBitmap = true + //前面4个参数分别表示渐变的开始x轴,开始y轴,结束的x轴,结束的y轴,mColorList表示渐变的颜色数组 + mLinearGradient = LinearGradient(0f,0f,mViewWidth.toFloat(),mViewHeight.toFloat(),mColorList!!,null,Shader.TileMode.CLAMP) + mPaint!!.shader = mLinearGradient + mPaint!!.strokeJoin = Paint.Join.ROUND + mPaint!!.strokeCap = Paint.Cap.ROUND + mPaint!!.style = Paint.Style.FILL_AND_STROKE + } + + /** + * 设置投影层 + * @param radius + * @param dx + * @param dy + * @param color + */ + fun setShadowLayerCustom(radius: Float, dx: Float, dy: Float, color: Int) { + mRadius = radius + mdx = dx + mdy = dy + mColor = color + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt new file mode 100644 index 0000000000..58a44d1da1 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/SingleTrafficLightView.kt @@ -0,0 +1,178 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.ImageView +import androidx.core.view.marginLeft +import com.mogo.eagle.core.function.api.hmi.view.IViewTrafficLight +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.UiThreadHandler + +/** + * 新版红绿灯view + */ +class SingleTrafficLightView @JvmOverloads constructor( + context: Context?, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : IViewTrafficLight(context, attrs, defStyleAttr) { + private var mLightIconIV: ImageView? = null + private var mLightIconBG: ImageView? = null + private var mLightTimeTV: GradientTextView? = null + private var mCurrentLightId = 0 + + init { + init(context) + } + + private fun init(context: Context?) { + LayoutInflater.from(context).inflate(R.layout.hmi_view_traffic_light, this, true) + mLightIconIV = findViewById(R.id.hmi_traffic_light_iv) + mLightIconBG = findViewById(R.id.hmi_traffic_light_bg) + mLightTimeTV = findViewById(R.id.hmi_traffic_light_time_tv) + } + + /** + * 展示红绿灯预警 + * + * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 + */ + override fun showWarningTrafficLight(checkLightId: Int) { + super.showWarningTrafficLight(checkLightId) + mCurrentLightId = checkLightId + updateTrafficLightIcon(checkLightId) + } + + /** + * 关闭红绿灯预警展示,并重制灯态 + */ + override fun disableWarningTrafficLight() { + super.disableWarningTrafficLight() + UiThreadHandler.post { + mCurrentLightId = 0 + this@SingleTrafficLightView.visibility = GONE + } + } + + override fun disableCountdown() { + super.disableCountdown() + UiThreadHandler.post { + val lp = this.layoutParams as MarginLayoutParams + lp.width = context.resources.getDimension(R.dimen.hmi_traffic_light_icon_size).toInt() + this.layoutParams = lp + mLightTimeTV!!.visibility = GONE + mLightIconBG!!.layoutParams.width = context.resources.getDimension(R.dimen.dp_124).toInt() + } + } + + /** + * @param redNum 红灯倒计时 + * @param yellowNum 黄灯倒计时 + * @param greenNum 绿灯倒计时 + */ + override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) { + super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum) + UiThreadHandler.post { + resetView() + 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) { + resetView() + mLightTimeTV!!.setVertical(true) + mLightTimeTV!!.setColorList( + intArrayOf( + resources.getColor(R.color.hmi_traffic_light_red_color_up), + resources.getColor(R.color.hmi_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) { + resetView() + mLightTimeTV!!.setVertical(true) + mLightTimeTV!!.setColorList( + intArrayOf( + resources.getColor(R.color.hmi_traffic_light_green_color_up), + resources.getColor(R.color.hmi_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) { + resetView() + mLightTimeTV!!.setVertical(true) + mLightTimeTV!!.setColorList( + intArrayOf( + resources.getColor(R.color.hmi_traffic_light_yellow_color_up), + resources.getColor(R.color.hmi_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.hmi_light_red_nor) + this@SingleTrafficLightView.visibility = VISIBLE + } + 2 -> { + mLightIconIV!!.setBackgroundResource(R.drawable.hmi_lightyellow_nor) + this@SingleTrafficLightView.visibility = VISIBLE + } + 3 -> { + mLightIconIV!!.setBackgroundResource(R.drawable.hmi_light_green_nor) + this@SingleTrafficLightView.visibility = VISIBLE + } + else -> this@SingleTrafficLightView.visibility = GONE + } + } + } + + private fun resetView(){ + val lp = this.layoutParams as MarginLayoutParams + lp.width = context.resources.getDimension(R.dimen.hmi_traffic_light_layout_width).toInt() + this.layoutParams = lp + mLightTimeTV!!.visibility = View.VISIBLE + mLightIconBG!!.layoutParams.width = context.resources.getDimension(R.dimen.hmi_traffic_light_bg_width).toInt() + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckApiServices.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckApiServices.java deleted file mode 100644 index a5c585b546..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckApiServices.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -import com.mogo.eagle.core.data.BaseData; - -import io.reactivex.Observable; -import okhttp3.RequestBody; -import retrofit2.http.Body; -import retrofit2.http.GET; -import retrofit2.http.Headers; -import retrofit2.http.POST; - -/** - * 时延验证相关接口 - * - * @author tongchenfei - */ -public interface DelayCheckApiServices { - - /** - * 空接口 - * @return 什么都不返回 - */ - @GET("/yycp-test-service/net/delay/heartbeat") - Observable emptyInterface(); - - /** - * 时延上报接口 接口文档如下 - * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48967034 - * @param params 相关参数,详见文档 - * @return 相关返回值,详见文档 - */ - @POST("/yycp-test-service/net/delay/log") - @Headers({"Content-type:application/json;charset=UTF-8"}) - Observable uploadDelayCheckData(@Body RequestBody params); -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckHttpConstant.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckHttpConstant.java deleted file mode 100644 index 5a4a87b9ae..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckHttpConstant.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -import com.mogo.commons.debug.DebugConfig; - -/** - * dzt base url - * - * @author tongchenfei - */ -public class DelayCheckHttpConstant { - public static final String HOST_DEV = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_TEST = "http://dzt-test.zhidaozhixing.com"; - public static final String HOST_DEMO = "http://dzt-show.zhidaozhixing.com"; - public static final String HOST_PRODUCT = "http://dzt.zhidaozhixing.com"; - - public static String getBaseUrl(){ - switch ( DebugConfig.getNetMode() ) { - case DebugConfig.NET_MODE_DEV: - return HOST_DEV; - case DebugConfig.NET_MODE_QA: - return HOST_TEST; - case DebugConfig.NET_MODE_DEMO: - return HOST_DEMO; - default: - return HOST_PRODUCT; - } - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResponse.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResponse.java deleted file mode 100644 index f969cee250..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -import com.mogo.eagle.core.data.BaseData; - -/** - * 延迟检测response - * - * @author tongchenfei - */ -public class DelayCheckResponse extends BaseData { - private DelayCheckResult result; - - public DelayCheckResult getResult() { - return result; - } - - public void setResult(DelayCheckResult result) { - this.result = result; - } - - @Override - public String toString() { - return "DelayCheckResponse{" + - "result=" + result + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResult.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResult.java deleted file mode 100644 index 6a99dde468..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckResult.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -/** - * 延迟检查返回结果 - * - * @author tongchenfei - */ -public class DelayCheckResult { - /** - * 是否保持心跳 - */ - private boolean necessary; - /** - * 心跳间隔,单位 s - */ - private int beatSeconds; - - public boolean isNecessary() { - return necessary; - } - - public void setNecessary(boolean necessary) { - this.necessary = necessary; - } - - public int getBeatSeconds() { - return beatSeconds; - } - - public void setBeatSeconds(int beatSeconds) { - this.beatSeconds = beatSeconds; - } - - @Override - public String toString() { - return "DelayCheckResult{" + - "necessary=" + necessary + - ", beatSeconds=" + beatSeconds + - '}'; - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUploadRequest.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUploadRequest.java deleted file mode 100644 index 8e7e4e2f68..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUploadRequest.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -/** - * 时延检测上报请求参数 - * - * @author tongchenfei - */ -public class DelayCheckUploadRequest { - private String sn; - private long startTime; - private long endTime; - /** - * 请求时长 - */ - private long burning; - /** - * 信号强度 - */ - private int netState; - private String place; - private String cityCode; - private double lat; - private double lon; - - public String getSn() { - return sn; - } - - public void setSn(String sn) { - this.sn = sn; - } - - public long getStartTime() { - return startTime; - } - - public void setStartTime(long startTime) { - this.startTime = startTime; - } - - public long getEndTime() { - return endTime; - } - - public void setEndTime(long endTime) { - this.endTime = endTime; - } - - public long getBurning() { - return burning; - } - - public void setBurning(long burning) { - this.burning = burning; - } - - public int getNetState() { - return netState; - } - - public void setNetState(int netState) { - this.netState = netState; - } - - public String getPlace() { - return place; - } - - public void setPlace(String place) { - this.place = place; - } - - public String getCityCode() { - return cityCode; - } - - public void setCityCode(String cityCode) { - this.cityCode = cityCode; - } - - public double getLat() { - return lat; - } - - public void setLat(double lat) { - this.lat = lat; - } - - public double getLon() { - return lon; - } - - public void setLon(double lon) { - this.lon = lon; - } - - @Override - public String toString() { - return "DelayCheckUploadRequest{" + - "sn='" + sn + '\'' + - ", startTime=" + startTime + - ", endTime=" + endTime + - ", burning=" + burning + - ", netState=" + netState + - ", place='" + place + '\'' + - ", cityCode='" + cityCode + '\'' + - ", lat=" + lat + - ", lon=" + lon + - '}'; - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java deleted file mode 100644 index 55ad4ced29..0000000000 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/delaycheck/DelayCheckUtil.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.mogo.eagle.core.function.main.delaycheck; - -import android.content.Context; -import android.os.Handler; -import android.os.Message; -import android.os.SystemClock; - -import com.mogo.cloud.passport.MoGoAiCloudClientConfig; -import com.mogo.commons.AbsMogoApplication; -import com.mogo.eagle.core.data.BaseData; -import com.mogo.eagle.core.data.map.MogoLocation; -import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; -import com.mogo.eagle.core.network.MoGoRetrofitFactory; -import com.mogo.eagle.core.network.RequestOptions; -import com.mogo.eagle.core.network.SubscribeImpl; -import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.util.NetworkUtils; -import com.mogo.map.location.IMogoLocationClient; - -import io.reactivex.schedulers.Schedulers; -import okhttp3.MediaType; -import okhttp3.RequestBody; - -/** - * 延时验证工具类 - * - * @author tongchenfei - */ -public class DelayCheckUtil implements Handler.Callback { - private final Handler handler = new Handler(this); - - private static final int MSG_CHECK_NET_CONNECT_STATUS = 1001; - /** - * 首次延时检测时间间隔,暂定10分钟,等待机器稳定后再做打算 - */ - private static final long FIRST_CHECK_NET_CONNECT_STATUS_DELAY = 10 * 60 * 1000; - private static final long CHECK_NET_CONNECT_STATUS_DELAY = 5000L; - - private static final int MSG_START_DELAY_CHECK = 1002; - /** - * 默认检测时间间隔,若服务端正确返回,以服务端返回为主 - */ - private static final long DELAY_CHECK_DELAY = 10 * 60 * 1000; - - private final Context context; - - public DelayCheckUtil(Context context) { - this.context = context; - } - - /** - * 每5s检查一下网络状态,网络状态为连接状态时,开始空接口请求以及后续的参数上报 - */ - public void waitingForCheck() { - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, FIRST_CHECK_NET_CONNECT_STATUS_DELAY); - } - - private long requestTime, netDelay, requestStartSystemTime, requestEndSystem; - - @Override - public boolean handleMessage(Message msg) { - switch (msg.what) { - case MSG_CHECK_NET_CONNECT_STATUS: - if (NetworkUtils.isConnected(context)) { - handler.sendEmptyMessage(MSG_START_DELAY_CHECK); - } else { - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - return true; - case MSG_START_DELAY_CHECK: - // 请求空接口 - startEmptyRequest(); - return true; - default: - return false; - } - } - - private void startEmptyRequest() { - requestTime = SystemClock.elapsedRealtime(); - requestStartSystemTime = System.currentTimeMillis(); - MoGoRetrofitFactory.getInstance(DelayCheckHttpConstant.getBaseUrl()).create(DelayCheckApiServices.class) - .emptyInterface().subscribeOn(Schedulers.io()).observeOn(Schedulers.io()) - .subscribe(new SubscribeImpl(RequestOptions.create(context)) { - @Override - public void onSuccess(BaseData o) { - super.onSuccess(o); - requestEndSystem = System.currentTimeMillis(); - netDelay = SystemClock.elapsedRealtime() - requestTime; - startUpload(); - } - - @Override - public void onError(Throwable e) { - super.onError(e); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - }); - } - - private void startUpload() { - IMogoLocationClient locationClient = CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(AbsMogoApplication.getApp()); - MogoLocation lastLocation = null; - if (locationClient != null) { - lastLocation = locationClient.getLastKnowLocation(); - } - if (lastLocation == null) { - handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, DELAY_CHECK_DELAY); - return; - } - DelayCheckUploadRequest request = new DelayCheckUploadRequest(); - request.setSn(MoGoAiCloudClientConfig.getInstance().getSn()); - request.setStartTime(requestStartSystemTime); - request.setEndTime(requestEndSystem); - request.setNetState(NetworkUtils.netStrengthLevel); - request.setPlace(lastLocation.getAddress()); - request.setCityCode(lastLocation.getCityCode()); - request.setLat(lastLocation.getLatitude()); - request.setLon(lastLocation.getLongitude()); - request.setBurning(netDelay); - - RequestBody params = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(request)); - - MoGoRetrofitFactory.getInstance(DelayCheckHttpConstant.getBaseUrl()).create(DelayCheckApiServices.class) - .uploadDelayCheckData(params).observeOn(Schedulers.io()).subscribeOn(Schedulers.io()) - .subscribe(new SubscribeImpl(RequestOptions.create(context)) { - @Override - public void onSuccess(DelayCheckResponse o) { - super.onSuccess(o); - DelayCheckResult result = o.getResult(); - if (result.isNecessary()) { - handler.sendEmptyMessageDelayed(MSG_START_DELAY_CHECK, result.getBeatSeconds() * 1000L); - } - } - - @Override - public void onError(String message, int code) { - super.onError(message, code); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - - @Override - public void onError(Throwable e) { - super.onError(e); - handler.sendEmptyMessageDelayed(MSG_CHECK_NET_CONNECT_STATUS, CHECK_NET_CONNECT_STATUS_DELAY); - } - }); - } -} diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java index 70d175f446..654e13984b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/service/MogoMainService.java @@ -15,7 +15,6 @@ import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.function.main.EventDispatchCenter; import com.mogo.eagle.core.function.main.cards.MogoModulesManager; -import com.mogo.eagle.core.function.main.delaycheck.DelayCheckUtil; import com.mogo.eagle.core.function.main.monitoring.VehicleMonitoring; import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; import com.mogo.eagle.core.utilcode.util.UiThreadHandler; @@ -55,9 +54,6 @@ class MogoMainService extends Service implements IMogoLocationListener { HdMapBuildConfig.isMapLoaded = true; }, 5_000L ); - // 开启延时检测 - DelayCheckUtil delayCheckUtil = new DelayCheckUtil(this); - delayCheckUtil.waitingForCheck(); // 车辆检测 VehicleMonitoring monitoring = new VehicleMonitoring(this); monitoring.vehicleCheck(); diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_green_nor.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_green_nor.png new file mode 100644 index 0000000000..bc9fed952d Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_green_nor.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_red_nor.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_red_nor.png new file mode 100644 index 0000000000..8732508ded Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_light_red_nor.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_lightyellow_nor.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_lightyellow_nor.png new file mode 100644 index 0000000000..bae01408fd Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi-2560x1440/hmi_lightyellow_nor.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/traffic_light_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/traffic_light_bg.xml new file mode 100644 index 0000000000..c310967c2f --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/traffic_light_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index 890390e686..f70e6c4655 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -65,22 +65,19 @@ android:layout_marginTop="45px" android:layout_marginEnd="40px" android:background="@drawable/icon_camera_nor" - app:layout_constraintEnd_toStartOf="@id/viewTrafficLightVr" + app:layout_constraintRight_toLeftOf="@id/viewTrafficLightVr" app:layout_constraintTop_toTopOf="parent" tools:visibility="visible" /> - + android:layout_marginTop="@dimen/hmi_traffic_light_layout_margin_top" + android:layout_marginRight="@dimen/hmi_traffic_light_layout_margin_right" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml index ac46370092..c696276cb8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -37,4 +37,17 @@ 580px 588px 1066px + + 225px + 154px + 60px + 40px + 23px + 210px + 120px + 15px + 17px + 154px + 130px + 60px \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml index ccf9d105ba..bd4ed43a04 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/color.xml @@ -46,4 +46,11 @@ #3B4577 #000000 + + #FFFFA28B + #FFDA1100 + #FF60FFD3 + #FF006D43 + #FFFFE198 + #FFFF9B00 \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml index 4d983f8617..79e0076a1b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/values/dimens.xml @@ -42,4 +42,16 @@ 460px 120px + 225px + 154px + 60px + 40px + 23px + 210px + 120px + 15px + 17px + 154px + 130px + 60px \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index 4635c439f9..a32cb22ec7 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -441,7 +441,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb * V2XEvent事件回调 */ override fun onAck(event: V2XEvent) { - CallerLogger.d("$M_V2X$TAG", "OK->:$event") + CallerLogger.d("$M_V2X$TAG", "OK->: ${event.javaClass.name}") when (event) { is V2XEvent.ForwardsWarning -> { handleAdvanceWarningEvent(event) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt index 15e3a3c251..62ae1f56e9 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -48,11 +48,11 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 { .registerCenterApi.registerCarLocationChangedListener(TAG, this) mThreadHandler = TrafficLightThreadHandler(Looper.getMainLooper(), { - //查询路口时,如果红绿灯显示,则隐藏掉 - if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) { - TrafficLightHMIManager.INSTANCE.hideTrafficLight() - CallTrafficLightListenerManager.resetTrafficLightData() - } + //TODO emArrow 查询路口时,如果红绿灯显示,则隐藏掉 +// if (TrafficLightHMIManager.INSTANCE.isWarningTrafficLightShow()) { +// TrafficLightHMIManager.INSTANCE.hideTrafficLight() +// CallTrafficLightListenerManager.resetTrafficLightData() +// } mLocation?.let { it -> val tileId = CallerMapUIServiceManager.getMapUIController()?.getTileId(it.longitude, it.latitude) ?: 0 trafficLightNetWorkModel.requestRoadID( @@ -78,7 +78,7 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 { trafficLightNetWorkModel.requestTrafficLight( it.latitude, it.longitude, it.bearing.toDouble(), road, { result -> trafficLightResult = result -// TrafficLightHMIManager.INSTANCE.updateTrafficLight(result) + TrafficLightHMIManager.INSTANCE.updateTrafficLight(result) CallTrafficLightListenerManager.invokeTrafficLightStatus(result) }, { errorMsg -> diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt index 9b87dab0f9..3c38f4a32f 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/view/IViewTrafficLight.kt @@ -35,5 +35,8 @@ abstract class IViewTrafficLight(context: Context?, attrs: AttributeSet?, defSty open fun changeCountdownRed(redNum: Int) {} - + /** + * 隐藏倒计时 + */ + open fun disableCountdown(){} } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt index 3213a6ccfa..4c360dd14a 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/hmi/warning/IMoGoWaringProvider.kt @@ -93,6 +93,11 @@ interface IMoGoWaringProvider : IMoGoHmiViewProxy { */ fun disableWarningTrafficLight() + /** + * 关闭红绿灯倒计时 + */ + fun disableWarningTrafficLightCountDown() + /** * 修改红灯倒计时 */ diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt index 6beadf6915..c513209bca 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/hmi/CallerHmiManager.kt @@ -23,7 +23,7 @@ import com.mogo.eagle.core.function.call.base.CallerBase object CallerHmiManager : CallerBase() { private val waringProviderApi get() = ARouter.getInstance().build(MoGoFragmentPaths.PATH_FRAGMENT_HMI) - .navigation() as? IMoGoWaringProvider; + .navigation() as? IMoGoWaringProvider /** * 隐藏 脉速表 @@ -125,6 +125,13 @@ object CallerHmiManager : CallerBase() { return waringProviderApi?.isWarningTrafficLightShow() ?: false } + /** + * 关闭红绿灯倒计时 + */ + fun disableWarningTrafficLightCountDown(){ + waringProviderApi?.disableWarningTrafficLightCountDown() + } + /** * 修改红灯倒计时 */