diff --git a/config.gradle b/config.gradle index c15cb61257..4fd57c702c 100644 --- a/config.gradle +++ b/config.gradle @@ -34,7 +34,7 @@ ext { // 地图 amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0", amapsearch : "com.amap.api:search:7.1.0", - amaplocation : "com.amap.api:location:4.9.0", + amaplocation : "com.amap.api:location:5.2.0", // json 转换 gson : "com.google.code.gson:gson:2.8.4", // 内存泄漏检测 diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index c5371e1e3b..2cf6e854fc 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -76,7 +76,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, private static final String TAG = "AMapNaviViewWrapper"; - private final AMapNaviView mMapView; + private AMapNaviView mMapView; private IMogoMap mIMap; private AMapMarkerClickHandler mMarkerClickHandler; @@ -239,8 +239,10 @@ public class AMapNaviViewWrapper implements IMogoMapView, public void onDestroy() { if ( mMapView != null ) { mMapView.onDestroy(); + mMapView = null; AMapUIController.release(); AMapWrapper.release(); + AMapMessageManager.getInstance().unregisterAMapMessageListener( this ); Logger.d( TAG, "map onDestroy" ); } } diff --git a/libraries/map-custom/build.gradle b/libraries/map-custom/build.gradle index 7be264997b..2055423589 100644 --- a/libraries/map-custom/build.gradle +++ b/libraries/map-custom/build.gradle @@ -67,8 +67,8 @@ dependencies { implementation project(':foudations:mogo-commons') } - implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.8.1' -// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1' + implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.8.7' +// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4' } apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 12afb20a67..f397e09b56 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -41,6 +41,7 @@ import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory; import com.zhidaoauto.map.sdk.open.camera.LatLngBounds; import com.zhidaoauto.map.sdk.open.location.LocationListener; import com.zhidaoauto.map.sdk.open.location.MyLocationStyle; +import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean; import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory; import com.zhidaoauto.map.sdk.open.marker.Marker; import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener; @@ -51,6 +52,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.json.JSONObject; import java.util.List; @@ -912,4 +914,35 @@ public class AMapViewWrapper implements IMogoMapView, Logger.e( TAG, e, "rtkEnable" ); } } + + @Override + public void syncLocation2Map( JSONObject data ) { + if ( !checkAMapView() ) { + return; + } + if ( data == null ) { + Logger.d( TAG, "停止使用rtk定位数据" ); + mMapView.getLocationClient().stopAutoPilotRTK(); + return; + } + double lon = data.optDouble( "lon", -1 ); + double lat = data.optDouble( "lat", -1 ); + double alt = data.optDouble( "alt", -1 ); + double heading = data.optDouble( "heading", -1 ); + double acceleration = data.optDouble( "acceleration", -1 ); + double yawRate = data.optDouble( "yawRate", -1 ); + if ( lon == -1 ) { + return; + } + RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean(); + bean.setYaw_rate( yawRate ); + bean.setHeading( heading ); + bean.setHeading( heading ); + bean.setAcceleration( acceleration ); + bean.setAlt( alt ); + bean.setLon( lon ); + bean.setLat( lat ); + mMapView.getLocationClient().updateRTKAutoPilotLocation( bean ); + Logger.d( TAG, "使用rtk定位数据" ); + } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java index 8b4516726c..553117b85d 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java @@ -14,6 +14,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.map.uicontroller.MapCameraPosition; import com.mogo.map.uicontroller.MapControlResult; +import org.json.JSONObject; + import java.util.List; /** @@ -296,4 +298,11 @@ public class AMapUIController implements IMogoMapUIController { mClient.rtkEnable( enable ); } } + + @Override + public void syncLocation2Map( JSONObject data ) { + if ( mClient != null ) { + mClient.syncLocation2Map( data ); + } + } } diff --git a/libraries/map-custom/src/main/res/drawable-ldpi/map_api_ic_current_location2.png b/libraries/map-custom/src/main/res/drawable-ldpi/map_api_ic_current_location2.png index 5f91be07f3..98fc674705 100644 Binary files a/libraries/map-custom/src/main/res/drawable-ldpi/map_api_ic_current_location2.png and b/libraries/map-custom/src/main/res/drawable-ldpi/map_api_ic_current_location2.png differ diff --git a/libraries/map-custom/src/main/res/drawable-mdpi/map_api_ic_current_location2.png b/libraries/map-custom/src/main/res/drawable-mdpi/map_api_ic_current_location2.png index 5f91be07f3..98fc674705 100644 Binary files a/libraries/map-custom/src/main/res/drawable-mdpi/map_api_ic_current_location2.png and b/libraries/map-custom/src/main/res/drawable-mdpi/map_api_ic_current_location2.png differ diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 21f3ed6515..594931745a 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -13,6 +13,8 @@ import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.anim.OnMarkerAnimationListener; +import org.json.JSONObject; + import java.util.List; /** @@ -254,4 +256,8 @@ public interface IMogoMapUIController { default void destroy(){ } + + default void syncLocation2Map( JSONObject data ){ + + } } diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index d390ef0148..3257297088 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -3,6 +3,7 @@ package com.mogo.map; import android.graphics.Point; import android.graphics.Rect; import android.location.Location; +import android.util.Log; import android.view.View; import android.view.animation.Interpolator; @@ -14,6 +15,8 @@ import com.mogo.map.uicontroller.MapCameraPosition; import com.mogo.map.uicontroller.MapControlResult; import com.mogo.utils.logger.Logger; +import org.json.JSONObject; + import java.util.List; /** @@ -55,6 +58,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void setTrafficEnabled( boolean visible ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.setTrafficEnabled( visible ); } @@ -62,6 +66,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MapControlResult changeZoom( boolean zoom ) { + initDelegate(); if ( mDelegate != null ) { return mDelegate.changeZoom( zoom ); } @@ -70,6 +75,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MapControlResult changeZoom( float zoom ) { + initDelegate(); if ( mDelegate != null ) { return mDelegate.changeZoom( zoom ); } @@ -78,8 +84,8 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void changeMapMode( EnumMapUI mode ) { + initDelegate(); if ( mDelegate != null ) { - Logger.d( "whatthefuck-MogoMapUIController", "%s", this ); Logger.d( TAG, "set type: %s", mode.name() ); mDelegate.changeMapMode( mode ); } @@ -88,6 +94,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void moveToCenter( MogoLatLng latLng, boolean animate ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.moveToCenter( latLng, animate ); } @@ -95,6 +102,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void showMyLocation( boolean visible ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.showMyLocation( visible ); } @@ -102,6 +110,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void emphasizeMyLocation() { + initDelegate(); if ( mDelegate != null ) { mDelegate.emphasizeMyLocation(); } @@ -109,6 +118,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void showMyLocation( View view ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.showMyLocation( view ); } @@ -116,6 +126,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void recoverLockMode() { + initDelegate(); if ( mDelegate != null ) { mDelegate.recoverLockMode(); } @@ -123,6 +134,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void loseLockMode() { + initDelegate(); if ( mDelegate != null ) { mDelegate.loseLockMode(); } @@ -130,6 +142,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void setLockZoom( int var1 ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.setLockZoom( var1 ); } @@ -137,6 +150,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void displayOverview( Rect bounds ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.displayOverview( bounds ); } @@ -144,6 +158,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public float getScalePerPixel() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getScalePerPixel(); } @@ -152,6 +167,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public float getZoomLevel() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getZoomLevel(); } @@ -160,6 +176,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MogoLatLng getCameraNorthEastPosition() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getCameraNorthEastPosition(); } @@ -168,6 +185,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MogoLatLng getCameraSouthWestPosition() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getCameraSouthWestPosition(); } @@ -176,6 +194,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MogoLatLng getWindowCenterLocation() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getWindowCenterLocation(); } @@ -184,6 +203,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void setPointToCenter( double mapCenterX, double mapCenterY ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.setPointToCenter( mapCenterX, mapCenterY ); } @@ -191,6 +211,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public Point getLocationPointInScreen( MogoLatLng latLng ) { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getLocationPointInScreen( latLng ); } @@ -199,6 +220,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MogoLatLng getLocationMogoLatLngInScreen( Point point ) { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getLocationMogoLatLngInScreen( point ); } @@ -207,6 +229,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.startJumpAnimation( marker, high, interpolator, duration ); } @@ -214,6 +237,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void setRenderFps( int fps ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.setRenderFps( fps ); } @@ -221,6 +245,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.showBounds( tag, carPosition, lonLats, bound, lockCarPosition ); } @@ -228,6 +253,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void forceRender() { + initDelegate(); if ( mDelegate != null ) { mDelegate.forceRender(); } @@ -235,6 +261,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception { + initDelegate(); if ( mDelegate != null ) { return mDelegate.calculateLineDistance( p1, p2 ); } @@ -243,6 +270,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public EnumMapUI getCurrentUiMode() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getCurrentUiMode(); } @@ -251,6 +279,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void changeMyLocation( Location location ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.changeMyLocation( location ); } @@ -258,6 +287,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public boolean isCarLocked() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.isCarLocked(); } @@ -266,6 +296,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void setCarCursorOption( CarCursorOption option ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.setCarCursorOption( option ); } @@ -273,6 +304,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public MapCameraPosition getMapCameraPosition() { + initDelegate(); if ( mDelegate != null ) { return mDelegate.getMapCameraPosition(); } @@ -281,6 +313,7 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void changeBearing( float bearing ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.changeBearing( bearing ); } @@ -288,15 +321,23 @@ public class MogoMapUIController implements IMogoMapUIController { @Override public void rtkEnable( boolean enable ) { + initDelegate(); if ( mDelegate != null ) { mDelegate.rtkEnable( enable ); } } + @Override + public void syncLocation2Map( JSONObject data ) { + initDelegate(); + if ( mDelegate != null ) { + mDelegate.syncLocation2Map( data ); + } + } + @Override public void destroy() { mDelegate = null; - release(); } private void initDelegate() { diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index f2cc701298..12c3023b00 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -367,6 +367,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme mMogoStatusManager.setMainPageLaunchedStatus( TAG, false ); mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, false ); mMogoFragmentManager.unregisterMainFragmentStackTransactionListener(); + mMogoFragmentManager.destroy(); mMogoFragmentManager = null; mServiceApis.getMapServiceApi().getMapViewInstanceHandler().destroy(); mServiceApis.getMapServiceApi().getMapUIController().destroy(); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java index ecd894836c..a8e7953c73 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/ADASStatusIntentHandler.java @@ -2,20 +2,16 @@ package com.mogo.module.service.intent; import android.content.Context; import android.content.Intent; -import android.location.Location; -import android.location.LocationManager; import android.text.TextUtils; -import android.view.View; -import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.module.service.MarkerServiceHandler; -import com.mogo.module.service.R; import com.mogo.module.service.ServiceConst; import com.mogo.module.service.carinfo.CarStateInfo; import com.mogo.module.service.receiver.MogoReceiver; -import com.mogo.utils.UiThreadHandler; import com.mogo.utils.network.utils.GsonUtil; +import org.json.JSONObject; + public /** * @author congtaowang @@ -56,53 +52,27 @@ class ADASStatusIntentHandler implements IntentHandler { MarkerServiceHandler.getMogoStatusManager().setADASUIShow( ServiceConst.TYPE, status == 1 ); } // 由于adas可能调高此处的调用频率,存在anr风险,且此处没有作用,所以暂时注释掉 -// else { -// String msg = intent.getStringExtra( "adasMsg" ); -// if ( TextUtils.isEmpty( msg ) ) { -// return; -// } -// CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class ); -// if ( stateInfo != null ) { -// changeCarHeadstockDirection( context, stateInfo.getValues().getHeading() ); -// // changeMyLocation( stateInfo.getValues() ); -// } -// } - } - - private void changeCarHeadstockDirection( final Context context, final double degree ) { - if ( MarkerServiceHandler.getNavi().isNaviing() ) { - return; + else { + String msg = intent.getStringExtra( "adasMsg" ); + if ( TextUtils.isEmpty( msg ) ) { + return; + } + CarStateInfo stateInfo = GsonUtil.objectFromJson( msg, CarStateInfo.class ); + if ( stateInfo != null && stateInfo.getValues() != null ) { + JSONObject data = new JSONObject(); + try { + data.putOpt( "lon", stateInfo.getValues().getLon() ); + data.putOpt( "lat", stateInfo.getValues().getLat() ); + data.putOpt( "alt", stateInfo.getValues().getAlt() ); + data.putOpt( "heading", stateInfo.getValues().getHeading() ); + data.putOpt( "acceleration", stateInfo.getValues().getAcceleration() ); + data.putOpt( "yawRate", stateInfo.getValues().getYaw_rate() ); + MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController() + .syncLocation2Map( data ); + } catch ( Exception e ) { + e.printStackTrace(); + } + } } - if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) { - return; - } - if ( !MarkerServiceHandler.getMogoStatusManager().isMainPageOnResume() ) { - return; - } - if ( MarkerServiceHandler.getMogoStatusManager().isSeekHelping() ) { - return; - } - if ( MarkerServiceHandler.getMapUIController().getCurrentUiMode() != EnumMapUI.NorthUP_2D ) { - return; - } - UiThreadHandler.post( () -> { - MarkerServiceHandler.getMapUIController().showMyLocation( inflateCursorView( context, degree ) ); - } ); - } - - private View inflateCursorView( Context context, double degree ) { - View view = View.inflate( context, R.layout.map_amap_cursor, null ); - view.setRotation( ( float ) degree ); - return view; - } - - private void changeMyLocation( CarStateInfo.ValuesBean valuesBean ) { - if ( valuesBean == null ) { - return; - } - Location location = new Location( LocationManager.GPS_PROVIDER ); - location.setAltitude( valuesBean.getAlt() ); - location.setLatitude( valuesBean.getLat() ); - location.setLongitude( valuesBean.getLon() ); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index bcb6785d5f..3b442b3177 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -387,6 +387,10 @@ public class MockIntentHandler implements IntentHandler { MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() .rtkEnable( false ); break; + case 39: + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController() + .syncLocation2Map( null ); + break; } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java index 2133a299a1..5ac444b6c0 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/receiver/MogoReceiver.java @@ -72,6 +72,7 @@ public class MogoReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); + Logger.d( TAG, action ); if (TextUtils.equals(VOICE_ACTION, action)) { String cmd = intent.getStringExtra(PARAM_COMMAND); if (!TextUtils.isEmpty(cmd)) { diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java index 937d381963..6770fd9477 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/fragmentmanager/IMogoFragmentManager.java @@ -78,4 +78,6 @@ public interface IMogoFragmentManager extends IProvider { void initMessageHistoryContainerId( int layoutId ); int getMessageHistoryContainerId(); + + void destroy(); } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java index 41eeb123b8..ec1ab90a88 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/FragmentStack.java @@ -50,7 +50,7 @@ public class FragmentStack { return sInstance; } - public synchronized void release() { + public static synchronized void release() { sInstance = null; } @@ -201,4 +201,8 @@ public class FragmentStack { } invokeCallback(); } + + public void destroy(){ + mFragmentManager = null; + } } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java index 249b72a1a5..79f8abe749 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/fragmentmanager/MogoFragmentManager.java @@ -74,6 +74,11 @@ public class MogoFragmentManager implements IMogoFragmentManager { return FragmentStack.getInstance().getMessageHistoryContainerId(); } + @Override + public void destroy() { + FragmentStack.getInstance().destroy(); + } + @Override public void init( Context context ) {