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

This commit is contained in:
wangcongtao
2020-01-14 21:59:05 +08:00
10 changed files with 275 additions and 33 deletions

View File

@@ -11,6 +11,7 @@ public class MarkerCardResult implements Serializable {
private List<MarkerExploreWay> exploreWay;
private List<MarkerOnlineCar> onlineCar;
private List<MarkerShareMusic> shareMusic;
private List<MarkerNoveltyInfo> noveltyInfo;
public List<MarkerCarChat> getCarChat() {
return carChat;
@@ -44,6 +45,14 @@ public class MarkerCardResult implements Serializable {
this.shareMusic = shareMusic;
}
public List<MarkerNoveltyInfo> getNoveltyInfo() {
return noveltyInfo;
}
public void setNoveltyInfo(List<MarkerNoveltyInfo> noveltyInfo) {
this.noveltyInfo = noveltyInfo;
}
@Override
public String toString() {
return "MarkerCardResult{" +
@@ -51,6 +60,7 @@ public class MarkerCardResult implements Serializable {
", exploreWay=" + exploreWay +
", onlineCar=" + onlineCar +
", shareMusic=" + shareMusic +
", noveltyInfo=" + noveltyInfo +
'}';
}
}

View File

@@ -0,0 +1,110 @@
package com.mogo.module.common.entity;
public class MarkerNoveltyInfo {
private ContentData contentData;
private MarkerLocation location;
private String poiType;
private String type;
private MarkerUserInfo userInfo;
public ContentData getContentData() {
return contentData;
}
public void setContentData(ContentData contentData) {
this.contentData = contentData;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getPoiType() {
return poiType;
}
public void setPoiType(String poiType) {
this.poiType = poiType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
public class ContentData {
private String content;
private String iconUrl;
private String imgUrl;
private String infoId;
private Long likeNum;
private String title;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getInfoId() {
return infoId;
}
public void setInfoId(String infoId) {
this.infoId = infoId;
}
public Long getLikeNum() {
return likeNum;
}
public void setLikeNum(Long likeNum) {
this.likeNum = likeNum;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}

View File

@@ -13,6 +13,8 @@ public class MarkerShowEntity {
// false - 没选中true - 选中
private boolean isChecked;
// false - 非高亮true - 高亮
private boolean isHighlighted;
// icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图
private String iconUrl;
// 要展示的文本
@@ -32,6 +34,14 @@ public class MarkerShowEntity {
isChecked = checked;
}
public boolean isHighlighted() {
return isHighlighted;
}
public void setHighlighted(boolean highlighted) {
isHighlighted = highlighted;
}
public String getIconUrl() {
return iconUrl;
}
@@ -78,6 +88,7 @@ public class MarkerShowEntity {
if (o == null || getClass() != o.getClass()) return false;
MarkerShowEntity that = (MarkerShowEntity) o;
return isChecked == that.isChecked &&
isHighlighted == that.isHighlighted &&
Objects.equals(iconUrl, that.iconUrl) &&
Objects.equals(textContent, that.textContent) &&
Objects.equals(markerType, that.markerType) &&
@@ -87,13 +98,14 @@ public class MarkerShowEntity {
@Override
public int hashCode() {
return Objects.hash(isChecked, iconUrl, textContent, markerType, bindObj, markerLocation);
return Objects.hash(isChecked, isHighlighted, iconUrl, textContent, markerType, bindObj, markerLocation);
}
@Override
public String toString() {
return "MarkerShowEntity{" +
"isChecked=" + isChecked +
", isHighlighted=" + isHighlighted +
", iconUrl='" + iconUrl + '\'' +
", textContent='" + textContent + '\'' +
", markerType='" + markerType + '\'' +

View File

@@ -71,6 +71,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
private int mCurrentPosition = 0;
// 是否是点击Marker进行的页面切换false-不是true-是
private boolean isClickMarker;
@Override
protected int getLayoutId() {
return R.layout.module_main_activity_main;
@@ -86,8 +89,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
public void onPageSelected( int position ) {
try {
mCurrentPosition = position;
mMogoModuleHandler.setEnable( mCardModulesAdapter.getProvider( position ).getModuleName() );
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
mMogoModuleHandler.setEnable(mCardModulesAdapter.getProvider(position).getModuleName());
if (!isClickMarker) {
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
}
} catch ( Exception e ) {
e.printStackTrace();
}
@@ -200,10 +205,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
public boolean onMarkerClicked( IMogoMarker marker ) {
isClickMarker = true;
switch2( marker.getOwner() );
if ( mMogoModuleHandler != null ) {
mMogoModuleHandler.onMarkerReceive( marker );
}
isClickMarker = false;
return false;
}
@@ -213,7 +220,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
int position = mCardModulesAdapter.getProviderPosition( cardType );
if ( position != -1 ) {
mCardsContainer.setCurrentItem( position, Math.abs( mCurrentPosition - position ) == 1 );
mMogoCardManager.invoke( position, mMogoModuleHandler.getCurrentModuleName() );
if (!isClickMarker) {
mMogoCardManager.invoke(position, mMogoModuleHandler.getCurrentModuleName());
}
} else {
Logger.e( TAG, "Can't find type of %s's position", cardType );
}

View File

@@ -14,12 +14,15 @@ import com.mogo.module.common.entity.MarkerCarChat;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerNoveltyInfo;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.marker.MapMarkerAdapter;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.cardmanager.IMogoCardChangedListener;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.imageloader.IMogoImageloader;
@@ -27,6 +30,7 @@ import com.mogo.service.map.IMogoMapService;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
/**
@@ -49,6 +53,7 @@ public class MarkerServiceHandler {
private static IMogoStatusManager mMogoStatusManager;
private static IMogoImageloader mImageloader;
private static IMogoSocketManager mMogoSocketManager;
private static IMogoCardManager mMogoCardManager;
private static Context mContext;
@@ -57,14 +62,16 @@ public class MarkerServiceHandler {
mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context);
mImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(context);
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(context);
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
mMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation();
mMarkerManager = mMapService.getMarkerManager(context);
mNavi = mMapService.getNavi(context);
mMapUIController = mMapService.getMapUIController();
mogoMarkerClickListener = new MoGoMarkerClickListener();
// 长连接
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
mMogoSocketManager.registerOnMessageListener(401001, new IMogoOnMessageListener<MarkerResponse>() {
@Override
@@ -80,6 +87,15 @@ public class MarkerServiceHandler {
}
}
});
getMogoCardManager().registerCardChangedListener("LAUNCHER_MARKER_MODULE", new IMogoCardChangedListener() {
@Override
public void onSwitched(int position, String moduleName) {
Logger.e(TAG, "======moduleName" + moduleName);
highlightedMarker(moduleName);
}
});
}
public static IMogoMapService getMapService() {
@@ -110,6 +126,9 @@ public class MarkerServiceHandler {
return mMogoStatusManager;
}
public static IMogoCardManager getMogoCardManager() {
return mMogoCardManager;
}
private static IMogoMarker lastMarker;
@@ -134,7 +153,7 @@ public class MarkerServiceHandler {
Logger.e(TAG, "onMarkerClicked 点击了大而全中的Marker lastMarkerShowEntity" + lastMarkerShowEntity);
lastMarkerShowEntity.setChecked(false);
drawMapMarker(lastMarkerShowEntity);
drawMapMarkerItem(lastMarkerShowEntity);
lastMarker.remove();
}
@@ -145,13 +164,38 @@ public class MarkerServiceHandler {
markerShowEntity.setChecked(true);
lastMarker = drawMapMarker(markerShowEntity);
lastMarker = drawMapMarkerItem(markerShowEntity);
marker.remove();
return false;
}
}
// 记录所有的Marker
private static List<MarkerShowEntity> markerShowEntities;
// 对指定类型高亮处理
public static void highlightedMarker(String typeTag) {
if (markerShowEntities != null) {
if (lastMarker != null) {
// 将上次选中 Marker 设置为未选中状态
MarkerShowEntity lastMarkerShowEntity = (MarkerShowEntity) lastMarker.getObject();
lastMarkerShowEntity.setChecked(false);
drawMapMarkerItem(lastMarkerShowEntity);
}
lastMarker = null;
getMarkerManager().removeMarkers();
for (MarkerShowEntity markerShowEntity : markerShowEntities) {
if (markerShowEntity.getMarkerType().equals(typeTag)) {
markerShowEntity.setHighlighted(true);
} else {
markerShowEntity.setHighlighted(false);
}
drawMapMarkerItem(markerShowEntity);
}
}
}
/**
* 绘制Marker
@@ -164,13 +208,14 @@ public class MarkerServiceHandler {
if (response != null && response.getResult() != null) {
MarkerCardResult markerCardResult = response.getResult();
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
List<MarkerCarChat> carChatList = markerCardResult.getCarChat();
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
List<MarkerShareMusic> shareMusicList = markerCardResult.getShareMusic();
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
if (carChat != null) {
for (MarkerCarChat markerCarChat : carChat) {
if (carChatList != null) {
for (MarkerCarChat markerCarChat : carChatList) {
MarkerLocation markerLocation = markerCarChat.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
@@ -184,8 +229,8 @@ public class MarkerServiceHandler {
}
}
if (onlineCar != null) {
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
if (onlineCarList != null) {
for (MarkerOnlineCar markerOnlineCar : onlineCarList) {
MarkerLocation markerLocation = markerOnlineCar.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
@@ -199,8 +244,8 @@ public class MarkerServiceHandler {
}
}
if (exploreWay != null) {
for (MarkerExploreWay markerExploreWay : exploreWay) {
if (exploreWayList != null) {
for (MarkerExploreWay markerExploreWay : exploreWayList) {
if (!markerExploreWay.getCanLive()) {
MarkerLocation markerLocation = markerExploreWay.getLocation();
@@ -215,8 +260,8 @@ public class MarkerServiceHandler {
}
}
if (shareMusic != null) {
for (MarkerShareMusic markerShareMusic : shareMusic) {
if (shareMusicList != null) {
for (MarkerShareMusic markerShareMusic : shareMusicList) {
MarkerLocation markerLocation = markerShareMusic.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
@@ -230,6 +275,20 @@ public class MarkerServiceHandler {
}
}
if (noveltyInfoList != null) {
for (MarkerNoveltyInfo noveltyInfo : noveltyInfoList) {
MarkerLocation markerLocation = noveltyInfo.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj(noveltyInfo);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(noveltyInfo.getType());
markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress());
drawMapMarker(markerShowEntity);
}
}
}
getMapUIController().changeZoom(12);
}
@@ -238,7 +297,7 @@ public class MarkerServiceHandler {
* 绘制Marker
*/
public static IMogoMarker drawMapMarker(MarkerShowEntity markerShowEntity) {
Logger.e(TAG, "绘制Marker====markerTag" + markerShowEntity);
Logger.e(TAG, "绘制Marker====drawMapMarker" + markerShowEntity);
try {
if (markerShowEntity.getMarkerLocation() != null) {
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
@@ -252,6 +311,40 @@ public class MarkerServiceHandler {
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(markerShowEntity);
if (markerShowEntities == null) {
markerShowEntities = new ArrayList<>();
}
markerShowEntities.add(markerShowEntity);
return marker;
} else {
Logger.e(TAG, "Location 必须进行初始化!!!!!");
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 绘制Marker
*/
public static IMogoMarker drawMapMarkerItem(MarkerShowEntity markerShowEntity) {
Logger.e(TAG, "绘制Marker====drawMapMarkerItem" + markerShowEntity);
try {
if (markerShowEntity.getMarkerLocation() != null) {
View markerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(markerShowEntity.getMarkerType())
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
options.icon(markerView);
IMogoMarker marker = getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
marker.setOnMarkerClickListener(mogoMarkerClickListener);
marker.setObject(markerShowEntity);
return marker;
} else {
Logger.e(TAG, "Location 必须进行初始化!!!!!");

View File

@@ -95,9 +95,9 @@ public class MapMarkerInfoView extends MapMarkerBaseView {
ivUserHead.setVisibility(View.GONE);
ivIcon.setVisibility(View.VISIBLE);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_green_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_green);
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:

View File

@@ -57,6 +57,12 @@ public class MapMarkerView extends MapMarkerBaseView {
try {
Object bindObj = markerShowEntity.getBindObj();
if (markerShowEntity.isHighlighted()) {
ivBg.setAlpha(1f);
} else {
ivBg.setAlpha(0.7f);
}
switch (markerShowEntity.getMarkerType()) {
case ServiceConst.CARD_TYPE_CARS_CHATTING:
case ServiceConst.CARD_TYPE_USER_DATA:
@@ -86,8 +92,8 @@ public class MapMarkerView extends MapMarkerBaseView {
ivUserHead.setVisibility(View.GONE);
ivIcon.setVisibility(View.VISIBLE);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up);
ivBg.setImageResource(R.drawable.bg_map_marker_blue);
ivIcon.setImageResource(R.drawable.icon_map_marker_road_check);
ivBg.setImageResource(R.drawable.bg_map_marker_green);
ivCar.setImageResource(R.drawable.icon_map_marker_location_blue);
break;
case ServiceConst.CARD_TYPE_SHARE_MUSIC:

View File

@@ -57,7 +57,7 @@ public class RefreshModel {
if ( mRefreshApiService != null ) {
final Map< String, Object > query = new ParamsProvider.Builder( mContext ).build();
final RefreshBody refreshBody = new RefreshBody();
refreshBody.limit = 20;
refreshBody.limit = 5;
refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng );
refreshBody.radius = radius;
query.put( "data", GsonUtil.jsonFromObject( refreshBody ) );

View File

@@ -12,7 +12,7 @@
android:layout_width="@dimen/dp_34"
android:layout_height="@dimen/dp_64"
android:src="@drawable/icon_map_marker_car_gray"
android:translationY="-5dp"
android:translationY="-10dp"
app:layout_constraintEnd_toEndOf="@+id/ivBg"
app:layout_constraintStart_toStartOf="@+id/ivBg"
app:layout_constraintTop_toBottomOf="@+id/ivBg" />
@@ -23,6 +23,7 @@
android:layout_height="@dimen/dp_85"
android:layout_gravity="center"
android:src="@drawable/bg_map_marker_blue"
android:alpha="0.8"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -13,14 +13,15 @@
android:layout_width="@dimen/dp_34"
android:layout_height="@dimen/dp_64"
android:src="@drawable/icon_map_marker_car_gray"
android:translationY="-5dp"
android:translationY="-10dp"
app:layout_constraintEnd_toEndOf="@+id/ivReverseTriangle"
app:layout_constraintStart_toStartOf="@+id/ivReverseTriangle"
app:layout_constraintTop_toBottomOf="@+id/ivReverseTriangle" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clMarkerContent"
android:layout_width="@dimen/dp_366"
android:layout_width="wrap_content"
android:maxWidth="@dimen/dp_366"
android:layout_height="@dimen/dp_74"
android:background="@drawable/bg_map_marker_blue_info"
app:layout_constraintEnd_toEndOf="parent"
@@ -53,9 +54,9 @@
<TextView
android:id="@+id/tvMarkerContent"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginLeft="@dimen/dp_10"
android:ellipsize="end"
android:gravity="center"
android:maxLength="8"
@@ -69,7 +70,6 @@
tools:text="诗一样的女子诗诗一样的女子诗诗一样的女子诗" />
</androidx.constraintlayout.widget.ConstraintLayout >
<ImageView
android:id="@+id/ivReverseTriangle"
android:layout_width="10dp"
@@ -79,4 +79,5 @@
app:layout_constraintStart_toStartOf="@+id/clMarkerContent"
app:layout_constraintTop_toBottomOf="@+id/clMarkerContent" />
</merge >