[Fix]
增加初始化延时,增加稳定性 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -5,19 +5,14 @@ import static com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT;
|
||||
import static com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -113,7 +108,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private boolean mMapLoaded = false;
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
private Marker mSelfMarker;
|
||||
|
||||
public AMapViewWrapper(MapAutoView mMapView) {
|
||||
startTime = System.currentTimeMillis();
|
||||
@@ -274,7 +268,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mMapView.setOnMapClickListener(null);
|
||||
mMapView.getLocationClient().unRegisterListener(this);
|
||||
mMapView.setOnCameraChangeListener(null);
|
||||
mSelfMarker = null;
|
||||
Logger.d(TAG, "map onDestroy");
|
||||
}
|
||||
}
|
||||
@@ -798,85 +791,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
MapStyleController.getInstance().onLocationChanged(location, this);
|
||||
}
|
||||
}
|
||||
|
||||
if (mSelfMarker == null) {
|
||||
try {
|
||||
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
|
||||
mSelfMarker.setInfoWindowEnable(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
// 通过不同的方向类型来改变车模,目前暂定三种模型,drawlevel 1 绿,2 黄,3 红,绿色的时候需要把相应的切换为默认模型
|
||||
// Logger.d("liyz", " mDrawlevel = " + mDrawlevel);
|
||||
// if (mDrawlevel == 1 && isShowWarn) {
|
||||
// mSelfMarker.marker3DIcon(R.raw.car);
|
||||
// isShowWarn = false;
|
||||
// } else if (mDrawlevel == 2) { //不处理
|
||||
//
|
||||
// } else if (mDrawlevel == 3 && !isShowWarn) {
|
||||
// //继续判断相应的方位,目前是只有 前方 TODO
|
||||
// mSelfMarker.marker3DIcon(R.raw.qfpz);
|
||||
// isShowWarn = true;
|
||||
// }
|
||||
//
|
||||
// UiThreadHandler.postDelayed(() -> {
|
||||
// if (!isShowWarn) {
|
||||
// mSelfMarker.marker3DIcon(R.raw.qfpz);
|
||||
// isShowWarn = true;
|
||||
// }
|
||||
// }, 6_000L);
|
||||
|
||||
}
|
||||
//showSelfSpeed(location.getSpeed());
|
||||
}
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
private int mLastYOffset = 20;
|
||||
|
||||
private void showSelfSpeed(float speed) {
|
||||
|
||||
if (!checkAMapView()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mSelfMarker == null) {
|
||||
return;
|
||||
}
|
||||
if (mCurrentUI != EnumMapUI.Type_VR) {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
int speedIntVal = (int) (speed * 3.6);
|
||||
if (speedIntVal <= 0) {
|
||||
mSelfMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
String speedVal = String.valueOf(speedIntVal);
|
||||
String infoResName = ResIdCache.getVal(speedVal);
|
||||
int offset = 20;
|
||||
if (!mMapView.getMapAutoViewHelper().getLockMode()) {
|
||||
offset = 30;
|
||||
}
|
||||
if (offset != mLastYOffset) {
|
||||
mLastYOffset = offset;
|
||||
}
|
||||
mSelfMarker.setInfoWindowOffset(0, offset);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(mMapView.getContext());
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
mSpeedView.setText(speedVal);
|
||||
mSelfMarker.setInfoWindowView(mSpeedView);
|
||||
ResIdCache.putVal(speedVal, mSelfMarker.getMarkeOptions().getMarkerInfoName());
|
||||
} else {
|
||||
mSelfMarker.setMarkerInfoName(infoResName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user