Revert "[RouterOpt]车前引导线拖尾问题优化2"

This reverts commit a0f0d3c2
This commit is contained in:
renwenjie
2022-04-12 15:31:17 +08:00
parent 405c084f5a
commit 101ac56f11
9 changed files with 181 additions and 281 deletions

View File

@@ -12,9 +12,6 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.os.Trace;
import android.text.TextUtils;
import android.util.Log;
@@ -289,9 +286,6 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnCameraChangeListener(null);
CallerLogger.INSTANCE.d(TAG, "map onDestroy");
}
if (mLocationTask != null) {
mainHandler.removeCallbacks(mLocationTask);
}
}
@Override
@@ -648,52 +642,18 @@ public class AMapViewWrapper implements IMogoMapView,
return ObjectUtils.transformCenterLine(MapDataApi.INSTANCE.getCenterLineInfo(lon, lat, angle));
}
private static class LocationTask implements Runnable {
private MogoLocation location;
public void setMoGoLocation(MogoLocation location) {
this.location = location;
}
@Override
public void run() {
if (location != null) {
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(location);
location = null;
}
}
}
private volatile LocationTask mLocationTask;
private final Handler mainHandler = new Handler(Looper.getMainLooper());
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
MogoLocation currentLocation = ObjectUtils.fromLocation(location);
if (Looper.myLooper() == Looper.getMainLooper()) {
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation);
} else {
if (mLocationTask == null) {
mLocationTask = new LocationTask();
}
mLocationTask.setMoGoLocation(currentLocation);
mainHandler.removeCallbacks(mLocationTask);
mainHandler.post(mLocationTask);
}
MogoLocation mLastLocation = ObjectUtils.fromLocation(location);
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation));
long start = SystemClock.elapsedRealtime();
Location sysLocation = new Location(location.getProvider());
sysLocation.setAltitude(location.getAltitude());
sysLocation.setLatitude(location.getLat());
sysLocation.setLongitude(location.getLon());
sysLocation.setProvider(location.getProvider());
sysLocation.setAccuracy(location.getAcceleration());
sysLocation.setTime(location.duration);
sysLocation.setTime(location.getDuration());
sysLocation.setBearing((float) location.getHeading());
sysLocation.setSpeed(location.getSpeed());
@@ -707,6 +667,7 @@ public class AMapViewWrapper implements IMogoMapView,
.putString(SharedPrefsConstants.LOCATION_LONGITUDE, String.valueOf(location.getLon()));
}
if (MogoCarLocationChangedListenerRegister.getInstance().getListener() != null) {
MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2(sysLocation);
}
@@ -726,7 +687,6 @@ public class AMapViewWrapper implements IMogoMapView,
CallerLogger.INSTANCE.d(TAG, "同步定位:" + GsonUtils.toJson(location));
}
}
Log.d("TTTTT", "xxxxx:" + (SystemClock.elapsedRealtime() - start));
}
@Override