diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index aa2562d834..12df6938f6 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -35,6 +35,7 @@
+
diff --git a/modules/mogo-module-data/.gitignore b/modules/mogo-module-data/.gitignore
new file mode 100644
index 0000000000..42afabfd2a
--- /dev/null
+++ b/modules/mogo-module-data/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/modules/mogo-module-data/README.md b/modules/mogo-module-data/README.md
new file mode 100644
index 0000000000..749fbb0794
--- /dev/null
+++ b/modules/mogo-module-data/README.md
@@ -0,0 +1 @@
+### 这里存放数据相关的class
\ No newline at end of file
diff --git a/modules/mogo-module-data/build.gradle b/modules/mogo-module-data/build.gradle
new file mode 100644
index 0000000000..002aeb57bc
--- /dev/null
+++ b/modules/mogo-module-data/build.gradle
@@ -0,0 +1,36 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+android {
+ compileSdkVersion rootProject.ext.android.compileSdkVersion
+ // buildToolsVersion rootProject.ext.android.buildToolsVersion
+ defaultConfig {
+ minSdkVersion rootProject.ext.android.minSdkVersion
+ targetSdkVersion rootProject.ext.android.targetSdkVersion
+ versionCode Integer.valueOf(VERSION_CODE)
+ versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation rootProject.ext.dependencies.kotlinstdlibjdk7
+}
+
+apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
diff --git a/modules/mogo-module-data/consumer-rules.pro b/modules/mogo-module-data/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/modules/mogo-module-data/gradle.properties b/modules/mogo-module-data/gradle.properties
new file mode 100644
index 0000000000..803c4a6016
--- /dev/null
+++ b/modules/mogo-module-data/gradle.properties
@@ -0,0 +1,3 @@
+GROUP=com.mogo.module
+POM_ARTIFACT_ID=module-data
+VERSION_CODE=1
diff --git a/modules/mogo-module-data/proguard-rules.pro b/modules/mogo-module-data/proguard-rules.pro
new file mode 100644
index 0000000000..481bb43481
--- /dev/null
+++ b/modules/mogo-module-data/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/modules/mogo-module-data/src/main/AndroidManifest.xml b/modules/mogo-module-data/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..ca10114319
--- /dev/null
+++ b/modules/mogo-module-data/src/main/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-data/src/main/java/com/mogo/module/data/enums/WarningDirectionEnum.kt b/modules/mogo-module-data/src/main/java/com/mogo/module/data/enums/WarningDirectionEnum.kt
new file mode 100644
index 0000000000..97ef53c041
--- /dev/null
+++ b/modules/mogo-module-data/src/main/java/com/mogo/module/data/enums/WarningDirectionEnum.kt
@@ -0,0 +1,51 @@
+package com.mogo.module.data.enums
+
+/**
+ *@author xiaoyuzhou
+ *@date 2021/9/10 8:48 下午
+ */
+enum class WarningDirectionEnum(
+ var direction: Int,
+ var desc: String,
+) {
+ ALERT_WARNING_NON(
+ 0,
+ "关闭红色边框预警"
+ ),
+ ALERT_WARNING_TOP(
+ 1,
+ "正前方"
+ ),
+ ALERT_WARNING_RIGHT(
+ 2,
+ "正右边"
+ ),
+ ALERT_WARNING_BOTTOM(
+ 3,
+ "正后方"
+ ),
+ ALERT_WARNING_LEFT(
+ 4,
+ "正左方"
+ ),
+ ALERT_WARNING_TOP_RIGHT(
+ 5,
+ "正前方"
+ ),
+ ALERT_WARNING_BOTTOM_RIGHT(
+ 6,
+ "正前方"
+ ),
+ ALERT_WARNING_BOTTOM_LEFT(
+ 7,
+ "正前方"
+ ),
+ ALERT_WARNING_TOP_LEFT(
+ 8,
+ "正前方"
+ ),
+ ALERT_WARNING_ALL(
+ 9,
+ "全方位"
+ )
+}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/build.gradle b/modules/mogo-module-hmi/build.gradle
index dad5a3017a..3f46c36a3e 100644
--- a/modules/mogo-module-hmi/build.gradle
+++ b/modules/mogo-module-hmi/build.gradle
@@ -59,6 +59,7 @@ dependencies {
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleservice
+ implementation rootProject.ext.dependencies.moduledata
} else {
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
@@ -67,6 +68,7 @@ dependencies {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
+ implementation project(':modules:mogo-module-data')
}
}
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningContract.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningContract.kt
index cac952f4ab..8051e89f27 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningContract.kt
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningContract.kt
@@ -1,6 +1,7 @@
package com.mogo.module.hmi.ui
import com.mogo.commons.mvp.IView
+import com.mogo.module.data.enums.WarningDirectionEnum
/**
@@ -9,10 +10,6 @@ import com.mogo.commons.mvp.IView
*/
interface MoGoWarningContract {
-
- /**
- *
- */
interface View : IView {
/**
@@ -81,5 +78,20 @@ interface MoGoWarningContract {
* 关闭限速预警
*/
fun disableLimitingVelocity()
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ */
+ fun showWarning(direction: WarningDirectionEnum)
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ * @param closeTime 倒计时
+ */
+ fun showWarning(direction: WarningDirectionEnum, closeTime: Long)
}
}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
index 7830135239..7e33c7ef62 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/MoGoWarningFragment.kt
@@ -14,6 +14,7 @@ import com.mogo.module.hmi.notification.WarningFloat
import com.mogo.module.hmi.notification.anim.DefaultAnimator
import com.mogo.module.hmi.notification.enums.SidePattern
import com.mogo.module.hmi.ui.widget.V2XNotificationView
+import com.mogo.module.data.enums.WarningDirectionEnum
import com.mogo.utils.logger.Logger
import kotlinx.android.synthetic.main.fragment_warning.*
@@ -95,7 +96,10 @@ class MoGoWarningFragment : MvpFragment ttsContent = $ttsContent")
AIAssist.getInstance(activity)
@@ -171,4 +175,23 @@ class MoGoWarningFragment : MvpFragment(view) {
- fun showWarningV2X(v2xType: Int, alertMessage: String, tag: String) {
-
- }
-
- fun disableWarningV2X(tag: String) {
- mView?.disableWarningV2X(tag)
- }
-
- fun showWarningTrafficLight(checkLightId: Int) {
- mView?.showWarningTrafficLight(checkLightId)
- }
-
- fun disableWarningTrafficLight() {
- mView?.disableWarningTrafficLight()
- }
-
- fun showLimitingVelocity(limitingSpeed: Int) {
- mView?.showLimitingVelocity(limitingSpeed)
- }
-
- fun disableLimitingVelocity() {
- mView?.disableLimitingVelocity()
- }
}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/V2XWarningView.kt b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/V2XWarningView.kt
new file mode 100644
index 0000000000..4da664470d
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/ui/widget/V2XWarningView.kt
@@ -0,0 +1,118 @@
+package com.mogo.module.hmi.ui.widget
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.RelativeLayout
+import com.mogo.module.data.enums.WarningDirectionEnum
+import com.mogo.module.hmi.R
+import com.mogo.utils.logger.Logger
+import kotlinx.android.synthetic.main.module_hmi_warning_v2x.view.*
+
+/**
+ *@author xiaoyuzhou
+ *@date 2021/9/10 7:44 下午
+ */
+class V2XWarningView @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : RelativeLayout(context, attrs, defStyleAttr) {
+
+ private val ALL_CLOSE_TIMER = 10000L
+
+ private val closeWarningTask: Runnable = Runnable {
+ showWarning(WarningDirectionEnum.ALERT_WARNING_NON)
+ }
+
+ init {
+ LayoutInflater.from(context).inflate(R.layout.module_hmi_warning_v2x, this, true)
+ }
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ */
+ fun showWarning(direction: WarningDirectionEnum) {
+ showWarning(direction, ALL_CLOSE_TIMER)
+ }
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ * @param closeTime 倒计时
+ */
+ fun showWarning(direction: WarningDirectionEnum, closeTime: Long) {
+ Logger.d("V2XWarningView", "预警红边:预警方向->$direction 预警倒计时->$closeTime")
+ // 如果传入的不是关闭显示,则设置倒计时,定时关闭红框警示
+ if (direction != WarningDirectionEnum.ALERT_WARNING_NON) {
+ removeCallbacks(closeWarningTask)
+ postDelayed(closeWarningTask, closeTime)
+ }
+ when (direction) {
+ WarningDirectionEnum.ALERT_WARNING_NON -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_TOP -> {
+ hmiWarningTopImg.visibility = View.VISIBLE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_RIGHT -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.VISIBLE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_BOTTOM -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.VISIBLE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_LEFT -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.VISIBLE
+ }
+ WarningDirectionEnum.ALERT_WARNING_TOP_RIGHT -> {
+ hmiWarningTopImg.visibility = View.VISIBLE
+ hmiWarningRightImg.visibility = View.VISIBLE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_BOTTOM_RIGHT -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.VISIBLE
+ hmiWarningBottomImg.visibility = View.VISIBLE
+ hmiWarningLeftImg.visibility = View.GONE
+ }
+ WarningDirectionEnum.ALERT_WARNING_BOTTOM_LEFT -> {
+ hmiWarningTopImg.visibility = View.GONE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.VISIBLE
+ hmiWarningLeftImg.visibility = View.VISIBLE
+ }
+ WarningDirectionEnum.ALERT_WARNING_TOP_LEFT -> {
+ hmiWarningTopImg.visibility = View.VISIBLE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.VISIBLE
+ }
+ WarningDirectionEnum.ALERT_WARNING_ALL -> {
+ hmiWarningTopImg.visibility = View.VISIBLE
+ hmiWarningRightImg.visibility = View.GONE
+ hmiWarningBottomImg.visibility = View.GONE
+ hmiWarningLeftImg.visibility = View.VISIBLE
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/warning/MoGoWarningProvider.java b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/warning/MoGoWarningProvider.java
index 62f186d0ad..a306528e2a 100644
--- a/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/warning/MoGoWarningProvider.java
+++ b/modules/mogo-module-hmi/src/main/java/com/mogo/module/hmi/warning/MoGoWarningProvider.java
@@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
+import com.mogo.module.data.enums.WarningDirectionEnum;
import com.mogo.module.hmi.WaringConst;
import com.mogo.module.hmi.ui.MoGoWarningFragment;
import com.mogo.service.MogoServicePaths;
@@ -101,4 +102,13 @@ public class MoGoWarningProvider implements IMoGoWaringProvider {
mMoGoWarningFragment.disableWarningV2X(tag);
}
+ @Override
+ public void showWarning(@NonNull WarningDirectionEnum direction) {
+ mMoGoWarningFragment.showWarning(direction);
+ }
+
+ @Override
+ public void showWarning(@NonNull WarningDirectionEnum direction, long closeTime) {
+ mMoGoWarningFragment.showWarning(direction, closeTime);
+ }
}
diff --git a/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_bottom.xml b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_bottom.xml
new file mode 100644
index 0000000000..74097c2465
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_bottom.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_left.xml b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_left.xml
new file mode 100644
index 0000000000..a9b438c963
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_left.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_right.xml b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_right.xml
new file mode 100644
index 0000000000..1a6e8c89b3
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_right.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_top.xml b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_top.xml
new file mode 100644
index 0000000000..1188f9c6d0
--- /dev/null
+++ b/modules/mogo-module-hmi/src/main/res/drawable/module_hmi_warning_bkg_top.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml b/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
index 99684e58bb..9414455ec6 100644
--- a/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
+++ b/modules/mogo-module-hmi/src/main/res/layout/fragment_warning.xml
@@ -5,6 +5,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/services/mogo-service-api/build.gradle b/services/mogo-service-api/build.gradle
index 6bb76edc71..e94afb7dff 100644
--- a/services/mogo-service-api/build.gradle
+++ b/services/mogo-service-api/build.gradle
@@ -56,9 +56,11 @@ dependencies {
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomapapi
api rootProject.ext.dependencies.skinsupport
+ implementation rootProject.ext.dependencies.moduledata
} else {
api project(":libraries:mogo-map-api")
api project(":skin:mogo-skin-support")
+ implementation project(':modules:mogo-module-data')
}
}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/warning/IMoGoWaringProvider.kt b/services/mogo-service-api/src/main/java/com/mogo/service/warning/IMoGoWaringProvider.kt
index 1d09eaea5c..bfcdc3fa2c 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/warning/IMoGoWaringProvider.kt
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/warning/IMoGoWaringProvider.kt
@@ -1,5 +1,6 @@
package com.mogo.service.warning
+import com.mogo.module.data.enums.WarningDirectionEnum
import com.mogo.service.module.IMogoModuleProvider
/**
@@ -73,4 +74,19 @@ interface IMoGoWaringProvider : IMogoModuleProvider {
* 关闭限速预警
*/
fun disableLimitingVelocity()
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ */
+ fun showWarning(direction: WarningDirectionEnum)
+
+ /**
+ * 展示指定方位上的红框预警
+ * @param direction
+ * @see WarningDirectionEnum
+ * @param closeTime 倒计时
+ */
+ fun showWarning(direction: WarningDirectionEnum, closeTime: Long)
}
\ No newline at end of file