This commit is contained in:
wangcongtao
2020-09-18 11:57:20 +08:00
parent d83800427f
commit 338c8fa714
2 changed files with 92 additions and 1 deletions

View File

@@ -273,6 +273,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
@Override
public void onTouch( MotionEvent motionEvent ) {
MogoMapListenerHandler.getInstance().onTouch( motionEvent );
changeMyLocationType2UnFollow();
}
/**
@@ -456,6 +457,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
break;
}
mMapView.setViewOptions( options );
changeMyLocationType2Follow();
}
}
@@ -527,6 +529,12 @@ public class AMapNaviViewWrapper implements IMogoMapView,
style = new MyLocationStyle();
}
style.showMyLocation( visible );
if ( mCurrentUIMode == EnumMapUI.CarUp_2D
|| mCurrentUIMode == EnumMapUI.CarUp_3D ) {
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
} else {
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
}
if ( visible ) {
// 强制刷新一遍车标
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
@@ -548,17 +556,69 @@ public class AMapNaviViewWrapper implements IMogoMapView,
if ( style == null ) {
style = new MyLocationStyle();
}
if ( mCurrentUIMode == EnumMapUI.CarUp_2D
|| mCurrentUIMode == EnumMapUI.CarUp_3D ) {
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
} else {
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
}
style.showMyLocation( true );
style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
mMapView.getMap().setMyLocationStyle( style );
}
}
private void changeMyLocationType2UnFollow(){
if ( mCurrentUIMode == null ) {
return;
}
if ( !checkAMapView() ) {
return;
}
MyLocationStyle style = getMyLocationStyle();
if ( style == null ) {
style = new MyLocationStyle();
}
switch ( mCurrentUIMode ) {
case NorthUP_2D:
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER );
break;
case CarUp_2D:
case CarUp_3D:
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
break;
}
mMapView.getMap().setMyLocationStyle( style );
}
private void changeMyLocationType2Follow() {
if ( mCurrentUIMode == null ) {
return;
}
if ( !checkAMapView() ) {
return;
}
MyLocationStyle style = getMyLocationStyle();
if ( style == null ) {
style = new MyLocationStyle();
}
switch ( mCurrentUIMode ) {
case NorthUP_2D:
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
break;
case CarUp_2D:
case CarUp_3D:
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE );
break;
}
mMapView.getMap().setMyLocationStyle( style );
}
public void initMyLocation() {
if ( checkAMapView() ) {
mMapView.getMap().setMyLocationEnabled( true );
MyLocationStyle style = getMyLocationStyle();
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE );
style.interval( 1000 );
style.anchor( 0.5F, 0.5F );
style.strokeColor( Color.TRANSPARENT );
@@ -576,6 +636,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
Logger.d( TAG, "锁车" );
mMapView.recoverLockMode();
changeMyLocationType2Follow();
mIsCarLocked = true;
}
}

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- module_main_activity_main.xml-->
<dimen name="module_main_map_left_shadow_frame_width">350px</dimen>
<dimen name="module_main_card_container_marginTop">8px</dimen>
<dimen name="module_main_card_container_width">352px</dimen>
<dimen name="module_main_card_container_height">370px</dimen>
<dimen name="module_main_card_container_marginLeft">32px</dimen>
<dimen name="module_main_card_container_marginBottom">140.5px</dimen>
<dimen name="module_main_card_container_paddingBottom">18px</dimen>
<dimen name="module_main_card_card_shadow_width_div">20px</dimen>
<dimen name="module_main_card_card_shadow_height_div">10px</dimen>
<dimen name="module_main_top_shadow_height">144px</dimen>
<dimen name="module_main_card_cover_up_margin">352px</dimen>
<dimen name="cards_container_dp_600">320px</dimen>
<dimen name="cards_container_shadow_dp_margin_top">319px</dimen>
<dimen name="module_main_apps_fragment_container_width">110px</dimen>
<dimen name="module_main_apps_fragment_container_padding">10px</dimen>
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
<dimen name="module_main_entrance_fragment_container_padding">10px</dimen>
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
<dimen name="module_event_fragment_container_padding">8px</dimen>
</resources>