diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java index 85ad93badb..2bed0dae80 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java @@ -8,6 +8,7 @@ import android.animation.ValueAnimator; import android.content.Context; import android.graphics.PointF; import android.graphics.drawable.Drawable; +import android.os.Handler; import android.util.AttributeSet; import android.util.Log; import android.view.View; @@ -27,11 +28,14 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL private Context context; private int[] animation_drawable = { R.drawable.icon_common_heart_animation_vr00, - R.drawable.icon_heart_unchoose_other, + R.drawable.icon_map_marker_pondingl2, R.drawable.icon_map_marker_living}; private Random random = new Random(); - private int width = 500, height = 210; + private int width = 180, height = 140; private int drawableWidth, drawableHeight; + private int resource = 0; + private Handler handler = new Handler(); + private Runnable runnable; public BezierAnimationView(Context context) { this(context, null); @@ -54,13 +58,24 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL @Override public void onClick(View view) { - Log.d("执行点赞动画", "ppp"); - bezierAnimation(); + runnable = new Runnable() { + @Override + public void run() { + try { + Log.d("点赞--", ""); + bezierAnimation(resource); + handler.postDelayed(this, 500); + } catch (Exception e) { + e.printStackTrace(); + } + } + }; + runnable.run(); } - private void bezierAnimation() { + private void bezierAnimation(int resource) { final ImageView imageView = new ImageView(context); - imageView.setBackgroundResource(animation_drawable[random.nextInt(animation_drawable.length - 1)]); + imageView.setBackgroundResource(animation_drawable[resource]); RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.addRule(ALIGN_BOTTOM); params.addRule(CENTER_HORIZONTAL); @@ -79,63 +94,66 @@ public class BezierAnimationView extends RelativeLayout implements View.OnClickL } }); animatorSet.start(); + Log.d(TAG, "动画执行到--" + String.valueOf(resource)); } private AnimatorSet getAnimatorSet(ImageView imageView) { AnimatorSet enter = new AnimatorSet(); - /* - * 缩放动画 - * */ + + //1、缩放动画 AnimatorSet scaleAnimator = new AnimatorSet(); - ObjectAnimator alpha = ObjectAnimator.ofFloat(imageView, "alpha", 0.8f, 1f); - ObjectAnimator scaleX = ObjectAnimator.ofFloat(imageView, "scaleX", 0.8f, 1f); - ObjectAnimator scaleY = ObjectAnimator.ofFloat(imageView, "scaleY", 0.8f, 1f); - scaleAnimator.setDuration(500); + ObjectAnimator alpha = ObjectAnimator.ofFloat(imageView, "alpha", 0.3f, 1f); + ObjectAnimator scaleX = ObjectAnimator.ofFloat(imageView, "scaleX", 0.3f, 1f); + ObjectAnimator scaleY = ObjectAnimator.ofFloat(imageView, "scaleY", 0.3f, 1f); + scaleAnimator.setDuration(1000); scaleAnimator.playTogether(alpha, scaleX, scaleY); - /* - * 贝塞尔动画 - * */ - ValueAnimator bezierAnimator = getBezierValueAnimator(imageView); - /* - * 两个动画按顺序播放 - * */ + //2、贝塞尔动画 + ValueAnimator bezierAnimator = getBezierAnimator(imageView); + + //3、两个动画按顺序播放 enter.playSequentially(scaleAnimator, bezierAnimator); return enter; } /** - * 获取贝塞尔曲线动画 + * 贝塞尔动画 * - * @param target * @return */ - private ValueAnimator getBezierValueAnimator(View target) { + private ValueAnimator getBezierAnimator(final ImageView imageView) { - //初始化一个BezierEvaluator - BezierEvaluator evaluator = new BezierEvaluator(getPointF(1), getPointF(1)); + //1、构建贝塞尔曲线的四个点 + PointF point0 = new PointF((width - drawableWidth) / 2, height - drawableHeight); + PointF point1 = new PointF(random.nextInt(width), random.nextInt(height / 2)); + PointF point2 = new PointF(random.nextInt(width), random.nextInt(height / 2) + height / 2); + PointF point3 = new PointF(random.nextInt(width - drawableWidth), 0); - // 起点固定,终点随机 - ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF((width - 40) / 2, height - 80), - new PointF(random.nextInt(getWidth()), 0)); - animator.addUpdateListener(new BezierListener(target)); - animator.setTarget(target); - animator.setDuration(3000); - return animator; + //2、创建贝塞尔属性动画 + BezierEvaluator evaluator = new BezierEvaluator(point0, point1); + final ValueAnimator valueAnimator = ObjectAnimator.ofObject(evaluator, point2, point3); + valueAnimator.setInterpolator(new LinearInterpolator()); + valueAnimator.setDuration(1000); + //3、监听贝塞尔曲线估值器返回值 + valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + //4、获取BezierEvaluator中evaluate()返回的运行轨迹坐标点,设置点赞图片路线 + PointF pointF = (PointF) animation.getAnimatedValue(); + imageView.setX(pointF.x); + imageView.setY(pointF.y); + //6、获取BezierEvaluator中evaluate()返回的参数t,设置消失动画 + float t = animation.getAnimatedFraction(); + imageView.setAlpha(1 - t + 0.2f); + } + }); + if (resource >= 3) { + handler.removeCallbacks(runnable); + return null; + } else { + resource += 1; + } + return valueAnimator; } - /** - * 获取一条路径的两个控制点 - * - * @param scale - */ - private PointF getPointF(int scale) { - - PointF pointF = new PointF(); - //减去100 是为了控制 x轴活动范围 - pointF.x = random.nextInt((width)); - //再Y轴上 为了确保第二个控制点 在第一个点之上,我把Y分成了上下两半 - pointF.y = random.nextInt((height)) / scale; - return pointF; - } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierEvaluator.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierEvaluator.java index 6effc925b1..b7be514fa9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierEvaluator.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierEvaluator.java @@ -11,34 +11,44 @@ import android.graphics.PointF; */ public class BezierEvaluator implements TypeEvaluator { - private PointF pointF1; - private PointF pointF2; + private PointF point1; + private PointF point2; public BezierEvaluator(PointF point1, PointF point2) { - this.pointF1 = point1; - this.pointF2 = point2; + this.point1 = point1; + this.point2 = point2; } @Override - public PointF evaluate(float time, PointF startValue, PointF endValue) { - float timeLeft = 1.0f - time; - - //结果 + public PointF evaluate(float t, PointF point0, PointF point3) { PointF point = new PointF(); + //t 取值为 [0,1] - PointF point0 = (PointF)startValue;//起点 - PointF point3 = (PointF)endValue;//终点 + /** + * 三阶贝塞尔公式 + * + * B(t)=(1 - t)^3 P0 + * + 3 t (1 - t)^2 P1 + * + 3 t^2 (1 - t) P2 + * + t^3 P3 + */ + point.x = point0.x * (1 - t) * (1 - t) * (1 - t) + + 3 * point1.x * t * (1 - t) * (1 - t) + + 3 * point2.x * t * t * (1 - t) + + point3.x * t * t * t; - // 贝塞尔公式 - point.x = timeLeft * timeLeft * timeLeft * (point0.x) - + 3 * timeLeft * timeLeft * time * (pointF1.x) - + 3 * timeLeft * time * time * (pointF2.x) - + time * time * time * (point3.x); - - point.y = timeLeft * timeLeft * timeLeft * (point0.y) - + 3 * timeLeft * timeLeft * time * (pointF1.y) - + 3 * timeLeft * time * time * (pointF2.y) - + time * time * time * (point3.y); + /** + * 三阶贝塞尔公式 + * + * B(t)=(1 - t)^3 P0 + * + 3 t (1 - t)^2 P1 + * + 3 t^2 (1 - t) P2 + * + t^3 P3 + */ + point.y = point0.y * (1 - t) * (1 - t) * (1 - t) + + 3 * point1.y * t * (1 - t) * (1 - t) + + 3 * point2.y * t * t * (1 - t) + + point3.y * t * t * t; return point; } diff --git a/modules/mogo-module-common/src/main/res/drawable-mdpi/module_camera_real_time_traffic.png b/modules/mogo-module-common/src/main/res/drawable-mdpi/module_camera_real_time_traffic.png new file mode 100644 index 0000000000..bb7e78c0e0 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-mdpi/module_camera_real_time_traffic.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png index 3f41ce4252..bb7e78c0e0 100644 Binary files a/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png differ diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 8ae5668217..c711775c99 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -676,6 +676,7 @@ public class EntranceFragment extends MvpFragment() { -// @Override -// public void onSuccess(V2XLivePushVoRes result) { -// Logger.d(TAG, "播放器:" + result); -// } -// -// @Override -// public void onFail(String msg) { -// Logger.e(TAG, "播放器:" + msg); -// } -// }, carLiveInfo.getVideoSn(), 1); - } catch (Exception e) { e.printStackTrace(); } @@ -196,10 +173,6 @@ public class CameraLiveGSYVideoView extends LiveRoundLayout implements IMogoSkin protected void onDetachedFromWindow() { stopLive(mLiveUrl); mLoading.setVisibility(VISIBLE); - // 反注册语音交互 -// V2XVoiceManager.INSTANCE -// .unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_CAR_LIVE) -// .unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REFRESH_LIVE_UN_WAKEUP); super.onDetachedFromWindow(); } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java index d796926105..89cb188fba 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/CameraLiveNoticeHelper.java @@ -22,6 +22,8 @@ import com.mogo.module.extensions.live.ExtensionServiceManager; import com.mogo.module.extensions.live.PushDataType; import com.mogo.service.connection.IMogoOnWebSocketMessageListener; import com.mogo.service.connection.WebSocketMsgType; +import com.mogo.service.statusmanager.IMogoStatusChangedListener; +import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.logger.Logger; @@ -34,17 +36,15 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener { -// mCloudRoadData = new CloudRoadData(); -//// mCloudRoadData.setRtmpUrl("rtmp://58.200.131.2:1935/livetv/hunantv"); -// mCloudRoadData.setRtmpUrl("http://video.zhidaozhixing.com/live/rec_12_22.flv"); -// -// mCloudRoadData.setLat(39.969089); -// mCloudRoadData.setLon(116.418009); -// -//// CameraLiveManager.getInstance().init(mCloudRoadData); -// addCameraMarker(mCloudRoadData); -// }, 2_000); -// } + public void release() { + MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(mContext).unregisterOnWebSocketMessageListener(this); + } + public void enterVrMode() { + Logger.d(TAG, "enterVrMode==="); + isVrMode = true; } public void exitVrMode() { Logger.d(TAG, "退出vr模式==="); -// removeCameraMarker(); -// isFirst = false; - MogoApisHandler.getInstance().getApis().getWebSocketManagerApi(mContext).unregisterOnWebSocketMessageListener(this); + isVrMode = false; } /** * PushRoadConditionDrawer + * vr模式 * * @param roadData */ - private void addCameraMarker(CloudRoadData roadData) { - Logger.d(TAG, "addCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon()); + private void addVrCameraMarker(CloudRoadData roadData) { + Logger.d(TAG, "addVrCameraMarker --lat = " + roadData.getLat() + "--lon =" + roadData.getLon()); + removeCameraMarker(); MogoMarkerOptions options = new MogoMarkerOptions() .object(roadData) .latitude(roadData.getLat()) @@ -109,6 +102,29 @@ public class CameraLiveNoticeHelper implements IMogoOnWebSocketMessageListener>>>mCurretnUuid = " + mCurretnUuid + ">>>mCloudRoadData.getUuid() = " + mCloudRoadData.getUuid()); + if (mCurretnUuid != null && mCurretnUuid.equals(mCloudRoadData.getUuid())) { + Log.d(TAG, "isLoadVr = " + isLoadVr + "....isLoadNormal = " + isLoadNormal); + if (isVrMode) { + if (!isLoadVr) { + addVrCameraMarker(mCloudRoadData); + isLoadVr = true; + isLoadNormal = false; + } + } else { + if (!isLoadNormal) { + addNormalCameraMarker(mCloudRoadData); + isLoadNormal = true; + isLoadVr = false; + } + } } else { - removeCameraMarker(); - addCameraMarker(mCloudRoadData); - mCurrentlat = mCloudRoadData.getLat(); - mCurrentlon = mCloudRoadData.getLon(); + if (isVrMode) { + addVrCameraMarker(mCloudRoadData); + } else { + addNormalCameraMarker(mCloudRoadData); + } + mCurretnUuid = mCloudRoadData.getUuid(); } } else { //删除marker - Logger.e(TAG, "onMsgReceived mCloudRoadData == null "); - UiThreadHandler.postDelayed(() -> { - removeCameraMarker(); - }, 1_000); + removeCameraMarker(); + +// Log.e(TAG, "onMsgReceived mCloudRoadData == null "); +// UiThreadHandler.postDelayed(() -> { +// +// }, 1_000); } } else { - Log.e(TAG, "onMsgReceived obj == null "); + Logger.e(TAG, "onMsgReceived obj == null "); } } diff --git a/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_camera_normal_traffic.png b/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_camera_normal_traffic.png new file mode 100644 index 0000000000..d98b71a08c Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-mdpi/module_camera_normal_traffic.png differ diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_normal_traffic.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_normal_traffic.png new file mode 100644 index 0000000000..d98b71a08c Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_normal_traffic.png differ diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png deleted file mode 100644 index 3f41ce4252..0000000000 Binary files a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png and /dev/null differ diff --git a/modules/mogo-module-smp/build.gradle b/modules/mogo-module-smp/build.gradle index 888a054935..b4842f190f 100644 --- a/modules/mogo-module-smp/build.gradle +++ b/modules/mogo-module-smp/build.gradle @@ -40,6 +40,7 @@ dependencies { implementation rootProject.ext.dependencies.arouter implementation rootProject.ext.dependencies.amapnavi3dmap + implementation rootProject.ext.dependencies.amaplocation annotationProcessor rootProject.ext.dependencies.aroutercompiler if (Boolean.valueOf(RELEASE)) { diff --git a/modules/mogo-module-smp/src/main/AndroidManifest.xml b/modules/mogo-module-smp/src/main/AndroidManifest.xml index 3d0a81ab9f..32b078729c 100644 --- a/modules/mogo-module-smp/src/main/AndroidManifest.xml +++ b/modules/mogo-module-smp/src/main/AndroidManifest.xml @@ -6,6 +6,6 @@ + android:process=":smallMap"/> \ No newline at end of file diff --git a/modules/mogo-module-smp/src/main/assets/small_map_style.data b/modules/mogo-module-smp/src/main/assets/small_map_style.data index 75195b39a2..412a2ab911 100644 Binary files a/modules/mogo-module-smp/src/main/assets/small_map_style.data and b/modules/mogo-module-smp/src/main/assets/small_map_style.data differ diff --git a/modules/mogo-module-smp/src/main/assets/small_map_style_extra.data b/modules/mogo-module-smp/src/main/assets/small_map_style_extra.data index 6f65457911..e5890460f3 100644 Binary files a/modules/mogo-module-smp/src/main/assets/small_map_style_extra.data and b/modules/mogo-module-smp/src/main/assets/small_map_style_extra.data differ diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java index 1eaedef6d3..3c8676cefa 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapDirectionView.java @@ -1,13 +1,17 @@ package com.mogo.module.small.map; import android.content.Context; +import android.graphics.BitmapFactory; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.animation.LinearInterpolator; import android.widget.ImageView; import androidx.annotation.Nullable; +import com.amap.api.location.AMapLocationClient; +import com.amap.api.location.AMapLocationClientOption; import com.amap.api.maps.AMap; import com.amap.api.maps.CameraUpdate; import com.amap.api.maps.CameraUpdateFactory; @@ -15,13 +19,17 @@ import com.amap.api.maps.TextureMapView; import com.amap.api.maps.UiSettings; import com.amap.api.maps.model.BitmapDescriptor; import com.amap.api.maps.model.BitmapDescriptorFactory; +import com.amap.api.maps.model.CameraPosition; import com.amap.api.maps.model.CustomMapStyleOptions; import com.amap.api.maps.model.MyLocationStyle; +import com.amap.api.navi.AMapNaviView; +import com.amap.api.navi.AMapNaviViewOptions; import com.mogo.module.common.view.RoundLayout; import com.mogo.module.small.map.animation.DirectionRotateAnimation; +import com.mogo.module.small.map.utils.MapAssetStyleUtils; +import java.io.IOException; import java.io.InputStream; -import java.net.URL; /** * 小地图的方向View @@ -32,11 +40,13 @@ import java.net.URL; public class SmallMapDirectionView extends RoundLayout { private ImageView mIvMapBorder; - private TextureMapView mTextureMapView; + private AMapNaviView mAMapNaviView; private AMap mAMap; private UiSettings mUiSettings; private CameraUpdate mCameraUpdate; private MyLocationStyle myLocationStyle; + private AMapLocationClient mLocationClient; + private AMapLocationClientOption mLocationClientOption; private DirectionRotateAnimation mRotateAnimation; private int lastAngle = 0; @@ -59,42 +69,127 @@ public class SmallMapDirectionView extends RoundLayout { LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this); mIvMapBorder = findViewById(R.id.ivMapBorder); - mTextureMapView = findViewById(R.id.textureMapView); + mAMapNaviView = findViewById(R.id.aMapNaviView); + mAMapNaviView.onCreate(null); + // 车头朝上 + mAMapNaviView.setNaviMode(AMapNaviView.CAR_UP_MODE); + mAMap = mAMapNaviView.getMap(); - mTextureMapView.onCreate(null); - mAMap = mTextureMapView.getMap(); - mAMap.setMapType(AMap.MAP_TYPE_NIGHT);//夜景地图,aMap是地图控制器对象。 - - URL small_map_style = getClass().getResource("/assets/small_map_style.data"); - URL small_map_style_extra = getClass().getResource("/assets/small_map_style_extra.data"); - - mAMap.setCustomMapStyle(new CustomMapStyleOptions() - .setEnable(true) - .setStyleDataPath(small_map_style.getPath()) - .setStyleExtraPath(small_map_style_extra.getPath()) - ); - - myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。 - myLocationStyle.interval(2000); //设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。 - BitmapDescriptor location = BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo); - myLocationStyle.myLocationIcon(location); - mAMap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style - mAMap.setMyLocationEnabled(true);// 设置为true表示启动显示定位蓝点,false表示隐藏定位蓝点并不进行定位,默认是false。 + // 导航地图 + AMapNaviViewOptions options = mAMapNaviView.getViewOptions(); + //设置导航界面UI是否显示。 + if (options != null) { + // 设置是否开启自动黑夜模式切换,默认为false,不自动切换 + options.setAutoNaviViewNightMode(false); + // 设置6秒后是否自动锁车 + options.setAutoLockCar(true); + // 设置路线上的摄像头气泡是否显示 + options.setCameraBubbleShow(false); + // 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。 + // options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() ); + // 设置自车的图片对象 + options.setCarBitmap(BitmapFactory.decodeResource(getContext().getResources(), + R.drawable.module_small_map_view_my_location_logo)); + // 设置罗盘位图对象 + options.setFourCornersBitmap(BitmapFactory.decodeResource(getContext().getResources(), + R.drawable.icon_module_small_map_four_corners)); + // 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。 + options.setCompassEnabled(false); + // 黑夜模式 + options.setNaviNight(true); + //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。 + options.setTrafficBarEnabled(false); + // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。 + options.setTrafficLayerEnabled(false); + // 设置导航界面是否显示路线全览按钮。 + options.setRouteListButtonShow(false); + // 设置屏幕是否常亮,默认开启 + options.setScreenAlwaysBright(false); + // 设置交通播报是否打开(只适用于驾车导航,需要联网)。 + options.setTrafficInfoUpdateEnabled(false); + // 设置摄像头播报是否打开(只适用于驾车导航)。 + options.setCameraInfoUpdateEnabled(false); + // 设置菜单按钮是否在导航界面显示。 + options.setSettingMenuEnabled(false); + // 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。 + options.setTrafficLine(false); + // 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。 + options.setLeaderLineEnabled(-1); + // 设置导航界面UI是否显示。 + options.setLayoutVisible(false); + // 设置是否自动画路 + options.setAutoDrawRoute(false); + // 设置是否显示路口放大图(实景图) + options.setRealCrossDisplayShow(false); + // 设置是否显示路口放大图(路口模型图) + options.setModeCrossDisplayShow(false); + // 设置是否显示道路信息view + options.setLaneInfoShow(false); + // 设置是否自动改变缩放等级 + options.setAutoChangeZoom(false); + // 设置是否自动全览模式,即在算路成功后自动进入全览模式 + options.setAutoDisplayOverview(false); + // 设置路线转向箭头隐藏和显示 + options.setNaviArrowVisible(false); + // 通过路线是否自动置灰,仅支持驾车导航 + options.setAfterRouteAutoGray(false); + //options.setZoom(((int) 9)); + //options.setPointToCenter(0.7D, 0.5D); + // 2D模式 + options.setTilt(0); + mAMapNaviView.setViewOptions(options); + } + // 设置电子眼所在路线的可见性 + mAMapNaviView.setRouteOverlayVisible(false); + // 设置是否隐藏AMapNaviView上的CarOverlay,包括自车、罗盘 + mAMapNaviView.setCarOverlayVisible(true); + mAMapNaviView.setViewOptions(options); //设置希望展示的地图缩放级别 mCameraUpdate = CameraUpdateFactory.zoomTo(12); mAMap.moveCamera(mCameraUpdate); + // 设置当前位置的样式 +// myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类 +// myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。 +// myLocationStyle.interval(1000); //设置连续定位模式下的定位间隔,只在连续定位模式下生效,单次定位模式下不会生效。单位为毫秒。 +// BitmapDescriptor location = BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo); +// myLocationStyle.myLocationIcon(location); +// mAMap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style +// mAMap.setMyLocationEnabled(true);// 设置为true表示启动显示定位蓝点,false表示隐藏定位蓝点并不进行定位,默认是false。 + + mAMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() { + @Override + public void onCameraChange(CameraPosition cameraPosition) { + if (cameraPosition != null) { + //Log.w("onCameraChange", "cameraPosition=" + cameraPosition.bearing); + changeAngle((int) cameraPosition.bearing); + } + } + + @Override + public void onCameraChangeFinish(CameraPosition cameraPosition) { + + } + }); + + // 关闭地图文字标注 + mAMap.showMapText(false); + + // 设置地图的样式 mUiSettings = mAMap.getUiSettings(); mUiSettings.setZoomControlsEnabled(false);// 地图缩放级别的交换按钮 -// mUiSettings.setZoomGesturesEnabled(false);// 缩放手势 -// mUiSettings.setScrollGesturesEnabled(false);// 滑动手势 -// mUiSettings.setRotateGesturesEnabled(false);// 旋转手势 -// mUiSettings.setTiltGesturesEnabled(false);// 倾斜手势 mUiSettings.setAllGesturesEnabled(false);// 所有手势 mUiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮 mUiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可 + + CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions(); + customMapStyleOptions.setStyleData(MapAssetStyleUtils.getAssetsStyle(context)); + customMapStyleOptions.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(context)); + customMapStyleOptions.setEnable(true); + mAMap.setCustomMapStyle(customMapStyleOptions); + } @@ -104,9 +199,10 @@ public class SmallMapDirectionView extends RoundLayout { * @param angle 角度 0 - 359度旋转,相对于自身中心位置 */ public void changeAngle(int angle) { - int tempAngle = angle; - if (angle <= 180) { - tempAngle = angle; + int tempAngle = 360 - angle; + + if (tempAngle <= 180) { + tempAngle = tempAngle; } else { tempAngle = -(360 - tempAngle); } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java index f50a457f25..5841270767 100644 --- a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/SmallMapService.java @@ -88,15 +88,6 @@ public class SmallMapService extends Service { mSmallMapDirectionView = mWindowManagerView.findViewById(R.id.smallMapDirectionView); - - mSmallMapDirectionView.postDelayed(new Runnable() { - @Override - public void run() { - Random random = new Random(); - mSmallMapDirectionView.changeAngle(random.nextInt(360)); - } - }, 1000); - } diff --git a/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/utils/MapAssetStyleUtils.java b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/utils/MapAssetStyleUtils.java new file mode 100644 index 0000000000..4f640ea613 --- /dev/null +++ b/modules/mogo-module-smp/src/main/java/com/mogo/module/small/map/utils/MapAssetStyleUtils.java @@ -0,0 +1,60 @@ +package com.mogo.module.small.map.utils; + +import android.content.Context; + +import java.io.IOException; +import java.io.InputStream; + +/** + * @author donghongyu + * @date 12/18/20 5:37 PM + */ +public class MapAssetStyleUtils { + + public static byte[] getAssetsStyle(Context context) { + byte[] buffer1 = null; + InputStream is1 = null; + try { + is1 = context.getResources().getAssets().open("small_map_style.data"); + int lenght1 = is1.available(); + buffer1 = new byte[lenght1]; + is1.read(buffer1); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (is1 != null) { + is1.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return buffer1; + } + + + public static byte[] getAssetsExtraStyle(Context context) { + byte[] buffer1 = null; + InputStream is1 = null; + try { + is1 = context.getResources().getAssets().open("small_map_style_extra.data"); + int lenght1 = is1.available(); + buffer1 = new byte[lenght1]; + is1.read(buffer1); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (is1 != null) { + is1.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return buffer1; + } + + +} diff --git a/modules/mogo-module-smp/src/main/res/drawable-xhdpi/icon_module_small_map_four_corners.png b/modules/mogo-module-smp/src/main/res/drawable-xhdpi/icon_module_small_map_four_corners.png new file mode 100644 index 0000000000..91e02323a8 Binary files /dev/null and b/modules/mogo-module-smp/src/main/res/drawable-xhdpi/icon_module_small_map_four_corners.png differ diff --git a/modules/mogo-module-smp/src/main/res/drawable/bg_module_small_map_view_border.xml b/modules/mogo-module-smp/src/main/res/drawable/bg_module_small_map_view_border.xml index 46982d07c3..1537b40512 100644 --- a/modules/mogo-module-smp/src/main/res/drawable/bg_module_small_map_view_border.xml +++ b/modules/mogo-module-smp/src/main/res/drawable/bg_module_small_map_view_border.xml @@ -2,25 +2,23 @@ - + - + android:angle="315" + android:endColor="#284190" + android:startColor="#7997ff" + android:type="linear" /> - + diff --git a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml index 59c74ffedd..d86de24931 100644 --- a/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml +++ b/modules/mogo-module-smp/src/main/res/layout/module_small_map_view.xml @@ -19,8 +19,8 @@ android:layout_centerInParent="true" app:roundLayoutRadius="360dp"> - diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_fatigue_driving_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_fatigue_driving_data.json index f101b621e1..e6612d5f41 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_fatigue_driving_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_fatigue_driving_data.json @@ -14,11 +14,11 @@ "zoom": true, "zoomScale": 15, "location": { - "lat":39.966668, - "lon":116.411211 + "lat":39.969088, + "lon":116.41808 }, - "lat":39.966668, - "lon":116.411211, + "lat":39.969088, + "lon":116.41808, "userHead": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png", "msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg" } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_animation_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_animation_event_data.json index 4181815172..fda51992cb 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_animation_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_animation_event_data.json @@ -13,8 +13,8 @@ "zoom": true, "zoomScale": 15, "location": { - "lat": 39.9754100000, - "lon": 116.4178276100 + "lat":39.969088, + "lon":116.41808 }, "userHead": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png", "msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg" diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_cross_crash.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_cross_crash.json index 180b9688a1..57942107bb 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_cross_crash.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_cross_crash.json @@ -13,8 +13,8 @@ "zoom": true, "zoomScale": 15, "location": { - "lat": 39.9754100000, - "lon": 116.4178276100 + "lat":39.969088, + "lon":116.41808 }, "userHead": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png", "msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg" diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_event_data.json index c166e32a62..602c35d0a1 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_event_data.json @@ -13,11 +13,11 @@ "zoom": true, "zoomScale": 15, "location": { - "lat": 39.971417, - "lon": 116.415853 + "lat":39.969088, + "lon":116.41808 }, - "lat": 39.968678, - "lon": 116.405467, + "lat":39.969088, + "lon":116.41808, "userHead": "tUserHeadImg/5.png", "msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg" } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_live_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_live_event_data.json index fc870468e2..a08db2ad3d 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_live_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_live_event_data.json @@ -13,11 +13,11 @@ "zoom": true, "zoomScale": 15, "location": { - "lat": 39.971417, - "lon": 116.415853 + "lat":39.969088, + "lon":116.41808 }, - "lat": 39.968678, - "lon": 116.405467, + "lat":39.969088, + "lon":116.41808, "headImgUrl": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png", "msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg" } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json index 485117a72d..d1fd466bcf 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json @@ -11,8 +11,8 @@ "tts": "前方发现障碍物注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json index 649a659c18..af1fb347f7 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json @@ -11,8 +11,8 @@ "tts": "发现后方车辆超速,注意保持车道", "zoom": false, "zoomScale": 15, - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json index 139b16390e..78e259ec25 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json @@ -11,8 +11,8 @@ "tts": "前车急刹注意减速", "zoom": false, "zoomScale": 15, - "lat": 40.195206, - "lon": 116.727433, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json index 90519ff610..58209f8d88 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json @@ -14,8 +14,8 @@ "zoomScale": 15, "userHead": "", "msgImgUrl": "", - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "polyline": [ [ 116.725091, diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json index a4707406c6..58209f8d88 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json @@ -14,8 +14,8 @@ "zoomScale": 15, "userHead": "", "msgImgUrl": "", - "lat": 40.195571, - "lon": 116.729344, + "lat":39.969088, + "lon":116.41808, "polyline": [ [ 116.725091, diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json index 9a770eda3f..dc6471c258 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json @@ -11,8 +11,8 @@ "tts": "发现后方VIP车辆,注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json index f0ffa82850..3a8732358c 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json @@ -11,8 +11,8 @@ "tts": "对向来车注意减速", "zoom": false, "zoomScale": 15, - "lat": 40.196175, - "lon": 116.731011, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json index c3d10b092f..2e80f28202 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json @@ -11,8 +11,8 @@ "tts": "已为您变灯,可优先通行", "zoom": false, "zoomScale": 15, - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json index d2c7eaa55a..5c9ac8e5da 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json @@ -11,8 +11,8 @@ "tts": "检测到路口行人穿行注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.196512, - "lon": 116.736461, + "lat":39.969088, + "lon":116.41808, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_road_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_road_event_data.json index cf4d9e9c07..ce7f84f44f 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_road_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_road_event_data.json @@ -5,8 +5,8 @@ "location":{ "address":"北三环环球贸易中心", "angle":270, - "lat":39.966668, - "lon":116.411211 + "lat":39.969088, + "lon":116.41808 }, "noveltyInfo":{ "addr":"北三环环球贸易中心", @@ -27,8 +27,8 @@ "location":{ "address":"北三环环球贸易中心", "angle":270, - "lat":39.966668, - "lon":116.411211 + "lat":39.969088, + "lon":116.41808 }, "poiType":"10003", "type":"CARD_TYPE_ROAD_CONDITION", diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_seek_help.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_seek_help.json index 2f6a9823ac..58853e2a6f 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_seek_help.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_seek_help.json @@ -3,8 +3,8 @@ { "createTime":1593678359872, "distance":1100, - "lat":39.866668, - "lon":116.411211, + "lat":39.969088, + "lon":116.41808, "sn":"ZD801B1932L00041", "targetId":20007, "targetName":"故障车",