Merge branch 'feature/v1.0.4' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.4

This commit is contained in:
wangcongtao
2020-04-21 10:34:49 +08:00
14 changed files with 604 additions and 318 deletions

View File

@@ -68,7 +68,7 @@ MOGO_MODULE_ONLINECAR_VERSION=1.0.3.1
# v2x
MOGO_MODULE_V2X_VERSION=1.0.3.3-SNAPSHOT
# 媒体卡片
MOGO_MODULE_MEDIA_VERSION=1.0.4.1
MOGO_MODULE_MEDIA_VERSION=1.0.4.2
# 推送
MOGO_MODULE_PUSH_VERSION=1.0.1
# 广告资源位

View File

@@ -15,7 +15,9 @@ import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.animation.Animation;
import com.amap.api.maps.model.animation.ScaleAnimation;
import com.amap.api.maps.model.animation.TranslateAnimation;
import com.amap.api.maps.utils.overlay.MovingPointOverlay;
import com.mogo.map.MogoLatLng;
import com.mogo.map.impl.amap.AMapWrapper;
import com.mogo.map.impl.amap.utils.ObjectUtils;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
@@ -26,6 +28,7 @@ import com.mogo.utils.WindowUtils;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
@@ -49,6 +52,8 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
private MogoMarkerOptions mMogoMarkerOptions;
private String mOwner;
private MovingPointOverlay mMovingPointOverlay;
public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) {
this.mMarker = marker;
if ( marker != null ) {
@@ -338,4 +343,30 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
mMarker.setClickable( clickable );
}
}
@Override
public void startSmooth(List<MogoLatLng> points,int duration) {
if (mMarker != null && points.size() > 0){
List<LatLng> p = new ArrayList<>();
for (int i = 0; i < points.size(); i++) {
p.add(ObjectUtils.fromMogo2(points.get(i)));
}
mMovingPointOverlay = new MovingPointOverlay(AMapWrapper.getAMap(),mMarker);
mMovingPointOverlay.setPoints(p);
mMovingPointOverlay.setTotalDuration(duration);
mMovingPointOverlay.setVisible(true);
mMovingPointOverlay.setMoveListener(new MovingPointOverlay.MoveListener() {
@Override
public void move(double v) {
}
});
mMovingPointOverlay.startSmoothMove();
}
}
@Override
public void stopSmooth() {
}
}

View File

@@ -8,6 +8,7 @@ import android.view.animation.Interpolator;
import com.mogo.map.MogoLatLng;
import java.util.ArrayList;
import java.util.List;
/**
* @author congtaowang
@@ -252,4 +253,14 @@ public interface IMogoMarker {
* @param clickable
*/
void setClickable( boolean clickable );
/**
* 开始平滑移动
*
* @param points 坐标点
* @param duration 时长
*/
void startSmooth(List<MogoLatLng> points, int duration);
void stopSmooth();
}

View File

@@ -0,0 +1,41 @@
package com.mogo.module.common.entity;
/**
* Created by ihoudf on 2020-04-16.
**/
public class MarkerCarPois {
private double[] coordinates;
private double angle; // 车头角度
private String adcode;
public double[] getCoordinates() {
return coordinates;
}
public void setCoordinates(double[] coordinates) {
this.coordinates = coordinates;
}
public double getAngle() {
return angle;
}
public void setAngle(double angle) {
this.angle = angle;
}
public String getAdcode() {
return adcode;
}
public void setAdcode(String adcode) {
this.adcode = adcode;
}
@Override
public String toString() {
return "MarkerCarPois{" + "coordinates=" + coordinates + ", angle=" + angle + ", adcode" +
"='" + adcode + '\'' + '}';
}
}

View File

@@ -1,10 +1,9 @@
package com.mogo.module.common.entity;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("unused")
public class MarkerOnlineCar implements Serializable {
private String type;//卡片类型
@@ -12,11 +11,28 @@ public class MarkerOnlineCar implements Serializable {
private Boolean isFocus;//isFocus":"0-未关注1-关注
private MarkerUserInfo userInfo;//用户数据
private MarkerCarInfo carInfo;//车辆数据
private List<MarkerCarPois> pois;//车辆路线
private MarkerDynamicData dynamicData;//动态数据
private MarkerHobbyDatum hobbyData;//爱好数据集合
private List<MarkerActivitiesScope> activitiesScope;//活动范围数据集合
private int compatibility;//匹配度
public Boolean getFocus() {
return isFocus;
}
public void setFocus(Boolean focus) {
isFocus = focus;
}
public List<MarkerCarPois> getPois() {
return pois;
}
public void setPois(List<MarkerCarPois> pois) {
this.pois = pois;
}
public List<MarkerActivitiesScope> getActivitiesScope() {
return activitiesScope;
}
@@ -91,16 +107,7 @@ public class MarkerOnlineCar implements Serializable {
@Override
public String toString() {
return "MarkerOnlineCar{" +
"activitiesScope=" + activitiesScope +
", carInfo=" + carInfo +
", compatibility='" + compatibility + '\'' +
", dynamicData=" + dynamicData +
", hobbyData=" + hobbyData +
", isFocus=" + isFocus +
", location=" + location +
", type='" + type + '\'' +
", userInfo=" + userInfo +
'}';
return "MarkerOnlineCar{" + "type='" + type + '\'' + ", location=" + location + ", " +
"isFocus=" + isFocus + ", userInfo=" + userInfo + ", carInfo=" + carInfo + ", " + "pois=" + pois + ", dynamicData=" + dynamicData + ", hobbyData=" + hobbyData + "," + " activitiesScope=" + activitiesScope + ", compatibility=" + compatibility + '}';
}
}

View File

@@ -2,13 +2,15 @@
package com.mogo.module.common.entity;
import com.mogo.commons.data.BaseData;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerResponse implements Serializable {
public class MarkerResponse extends BaseData implements Serializable {
private int code;
private String msg;
// private int code;
// private String msg;
private MarkerCardResult result;
private String sign;
@@ -32,6 +34,7 @@ public class MarkerResponse implements Serializable {
return result;
}
public void setResult(MarkerCardResult result) {
this.result = result;
}
@@ -46,11 +49,6 @@ public class MarkerResponse implements Serializable {
@Override
public String toString() {
return "MarkerResponse{" +
"code=" + code +
", msg='" + msg + '\'' +
", result=" + result +
", sign='" + sign + '\'' +
'}';
return "MarkerResponse{" + "result=" + result + ", sign='" + sign + '\'' + ", code=" + code + ", msg='" + msg + '\'' + '}';
}
}

View File

@@ -61,6 +61,13 @@ public class MapCenterPointStrategy {
categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) );
categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.596759D ) );
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
// V2X场景视图右边
Map< Integer, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.65D ) );
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {

View File

@@ -37,4 +37,9 @@ public interface Scene {
* 分类搜索
*/
int CATEGORY_SEARCH = 5;
/**
* V2X触发了预警场景
*/
int CATEGORY_V2X_EVENT = 6;
}

View File

@@ -226,10 +226,11 @@ public class MogoServices implements IMogoMapListener,
*/
private RefreshCallback mCustomRefreshCallback = new RefreshCallback() {
@Override
public void onSuccess() {
public void onSuccess(Object o) {
mLoopRequest = false;
// 用户手动操作地图刷新成功后,设置状态为 true引发延时策略
mStatusManager.setUserInteractionStatus( ServiceConst.TYPE, true, true );
}
@Override
@@ -243,7 +244,7 @@ public class MogoServices implements IMogoMapListener,
*/
private RefreshCallback mAutoRefreshCallback = new RefreshCallback() {
@Override
public void onSuccess() {
public void onSuccess(Object o) {
mLoopRequest = false;
Logger.d( TAG, "request Success." );
invokeAutoRefreshStrategy();
@@ -340,6 +341,8 @@ public class MogoServices implements IMogoMapListener,
if ( msg.obj instanceof RefreshObject ) {
RefreshObject ro = ( ( RefreshObject ) msg.obj );
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
MapMarkerManager.getInstance().getOnlineCarData(ro.mLonLat);
Logger.i( TAG, "刷新半径 = %s, 点 = %s, zoomLevel = %s, amount = %s", ro.mRadius, ro.mLonLat, mLastZoomLevel, ro.mAmount );
}
}
@@ -643,7 +646,7 @@ public class MogoServices implements IMogoMapListener,
} else {
// 搜索后,打开打点策略
if ( mAutoRefreshCallback != null ) {
mAutoRefreshCallback.onSuccess();
mAutoRefreshCallback.onSuccess(null);
}
}
break;
@@ -698,7 +701,7 @@ public class MogoServices implements IMogoMapListener,
refreshStrategy();
// ADAS关闭后打开打点策略
if ( mAutoRefreshCallback != null ) {
mAutoRefreshCallback.onSuccess();
mAutoRefreshCallback.onSuccess(null);
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.service.network;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerResponse;
import java.util.Map;
@@ -23,4 +24,9 @@ public interface RefreshApiService {
@FormUrlEncoded
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
@FormUrlEncoded
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
Observable<MarkerResponse> queryOnLineCarWithRoute(@FieldMap Map< String, Object > parameters );
}

View File

@@ -16,6 +16,7 @@ public class RefreshBody {
public int radius = 2_000; // 地理围栏半径(米)
public LatLon location; // 坐标
public String sn;
public boolean onlyFocus; // 是否仅查询已关注的好友
public boolean onlySameCity; // 是否仅查询注册城市相同的同城用户

View File

@@ -6,9 +6,9 @@ package com.mogo.module.service.network;
* <p>
* 刷新回调
*/
public interface RefreshCallback {
public interface RefreshCallback <T> {
void onSuccess();
void onSuccess(T o);
void onFail();
}

View File

@@ -7,7 +7,9 @@ import com.mogo.commons.data.BaseData;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.service.ServiceConst;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.network.IMogoNetwork;
@@ -62,7 +64,7 @@ public class RefreshModel {
refreshBody.dataType.add(ServiceConst.CARD_TYPE_CARS_CHATTING);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_ROAD_CONDITION);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_SHARE_MUSIC);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_USER_DATA);
// refreshBody.dataType.add(ServiceConst.CARD_TYPE_USER_DATA);
refreshBody.dataType.add(ServiceConst.CARD_TYPE_NOVELTY);
query.put("data", GsonUtil.jsonFromObject(refreshBody));
mRefreshApiService.refreshData(query)
@@ -73,7 +75,7 @@ public class RefreshModel {
public void onSuccess(BaseData o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess();
callback.onSuccess(o);
}
}
@@ -129,7 +131,7 @@ public class RefreshModel {
public void onSuccess(BaseData o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess();
callback.onSuccess(o);
}
}
@@ -143,4 +145,52 @@ public class RefreshModel {
});
}
}
/**
* 查询车辆 及路线
*
* @param latLng 经纬度
* @param onlyFocus 是否仅查询已关注的好友
* @param onlySameCity 是否仅查询注册城市相同的同城用户
* @param callback
*/
public void queryOnLineCarWithRoute(MogoLatLng latLng,
boolean onlyFocus,
boolean onlySameCity,
final RefreshCallback callback){
if (mRefreshApiService != null) {
final Map<String, Object> query = new ParamsProvider.Builder(mContext).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.sn = Utils.getSn();
refreshBody.location = new RefreshBody.LatLon(latLng.lat, latLng.lng);
refreshBody.onlyFocus = onlyFocus;
refreshBody.onlySameCity = onlySameCity;
query.put("data", GsonUtil.jsonFromObject(refreshBody));
mRefreshApiService.queryOnLineCarWithRoute(query)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<MarkerResponse>(RequestOptions.create(mContext)){
@Override
public void onSuccess(MarkerResponse o) {
super.onSuccess(o);
if (callback != null) {
callback.onSuccess(o);
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
if (callback != null) {
callback.onFail();
}
}
});
}
}
}