This commit is contained in:
wangcongtao
2020-01-17 12:52:41 +08:00
6 changed files with 136 additions and 23 deletions

View File

@@ -7,14 +7,12 @@ package com.mogo.module.common.entity;
public class MarkerNoveltyInfo {
private String type;
private MarkerLocation location;
private MarkerUserInfo userInfo;
/**
* @see MarkerPoiTypeEnum
*/
private String poiType;
private ContentData contentData;
public ContentData getContentData() {
return contentData;
}
@@ -47,21 +45,16 @@ public class MarkerNoveltyInfo {
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 long likeNum;
private String title;
private boolean displayNavigation;
private String styleType;
public String getContent() {
return content;
@@ -95,11 +88,11 @@ public class MarkerNoveltyInfo {
this.infoId = infoId;
}
public Long getLikeNum() {
public long getLikeNum() {
return likeNum;
}
public void setLikeNum(Long likeNum) {
public void setLikeNum(long likeNum) {
this.likeNum = likeNum;
}
@@ -111,5 +104,44 @@ public class MarkerNoveltyInfo {
this.title = title;
}
public boolean isDisplayNavigation() {
return displayNavigation;
}
public void setDisplayNavigation(boolean displayNavigation) {
this.displayNavigation = displayNavigation;
}
public String getStyleType() {
return styleType;
}
public void setStyleType(String styleType) {
this.styleType = styleType;
}
@Override
public String toString() {
return "ContentData{" +
"content='" + content + '\'' +
", iconUrl='" + iconUrl + '\'' +
", imgUrl='" + imgUrl + '\'' +
", infoId='" + infoId + '\'' +
", likeNum=" + likeNum +
", title='" + title + '\'' +
", displayNavigation=" + displayNavigation +
", styleType='" + styleType + '\'' +
'}';
}
}
@Override
public String toString() {
return "MarkerNoveltyInfo{" +
"type='" + type + '\'' +
", location=" + location +
", poiType='" + poiType + '\'' +
", contentData=" + contentData +
'}';
}
}

View File

@@ -50,7 +50,10 @@ import com.mogo.map.search.poisearch.MogoPoiResult;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerExploreWayItem;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.share.ShareControl;
import com.mogo.module.tanlu.R;
@@ -62,6 +65,7 @@ import com.mogo.module.tanlu.constant.TanluConstants;
import com.mogo.module.tanlu.model.Center;
import com.mogo.module.tanlu.model.Information;
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
import com.mogo.module.tanlu.model.Items;
import com.mogo.module.tanlu.model.PathLineResult;
import com.mogo.module.tanlu.model.TanluModelData;
import com.mogo.module.tanlu.model.VoiceSearchResult;
@@ -294,7 +298,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
Logger.d(TAG, "onActivityCreated -------> ");
EventBus.getDefault().register(this);
initInterface();
initModelData();
@@ -357,9 +360,10 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mEmptyLayout.setVisibility(View.GONE);
mRootLayout.setVisibility(View.VISIBLE);
Logger.d(TAG, "onMarkerClicked registerMogoMarkerClickListener = ");
Log.d(TAG, "onMarkerClicked registerMogoMarkerClickListener --1---- ");
MarkerExploreWay exploreWay = extractFromMarker(marker);
if (exploreWay == null) {
Log.e(TAG, "onMarkerClicked registerMogoMarkerClickListener --2---- ");
return false;
}
@@ -370,6 +374,8 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
handleData(exploreWay);
}
Log.d(TAG, "onMarkerClicked registerMogoMarkerClickListener --3----size() = " + markerExploreWayList.size());
//更新位置currentPosition
for (int i = 0; i < markerExploreWayList.size(); i++) {
if (markerExploreWayList.get(i) == exploreWay) {
@@ -413,7 +419,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mogoIntentManager.registerIntentListener(TanluConstants.GO_TO_SHARE, mogoIntentListener);
}
/**
* 唤醒语音
*/
@@ -459,7 +464,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Logger.d(TAG, "免唤醒 onCmdSelected mogoVoiceListener cmd =" + cmd);
if (cmd.equals(TanluConstants.PLAY_VIDEO)) { //播放路况 --ok
//TODO
FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime);
}
}
@@ -537,7 +542,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
} else if (id == R.id.tv_main_empty) { //上报路况
Logger.d(TAG, "tv_main_empty click -----> ");
sendShareReceiver("1");
}
}
@@ -661,6 +665,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
/**
* TODO
* C位事件,如何获取数据,需要有默认数据
* 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面
*/
@@ -673,6 +678,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
mMarkerManager = mMogoMapService.getMarkerManager(getActivity());
List<IMogoMarker> markers = mMarkerManager.getMarkers(TanluConstants.MODEL_NAME);
if (markers != null && markers.size() > 0) {
mEmptyLayout.setVisibility(View.GONE);
mRootLayout.setVisibility(View.VISIBLE);
@@ -685,6 +691,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
markerExploreWayList.add(exploreWay);
}
Log.e("TAG", "tanlu卡片 onPerform 有效 markerExploreWayList.size() =" + markerExploreWayList.size());
if (markers.size() == 1) {
mPreviousTv.setVisibility(View.GONE);
mNextTv.setVisibility(View.GONE);
@@ -702,11 +709,17 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
refreshVideoData(markerExploreWay);
}
}
} else {
mEmptyLayout.setVisibility(View.VISIBLE);
mRootLayout.setVisibility(View.GONE);
mEmptyTv.setText(Html.fromHtml(getContext().getString(R.string.main_empty_content)));
}
//TODO liyz
getRoadLineData();
}
/**
@@ -830,7 +843,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
/**
* 上报分享信息
* 上报分享信息 TODO
*/
private void uploadShareInfo(String poiType, String poiImgUrl, String nickname, String headImgUrl) {
double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
@@ -977,12 +990,15 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Logger.d(TAG, "getVoiceControlRoadData discription = " + discription);
if (o.getResult().getInformations() != null && o.getResult().getInformations().size() > 0) {
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
markerExploreWayList.clear(); //
markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
currentPosition = 0;
}
//转换数据结构
convertData(o.getResult().getInformations());
//切换到探路卡片
if (!isCurrentPage) {
//切换探路卡片
iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
@@ -997,6 +1013,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
for (int i = 0; i < informationList.size(); i++) {
//根据type确定添加的图片
String trafficType = informationList.get(i).trafficInfoType;
Log.e(TAG, "trafficType =" + trafficType);
if (trafficType.equals("traffic_jam")) { //拥堵
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
} else if (trafficType.equals("car_checking")) { //查车
@@ -1014,6 +1031,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
.longitude(informationList.get(i).lon);
optionList.add(options);
Log.e(TAG, "lat =" + informationList.get(i).lat + ">>>lon =" + informationList.get(i).lon);
}
Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
@@ -1035,6 +1053,64 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
});
}
/**
* 将探路的数据结构转换成 MarkerExploreWay的列表
*/
private void convertData(List<Information> informations) {
for (int i = 0 ; i < informations.size(); i++) {
MarkerExploreWay markerExploreWay = new MarkerExploreWay();
markerExploreWay.setAddr(informations.get(i).addr);
markerExploreWay.setCityName(informations.get(i).cityName);
markerExploreWay.setDistance(informations.get(i).distance);
markerExploreWay.setFileType(informations.get(i).type);
markerExploreWay.setItems(convertMediaData(informations.get(i).items));
markerExploreWay.setLocation(convertLocation(informations.get(i)));
markerExploreWay.setUserInfo(convertUserInfo(informations.get(i)));
markerExploreWayList.add(markerExploreWay);
}
Log.e(TAG, "convertData markerExploreWayList.size() =" + markerExploreWayList.size());
}
/**
* 转换媒体数据
* @param items
* @return
*/
private List<MarkerExploreWayItem> convertMediaData(ArrayList<Items> items) {
List<MarkerExploreWayItem> exploreWayItems = new ArrayList<>();
MarkerExploreWayItem item = new MarkerExploreWayItem();
if (items != null && items.size() > 0) {
item.setThumbnail(items.get(0).getThumbnail());
item.setUrl(items.get(0).getUrl());
exploreWayItems.add(item);
}
return exploreWayItems;
}
private MarkerLocation convertLocation(Information information) {
MarkerLocation location = new MarkerLocation();
location.setAddress(information.addr);
location.setAngle(0);
location.setLat(information.lat);
location.setLon(information.lon);
return location;
}
private MarkerUserInfo convertUserInfo(Information information) {
MarkerUserInfo userInfo = new MarkerUserInfo();
userInfo.setUserHead(information.headImgUrl);
userInfo.setUserName(information.nickName);
return userInfo;
}
Random random = new Random();
private void speakSuccessVoice(List<Information> informations, String

View File

@@ -49,7 +49,6 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
}
}
private var control = HideControl()
private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
private var videoUrl: String? = null
@@ -109,6 +108,7 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
}
})
video_view
video_view.loadCoverImage(thumbUrl!!)
//设置url点击播放
gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.SeekBar
import com.bumptech.glide.Glide
import com.mogo.module.tanlu.R
import com.shuyu.gsyvideoplayer.GSYVideoManager
@@ -110,6 +111,7 @@ class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
override fun onAutoCompletion() {
super.onAutoCompletion()
mProgressBar.progress = 0
Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
}
override fun showWifiDialog() {
@@ -147,6 +149,9 @@ class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
}
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
super.onProgressChanged(seekBar, progress, fromUser)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="tanlu_module_marginleft">4px</dimen>
<dimen name="tanlu_module_start_width">px</dimen>
<dimen name="tanlu_module_666px">666px</dimen>