This commit is contained in:
wangcongtao
2020-02-19 13:18:26 +08:00
8 changed files with 27 additions and 6 deletions

View File

@@ -44,6 +44,7 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
@Override @Override
public void onViewCreated( @NonNull View view, @Nullable Bundle savedInstanceState ) { public void onViewCreated( @NonNull View view, @Nullable Bundle savedInstanceState ) {
super.onViewCreated( view, savedInstanceState ); super.onViewCreated( view, savedInstanceState );
initViews(savedInstanceState);
} }
/** /**
@@ -66,6 +67,7 @@ public abstract class MvpFragment< V extends IView, P extends Presenter< V > > e
* presenter 生命周期错乱 * presenter 生命周期错乱
*/ */
protected abstract void initViews(); protected abstract void initViews();
protected void initViews(Bundle savedInstanceState){}
/** /**
* 创建 presenter 实例 * 创建 presenter 实例

View File

@@ -155,6 +155,10 @@ public class AMapNaviViewWrapper implements IMogoMapView,
aMap.setOnCameraChangeListener( this ); aMap.setOnCameraChangeListener( this );
} }
AMapMessageManager.getInstance().registerAMapMessageListener( this ); AMapMessageManager.getInstance().registerAMapMessageListener( this );
} }
private Context getContext() { private Context getContext() {
@@ -422,6 +426,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
mMapView.getMap().setMyLocationEnabled( true ); mMapView.getMap().setMyLocationEnabled( true );
MyLocationStyle style = mMapView.getMap().getMyLocationStyle(); MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER ); style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
style.interval(1000);
style.showMyLocation( visible );
style.strokeColor( Color.TRANSPARENT ); style.strokeColor( Color.TRANSPARENT );
style.strokeWidth( 0 ); style.strokeWidth( 0 );
style.showMyLocation(visible); style.showMyLocation(visible);
@@ -461,7 +467,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
public void onNaviStarted() { public void onNaviStarted() {
if ( checkAMapView() ) { if ( checkAMapView() ) {
mMapView.setCarOverlayVisible( true ); mMapView.setCarOverlayVisible( true );
showMyLocation( false ); //showMyLocation( false );
} }
} }

View File

@@ -46,7 +46,7 @@ public class NaviClient implements IMogoNavi {
private NaviClient( Context context ) { private NaviClient( Context context ) {
mAMapNavi = AMapNavi.getInstance( context ); mAMapNavi = AMapNavi.getInstance( context );
mAMapNavi.setEmulatorNaviSpeed( 120 ); //mAMapNavi.setEmulatorNaviSpeed( 120 );
mAMapNavi.setUseInnerVoice( true ); mAMapNavi.setUseInnerVoice( true );
mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this ); mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this );
mAimlessModeListener = new AimlessModeListenerAdapter() { mAimlessModeListener = new AimlessModeListenerAdapter() {

View File

@@ -62,6 +62,9 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
mNaviOverlayHelper = new NaviOverlayHelper( mAMapNavi, AMapWrapper.getAMap(), mContext ); mNaviOverlayHelper = new NaviOverlayHelper( mAMapNavi, AMapWrapper.getAMap(), mContext );
} }
public void setNaviing( boolean mIsNaviing ) { public void setNaviing( boolean mIsNaviing ) {
this.mIsNaviing = mIsNaviing; this.mIsNaviing = mIsNaviing;
} }
@@ -90,6 +93,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
@Override @Override
public void onInitNaviSuccess() { public void onInitNaviSuccess() {
MogoNaviListenerHandler.getInstance().onInitNaviSuccess(); MogoNaviListenerHandler.getInstance().onInitNaviSuccess();
//mAMapNavi.startAimlessMode(AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED);
} }
@Override @Override
@@ -202,6 +206,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
@Override @Override
public void onLocationChange( AMapNaviLocation aMapNaviLocation ) { public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
super.onLocationChange( aMapNaviLocation ); super.onLocationChange( aMapNaviLocation );
Logger.i( TAG, "onLocationChange" +aMapNaviLocation.getCoord().toString());
mNaviOverlayHelper.handlePassedLocation( aMapNaviLocation ); mNaviOverlayHelper.handlePassedLocation( aMapNaviLocation );
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

After

Width:  |  Height:  |  Size: 804 B

View File

@@ -306,7 +306,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
private void startLocation() { private void startLocation() {
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() ); mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
mLocationClient.addLocationListener( this ); mLocationClient.addLocationListener( this );
mLocationClient.start(10_000L); mLocationClient.start(2_000L);
} }
private void loadContainerModules() { private void loadContainerModules() {

View File

@@ -31,7 +31,15 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
@Override @Override
protected void initViews() { protected void initViews() {
//mMogoMapView = findViewById( R.id.module_map_id_map );
//mMogoMap = mMogoMapView.getMap();
//mMogoMap.getUIController().showMyLocation( true );
}
@Override protected void initViews(Bundle savedInstanceState) {
super.initViews(savedInstanceState);
mMogoMapView = findViewById( R.id.module_map_id_map ); mMogoMapView = findViewById( R.id.module_map_id_map );
mMogoMapView.onCreate( savedInstanceState );
mMogoMap = mMogoMapView.getMap(); mMogoMap = mMogoMapView.getMap();
mMogoMap.getUIController().showMyLocation( true ); mMogoMap.getUIController().showMyLocation( true );
} }
@@ -45,9 +53,9 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
@Override @Override
public void onActivityCreated( @Nullable Bundle savedInstanceState ) { public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
super.onActivityCreated( savedInstanceState ); super.onActivityCreated( savedInstanceState );
if ( mMogoMapView != null ) { //if ( mMogoMapView != null ) {
mMogoMapView.onCreate( savedInstanceState ); // mMogoMapView.onCreate( savedInstanceState );
} //}
initMapView(); initMapView();
} }