内存优化

This commit is contained in:
wangcongtao
2020-11-27 11:32:31 +08:00
parent ce047c1326
commit 18a2d8e4e1
6 changed files with 69 additions and 37 deletions

View File

@@ -27,11 +27,13 @@ public class MapCenterPointStrategy {
{ {
// 选点场景,定位中心点 // 选点场景,定位中心点
Map< String, MapCenterPoint > choosePoint = new HashMap<>(); Map< String, MapCenterPoint > choosePoint = new HashMap<>();
choosePoint.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) ); final MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
choosePoint.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) ); choosePoint.put( "d80x", point );
choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) ); choosePoint.put( "em4", point );
choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) ); choosePoint.put( "em3", point );
choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) ); choosePoint.put( "e8xx", point );
choosePoint.put( "f80x", point );
choosePoint.put( "f8xx", point );
sStrategies.put( Scene.CHOOSE_POINT, choosePoint ); sStrategies.put( Scene.CHOOSE_POINT, choosePoint );
} }
@@ -39,10 +41,13 @@ public class MapCenterPointStrategy {
// 导航场景,定位视图右下角偏下 // 导航场景,定位视图右下角偏下
Map< String, MapCenterPoint > navi = new HashMap<>(); Map< String, MapCenterPoint > navi = new HashMap<>();
navi.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.573333333333D ) ); navi.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.573333333333D ) );
navi.put( "em4", new MapCenterPoint( 0.734375D, 0.573333333333D ) ); final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.573333333333D );
navi.put( "e8xx", new MapCenterPoint( 0.734375D, 0.573333333333D ) ); navi.put( "em4", em4 );
navi.put( "f80x", new MapCenterPoint( 0.705208333D, 0.575D ) ); navi.put( "em3", em4 );
navi.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.575D ) ); navi.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.575D );
navi.put( "f80x", f80x );
navi.put( "f8xx", f80x );
sStrategies.put( Scene.NAVI, navi ); sStrategies.put( Scene.NAVI, navi );
} }
@@ -50,10 +55,13 @@ public class MapCenterPointStrategy {
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下 // 导航场景 vs 道路事件展示场景,定位视图右下角偏下
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>(); Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) ); naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.73936170212766D ) );
naviWithRoadEvent.put( "em4", new MapCenterPoint( 0.734375D, 0.73936170212766D ) ); final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.73936170212766D );
naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.73936170212766D ) ); naviWithRoadEvent.put( "em4", em4 );
naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.683333333333D ) ); naviWithRoadEvent.put( "em3", em4 );
naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.683333333333D ) ); naviWithRoadEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.683333333333D );
naviWithRoadEvent.put( "f80x", f80x );
naviWithRoadEvent.put( "f8xx", f80x );
sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent ); sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
} }
@@ -61,10 +69,13 @@ public class MapCenterPointStrategy {
// 巡航场景 // 巡航场景
Map< String, MapCenterPoint > aimless = new HashMap<>(); Map< String, MapCenterPoint > aimless = new HashMap<>();
aimless.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.5D ) ); aimless.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.5D ) );
aimless.put( "em4", new MapCenterPoint( 0.734375D, 0.5D ) ); final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.5D );
aimless.put( "e8xx", new MapCenterPoint( 0.734375D, 0.5D ) ); aimless.put( "em4", em4 );
aimless.put( "f80x", new MapCenterPoint( 0.705208333D, 0.5D ) ); aimless.put( "em3", em4 );
aimless.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.5D ) ); aimless.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.5D );
aimless.put( "f80x", f80x );
aimless.put( "f8xx", f80x );
sStrategies.put( Scene.AIMLESS, aimless ); sStrategies.put( Scene.AIMLESS, aimless );
} }
@@ -72,32 +83,41 @@ public class MapCenterPointStrategy {
// 巡航场景 vs 道路事件展示场景 // 巡航场景 vs 道路事件展示场景
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>(); Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.68617 ) ); aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.68617 ) );
aimlessWithRoadEvent.put( "em4", new MapCenterPoint( 0.734375D, 0.68617 ) ); final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.68617 );
aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.68617 ) ); aimlessWithRoadEvent.put( "em4", em4 );
aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.599074074D ) ); aimlessWithRoadEvent.put( "em3", em4 );
aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.599074074D ) ); aimlessWithRoadEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.599074074D );
aimlessWithRoadEvent.put( "f80x", f80x );
aimlessWithRoadEvent.put( "f8xx", f80x );
sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent ); sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
} }
{ {
// 规划路线,定位视图右边 // 规划路线,定位视图右边
Map< String, MapCenterPoint > calculatePath = new HashMap<>(); Map< String, MapCenterPoint > calculatePath = new HashMap<>();
calculatePath.put( "d80x", new MapCenterPoint( 0.733398D, 0.610833D ) ); final MapCenterPoint d80x = new MapCenterPoint( 0.733398D, 0.610833D );
calculatePath.put( "em4", new MapCenterPoint( 0.733398D, 0.610833D ) ); calculatePath.put( "d80x", d80x );
calculatePath.put( "e8xx", new MapCenterPoint( 0.733398D, 0.610833D ) ); calculatePath.put( "em4", d80x );
calculatePath.put( "f80x", new MapCenterPoint( 0.703125D, 0.6083333D ) ); calculatePath.put( "em3", d80x );
calculatePath.put( "f8xx", new MapCenterPoint( 0.703125D, 0.6083333D ) ); calculatePath.put( "e8xx", d80x );
final MapCenterPoint f80x = new MapCenterPoint( 0.703125D, 0.6083333D );
calculatePath.put( "f80x", f80x );
calculatePath.put( "f8xx", f80x );
sStrategies.put( Scene.CALCULATE_PATH, calculatePath ); sStrategies.put( Scene.CALCULATE_PATH, calculatePath );
} }
{ {
// 分类搜索,定位视图右边 // 分类搜索,定位视图右边
Map< String, MapCenterPoint > categorySearch = new HashMap<>(); Map< String, MapCenterPoint > categorySearch = new HashMap<>();
categorySearch.put( "d80x", new MapCenterPoint( 0.733398D, 0.5D ) ); final MapCenterPoint d80x = new MapCenterPoint( 0.733398D, 0.5D );
categorySearch.put( "em4", new MapCenterPoint( 0.733398D, 0.5D ) ); categorySearch.put( "d80x", d80x );
categorySearch.put( "e8xx", new MapCenterPoint( 0.733398D, 0.5D ) ); categorySearch.put( "em4", d80x );
categorySearch.put( "f80x", new MapCenterPoint( 0.733594D, 0.5D ) ); categorySearch.put( "em3", d80x );
categorySearch.put( "f8xx", new MapCenterPoint( 0.733594D, 0.5D ) ); categorySearch.put( "e8xx", d80x );
final MapCenterPoint f80x = new MapCenterPoint( 0.733594D, 0.5D );
categorySearch.put( "f80x", f80x );
categorySearch.put( "f8xx", f80x );
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch ); sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
} }
@@ -105,10 +125,13 @@ public class MapCenterPointStrategy {
// V2X场景视图右边 // V2X场景视图右边
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>(); Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.7D ) ); categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.7D ) );
categoryV2XEvent.put( "em4", new MapCenterPoint( 0.677734375D, 0.7D ) ); final MapCenterPoint em4 = new MapCenterPoint( 0.677734375D, 0.7D );
categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.677734375D, 0.7D ) ); categoryV2XEvent.put( "em4", em4 );
categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.6963541D, 0.65D ) ); categoryV2XEvent.put( "em3", em4 );
categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.6963541D, 0.65D ) ); categoryV2XEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.6963541D, 0.65D );
categoryV2XEvent.put( "f80x", f80x );
categoryV2XEvent.put( "f8xx", f80x );
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent ); sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
} }
} }

View File

@@ -233,7 +233,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override @Override
public void hideCoverUpLayout() { public void hideCoverUpLayout() {
Logger.d( TAG, "隐藏遮罩" ); getWindow().setBackgroundDrawable( null );
mCoverUpLayout.setVisibility( View.GONE ); mCoverUpLayout.setVisibility( View.GONE );
mServiceApis.getAdasControllerApi().showADAS(); mServiceApis.getAdasControllerApi().showADAS();
} }
@@ -314,6 +314,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, true ); mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, true );
if ( shouldCloseADASPanelWhenPause() ) {
mServiceApis.getAdasControllerApi().closeADAS();
}
} }
@Override @Override

View File

@@ -2,6 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/module_main_window_background_color"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">

View File

@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/module_main_window_background_color"
android:orientation="vertical"> android:orientation="vertical">
<!-- 地图--> <!-- 地图-->

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="module_main_window_background_color">#1D1D1D</color> <color name="module_main_window_background_color">#212831</color>
</resources> </resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_main_window_background_color_light">#f7f7ff</color>
</resources>