diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index 663459aa50..0d156937bb 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -3,9 +3,18 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index 3b62eef43d..e082ea7475 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,7 +7,4 @@ - - \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bb9630b495..5121884a7f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,7 @@ package="com.mogo.launcher"> + = 20f ) { return MapControlResult.TARGET; @@ -290,7 +291,9 @@ public class AMapViewWrapper implements IMogoMapView, if ( DebugConfig.isDebug() ) { Logger.d( TAG, Log.getStackTraceString( new Throwable() ) ); } - + if ( mCurrentUI == EnumMapUI.Type_VR ) { + return MapControlResult.ERROR; + } getMap().changeZoom( zoom ); return MapControlResult.SUCCESS; } @@ -305,6 +308,7 @@ public class AMapViewWrapper implements IMogoMapView, case CarUp_2D: case CarUp_3D: case NorthUP_2D: + setUIMode( ui ); break; case Type_VR: mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_VR ); @@ -762,8 +766,27 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onChangeMapStyle( int i ) { - if ( i == MapParams.MAP_STYLE_VR ) { - MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_VR ); + if ( i == MapAutoApi.MAP_STYLE_DAY + || i == MapAutoApi.MAP_STYLE_DAY_NAV ) { + mCurrentUI = EnumMapUI.Type_Light; + } else if ( i == MapAutoApi.MAP_STYLE_NIGHT + || i == MapAutoApi.MAP_STYLE_NIGHT_NAV ) { + mCurrentUI = EnumMapUI.Type_Night; + } else if ( i == MapAutoApi.MAP_STYLE_VR ) { + mCurrentUI = EnumMapUI.Type_VR; + } else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) { + mCurrentUI = EnumMapUI.CarUp_2D; + } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) { + mCurrentUI = EnumMapUI.CarUp_3D; + } + if ( mCurrentUI != null ) { + UiThreadHandler.post( () -> { + try { + MogoMapListenerHandler.getInstance().onMapModeChanged( mCurrentUI ); + } catch ( Exception e ) { + e.printStackTrace(); + } + } ); } } } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java index e6c9a8d05d..1081ea35b3 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java @@ -91,7 +91,7 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder { @Override public IMogoMapView getMapView( Context context ) { NavAutoApi.INSTANCE.init( context, MapParams.Companion.init() - .setDebugMode( false ) + .setDebugMode( true ) .setCoordinateType( MapParams.COORDINATETYPE_GCJ02 ) .setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D ) .setZoom( 16 ) diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapInfoWindowAdapter.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapInfoWindowAdapter.java index 1e06b9ddbb..78150eabb5 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapInfoWindowAdapter.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/marker/AMapInfoWindowAdapter.java @@ -2,32 +2,44 @@ package com.mogo.map.impl.custom.marker; import android.view.View; +import com.mogo.map.impl.custom.AMapMarkerClickHandler; import com.mogo.map.marker.IMogoInfoWindowAdapter; import com.mogo.map.marker.IMogoMarker; import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter; import com.zhidaoauto.map.sdk.open.marker.Marker; +import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.io.FileInputStream; + /** * @author congtaowang * @since 2019-12-24 *

* 自定义infowindow */ -public final class AMapInfoWindowAdapter implements InfoWindowAdapter { +public final class AMapInfoWindowAdapter implements InfoWindowAdapter, OnInfoWindowClickListener { public View getInfoWindow( Marker marker ) { if ( marker.getMObject() instanceof IMogoMarker ) { IMogoMarker mogoMarker = ( ( IMogoMarker ) marker.getMObject() ); IMogoInfoWindowAdapter delegate = mogoMarker.getInfoWindowAdapter(); if ( delegate != null ) { - return delegate.getInfoWindow( mogoMarker ); + final View infoView = delegate.getInfoWindow( mogoMarker ); + marker.setOnInfoWindowClickListener( this ); + return infoView; } } return null; } + @Override + public void onInfoWindowClick( @NotNull Marker marker ) { + AMapMarkerClickHandler.getInstance().handleMarkerClicked( marker ); + } + @Nullable @Override public View getInfoContents(@Nullable Marker marker) { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java index c950276731..1852c8c8ea 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java @@ -77,7 +77,6 @@ public class ObjectUtils { // .icons( descriptors ) // .period( opt.getPeriod() ) .rotateAngle( opt.getRotate() ) - .marker3DIcon( opt.getIcon3DRes() ) .setFlat( opt.isFlat() ) .visible( opt.isVisible() ) .infoWindowEnable( opt.isInifoWindowEnable() ) @@ -86,6 +85,9 @@ public class ObjectUtils { // .draggable( opt.isDraggable() ) .setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() ) .zIndex( opt.getzIndex() ); + if ( opt.getIcon3DRes() != 0 ) { + markerOptions.marker3DIcon( opt.getIcon3DRes() ); + } if ( !TextUtils.isEmpty( opt.getTitle() ) ) { markerOptions.title( opt.getTitle() ); } @@ -699,7 +701,7 @@ public class ObjectUtils { target.setLonLatPoints( points ); } target.setLineWidth( options.getWidth() ); - target.setColor( options.getColor()); + target.setColor( options.getColor() ); // target.zIndex( options.getWidth() ); // target.visible( options.isVisible() ); //// target.geodesic( options.isGeodesic() ); 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 new file mode 100644 index 0000000000..85ad93badb --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierAnimationView.java @@ -0,0 +1,141 @@ +package com.mogo.module.common.animation; + +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.PointF; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.LinearInterpolator; +import android.widget.ImageView; +import android.widget.RelativeLayout; + +import androidx.core.content.ContextCompat; + +import com.mogo.module.common.R; + +import java.util.Random; + +public class BezierAnimationView extends RelativeLayout implements View.OnClickListener { + private String TAG = "BezierAnimationView"; + 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_living}; + private Random random = new Random(); + private int width = 500, height = 210; + private int drawableWidth, drawableHeight; + + public BezierAnimationView(Context context) { + this(context, null); + } + + public BezierAnimationView(Context context, AttributeSet attributes) { + this(context, attributes, 0); + } + + public BezierAnimationView(Context context, AttributeSet attributes, int defStyleAttr) { + super(context, attributes, defStyleAttr); + this.context = context; + //3、设置点击事件 + setOnClickListener(this); + //4、获取点赞图片的宽高 + Drawable drawable = ContextCompat.getDrawable(context, R.drawable.icon_common_heart_animation_vr02); + drawableWidth = drawable.getIntrinsicWidth(); + drawableHeight = drawable.getIntrinsicHeight(); + } + + @Override + public void onClick(View view) { + Log.d("执行点赞动画", "ppp"); + bezierAnimation(); + } + + private void bezierAnimation() { + final ImageView imageView = new ImageView(context); + imageView.setBackgroundResource(animation_drawable[random.nextInt(animation_drawable.length - 1)]); + RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); + params.addRule(ALIGN_BOTTOM); + params.addRule(CENTER_HORIZONTAL); + imageView.setLayoutParams(params); + addView(imageView); + + /* + * 开始执行点赞效果 + * */ + AnimatorSet animatorSet = getAnimatorSet(imageView); + animatorSet.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + //3、动画执行后移除View + removeView(imageView); + } + }); + animatorSet.start(); + } + + private AnimatorSet getAnimatorSet(ImageView imageView) { + AnimatorSet enter = new AnimatorSet(); + /* + * 缩放动画 + * */ + 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); + scaleAnimator.playTogether(alpha, scaleX, scaleY); + + /* + * 贝塞尔动画 + * */ + ValueAnimator bezierAnimator = getBezierValueAnimator(imageView); + /* + * 两个动画按顺序播放 + * */ + enter.playSequentially(scaleAnimator, bezierAnimator); + return enter; + } + + /** + * 获取贝塞尔曲线动画 + * + * @param target + * @return + */ + private ValueAnimator getBezierValueAnimator(View target) { + + //初始化一个BezierEvaluator + BezierEvaluator evaluator = new BezierEvaluator(getPointF(1), getPointF(1)); + + // 起点固定,终点随机 + 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; + } + + /** + * 获取一条路径的两个控制点 + * + * @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 new file mode 100644 index 0000000000..6effc925b1 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierEvaluator.java @@ -0,0 +1,45 @@ +package com.mogo.module.common.animation; + +import android.animation.TypeEvaluator; +import android.graphics.PointF; + +/** + * 贝塞尔曲线估值器:计算动画的执行轨迹 + * + * @params 传入贝塞尔曲线需要的四个点 + * @return 通过计算返回贝塞尔曲线的坐标 + */ +public class BezierEvaluator implements TypeEvaluator { + + private PointF pointF1; + private PointF pointF2; + + public BezierEvaluator(PointF point1, PointF point2) { + this.pointF1 = point1; + this.pointF2 = point2; + } + + @Override + public PointF evaluate(float time, PointF startValue, PointF endValue) { + float timeLeft = 1.0f - time; + + //结果 + PointF point = new PointF(); + + PointF point0 = (PointF)startValue;//起点 + PointF point3 = (PointF)endValue;//终点 + + // 贝塞尔公式 + 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); + + return point; + } +} \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierListener.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierListener.java new file mode 100644 index 0000000000..04ab1129c2 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/animation/BezierListener.java @@ -0,0 +1,24 @@ +package com.mogo.module.common.animation; + +import android.animation.ValueAnimator; +import android.graphics.PointF; +import android.view.View; + +public class BezierListener implements ValueAnimator.AnimatorUpdateListener { + + private View target; + + public BezierListener(View target) { + this.target = target; + } + + @Override + public void onAnimationUpdate(ValueAnimator animation) { + //这里获取到贝塞尔曲线计算出来的的x y值 赋值给view 这样就能让爱心随着曲线走啦 + PointF pointF = (PointF) animation.getAnimatedValue(); + target.setX(pointF.x); + target.setY(pointF.y); + // 这里偷个懒,顺便做一个alpha动画,这样alpha渐变也完成啦 + target.setAlpha(1 - animation.getAnimatedFraction()); + } +} \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/TrafficLightConst.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/TrafficLightConst.java new file mode 100644 index 0000000000..f543e4b242 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/TrafficLightConst.java @@ -0,0 +1,18 @@ +package com.mogo.module.common.constants; + +/** + * 用于内部标识红绿灯颜色 + * + * @author tongchenfei + */ +public class TrafficLightConst { + public static final int TRAFFIC_LIGHT_COLOR_GRAY = 0; + public static final int TRAFFIC_LIGHT_COLOR_RED = 1; + public static final int TRAFFIC_LIGHT_COLOR_YELLOW = 2; + public static final int TRAFFIC_LIGHT_COLOR_GREEN = 3; + + public static final int TRAFFIC_LIGHT_DIRECTION_TURN_AROUND = 0; + public static final int TRAFFIC_LIGHT_DIRECTION_TURN_LEFT = 1; + public static final int TRAFFIC_LIGHT_DIRECTION_STRAIGHT = 2; + public static final int TRAFFIC_LIGHT_DIRECTION_TURN_RIGHT = 3; +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java index 8fea64910c..0f687f677f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/MarkerDrawer.java @@ -60,10 +60,14 @@ class MarkerDrawer { } public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener ) { + return drawMapMarkerImpl(markerShowEntity, zIndex, 0, listener); + } + + public IMogoMarker drawMapMarkerImpl( MarkerShowEntity markerShowEntity, int zIndex, int icon3DRes, IMogoMarkerClickListener listener ) { if ( markerShowEntity == null || markerShowEntity.getMarkerLocation() == null ) { return null; } - MogoMarkerOptions options = new MogoMarkerOptions().owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() ); + MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes( icon3DRes ).owner( markerShowEntity.getMarkerType() ).zIndex( zIndex ).object( markerShowEntity ).latitude( markerShowEntity.getMarkerLocation().getLat() ).longitude( markerShowEntity.getMarkerLocation().getLon() ); IMarkerView markerView = MapMarkerAdapter.getMarkerView( AbsMogoApplication.getApp(), markerShowEntity, options ); if ( markerView instanceof OnlineCarMarkerView ) { try { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java index 5829eee710..621692464e 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java @@ -8,6 +8,7 @@ import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.module.common.ModuleNames; import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.R; import com.mogo.module.common.entity.MarkerCarPois; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerOnlineCar; @@ -104,7 +105,7 @@ class OnlineCarDrawer { String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerOnlineCar ); IMogoMarker mogoMarker = existCarMap.get( sn ); if ( mogoMarker == null || mogoMarker.isDestroyed() ) { - mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_LOW, listener ); + mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_LOW, R.raw.taxi, listener ); } if ( mogoMarker != null ) { mogoMarker.setVisible( true ); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java index 8fa79aaf08..fde64b7020 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/RoadConditionDrawer.java @@ -9,6 +9,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.anim.OnMarkerAnimationListener; import com.mogo.module.common.ModuleNames; import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.drawer.marker.RoadConditionInfoWindow3DAdapter; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; @@ -84,10 +85,16 @@ class RoadConditionDrawer { if ( mogoMarker == null || mogoMarker.isDestroyed() ) { Logger.d( TAG, "draw road condition, sn = %s", sn ); try { - if ( DebugConfig.isRoadEventAnimated() ) { - post2AddAndStartAnimation( markerShowEntity, i * 100L, listener ); - } else { + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener ); + mogoMarker.setInfoWindowAdapter( new RoadConditionInfoWindow3DAdapter( markerShowEntity, AbsMogoApplication.getApp(), mogoMarker.getMogoMarkerOptions() ) ); + mogoMarker.showInfoWindow(); + } else { + if ( DebugConfig.isRoadEventAnimated() ) { + post2AddAndStartAnimation( markerShowEntity, i * 100L, listener ); + } else { + mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, MarkerDrawer.MARKER_Z_INDEX_HIGH, listener ); + } } } catch ( Exception e ) { e.printStackTrace(); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/EmptyMarkerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/EmptyMarkerView.java new file mode 100644 index 0000000000..be4771ae5a --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/EmptyMarkerView.java @@ -0,0 +1,46 @@ +package com.mogo.module.common.drawer.marker; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; + +import androidx.annotation.Nullable; + +import com.mogo.map.marker.IMogoMarker; + +public +/** + * @author congtaowang + * @since 2020/12/16 + * + * 描述 + */ +class EmptyMarkerView extends View implements IMarkerView { + + public EmptyMarkerView( Context context ) { + this( context, null ); + } + + public EmptyMarkerView( Context context, @Nullable AttributeSet attrs ) { + this( context, attrs, 0 ); + } + + public EmptyMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { + super( context, attrs, defStyleAttr ); + } + + @Override + public View getView() { + return this; + } + + @Override + public void setMarker( IMogoMarker marker ) { + + } + + @Override + protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) { + setMeasuredDimension( 1, 1 ); + } +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapCameraInfoView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapCameraInfoView.java new file mode 100644 index 0000000000..9d88d0b644 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapCameraInfoView.java @@ -0,0 +1,67 @@ +package com.mogo.module.common.drawer.marker; + +import android.content.Context; +import android.text.TextUtils; +import android.util.AttributeSet; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.Nullable; +import androidx.constraintlayout.widget.ConstraintLayout; + +import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.module.common.ModuleNames; +import com.mogo.module.common.MogoApisHandler; +import com.mogo.module.common.R; +import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.MarkerShareMusic; +import com.mogo.module.common.entity.MarkerShowEntity; +import com.mogo.module.common.marker.PoiWrapper; +import com.mogo.module.common.utils.CloudPoiManager; +import com.mogo.utils.logger.Logger; + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-0619:55 + * desc : 地图Marker图标带文本信息 + * version: 1.0 + */ +public class MapCameraInfoView extends MapMarkerBaseView { + private String TAG = "MapCameraInfoView"; + + private ImageView mCameraImage; + + + public MapCameraInfoView(Context context ) { + super( context ); + } + + public MapCameraInfoView(Context context, @Nullable AttributeSet attrs ) { + super( context, attrs ); + } + + public MapCameraInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { + super( context, attrs, defStyleAttr ); + } + + public MapCameraInfoView(Context context, MogoMarkerOptions options ) { + super( context ); + mOptions = options; + } + + @Override + protected void initView( Context context ) { + LayoutInflater.from( context ).inflate( R.layout.modudle_camera_layout_info, this ); + mCameraImage = findViewById( R.id.iv_camera_traffic); + } + + @Override + public void updateView( MarkerShowEntity markerShowEntity ) { + + } + +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java index 94d682ca4a..8a130a1f59 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerAdapter.java @@ -5,6 +5,7 @@ import android.text.TextUtils; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.ModuleNames; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.MarkerShowEntity; /** @@ -23,17 +24,36 @@ public class MapMarkerAdapter { * @param markerShowEntity 要填充的数据 * @return MarkerView */ - public static IMarkerView getMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) { + public static IMarkerView getMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) { if ( TextUtils.equals( markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA ) ) { return OnlineCarMarkerView.getInstance(); } else { - if (markerShowEntity.isChecked()) { - return new MapMarkerInfoView(context, markerShowEntity, options); + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + return new EmptyMarkerView( context ); } else { - return new MapMarkerView(context, markerShowEntity, options); + if ( markerShowEntity.isChecked() ) { + return new MapMarkerInfoView( context, markerShowEntity, options ); + } else { + return new MapMarkerView( context, markerShowEntity, options ); + } } } } + + /** + * 获取 MarkerShowEntity 填充好的 MarkerView + * + * @param context 上下文 + * @param markerShowEntity 要填充的数据 + * @return MarkerView + */ + public static IMarkerView getMarkerInfoWindowView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) { + if ( markerShowEntity.isChecked() ) { + return new MapMarkerInfoView( context, markerShowEntity, options ); + } else { + return new MapMarkerView( context, markerShowEntity, options ); + } + } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java index 404ded1d88..9ded911563 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/MapMarkerInfoView.java @@ -13,6 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.ModuleNames; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; @@ -71,7 +72,11 @@ public class MapMarkerInfoView extends MapMarkerBaseView { Object bindObj = markerShowEntity.getBindObj(); - ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); + if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr ); + } else { + ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); + } clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info ); ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow ); switch ( markerShowEntity.getMarkerType() ) { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java new file mode 100644 index 0000000000..063be888e7 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/marker/RoadConditionInfoWindow3DAdapter.java @@ -0,0 +1,37 @@ +package com.mogo.module.common.drawer.marker; + +import android.content.Context; +import android.view.View; + +import com.mogo.map.marker.IMogoInfoWindowAdapter; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.module.common.entity.MarkerShowEntity; + +public +/** + * @author congtaowang + * @since 2020/12/15 + * + * 描述 + */ +class RoadConditionInfoWindow3DAdapter implements IMogoInfoWindowAdapter { + + private MarkerShowEntity mEntity; + private Context mContext; + private MogoMarkerOptions mOptions; + + public RoadConditionInfoWindow3DAdapter( MarkerShowEntity entity, + Context context, + MogoMarkerOptions options ) { + this.mEntity = entity; + this.mContext = context; + this.mOptions = options; + } + + @Override + public View getInfoWindow( IMogoMarker marker ) { + IMarkerView creator = MapMarkerAdapter.getMarkerInfoWindowView( mContext, mEntity, mOptions ); + return creator.getView(); + } +} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/RoundLayout.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/RoundLayout.java index 23418c8b9e..20150f4a19 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/RoundLayout.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/RoundLayout.java @@ -3,6 +3,8 @@ package com.mogo.module.common.view; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PaintFlagsDrawFilter; import android.graphics.Path; import android.graphics.RectF; import android.util.AttributeSet; @@ -19,11 +21,10 @@ import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate; * desc : * version: 1.0 */ -public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable { +public class RoundLayout extends RelativeLayout { private float roundLayoutRadius = 14f; private Path roundPath; private RectF rectF; - private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper; public RoundLayout(Context context) { this(context, null); @@ -41,9 +42,6 @@ public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSuppor typedArray.recycle(); init(); - - mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this); - mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr); } @@ -75,16 +73,10 @@ public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSuppor @Override public void draw(Canvas canvas) { if (roundLayoutRadius > 0f) { + canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG)); canvas.clipPath(roundPath); } super.draw(canvas); } - - @Override - public void applySkin() { - if (mBackgroundTintHelper != null) { - mBackgroundTintHelper.applySkin(); - } - } } diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png new file mode 100644 index 0000000000..5246d61ccc Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr00.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr01.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr01.png new file mode 100644 index 0000000000..5246d61ccc Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr01.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.png new file mode 100644 index 0000000000..5246d61ccc Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_common_heart_animation_vr02.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 new file mode 100644 index 0000000000..3f41ce4252 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/module_camera_real_time_traffic.png differ diff --git a/modules/mogo-module-common/src/main/res/layout/modudle_camera_layout_info.xml b/modules/mogo-module-common/src/main/res/layout/modudle_camera_layout_info.xml new file mode 100644 index 0000000000..39535e2391 --- /dev/null +++ b/modules/mogo-module-common/src/main/res/layout/modudle_camera_layout_info.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/res/raw/taxi.n3d b/modules/mogo-module-common/src/main/res/raw/taxi.n3d new file mode 100644 index 0000000000..8352a248bc Binary files /dev/null and b/modules/mogo-module-common/src/main/res/raw/taxi.n3d differ diff --git a/modules/mogo-module-common/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-common/src/main/res/values-xhdpi/dimens.xml index 96ca04697b..1f8f71e5f9 100644 --- a/modules/mogo-module-common/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-common/src/main/res/values-xhdpi/dimens.xml @@ -1116,4 +1116,8 @@ 60px 22.5px + 360px + 63px + 96px + diff --git a/modules/mogo-module-common/src/main/res/values/dimens.xml b/modules/mogo-module-common/src/main/res/values/dimens.xml index 0950acfa9d..d64511c300 100644 --- a/modules/mogo-module-common/src/main/res/values/dimens.xml +++ b/modules/mogo-module-common/src/main/res/values/dimens.xml @@ -1107,4 +1107,8 @@ 17px 60px 12.5px + + 36px + 53px + 194px 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 a6db2c98b9..8ae5668217 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 @@ -4,15 +4,18 @@ import android.content.Intent; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; +import android.os.SystemClock; import android.text.TextUtils; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageButton; +import android.widget.Button; import android.widget.EditText; +import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.RadioButton; import android.widget.TextView; import androidx.annotation.NonNull; @@ -183,11 +186,10 @@ public class EntranceFragment extends MvpFragment { - mApis.getSearchManagerApi().goSettings(); - return true; - }); - - mUploadRoadCondition.setOnLongClickListener(view -> { - mApis.getMogoMonitorApi().getMogoMonitorLog().showLogDebugDialog(); - return true; - }); - - mUserHeadImg.setOnLongClickListener(view ->{ - if (groupFix.getVisibility() == View.VISIBLE) { - groupFix.setVisibility(View.GONE); - }else{ - groupFix.setVisibility(View.VISIBLE); - } - return true; - }); - } - groupFix = findViewById(R.id.groupFix); ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout); @@ -327,48 +257,10 @@ public class EntranceFragment extends MvpFragment { - dlg.dismiss(); - mMogoNavi.stopNavi(); - }) - .setCancelButton(R.string.module_commons_button_cancel, - (dlg, which) -> { - dlg.dismiss(); - }) - .setContent(R.string.module_commons_exit_navi_content) - .build() - .show(); - } else { - MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI); - mMApUIController.recoverLockMode(); - } - } - } - }); - mCameraMode = findViewById(R.id.module_ext_id_north); - mCameraMode.setOnClickListener(new OnPreventFastClickListener() { - @Override - public void onClickImpl(View v) { - if (mCameraMode.isSelected()) { - mMApUIController.changeMapMode(EnumMapUI.CarUp_2D); - } else { - mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D); - } - } - }); - - mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this); MogoEntranceButtons.save(ButtonIndex.BUTTON1, findViewById(R.id.module_entrance_id_button1)); MogoEntranceButtons.save(ButtonIndex.BUTTON2, findViewById(R.id.module_entrance_id_button2)); - mDisplayOverviewBounds = new Rect( ResourcesHelper.getDimensionPixelSize(getContext(), R.dimen.module_map_display_overview_left_margin), @@ -383,67 +275,49 @@ public class EntranceFragment extends MvpFragment properties = new HashMap<>(); - properties.put("type", 3); - ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon", - properties); - } catch (Exception e) { - Logger.e(TAG, e, "打开个人中心Exception"); - } - } - }); + mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload, + mStatusManager); + tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode); + tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode); + + tvEnterVrMode.setOnClickListener(clickListener); + tvExitVrMode.setOnClickListener(clickListener); + mMsgContainer.setOnClickListener(clickListener); + mUserHeadImg.setOnClickListener(clickListener); + mMove2CurrentLocation.setOnClickListener(clickListener); + mDisplayOverview.setOnClickListener(clickListener); + mExitNavi.setOnClickListener(clickListener); + mCameraMode.setOnClickListener(clickListener); groupUserHead.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE); - mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload, - mStatusManager); + if (DebugConfig.isDebug()) { + mMove2CurrentLocation.setOnLongClickListener(view -> { + mApis.getSearchManagerApi().goSettings(); + return true; + }); - tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode); - tvEnterVrMode.setOnClickListener((v)->{ - // 进入vr模式 - enterVrMode(); - mApis.getStatusManagerApi().setVrMode(TAG, true); -// mApis.getMapFrameControllerApi().changeToVRMode(); - }); + mUploadRoadCondition.setOnLongClickListener(view -> { + mApis.getMogoMonitorApi().getMogoMonitorLog().showLogDebugDialog(); + return true; + }); - tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode); - tvExitVrMode.setOnClickListener((v)->{ - // 退出vr模式 - exitVrMode(); - mApis.getStatusManagerApi().setVrMode(TAG, false); -// mApis.getMapFrameControllerApi().changeTo2dMode(); - }); + mUserHeadImg.setOnLongClickListener(view -> { + if (groupFix.getVisibility() == View.VISIBLE) { + groupFix.setVisibility(View.GONE); + } else { + groupFix.setVisibility(View.VISIBLE); + } + return true; + }); + } dealWeatherContainer(); @@ -457,60 +331,48 @@ public class EntranceFragment extends MvpFragment{ - try { - String times = etTimes.getText().toString().trim(); - int fixTime = Integer.parseInt(times); - Logger.d(TAG, "修改上报时间间隔: " + times + " fixTime: " + fixTime); - if(fixTime > 0) { - Intent intent = new Intent("com.mogo.launcher.action.FIX_UPLOAT_DELAY"); - intent.putExtra("fixTime", fixTime); - getContext().sendBroadcast(intent); - TipToast.tip("已经发送修改广播"); - }else{ - TipToast.tip("fixTime为0,不发送广播"); - } - } catch (Exception e) { - TipToast.tip("fixTime异常"); - e.printStackTrace(); - } - }); + findViewById(R.id.btnFix).setOnClickListener(clickListener); + + findViewById(R.id.debugPanel).setOnClickListener(clickListener); + + initDebugPanel(); } + private int debugPanelClickCount = 0; + private long lastDebugPanelClickTime = 0; + private EditText etTimes; private Group groupFix; - private void enterVrMode(){ - tvEnterVrMode.setVisibility(View.GONE); + private void enterVrMode() { +// tvEnterVrMode.setVisibility(View.GONE); mMove2CurrentLocation.setVisibility(View.GONE); mUploadRoadCondition.setVisibility(View.GONE); mWeatherContainer.setVisibility(View.GONE); mMsgContainer.setVisibility(View.GONE); groupUserHead.setVisibility(View.GONE); - tvExitVrMode.setVisibility(View.VISIBLE); +// tvExitVrMode.setVisibility(View.VISIBLE); TopViewAnimHelper.getInstance().enterVrMode(); TopViewNoLinkageAnimHelper.getInstance().enterVrMode(); mNaviInfo = vrModeNavInfoView; adasNoticeHelper.enterVrMode(); mCameraLiveNoticeHelper.enterVrMode(); - MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG,this); - - mMApUIController.changeMapMode( EnumMapUI.Type_VR ); + MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerMogoLocationListener(TAG, this); } - private void exitVrMode(){ + private void exitVrMode() { EntranceViewHolder.getInstance().forceHideNoticeView(); - tvEnterVrMode.setVisibility(View.VISIBLE); +// tvEnterVrMode.setVisibility(View.VISIBLE); mMove2CurrentLocation.setVisibility(View.VISIBLE); mUploadRoadCondition.setVisibility(View.VISIBLE); groupUserHead.setVisibility(View.VISIBLE); // mWeatherContainer.setVisibility(View.VISIBLE); // mMsgContainer.setVisibility(View.VISIBLE); - tvExitVrMode.setVisibility(View.GONE); +// tvExitVrMode.setVisibility(View.GONE); TopViewAnimHelper.getInstance().exitVrMode(); TopViewNoLinkageAnimHelper.getInstance().exitVrMode(); mNaviInfo = animNavInfoView; @@ -518,11 +380,9 @@ public class EntranceFragment extends MvpFragment { - return !mMogoNavi.isNaviing(); - }); + , () -> !mMogoNavi.isNaviing()); if (CustomNaviInterrupter.getInstance().interrupt()) { mDisplayOverview.setVisibility(View.GONE); mCameraMode.setVisibility(View.GONE); @@ -878,12 +734,6 @@ public class EntranceFragment extends MvpFragment()); - // 目的地车友的显示隐藏控制准备迁移到TopViewAnimHelper中 -// if ( DebugConfig.isSupportedSearchDestinationOnlineCarList() ) { -// mOnlineCarEntrance.setVisibility( View.VISIBLE ); -// } else { -// mOnlineCarEntrance.setVisibility( View.GONE ); -// } } @Override @@ -896,15 +746,11 @@ public class EntranceFragment extends MvpFragment