[Update]Map相关的模块中的Logger替换成CallerLogger

This commit is contained in:
chenfufeng
2022-03-17 15:10:45 +08:00
parent eb59f97196
commit fd860c6bcf
8 changed files with 25 additions and 58 deletions

View File

@@ -1,32 +0,0 @@
package com.mogo.eagle.core.function.call.logger
import com.mogo.eagle.core.function.call.devatools.scene.Scene.Companion.scene
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
object CallerLogger {
fun i(tag: String, message: String, any: Any) {
if (scene.check(tag)) {
Logger.i(tag, message, any)
}
}
fun d(tag: String, message: String, any: Any) {
if (scene.check(tag)) {
Logger.d(tag, message, any)
}
}
fun w(tag: String, message: String, any: Any) {
if (scene.check(tag)) {
Logger.w(tag, message, any)
}
}
fun e(tag: String, message: String, any: Any) {
if (scene.check(tag)) {
Logger.e(tag, message, any)
}
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map;
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.AMapMarkerWrapper;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
@@ -54,7 +54,7 @@ public class AMapMarkerClickHandler {
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions());
iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多需要owner匹配机制,以及控制owner细粒度
Logger.d("AMapMarkerWrapper", "traffic marker 点击回调");
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "traffic marker 点击回调");
return MogoMarkersHandler.getInstance().onStaticMarkerClicked(iMogoMarker);
}
@@ -62,7 +62,7 @@ public class AMapMarkerClickHandler {
if (mogoMarkerMap.containsKey(marker.getId())) {
IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId());
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
Logger.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker);
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "marker 点击回调:%s -> %s", mogoMarker, marker);
if (listener != null) {
boolean result = listener.onMarkerClicked(mogoMarker);
if (result) {

View File

@@ -3,8 +3,7 @@ package com.mogo.map;
import android.content.Context;
import android.graphics.Point;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.AMapInfoWindowAdapter;
import com.mogo.map.marker.AMapMarkerWrapper;
import com.mogo.map.marker.IMogoMarker;
@@ -53,7 +52,7 @@ public class AMapWrapper implements IMogoMap {
private IMogoUiSettings mUiSettings;
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
CallerLogger.INSTANCE.i(TAG, "autoop--AMapWrapper: init" + this);
this.mAMap = map;
sAMap = map;
this.mMapView = mapView;
@@ -91,7 +90,7 @@ public class AMapWrapper implements IMogoMap {
}
MarkerOptions markerOptions = ObjectUtils.fromMogo(options);
if (markerOptions == null) {
Logger.e(TAG, "marker参数为空");
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
return null;
}
final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options);
@@ -110,7 +109,7 @@ public class AMapWrapper implements IMogoMap {
for (MessagePad.TrackedObject mogoMarkerOptions : optionsArrayList) {
MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions);
if (markerOptions == null) {
Logger.e(TAG, "marker参数为空");
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
break;
}
markerOptionsArrayList.add(markerOptions);
@@ -259,7 +258,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void changeZoom(float zoom) {
Logger.d(TAG, "changeZoom %s", zoom);
CallerLogger.INSTANCE.d(TAG, "changeZoom %s", zoom);
if (checkAMap()) {
mAMap.setZoom((int) zoom);
}
@@ -283,7 +282,7 @@ public class AMapWrapper implements IMogoMap {
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
if (checkAMap()) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
CallerLogger.INSTANCE.d(TAG, "addPolyline %s", polylineOptions.toString());
if (polylineOptions == null) {
return null;
}
@@ -307,7 +306,7 @@ public class AMapWrapper implements IMogoMap {
mAMap = mMapView.getMapAutoViewHelper();
sAMap = mAMap;
if (mAMap == null) {
Logger.e(TAG, "自研map实例为空请检查");
CallerLogger.INSTANCE.e(TAG, "自研map实例为空请检查");
return false;
}
return true;

View File

@@ -4,7 +4,7 @@ import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.location.ALocationClient;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.search.GeocodeSearchClient;
@@ -85,6 +85,6 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public void init(Context context) {
Logger.d(TAG, "init");
CallerLogger.INSTANCE.d(TAG, "init");
}
}

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.map.utils.ObjectUtils;
import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener;
@@ -427,7 +427,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMarker.setTranslateAnimation( animation );
mMarker.startAnimation();
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
CallerLogger.INSTANCE.e( TAG, e, "error." );
}
}
@@ -495,7 +495,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMarker.marker3DIcon( model3D );
return mMarker.getMarkeOptions().getMarkerIconName();
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
}
return null;
}
@@ -506,7 +506,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMarker.getMarkeOptions().setVrIcon( true );
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
}
}
@@ -516,7 +516,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMarker.getMarkeOptions().setVrIcon( false );
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
CallerLogger.INSTANCE.e( TAG, e, "use3DResource" );
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map.search;
import android.content.Context;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
import com.mogo.map.search.inputtips.MogoTip;
@@ -60,7 +60,7 @@ public class InputtipsSearch implements IMogoInputtipsSearch, InputtipsListener
mListener.onGetInputtips(getResult(list));
}
} else {
Logger.e(TAG, "errorcode = " + i);
CallerLogger.INSTANCE.e(TAG, "errorcode = " + i);
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map.search;
import android.content.Context;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.search.geo.MogoPoiItem;
import com.mogo.map.search.poisearch.IMogoPoiSearch;
@@ -111,7 +111,7 @@ public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
@Override
public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) {
if ( errorCode != 0 ) {
Logger.e( TAG, "errorcode is %d", errorCode );
CallerLogger.INSTANCE.e( TAG, "errorcode is %d", errorCode );
}
if ( mListener != null ) {
mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode );
@@ -121,7 +121,7 @@ public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
@Override
public void onPoiItemSearched( PoiItem poiItem, int errorCode ) {
if ( errorCode != 0 ) {
Logger.e( TAG, "errorcode is %d", errorCode );
CallerLogger.INSTANCE.e( TAG, "errorcode is %d", errorCode );
}
if ( mListener != null ) {
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );

View File

@@ -2,7 +2,7 @@ package com.mogo.map.utils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import java.util.List;
@@ -38,13 +38,13 @@ public class PointInterpolatorUtil {
MogoLatLng current = points.get(i);
MogoLatLng next = points.get(i + 1);
float distance = CoordinateUtils.calculateLineDistance(current.lon, current.lat, next.lon, next.lat);
Logger.d(TAG, i + ": " + distance);
CallerLogger.INSTANCE.d(TAG, i + ": " + distance);
if (distance > DISTANCE_THRESHOLD) {
int inter = (int) (distance / DISTANCE_THRESHOLD) + 1;
for (int j = 1; j < inter; j++) {
double newLat = current.lat + (next.lat - current.lat) * j / inter;
double newLon = current.lon + (next.lon - current.lon) * j / inter;
Logger.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon);
CallerLogger.INSTANCE.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon);
points.add(i + 1, new MogoLatLng(newLat, newLon));
current = points.get(++i);
}