This commit is contained in:
wangcongtao
2020-03-20 11:58:18 +08:00
parent 5924c64c9c
commit f00fa093cb
16 changed files with 96 additions and 76 deletions

View File

@@ -155,7 +155,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
mMapView.setRouteOverlayVisible( false );
mMapView.setCarOverlayVisible( false );
setUIMode(EnumMapUI.CarUp_2D, null);
setUIMode( EnumMapUI.CarUp_2D, null );
}
}
@@ -201,7 +201,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
initMapView();
initListeners();
initMyLocation();
initLocationSource();
// initLocationSource();
}
}
@@ -450,7 +450,6 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
}
private boolean checkAMapView() {
if ( mMapView == null ) {
Logger.e( TAG, "高德mapView实例为空请检查" );
@@ -467,22 +466,17 @@ public class AMapNaviViewWrapper implements IMogoMapView,
return;
}
loseLockMode();
mMapView.getMap()
.moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
}
@Override
public void showMyLocation( boolean visible ) {
Logger.d( TAG, "showMyLocation1" );
Logger.d( TAG, "showMyLocation1 %s", visible );
if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) {
return;
}
if ( checkAMapView() ) {
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
if ( visible ) {
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
return;
}
}
style.showMyLocation( visible );
if ( visible ) {
// 强制刷新一遍车标
@@ -492,19 +486,15 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
}
private View mCursorView;
@Override
public void showMyLocation( float degree ) {
public void showMyLocation( View view ) {
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
return;
}
if ( checkAMapView() ) {
mCursorView = View.inflate( getContext(), R.layout.map_amap_cursor, null );
mCursorView.setRotation( degree );
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
style.showMyLocation( true );
style.myLocationIcon( BitmapDescriptorFactory.fromView( mCursorView ) );
style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
mMapView.getMap().setMyLocationStyle( style );
}
}
@@ -523,7 +513,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
}
}
private void initLocationSource(){
private void initLocationSource() {
if ( checkAMapView() ) {
mMapView.getMap().setLocationSource( new LocationSource() {
@Override

View File

@@ -94,9 +94,9 @@ public class AMapUIController implements IMogoMapUIController {
}
@Override
public void showMyLocation( float degree ) {
public void showMyLocation( View view ) {
if ( mClient != null ) {
mClient.showMyLocation( degree );
mClient.showMyLocation( view );
}
}

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/map_amap_id_cursor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/map_api_ic_current_location2_cursor" />
</LinearLayout>

View File

@@ -56,9 +56,10 @@ public interface IMogoMapUIController {
void showMyLocation( boolean visible );
/**
* @param degree 车标方向
*
* @param view
*/
void showMyLocation( float degree );
void showMyLocation( View view );
/**
* 以外部定位的方式改变当前位置

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@@ -88,9 +88,9 @@ public class MogoMapUIController implements IMogoMapUIController {
}
@Override
public void showMyLocation( float degree ) {
public void showMyLocation( View view ) {
if ( mDelegate != null ) {
mDelegate.showMyLocation( degree );
mDelegate.showMyLocation( view );
}
}