From ea26736c392bf1e8d9aefcf4a3b92a98bdd3c0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Tue, 14 Jan 2020 12:16:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E9=9F=B3=E4=B9=90=E7=9A=84Marker=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 2 +- .../common/entity/MarkerShareMusic.java | 18 +++++++-------- .../common/entity/MarkerShowEntity.java | 11 ++++++--- .../module/service/MarkerServiceHandler.java | 2 +- .../service/marker/MapMarkerInfoView.java | 20 +++++++++++++++-- .../module/service/marker/MapMarkerView.java | 21 +++++++++++++++--- ...er_listen.png => icon_map_marker_book.png} | Bin .../icon_map_marker_location.png | Bin 0 -> 905 bytes .../src/main/res/layout/view_map_marker.xml | 5 ++--- .../main/res/layout/view_map_marker_info.xml | 3 +-- 10 files changed, 58 insertions(+), 24 deletions(-) rename modules/mogo-module-service/src/main/res/drawable-xhdpi/{icon_map_marker_listen.png => icon_map_marker_book.png} (100%) create mode 100644 modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_location.png diff --git a/.idea/misc.xml b/.idea/misc.xml index 8a8f75bfe2..703e5d4b89 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ - + 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 f31c94f46e..2f9feeff19 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 Double id; - private Double likeNumber; + private int id; + private int 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 Double shareType; + private int shareType; private String type; private MarkerUserInfo userInfo; @@ -29,19 +29,19 @@ public class MarkerShareMusic implements Serializable { this.bookInfo = bookInfo; } - public Double getId() { + public int getId() { return id; } - public void setId(Double id) { + public void setId(int id) { this.id = id; } - public Double getLikeNumber() { + public int getLikeNumber() { return likeNumber; } - public void setLikeNumber(Double likeNumber) { + public void setLikeNumber(int likeNumber) { this.likeNumber = likeNumber; } @@ -93,11 +93,11 @@ public class MarkerShareMusic implements Serializable { this.shareContentText = shareContentText; } - public Double getShareType() { + public int getShareType() { return shareType; } - public void setShareType(Double shareType) { + public void setShareType(int shareType) { this.shareType = shareType; } 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 1abd3e3eea..fd2b18276b 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 @@ -13,7 +13,7 @@ public class MarkerShowEntity { // false - 没选中,true - 选中 private boolean isChecked; - // icon 地址,例如:头像,唱片图片,探路缩略 + // icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图 private String iconUrl; // 要展示的文本 private String textContent; @@ -77,12 +77,17 @@ public class MarkerShowEntity { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MarkerShowEntity that = (MarkerShowEntity) o; - return bindObj.equals(that.bindObj); + return isChecked == that.isChecked && + Objects.equals(iconUrl, that.iconUrl) && + Objects.equals(textContent, that.textContent) && + Objects.equals(markerType, that.markerType) && + Objects.equals(bindObj, that.bindObj) && + Objects.equals(markerLocation, that.markerLocation); } @Override public int hashCode() { - return Objects.hash(bindObj); + return Objects.hash(isChecked, iconUrl, textContent, markerType, bindObj, markerLocation); } @Override 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 9173298530..4686b82471 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 @@ -231,7 +231,7 @@ public class MarkerServiceHandler { } } - getMapUIController().changeZoom(12); + getMapUIController().changeZoom(10); } /** 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 0ae6100313..59a065fc77 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 @@ -12,6 +12,7 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import com.mogo.module.common.entity.MarkerOnlineCar; +import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.service.R; import com.mogo.module.service.ServiceConst; @@ -79,13 +80,29 @@ public class MapMarkerInfoView extends MapMarkerBaseView { ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple); } } + loadImageWithMarker(markerShowEntity); break; case ServiceConst .CARD_TYPE_ROAD_CONDITION: break; case ServiceConst .CARD_TYPE_SHARE_MUSIC: - ivIconForeground.setVisibility(View.VISIBLE); + if (bindObj instanceof MarkerShareMusic) { + // 2 为书籍听书,3 为新闻,1 为qq音乐,int + switch (((MarkerShareMusic) bindObj).getShareType()) { + case 1: + ivUserHead.setImageResource(R.drawable.icon_map_marker_misic); + break; + case 2: + ivUserHead.setImageResource(R.drawable.icon_map_marker_book); + break; + case 3: + ivUserHead.setImageResource(R.drawable.icon_map_marker_news); + break; + } + } + +// ivIconForeground.setVisibility(View.VISIBLE); llMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info); ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple); break; @@ -95,7 +112,6 @@ public class MapMarkerInfoView extends MapMarkerBaseView { if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) { tvMarkerContent.setText(markerShowEntity.getTextContent()); } - loadImageWithMarker(markerShowEntity); } catch (Exception e) { e.printStackTrace(); 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 e1ac66d2f6..e3c2114314 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 @@ -9,6 +9,7 @@ import android.widget.ImageView; import androidx.annotation.Nullable; import com.mogo.module.common.entity.MarkerOnlineCar; +import com.mogo.module.common.entity.MarkerShareMusic; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.service.R; import com.mogo.module.service.ServiceConst; @@ -71,20 +72,34 @@ public class MapMarkerView extends MapMarkerBaseView { ivBg.setImageResource(R.drawable.bg_map_marker_purple); } } + loadImageWithMarker(markerShowEntity); break; case ServiceConst .CARD_TYPE_ROAD_CONDITION: break; case ServiceConst .CARD_TYPE_SHARE_MUSIC: - ivIconForeground.setVisibility(View.VISIBLE); + if (bindObj instanceof MarkerShareMusic) { + // 2 为书籍听书,3 为新闻,1 为qq音乐,int + switch (((MarkerShareMusic) bindObj).getShareType()) { + case 1: + ivUserHead.setImageResource(R.drawable.icon_map_marker_misic); + break; + case 2: + ivUserHead.setImageResource(R.drawable.icon_map_marker_book); + break; + case 3: + ivUserHead.setImageResource(R.drawable.icon_map_marker_news); + break; + } + } + +// ivIconForeground.setVisibility(View.VISIBLE); ivBg.setImageResource(R.drawable.bg_map_marker_purple); break; } ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); - loadImageWithMarker(markerShowEntity); - } catch (Exception e) { e.printStackTrace(); } diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_listen.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_book.png similarity index 100% rename from modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_listen.png rename to modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_book.png diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_location.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/icon_map_marker_location.png new file mode 100644 index 0000000000000000000000000000000000000000..0807021a550ddaec7cdbe3e23767bdd129d4123b GIT binary patch literal 905 zcmV;419tq0P)O5Es!bC?*pAKo9XJVs!=F- zU0pV%FD)E03R4KNuWL|NWt0hHI_Q)XItcJb8EhS`;>WXP)h*&eo4&pY}=D6$5l~Sb-SEOy&a&QWx#n8 zKwY?o8xvEwDd{C;J6m}C>M5S6&>kSdH32kuct$bA6IjrVM0+7aL%slQefW-p<~H{Q zGMB07mx&XgEivMA$uT*Qi)Nxs3ggcVV8%>*ZZBhE5KFQp7ae77L5sU79>9XCC?W>2 zBqeguEFmN%Zf!|kMCQe^Tr}$$36$rIBrhWKVUde=#Z?xtJM^;TMdp224w|46_*u=$^Mlq(3$XBAJ9#}Hxc&u7!M{2BoHaJqekInCxI4O?D=7&|1 f*lv7{?3dnOjKgg|`5`Y^00000NkvXXu0mjfNf4q9 literal 0 HcmV?d00001 diff --git a/modules/mogo-module-service/src/main/res/layout/view_map_marker.xml b/modules/mogo-module-service/src/main/res/layout/view_map_marker.xml index eabc960031..d58f79028f 100644 --- a/modules/mogo-module-service/src/main/res/layout/view_map_marker.xml +++ b/modules/mogo-module-service/src/main/res/layout/view_map_marker.xml @@ -11,7 +11,7 @@ android:id="@+id/ivCar" android:layout_width="@dimen/dp_34" android:layout_height="@dimen/dp_64" - android:src="@drawable/icon_map_marker_car_blue" + android:src="@drawable/icon_map_marker_car_gray" android:translationY="-5dp" app:layout_constraintEnd_toEndOf="@+id/ivBg" app:layout_constraintStart_toStartOf="@+id/ivBg" @@ -22,7 +22,7 @@ android:layout_width="@dimen/dp_68" android:layout_height="@dimen/dp_85" android:layout_gravity="center" - android:src="@drawable/bg_map_marker_blue" + android:src="@drawable/bg_map_marker_green" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -33,7 +33,6 @@ android:layout_height="@dimen/dp_56" android:layout_gravity="center" android:layout_marginTop="@dimen/dp_6" - android:background="@drawable/icon_default" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" diff --git a/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml b/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml index a2d3e6ad2a..0351e95296 100644 --- a/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml +++ b/modules/mogo-module-service/src/main/res/layout/view_map_marker_info.xml @@ -12,7 +12,7 @@ android:id="@+id/ivCar" android:layout_width="@dimen/dp_34" android:layout_height="@dimen/dp_64" - android:src="@drawable/icon_map_marker_car_blue" + android:src="@drawable/icon_map_marker_car_gray" android:translationY="-5dp" app:layout_constraintEnd_toEndOf="@+id/ivReverseTriangle" app:layout_constraintStart_toStartOf="@+id/ivReverseTriangle" @@ -31,7 +31,6 @@ android:id="@+id/ivUserHead" android:layout_width="@dimen/dp_60" android:layout_height="@dimen/dp_60" - android:background="@drawable/icon_default" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:miv_failureHolder="@drawable/icon_default"