From ee2b4991b5ca3152f7bdc07d7acacf8c641ebfad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Mon, 13 Jan 2020 20:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/common/entity/MarkerCarChat.java | 2 +- .../common/entity/MarkerDynamicData.java | 10 +-- .../common/entity/MarkerExploreWay.java | 32 +++++----- .../common/entity/MarkerHobbyDatum.java | 1 - .../module/common/entity/MarkerLocation.java | 62 +++++++++---------- .../module/common/entity/MarkerOnlineCar.java | 22 +++---- .../common/entity/MarkerShareMusic.java | 35 ++++++----- .../common/entity/MarkerShowEntity.java | 3 - .../module/common/entity/MarkerUserInfo.java | 12 ++-- .../module/service/MarkerServiceHandler.java | 56 +++++++++-------- .../service/marker/MapMarkerInfoView.java | 2 +- .../module/service/marker/MapMarkerView.java | 2 +- .../tanlu/fragment/TanluCardViewFragment.java | 12 ++-- .../com/mogo/module/tanlu/util/Utils.java | 2 +- 14 files changed, 127 insertions(+), 126 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCarChat.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCarChat.java index 63a2838939..8a87118e91 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCarChat.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCarChat.java @@ -7,8 +7,8 @@ import java.io.Serializable; @SuppressWarnings("unused") public class MarkerCarChat implements Serializable { - private MarkerLocation location; private String type; + private MarkerLocation location; private MarkerUserInfo userInfo; public MarkerLocation getLocation() { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerDynamicData.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerDynamicData.java index 5bd61f4ddf..c535a956f9 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerDynamicData.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerDynamicData.java @@ -7,15 +7,15 @@ import java.io.Serializable; @SuppressWarnings("unused") public class MarkerDynamicData implements Serializable { - private Long id; + private double id; private String name; - private Long type; + private double type; - public Long getId() { + public double getId() { return id; } - public void setId(Long id) { + public void setId(double id) { this.id = id; } @@ -27,7 +27,7 @@ public class MarkerDynamicData implements Serializable { this.name = name; } - public Long getType() { + public double getType() { return type; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java index 51c6e88820..df0972cfb3 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java @@ -7,18 +7,18 @@ import java.util.List; @SuppressWarnings("unused") public class MarkerExploreWay implements Serializable { - private String addr; - private boolean canLive; - private String cityName; - private float direction; - private Long distance; - private Long fileType; - private Long generateTime; - private List items; - private String type; - private MarkerLocation location; + private String type;//卡片类型, private String sn; - private MarkerUserInfo userInfo; + private MarkerLocation location;//位置信息 + private int direction;//方位角度 + private boolean canLive;//是否可直播(1为可直播,0不可直播) + private int fileType;//是图片还是视频(1视频,0图片) + private String addr;//北京市朝阳区三里屯街道108号 + private long generateTime;//时间戳 + private String cityName;//:"城市名称", + private double distance;//距离 + private MarkerUserInfo userInfo;//用户信息 + private List items;//视频地址和图片地址 public String getAddr() { return addr; @@ -48,23 +48,23 @@ public class MarkerExploreWay implements Serializable { return direction; } - public void setDirection(float direction) { + public void setDirection(int direction) { this.direction = direction; } - public Long getDistance() { + public double getDistance() { return distance; } - public void setDistance(Long distance) { + public void setDistance(double distance) { this.distance = distance; } - public Long getFileType() { + public double getFileType() { return fileType; } - public void setFileType(Long fileType) { + public void setFileType(int fileType) { this.fileType = fileType; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerHobbyDatum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerHobbyDatum.java index d364b2ef3c..4cf8e1504c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerHobbyDatum.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerHobbyDatum.java @@ -7,7 +7,6 @@ import java.io.Serializable; @SuppressWarnings("unused") public class MarkerHobbyDatum implements Serializable { - private String content; private int isCheck; diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerLocation.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerLocation.java index 38715c15aa..9895187033 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerLocation.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerLocation.java @@ -7,10 +7,34 @@ import java.io.Serializable; @SuppressWarnings("unused") public class MarkerLocation implements Serializable { - private String address; - private float angle; - private Double lat; - private Double lon; + private double lat;//纬度 + private double lon;//经度 + private double angle;//车头角度,可以没有 + private String address;//具体的位置信息 + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getAngle() { + return angle; + } + + public void setAngle(double angle) { + this.angle = angle; + } public String getAddress() { return address; @@ -20,37 +44,13 @@ public class MarkerLocation implements Serializable { this.address = address; } - public float getAngle() { - return angle; - } - - public void setAngle(float angle) { - this.angle = angle; - } - - public Double getLat() { - return lat; - } - - public void setLat(Double lat) { - this.lat = lat; - } - - public Double getLon() { - return lon; - } - - public void setLon(Double lon) { - this.lon = lon; - } - @Override public String toString() { return "MarkerLocation{" + - "address='" + address + '\'' + - ", angle=" + angle + - ", lat=" + lat + + "lat=" + lat + ", lon=" + lon + + ", angle=" + angle + + ", address='" + address + '\'' + '}'; } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerOnlineCar.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerOnlineCar.java index 6ee700ecd0..1bc7ea165b 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerOnlineCar.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerOnlineCar.java @@ -7,15 +7,15 @@ import java.util.List; @SuppressWarnings("unused") public class MarkerOnlineCar implements Serializable { - private List activitiesScope; - private MarkerCarInfo carInfo; - private String compatibility; - private MarkerDynamicData dynamicData; - private List hobbyData; - private boolean isFocus; - private MarkerLocation location; - private String type; - private MarkerUserInfo userInfo; + private String type;//卡片类型 + private MarkerLocation location;//所在位置 + private Boolean isFocus;//isFocus":"0-未关注,1-关注 + private MarkerUserInfo userInfo;//用户数据 + private MarkerCarInfo carInfo;//车辆数据 + private MarkerDynamicData dynamicData;//动态数据 + private List hobbyData;//爱好数据集合 + private List activitiesScope;//活动范围数据集合 + private double compatibility; public List getActivitiesScope() { return activitiesScope; @@ -33,11 +33,11 @@ public class MarkerOnlineCar implements Serializable { this.carInfo = carInfo; } - public String getCompatibility() { + public double getCompatibility() { return compatibility; } - public void setCompatibility(String compatibility) { + public void setCompatibility(double compatibility) { this.compatibility = compatibility; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShareMusic.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShareMusic.java index d4f7dfb32c..f31c94f46e 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShareMusic.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShareMusic.java @@ -8,8 +8,8 @@ import java.io.Serializable; public class MarkerShareMusic implements Serializable { private String bookInfo; - private long id; - private int likeNumber; + private Double id; + private Double likeNumber; private MarkerLocation location; private String mediaId; private String mediaImg; @@ -17,7 +17,7 @@ public class MarkerShareMusic implements Serializable { private String mediaSinger; private String mediaUrl; private String shareContentText; - private int shareType; + private Double shareType; private String type; private MarkerUserInfo userInfo; @@ -29,30 +29,22 @@ public class MarkerShareMusic implements Serializable { this.bookInfo = bookInfo; } - public long getId() { + public Double getId() { return id; } - public void setId(long id) { + public void setId(Double id) { this.id = id; } - public int getLikeNumber() { + public Double getLikeNumber() { return likeNumber; } - public void setLikeNumber(int likeNumber) { + public void setLikeNumber(Double likeNumber) { this.likeNumber = likeNumber; } - public MarkerLocation getLocation() { - return location; - } - - public void setLocation(MarkerLocation location) { - this.location = location; - } - public String getMediaId() { return mediaId; } @@ -101,11 +93,11 @@ public class MarkerShareMusic implements Serializable { this.shareContentText = shareContentText; } - public int getShareType() { + public Double getShareType() { return shareType; } - public void setShareType(int shareType) { + public void setShareType(Double shareType) { this.shareType = shareType; } @@ -125,6 +117,15 @@ public class MarkerShareMusic implements Serializable { this.userInfo = userInfo; } + public MarkerLocation getLocation() { + return location; + } + + public void setLocation(MarkerLocation location) { + this.location = location; + } + + @Override public String toString() { return "MarkerShareMusic{" + diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShowEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShowEntity.java index 1572906b37..1abd3e3eea 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShowEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerShowEntity.java @@ -19,10 +19,8 @@ public class MarkerShowEntity { private String textContent; // Marker 类型 private String markerType; - // 绑定 MarkerView 的数据 private Object bindObj; - //Marker 经纬度位置信息 private MarkerLocation markerLocation; @@ -58,7 +56,6 @@ public class MarkerShowEntity { this.markerType = markerType; } - public Object getBindObj() { return bindObj; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerUserInfo.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerUserInfo.java index a817adba38..5c29773053 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerUserInfo.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerUserInfo.java @@ -9,12 +9,12 @@ import java.util.Calendar; @SuppressWarnings("unused") public class MarkerUserInfo implements Serializable { - private int age; - private String gender; private String sn; - private String userHead; - private Long userId; - private String userName; + private long userId; + private String userName;//用户昵称 + private String userHead;//用户头像 + private String gender;//gender": "男|女|无(也可以0|1|2根据实际库存返回即可) + private int age;// 年龄段,可以为空,与车聊聊一致 public void setAge(int age) { this.age = age; @@ -25,7 +25,7 @@ public class MarkerUserInfo implements Serializable { int year = cal.get(Calendar.YEAR); //2020-30=1990 - int ageDiffer = year - age; + double ageDiffer = year - age; String ageStr = "" + ageDiffer; char[] ageChars = ageStr.toCharArray(); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java index 2e67e2e710..4355d670d9 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -167,7 +167,7 @@ public class MarkerServiceHandler { List carChat = markerCardResult.getCarChat(); List onlineCar = markerCardResult.getOnlineCar(); List exploreWay = markerCardResult.getExploreWay(); - List shareMusic = markerCardResult.getShareMusic(); +// List shareMusic = markerCardResult.getShareMusic(); if (carChat != null) { for (MarkerCarChat markerCarChat : carChat) { @@ -209,27 +209,26 @@ public class MarkerServiceHandler { markerShowEntity.setMarkerLocation(markerLocation); markerShowEntity.setMarkerType(markerExploreWay.getType()); markerShowEntity.setTextContent(markerExploreWay.getAddr()); - markerShowEntity.setIconUrl(markerExploreWay.getUserInfo().getUserHead()); drawMapMarker(markerShowEntity); } } } - if (shareMusic != null) { - for (MarkerShareMusic markerShareMusic : shareMusic) { - MarkerLocation markerLocation = markerShareMusic.getLocation(); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setBindObj(markerShareMusic); - markerShowEntity.setMarkerLocation(markerLocation); - markerShowEntity.setMarkerType(markerShareMusic.getType()); - markerShowEntity.setTextContent(markerShareMusic.getMediaName()); - markerShowEntity.setIconUrl(markerShareMusic.getMediaImg()); - - drawMapMarker(markerShowEntity); - } - } +// if (shareMusic != null) { +// for (MarkerShareMusic markerShareMusic : shareMusic) { +// MarkerLocation markerLocation = markerShareMusic.getLocation(); +// +// MarkerShowEntity markerShowEntity = new MarkerShowEntity(); +// markerShowEntity.setBindObj(markerShareMusic); +// markerShowEntity.setMarkerLocation(markerLocation); +// markerShowEntity.setMarkerType(markerShareMusic.getType()); +// markerShowEntity.setTextContent(markerShareMusic.getMediaName()); +// markerShowEntity.setIconUrl(markerShareMusic.getMediaImg()); +// +// drawMapMarker(markerShowEntity); +// } +// } } getMapUIController().changeZoom(8); @@ -240,19 +239,24 @@ public class MarkerServiceHandler { */ public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) { Logger.e(TAG, "绘制Marker====markerTag:" + markerShowEntity); - View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity); - MogoMarkerOptions options = new MogoMarkerOptions() - .owner(markerShowEntity.getMarkerType()) - .latitude(markerShowEntity.getMarkerLocation().getLat()) - .longitude(markerShowEntity.getMarkerLocation().getLon()); - options.icon(markerView); + if (markerShowEntity.getMarkerLocation() != null) { + View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity); - IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); - marker.setOnMarkerClickListener(mogoMarkerClickListener); - marker.setObject(markerShowEntity); + MogoMarkerOptions options = new MogoMarkerOptions() + .owner(markerShowEntity.getMarkerType()) + .latitude(markerShowEntity.getMarkerLocation().getLat()) + .longitude(markerShowEntity.getMarkerLocation().getLon()); + options.icon(markerView); - return marker; + IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); + marker.setOnMarkerClickListener(mogoMarkerClickListener); + marker.setObject(markerShowEntity); + return marker; + } else { + Logger.e(TAG, "Location 必须进行初始化!!!!!"); + } + return null; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java index e379d4fc47..0ae6100313 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java @@ -91,7 +91,7 @@ public class MapMarkerInfoView extends MapMarkerBaseView { break; } - ivCar.setRotation(markerShowEntity.getMarkerLocation().getAngle()); + ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) { tvMarkerContent.setText(markerShowEntity.getTextContent()); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java index 5a4c1e7e42..e1ac66d2f6 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java @@ -81,7 +81,7 @@ public class MapMarkerView extends MapMarkerBaseView { ivBg.setImageResource(R.drawable.bg_map_marker_purple); break; } - ivCar.setRotation(markerShowEntity.getMarkerLocation().getAngle()); + ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); loadImageWithMarker(markerShowEntity); diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java index dc1dd00c70..ed29a8c4a9 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java @@ -375,10 +375,10 @@ public class TanluCardViewFragment extends MvpFragment> * @param exploreWay */ private void handleData(MarkerExploreWay exploreWay) { - if (exploreWay != null && exploreWay.getFileType() != null) { - if (exploreWay.getFileType().equals("0")) { //图片 + if (exploreWay != null ) { + if (exploreWay.getFileType()==0) { //图片 refreshPhotoData(exploreWay); - } else if (exploreWay.getFileType().equals("1")) { //视频 + } else if (exploreWay.getFileType()==1) { //视频 refreshVideoData(exploreWay); } } else { @@ -483,10 +483,10 @@ public class TanluCardViewFragment extends MvpFragment> //展示第一个数据 MarkerExploreWay markerExploreWay = markerExploreWayList.get(0); - if (markerExploreWay != null && markerExploreWay.getFileType() != null) { - if (markerExploreWay.getFileType().equals("0")) { //图片 + if (markerExploreWay != null) { + if (markerExploreWay.getFileType()==0) { //图片 refreshPhotoData(markerExploreWay); - } else if (markerExploreWay.getFileType().equals("1")) { //视频 + } else if (markerExploreWay.getFileType()==1) { //视频 refreshVideoData(markerExploreWay); } } diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java index c88085e0f5..55634d1bb8 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java @@ -10,7 +10,7 @@ import java.text.DecimalFormat; public class Utils { //处理距离,大于1000时,四舍五入保留一位小数 - public static String handleDistance(long distance) { + public static String handleDistance(double distance) { if (distance < 1000) { return distance + "M"; } else {