diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 0d156937bb..663459aa50 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -3,18 +3,9 @@ - diff --git a/.idea/misc.xml b/.idea/misc.xml index 21e99e2dc0..cd77a1f062 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 478aa6f23f..27bbdffabf 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -80,7 +80,9 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor")); MogoModulePaths.addModule( new MogoModule( V2XConst.PATH_EVENT_PANEL, V2XConst.MODULE_NAME_EVENT_PANEL ) ); MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) ); - +// 碰撞报警模块 + MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, + "CrashWarning")); if ( !DebugConfig.isLauncher() ) { PersistentManager.getInstance().initManager( this ); Intent intent = new Intent( this, MogoMainService.class ); diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 827f9320e1..1d3bffc49c 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -1,6 +1,5 @@ package com.mogo.module.extensions.entrance; -import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; @@ -9,7 +8,7 @@ import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.FrameLayout; +import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; @@ -60,8 +59,10 @@ import com.mogo.utils.ResourcesHelper; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.glide.GlideApp; import com.mogo.utils.logger.Logger; +import com.zhidao.manager.ts.TsThreshold; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Random; @@ -119,6 +120,11 @@ public class EntranceFragment extends MvpFragment { + thresholdSetContainer.setVisibility(View.GONE); + mApis.getAdasControllerApi().showADAS(); + }); + mUploadRoadCondition.setOnLongClickListener(v -> { + mApis.getAdasControllerApi().closeADAS(); + thresholdSetContainer.setVisibility(View.VISIBLE); + TsThreshold threshold = mApis.getCrashWarnProvider().getCurrentCrashThreshold(); + topEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC5())); + topEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS5())); + bottomEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC6())); + bottomEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS6())); + frontLeftEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC4())); + frontLeftEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS4())); + backLeftEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC3())); + backLeftEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS3())); + frontRightEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC1())); + frontRightEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS1())); + backRightEditC.setText(String.format(Locale.CHINA, "%d", threshold.getC2())); + backRightEditS.setText(String.format(Locale.CHINA, "%d", threshold.getS2())); + return true; + }); + findViewById(R.id.btnSet).setOnClickListener(view -> { + // 设置阈值 + TsThreshold threshold = new TsThreshold( + Integer.parseInt(frontRightEditC.getText().toString()), + Integer.parseInt(frontRightEditS.getText().toString()), + Integer.parseInt(backRightEditC.getText().toString()), + Integer.parseInt(backRightEditS.getText().toString()), + Integer.parseInt(backLeftEditC.getText().toString()), + Integer.parseInt(backLeftEditS.getText().toString()), + Integer.parseInt(frontLeftEditC.getText().toString()), + Integer.parseInt(frontLeftEditS.getText().toString()), + Integer.parseInt(topEditC.getText().toString()), + Integer.parseInt(topEditS.getText().toString()), + Integer.parseInt(bottomEditC.getText().toString()), + Integer.parseInt(bottomEditS.getText().toString()) + ); + mApis.getCrashWarnProvider().setCrashThreshold(threshold); + thresholdSetContainer.setVisibility(View.GONE); + mApis.getAdasControllerApi().showADAS(); + }); } public void showShareDialog() { diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_crash_threshold_set.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_crash_threshold_set.xml new file mode 100644 index 0000000000..1ce622b331 --- /dev/null +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_crash_threshold_set.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +