添加钛方科技碰撞报警相关逻辑,主要增加碰撞阈值设置临时入口和碰撞报警事件转发
This commit is contained in:
@@ -65,6 +65,9 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_OBU,"moduleObu"));
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
|
||||
MogoModulePaths.addModule(new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME));
|
||||
// 碰撞报警模块
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING,
|
||||
"CrashWarning"));
|
||||
|
||||
if (!DebugConfig.isLauncher()) {
|
||||
PersistentManager.getInstance().initManager(this);
|
||||
|
||||
@@ -8,9 +8,8 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -52,18 +51,17 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.LaunchUtils;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.manager.ts.TsThreshold;
|
||||
import com.zhidao.roadcondition.service.DelayService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
/**
|
||||
@@ -72,7 +70,7 @@ import java.util.Random;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter >
|
||||
public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresenter>
|
||||
implements EntranceView,
|
||||
IMogoNaviListener,
|
||||
IMogoMapListener,
|
||||
@@ -109,6 +107,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
private EntrancePresenter mEntrancePresenter;
|
||||
private IMogoStatusManager mStatusManager;
|
||||
|
||||
private View thresholdSetContainer;
|
||||
private EditText topEditC, frontLeftEditC, frontRightEditC, backLeftEditC, backRightEditC,
|
||||
bottomEditC;
|
||||
private EditText topEditS, frontLeftEditS, frontRightEditS, backLeftEditS, backRightEditS,
|
||||
bottomEditS;
|
||||
|
||||
/**
|
||||
* 搜索莫模块
|
||||
@@ -175,10 +178,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
private Runnable mLockCarRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if ( !mStatusManager.isDisplayOverview() ) {
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
return;
|
||||
}
|
||||
mStatusManager.setDisplayOverview( TAG, false );
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
};
|
||||
@@ -188,24 +191,24 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
}
|
||||
|
||||
private List< View > demoCache = new ArrayList<>();
|
||||
private List<View> demoCache = new ArrayList<>();
|
||||
|
||||
private int[] heights = new int[]{100,200,300};
|
||||
private int[] heights = new int[]{100, 200, 300};
|
||||
private int currentHeight;
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter( getContext(), this );
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
|
||||
mStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUpload = findViewById( R.id.module_entrance_id_upload );
|
||||
mUploading = findViewById( R.id.module_entrance_id_uploading );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
|
||||
mUpload = findViewById(R.id.module_entrance_id_upload);
|
||||
mUploading = findViewById(R.id.module_entrance_id_uploading);
|
||||
mUploadRoadCondition.setOnClickListener(view -> {
|
||||
// // todo 测试动画
|
||||
// View v = LayoutInflater.from(getContext()).inflate(R.layout.demo_top, null);
|
||||
// TextView tv = v.findViewById(R.id.tvIndex);
|
||||
@@ -213,7 +216,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
// currentHeight = heights[random.nextInt(3)];
|
||||
// tv.setText(demoCache.size()+" height: "+currentHeight + ": " + v);
|
||||
// demoCache.add(v);
|
||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, currentHeight);
|
||||
// ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams
|
||||
// .MATCH_PARENT, currentHeight);
|
||||
// mApis.getTopViewManager().addView(v, params,new IMogoTopViewStatusListener() {
|
||||
// @Override
|
||||
// public void onViewAdded(View view) {
|
||||
@@ -237,25 +241,25 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
// });
|
||||
// 原始逻辑
|
||||
showShareDialog();
|
||||
} );
|
||||
});
|
||||
|
||||
mDisplayOverview = findViewById( R.id.module_ext_id_display_overview );
|
||||
mDisplayOverviewText = findViewById( R.id.module_ext_id_display_overview_text );
|
||||
mDisplayOverviewIcon = findViewById( R.id.module_ext_id_display_overview_icon );
|
||||
mDisplayOverview.setOnClickListener( view -> {
|
||||
if ( !mStatusManager.isDisplayOverview() ) {
|
||||
mMApUIController.displayOverview( mDisplayOverviewBounds );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 );
|
||||
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
|
||||
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
|
||||
mDisplayOverviewIcon = findViewById(R.id.module_ext_id_display_overview_icon);
|
||||
mDisplayOverview.setOnClickListener(view -> {
|
||||
if (!mStatusManager.isDisplayOverview()) {
|
||||
mMApUIController.displayOverview(mDisplayOverviewBounds);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
|
||||
} else {
|
||||
mMApUIController.recoverLockMode();
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mStatusManager.setDisplayOverview( TAG, !mStatusManager.isDisplayOverview() );
|
||||
} );
|
||||
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
|
||||
});
|
||||
|
||||
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
|
||||
mMove2CurrentLocation.setOnClickListener( view -> {
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mMove2CurrentLocation.setOnClickListener(view -> {
|
||||
// // todo 测试动画
|
||||
// if(!toggle) {
|
||||
// TopViewAnimHelper.getInstance().showNaviView();
|
||||
@@ -296,120 +300,178 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
// });
|
||||
// 原始逻辑
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if ( location != null ) {
|
||||
if ( !mMogoStatusManager.isV2XShow() ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.setLockZoom( 16 );
|
||||
mMApUIController.changeZoom( 16.0f );
|
||||
if (location != null) {
|
||||
if (!mMogoStatusManager.isV2XShow()) {
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.setLockZoom(16);
|
||||
mMApUIController.changeZoom(16.0f);
|
||||
}
|
||||
if ( mStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
UiThreadHandler.removeCallbacks( mLockCarRunnable );
|
||||
if (mStatusManager.isDisplayOverview()) {
|
||||
mMogoStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
mMove2CurrentLocation.setOnLongClickListener( view -> {
|
||||
if (DebugConfig.isDebug()) {
|
||||
mMove2CurrentLocation.setOnLongClickListener(view -> {
|
||||
mApis.getSearchManagerApi().goSettings();
|
||||
return true;
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
// mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel );
|
||||
ConstraintLayout rootView = findViewById( R.id.module_entrance_id_top_motion_layout );
|
||||
if ( rootView != null ) {
|
||||
TopViewAnimHelper.getInstance().init( rootView );
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
if (rootView != null) {
|
||||
TopViewAnimHelper.getInstance().init(rootView);
|
||||
}
|
||||
|
||||
mExitNavi = findViewById( R.id.module_entrance_id_exit_navi );
|
||||
mExitNavi.setOnClickListener( view -> {
|
||||
if ( mMogoNavi != null ) {
|
||||
if ( mIsLock ) {
|
||||
new WMDialog.Builder( getContext() )
|
||||
.setOkButton( R.string.module_commons_button_ok, ( dlg, which ) -> {
|
||||
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
|
||||
mExitNavi.setOnClickListener(view -> {
|
||||
if (mMogoNavi != null) {
|
||||
if (mIsLock) {
|
||||
new WMDialog.Builder(getContext())
|
||||
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
mMogoNavi.stopNavi();
|
||||
} )
|
||||
.setCancelButton( R.string.module_commons_button_cancel,
|
||||
( dlg, which ) -> {
|
||||
})
|
||||
.setCancelButton(R.string.module_commons_button_cancel,
|
||||
(dlg, which) -> {
|
||||
dlg.dismiss();
|
||||
} )
|
||||
.setContent( R.string.module_commons_exit_navi_content )
|
||||
})
|
||||
.setContent(R.string.module_commons_exit_navi_content)
|
||||
.build()
|
||||
.show();
|
||||
} else {
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.NAVI );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
mCameraMode = findViewById( R.id.module_ext_id_north );
|
||||
mCameraMode.setOnClickListener( view -> {
|
||||
if ( mCameraMode.isSelected() ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
mCameraMode = findViewById(R.id.module_ext_id_north);
|
||||
mCameraMode.setOnClickListener(view -> {
|
||||
if (mCameraMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
} else {
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
}
|
||||
mCameraMode.setSelected( !mCameraMode.isSelected() );
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up :
|
||||
R.string.mode_north_up ) );
|
||||
} );
|
||||
mCameraMode.setSelected(!mCameraMode.isSelected());
|
||||
mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
|
||||
R.string.mode_north_up));
|
||||
});
|
||||
|
||||
|
||||
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV,
|
||||
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV,
|
||||
new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
|
||||
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
|
||||
if ( key_type == 10027 ) {
|
||||
if ( opera_type == 0 ) {
|
||||
mCameraMode.setSelected( false );
|
||||
} else if ( opera_type == 1 ) {
|
||||
mCameraMode.setSelected( true );
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
int key_type = intent.getIntExtra("KEY_TYPE", 0);
|
||||
int type = intent.getIntExtra("EXTRA_TYPE", -1);
|
||||
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
|
||||
if (key_type == 10027) {
|
||||
if (opera_type == 0) {
|
||||
mCameraMode.setSelected(false);
|
||||
} else if (opera_type == 1) {
|
||||
mCameraMode.setSelected(true);
|
||||
}
|
||||
mCameraMode.setText( getString( mCameraMode.isSelected() ?
|
||||
R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
mCameraMode.setText(getString(mCameraMode.isSelected() ?
|
||||
R.string.mode_car_up : R.string.mode_north_up));
|
||||
}
|
||||
}
|
||||
} );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON1,
|
||||
findViewById( R.id.module_entrance_id_button1 ) );
|
||||
MogoEntranceButtons.save( ButtonIndex.BUTTON2,
|
||||
findViewById( R.id.module_entrance_id_button2 ) );
|
||||
});
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
|
||||
findViewById(R.id.module_entrance_id_button1));
|
||||
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
|
||||
findViewById(R.id.module_entrance_id_button2));
|
||||
|
||||
mDisplayOverviewBounds = new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_left_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_top_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_right_margin ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(),
|
||||
R.dimen.module_map_display_overview_bottom_margin )
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_left_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_top_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_right_margin),
|
||||
ResourcesHelper.getDimensionPixelSize(getContext(),
|
||||
R.dimen.module_map_display_overview_bottom_margin)
|
||||
);
|
||||
|
||||
mNaviInfo = new NaviInfoView();
|
||||
mNaviInfo.inflate( rootView );
|
||||
mNaviInfo.inflate(rootView);
|
||||
|
||||
findViewById( R.id.module_map_id_navi_bg ).setOnClickListener( view -> {
|
||||
findViewById(R.id.module_map_id_navi_bg).setOnClickListener(view -> {
|
||||
try {
|
||||
LaunchUtils.launchByPkg( getContext(), "com.autonavi.amapauto" );
|
||||
} catch ( Exception e ) {
|
||||
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
||||
thresholdSetContainer = findViewById(R.id.thresholdSetContainer);
|
||||
findViewById(R.id.btnClose).setOnClickListener(view -> {
|
||||
thresholdSetContainer.setVisibility(View.GONE);
|
||||
mApis.getAdasControllerApi().showADAS();
|
||||
});
|
||||
|
||||
topEditC = findViewById(R.id.etTopC);
|
||||
frontLeftEditC = findViewById(R.id.etFrontLeftC);
|
||||
backLeftEditC = findViewById(R.id.etBackLeftC);
|
||||
frontRightEditC = findViewById(R.id.etFrontRightC);
|
||||
backRightEditC = findViewById(R.id.etBackRightC);
|
||||
bottomEditC = findViewById(R.id.etBottomC);
|
||||
|
||||
topEditS = findViewById(R.id.etTopS);
|
||||
frontLeftEditS = findViewById(R.id.etFrontLeftS);
|
||||
backLeftEditS = findViewById(R.id.etBackLeftS);
|
||||
frontRightEditS = findViewById(R.id.etFrontRightS);
|
||||
backRightEditS = findViewById(R.id.etBackRightS);
|
||||
bottomEditS = findViewById(R.id.etBottomS);
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
public void showShareDialog() {
|
||||
isClickShare = true;
|
||||
mApis.getShareManager().showShareDialog();
|
||||
traceData( "1" );
|
||||
traceData("1");
|
||||
}
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
|
||||
@@ -422,27 +484,27 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mService = mApis.getMapServiceApi();
|
||||
mMogoRegisterCenter = mApis.getRegisterCenterApi();
|
||||
mMApUIController = mService.getMapUIController();
|
||||
mMogoLocationClient = mService.getSingletonLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
mMogoLocationClient = mService.getSingletonLocationClient(getContext());
|
||||
mMogoNavi = mService.getNavi(getContext());
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mMogoStatusManager = mApis.getStatusManagerApi();
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener( TAG, this );
|
||||
mMogoRegisterCenter.registerMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoAimlessModeListener(TAG, this);
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
mMogoMarkerManager = mService.getMarkerManager(getContext());
|
||||
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.UPLOADING, this );
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.DISPLAY_OVERVIEW,
|
||||
this );
|
||||
mMogoStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
|
||||
mMogoStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW,
|
||||
this);
|
||||
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController( mMApUIController );
|
||||
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -452,162 +514,162 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
if ( naviinfo == null ) {
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
if (naviinfo == null) {
|
||||
return;
|
||||
}
|
||||
if ( mNaviInfo != null ) {
|
||||
if ( !mNaviInfo.isVisible() ) {
|
||||
if (mNaviInfo != null) {
|
||||
if (!mNaviInfo.isVisible()) {
|
||||
// 避免导航先开启,再开启app的情况
|
||||
onStartNavi();
|
||||
}
|
||||
mNaviInfo.notifyChanged( naviinfo );
|
||||
mNaviInfo.notifyChanged(naviinfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
TopViewAnimHelper.getInstance().showNaviView();
|
||||
mMApUIController.changeMapMode( mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
|
||||
EnumMapUI.CarUp_2D );
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay( mMApUIController, Scene.NAVI, 500
|
||||
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
|
||||
EnumMapUI.CarUp_2D);
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
|
||||
, () -> {
|
||||
return !mMogoNavi.isNaviing();
|
||||
} );
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
mDisplayOverview.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
});
|
||||
if (CustomNaviInterrupter.getInstance().interrupt()) {
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
mExitNavi.setVisibility(View.GONE);
|
||||
} else {
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mDisplayOverview.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
mExitNavi.setVisibility(View.VISIBLE);
|
||||
mDisplayOverview.setVisibility(View.VISIBLE);
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mApis.getAnalyticsApi().track( "Navigation_begin", new HashMap<>() );
|
||||
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
TopViewAnimHelper.getInstance().hideNaviView();
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
mDisplayOverview.setVisibility( View.GONE );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
MapCenterPointStrategy.setMapCenterPointByScene( mMApUIController, Scene.AIMLESS );
|
||||
mExitNavi.setVisibility(View.GONE);
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic2( MogoTraffic traffic ) {
|
||||
if ( traffic == null ) {
|
||||
public void onUpdateTraffic2(MogoTraffic traffic) {
|
||||
if (traffic == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
public void onLockMap(boolean isLock) {
|
||||
mIsLock = isLock;
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
if ( mMogoStatusManager.isDisplayOverview() ) {
|
||||
mMogoStatusManager.setDisplayOverview( TAG, false );
|
||||
if (isLock) {
|
||||
mExitNavi.setText(R.string.module_ext_str_exit_navi);
|
||||
if (mMogoStatusManager.isDisplayOverview()) {
|
||||
mMogoStatusManager.setDisplayOverview(TAG, false);
|
||||
}
|
||||
} else {
|
||||
mExitNavi.setText( R.string.module_ext_str_continue_navi );
|
||||
mExitNavi.setText(R.string.module_ext_str_continue_navi);
|
||||
}
|
||||
}
|
||||
|
||||
private void traceData( String from ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "from", from );
|
||||
mAnalytics.track( "v2x_share_click", properties );
|
||||
private void traceData(String from) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("from", from);
|
||||
mAnalytics.track("v2x_share_click", properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( mUploadRoadCondition == null ) {
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (mUploadRoadCondition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( descriptor == StatusDescriptor.UPLOADING ) {
|
||||
if ( isTrue ) {
|
||||
mUploading.setVisibility( View.VISIBLE );
|
||||
mUpload.setVisibility( View.GONE );
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
if (descriptor == StatusDescriptor.UPLOADING) {
|
||||
if (isTrue) {
|
||||
mUploading.setVisibility(View.VISIBLE);
|
||||
mUpload.setVisibility(View.GONE);
|
||||
if (mUploadFrameAnimHandler != null) {
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_STOP_ANIM);
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_FRAME_ANIM);
|
||||
}
|
||||
doFrameAnimOnUploadButton();
|
||||
} else {
|
||||
mCurrentUploadFrame = 0;
|
||||
if ( mUploadFrameAnimHandler != null ) {
|
||||
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
|
||||
if (mUploadFrameAnimHandler != null) {
|
||||
mUploadFrameAnimHandler.removeMessages(MSG_FRAME_ANIM);
|
||||
}
|
||||
mUploading.setVisibility( View.GONE );
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
mUploading.setVisibility(View.GONE);
|
||||
mUpload.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else if ( descriptor == StatusDescriptor.DISPLAY_OVERVIEW ) {
|
||||
if ( !mMogoNavi.isNaviing() ) {
|
||||
} else if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
|
||||
if (!mMogoNavi.isNaviing()) {
|
||||
return;
|
||||
}
|
||||
if ( isTrue ) {
|
||||
mDisplayOverviewText.setText( "退出全览" );
|
||||
mDisplayOverviewText.setTextSize( TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize( R.dimen.module_ext_display_overview_textSize ) );
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
if (isTrue) {
|
||||
mDisplayOverviewText.setText("退出全览");
|
||||
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize));
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
} else {
|
||||
mDisplayOverviewText.setText( "全览" );
|
||||
mDisplayOverviewText.setTextSize( TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize( R.dimen.module_ext_display_overview_textSize_large ) );
|
||||
if ( CustomNaviInterrupter.getInstance().interrupt() ) {
|
||||
mCameraMode.setVisibility( View.GONE );
|
||||
mDisplayOverviewText.setText("全览");
|
||||
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize_large));
|
||||
if (CustomNaviInterrupter.getInstance().interrupt()) {
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
} else {
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.ACC_STATUS) {
|
||||
Log.d(TAG, " onStatusChanged isTrue = " + isTrue);
|
||||
if ( isTrue ) {
|
||||
if (isTrue) {
|
||||
DelayService.Companion.launchService(getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void doFrameAnimOnUploadButton() {
|
||||
if ( mUploadFrameAnimHandler == null ) {
|
||||
mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
|
||||
if (mUploadFrameAnimHandler == null) {
|
||||
mUploadFrameAnimHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_FRAME_ANIM ) {
|
||||
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
|
||||
if ( mUploading != null ) {
|
||||
mUploading.setVisibility( View.GONE );
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_FRAME_ANIM) {
|
||||
if (mUploadingFrameRes == null || mUploadingFrameRes.length == 0) {
|
||||
if (mUploading != null) {
|
||||
mUploading.setVisibility(View.GONE);
|
||||
}
|
||||
if ( mUpload != null ) {
|
||||
mUpload.setVisibility( View.VISIBLE );
|
||||
if (mUpload != null) {
|
||||
mUpload.setVisibility(View.VISIBLE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( !mMogoStatusManager.isUploading() ) {
|
||||
if (!mMogoStatusManager.isUploading()) {
|
||||
mCurrentUploadFrame = 0;
|
||||
return;
|
||||
}
|
||||
if ( mUploading != null ) {
|
||||
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
|
||||
if (mUploading != null) {
|
||||
if (mCurrentUploadFrame == mUploadingFrameRes.length) {
|
||||
mCurrentUploadFrame = 12;
|
||||
}
|
||||
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
|
||||
mUploading.setImageResource(mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length]);
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME );
|
||||
} else if ( msg.what == MSG_STOP_ANIM ) {
|
||||
mStatusManager.setUploadingStatus( TAG, false );
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed(MSG_FRAME_ANIM,
|
||||
TIME_FRAME_INTERVAL_TIME);
|
||||
} else if (msg.what == MSG_STOP_ANIM) {
|
||||
mStatusManager.setUploadingStatus(TAG, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
|
||||
mUploadFrameAnimHandler.sendEmptyMessage(MSG_FRAME_ANIM);
|
||||
// 30s 后无论成功与否,停止动画
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed(MSG_STOP_ANIM, 30_000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/thresholdSetContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000"
|
||||
android:padding="30dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="前保险杠设置(5)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etTopC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvTop"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTop" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etTopS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvTop"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvTop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFrontLeft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="左前门设置(4)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tvFrontRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etTopC" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etFrontLeftC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvFrontLeft"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvFrontLeft" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etFrontLeftS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvFrontLeft"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvFrontLeft" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFrontRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:text="右前门设置(1)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/tvFrontLeft"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etTopC" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etFrontRightC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvFrontRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvFrontRight" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etFrontRightS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvFrontRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvFrontRight" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBackLeft"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="左后门设置(3)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tvBackRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etFrontRightS" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBackLeftC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvBackLeft"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBackLeft" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBackLeftS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvBackLeft"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBackLeft" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBackRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="右后门设置(2)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/tvBackLeft"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etFrontRightS" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBackRightC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvBackRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBackRight" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBackRightS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvBackRight"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBackRight" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="后保险杠设置(6)"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/etBackRightS" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBottomC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="碰撞"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/tvBottom"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBottom" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etBottomS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:hint="剐蹭"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="#ccc"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="@+id/tvBottom"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvBottom" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="关闭"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSet"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="设置"
|
||||
android:textColor="#fff"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -6,20 +6,20 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- <androidx.constraintlayout.widget.Group-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:id="@+id/naviGroup"-->
|
||||
<!-- android:visibility="visible"-->
|
||||
<!-- app:constraint_referenced_ids="module_map_id_navi_next_info_road,module_map_id_navi_next_info_turn_info,module_map_id_navi_bg,module_map_id_navi_next_info_road_turn_icon,module_map_id_navi_next_info_distance,module_map_id_navi_next_info_distance_unit,remainDistanceGroup,remainTimeGroup,arriveTimeGroup" />-->
|
||||
<!-- <androidx.constraintlayout.widget.Group-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:id="@+id/naviGroup"-->
|
||||
<!-- android:visibility="visible"-->
|
||||
<!-- app:constraint_referenced_ids="module_map_id_navi_next_info_road,module_map_id_navi_next_info_turn_info,module_map_id_navi_bg,module_map_id_navi_next_info_road_turn_icon,module_map_id_navi_next_info_distance,module_map_id_navi_next_info_distance_unit,remainDistanceGroup,remainTimeGroup,arriveTimeGroup" />-->
|
||||
|
||||
<View
|
||||
android:id="@+id/module_map_id_navi_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_ext_navi_info_panel_height"
|
||||
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintHorizontal_bias="0.501"
|
||||
app:layout_constraintLeft_toLeftOf="@id/module_entrance_id_top_container"
|
||||
app:layout_constraintRight_toRightOf="@id/module_entrance_id_top_container"
|
||||
@@ -241,17 +241,17 @@
|
||||
android:textSize="@dimen/module_ext_north_textSize"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_upload_road_condition"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
|
||||
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop" />
|
||||
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.module.extensions.navi.TopView
|
||||
android:id="@+id/module_entrance_id_top_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
@@ -262,12 +262,12 @@
|
||||
android:layout_height="@dimen/module_ext_button_height"
|
||||
android:layout_marginTop="@dimen/module_ext_camera_button_marginTop"
|
||||
android:background="@drawable/module_ext_dw_common_corner_bkg"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg">
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_ext_id_display_overview_icon"
|
||||
@@ -385,4 +385,6 @@
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/module_ext_layout_crash_threshold_set" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -39,7 +39,6 @@ dependencies {
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
|
||||
@@ -39,22 +39,6 @@ class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
|
||||
private var handler = Handler(Looper.getMainLooper(), this)
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return 0
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG,"init=======")
|
||||
if (DebugConfig.isUseMockObuData()) {
|
||||
@@ -68,34 +52,6 @@ class ObuManager: IMogoObuManager,Handler.Callback {
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return "moduleObu"
|
||||
}
|
||||
|
||||
override fun getAppName(): String {
|
||||
return ""
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun registerObuDataChangedListener(listener: IMogoObuDataChangedListener?) {
|
||||
this.dataChangedListener = listener
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhidao.mogo.module.obu.crashwarn
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.manager.constent.Common
|
||||
import com.zhidao.manager.power.ZDPowerManager
|
||||
import com.zhidao.manager.ts.TsSensorChannel
|
||||
import com.zhidao.manager.ts.TsThreshold
|
||||
|
||||
/**
|
||||
* 碰撞报警provider
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_CRASH_WARNING)
|
||||
class CrashWarningProvider:IMogoCrashWarnProvider {
|
||||
companion object{
|
||||
const val TAG = "CrashWarningProvider"
|
||||
}
|
||||
|
||||
val crashThreshold = TsThreshold(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
override fun setCrashThreshold(threshold: TsThreshold?) {
|
||||
ZDPowerManager.getInstance().setTsThreshold(threshold)
|
||||
}
|
||||
|
||||
override fun getCurrentCrashThreshold(): TsThreshold = crashThreshold
|
||||
|
||||
override fun init(context: Context) {
|
||||
Logger.d(TAG, "init---->")
|
||||
ZDPowerManager.getInstance().setTsBoxStatusListener(object : ZDPowerManager.TsBoxStatusListener{
|
||||
override fun onBoxSelfCheckChanged(p0: TsSensorChannel?) {
|
||||
}
|
||||
|
||||
override fun onBoxThresholdChanged(threshold: TsThreshold?) {
|
||||
threshold?.let {
|
||||
Logger.d(TAG, "获取到当前阈值: $threshold")
|
||||
crashThreshold.copy(threshold)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTimeChanged(p0: Int, p1: Int, p2: Int, p3: Int, p4: Int, p5: Int) {
|
||||
}
|
||||
|
||||
override fun onVersionChanged(p0: String?) {
|
||||
}
|
||||
|
||||
override fun onBoxSwitchChanged(p0: Int, p1: Int, p2: Int, p3: Int) {
|
||||
}
|
||||
/**
|
||||
* 碰撞报警事件
|
||||
* @param position 碰撞位置 1:右前车门,2:右后车门,3:左后车门,4:左前车门,5:前保险杠,6:后保险杠
|
||||
* @param levelH 高力度级数(1--5)
|
||||
* @param levelL 低力度级数 (1--5)
|
||||
*/
|
||||
override fun onAlarmChanged(position: Int, levelH: Int, levelL: Int) {
|
||||
// 发送广播通知adas
|
||||
Logger.d(TAG, "碰撞事件报警------ position: $position, levelH: $levelH,levelL: $levelL")
|
||||
val intent = Intent("com.mogo.launcher.action.CRASH_WARNING")
|
||||
intent.putExtra("position", position)
|
||||
intent.putExtra("levelH", levelH)
|
||||
intent.putExtra("levelL", levelL)
|
||||
context.sendBroadcast(intent)
|
||||
}
|
||||
|
||||
override fun onSerialNumChanged(p0: String?) {
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
val getThresholdResult = ZDPowerManager.getInstance().tsBoxStatus
|
||||
Logger.d(TAG, "获取当前碰撞阈值: $getThresholdResult")
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
// implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
@@ -50,8 +50,6 @@ dependencies {
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.guideshowprovider
|
||||
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
api rootProject.ext.dependencies.fresco
|
||||
api rootProject.ext.dependencies.obusdk
|
||||
api 'com.mogo.module:module-crash-warning:1'
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
} else {
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
@@ -208,4 +209,10 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return obuManager
|
||||
*/
|
||||
IMogoObuManager getObuManager();
|
||||
|
||||
/**
|
||||
* 获取crashWarnProvider
|
||||
* @return
|
||||
*/
|
||||
IMogoCrashWarnProvider getCrashWarnProvider();
|
||||
}
|
||||
|
||||
@@ -190,4 +190,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_OBU = "/obu/api";
|
||||
|
||||
/**
|
||||
* 碰撞报警模块
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_CRASH_WARNING = "/crash/warning";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.service.obu;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.zhidao.manager.ts.TsThreshold;
|
||||
|
||||
/**
|
||||
* 碰撞报警相关接口
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoCrashWarnProvider extends IProvider {
|
||||
/**
|
||||
* 设置碰撞碰撞报警阈值
|
||||
* @param threshold
|
||||
*/
|
||||
void setCrashThreshold(TsThreshold threshold);
|
||||
|
||||
/**
|
||||
* 获取当前碰撞报警阈值
|
||||
* @return
|
||||
*/
|
||||
TsThreshold getCurrentCrashThreshold();
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.mogo.service.obu;
|
||||
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.zhidao.smartv2x.listener.OnMessageReceiveListener;
|
||||
|
||||
/**
|
||||
* obu事件管理器
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoObuManager extends IMogoModuleProvider, OnMessageReceiveListener{
|
||||
public interface IMogoObuManager extends IProvider, OnMessageReceiveListener{
|
||||
void registerObuDataChangedListener(IMogoObuDataChangedListener listener);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.obu.IMogoCrashWarnProvider;
|
||||
import com.mogo.service.obu.IMogoObuManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
@@ -183,6 +184,11 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance(IMogoObuManager.class, MogoServicePaths.PATH_OBU);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoCrashWarnProvider getCrashWarnProvider() {
|
||||
return getApiInstance(IMogoCrashWarnProvider.class, MogoServicePaths.PATH_CRASH_WARNING);
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance(Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
|
||||
Reference in New Issue
Block a user