|
|
|
|
@@ -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();
|
|
|
|
|
@@ -976,12 +989,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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -990,13 +1006,14 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
|
|
|
|
List<Information> informationList = o.getResult().getInformations();
|
|
|
|
|
//清除探路之前的数据
|
|
|
|
|
mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
|
|
|
|
|
mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, false);
|
|
|
|
|
mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
|
|
|
|
|
|
|
|
|
|
//打点
|
|
|
|
|
ArrayList<MogoMarkerOptions> optionList = new ArrayList<>();
|
|
|
|
|
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
|
|
|
|
|
|