diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index d3efc6486b..e533b52ac5 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -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); 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 6cf876ad86..a19e6c40f8 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 @@ -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; *

* 描述 */ -public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > +public class EntranceFragment extends MvpFragment 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 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 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); } } 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +