This commit is contained in:
wangcongtao
2020-06-11 20:26:02 +08:00
parent cba69352ca
commit 5298cbef6d
10 changed files with 54 additions and 26 deletions

View File

@@ -577,11 +577,6 @@ public class MogoServices implements IMogoMapListener,
@Override
public void onLocationChanged( MogoLocation location ) {
}
@Override
public void onCarLocationChanged2( Location latLng ) {
if ( mStatusManager.isV2XShow() ) {
return;
}
@@ -590,12 +585,12 @@ public class MogoServices implements IMogoMapListener,
return;
}
if ( latLng == null ) {
if ( location == null ) {
return;
}
// 自动刷新触发
final MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
if ( mLastAutoRefreshLocation == null ) {
mLastAutoRefreshLocation = point;
mLoopRequest = true;
@@ -613,6 +608,10 @@ public class MogoServices implements IMogoMapListener,
}
}
@Override
public void onCarLocationChanged2( Location latLng ) {
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {

View File

@@ -691,7 +691,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
public void getOnlineCarDataByAutoRefreshStrategy( MogoLatLng latlng ) {
UiThreadHandler.removeCallbacks( runnable );
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
getOnlineCarDataImpl( latlng, false, false, 50, 2_000, false );
}
@@ -708,15 +707,14 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
int limit,
int radius ) {
UiThreadHandler.removeCallbacks( runnable );
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
getOnlineCarDataImpl( latLng, onlyFocus, onlySameCity, limit, radius, true );
}
private Runnable runnable = new Runnable() {
@Override
public void run() {
Logger.d( TAG, "内部 - 自动刷新在线车辆" );
getOnlineCarDataImpl( mCarLatLng, false, false, 50, 2_000, false );
UiThreadHandler.postDelayed( this, SMOOTH_DURATION * 1000 );
}
};
@@ -742,15 +740,24 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
int radius,
boolean fitBounds ) {
if ( mCarLatLng == null ) {
mCarLatLng = latLng;
}
Logger.d( TAG, "内部 - 请求执行" );
if ( latLng == null ) {
Logger.d( TAG, "内部 - 定位为空" );
return;
}
if ( ignoreOnlineCarRequest() ) {
Logger.d( TAG, "内部 - 忽略请求" );
removeCarMarkers();
return;
}
Logger.d( TAG, "内部 - 请求开始" );
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
@@ -764,8 +771,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() ) {
return;
}
int size = onlineCarList == null ? 0 : onlineCarList.size();
trackData( size );
final int size = onlineCarList == null ? 0 : onlineCarList.size();
if ( mMarkerDisplayBounds == null ) {
mMarkerDisplayBounds = new Rect(
@@ -776,8 +782,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
);
}
Logger.d( TAG, "内部 - 请求完毕" );
runOnTargetThread( () -> {
Logger.d( TAG, "内部 - 请求完毕开始处理" );
trackData( size );
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng );
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );
} );
}