This commit is contained in:
lixiaopeng
2020-01-16 18:29:08 +08:00
parent 644bb3ca95
commit 3025230d6b
14 changed files with 267 additions and 125 deletions

View File

@@ -3,6 +3,7 @@ package com.mogo.module.share.dialog;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
@@ -69,7 +70,9 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
if (id == R.id.btn_block_layout) { //拥堵
sendShareReceiver("1");
} else if (id == R.id.oil_price_layout) {
//TODO
Intent intent = new Intent();
intent.setData(Uri.parse("reshthing://com.zhidao.fresh.things/shareOilPrice"));
mContext.startActivity(intent);
} else if (id == R.id.traffic_check_layout) { //交通检查
sendShareReceiver("2");
} else if (id == R.id.road_closure_layout) { //封路
@@ -80,7 +83,7 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
}
/**
* 发送广播
* 发送广播 1拥堵2交通检查3封路
*/
private void sendShareReceiver(String type) {
Logger.d("liyz", "LaucherShareDialog sendShareReceiver ---->");

View File

@@ -53,6 +53,7 @@ dependencies {
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.moduleshare
} else {
implementation project(":libraries:mogo-map")
implementation project(":foudations:mogo-utils")
@@ -60,6 +61,7 @@ dependencies {
implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-share')
}
implementation 'com.shuyu:gsyVideoPlayer-armv7a:7.1.1'

View File

@@ -0,0 +1,14 @@
package com.mogo.module.tanlu.callback;
import com.mogo.commons.data.BaseData;
/**
* @author lixiaopeng
* @description 上报分享
* @since 2020-01-09
*/
public interface UploadShareCallback {
void onSuccess(BaseData data);
void onFail(String message, int code);
}

View File

@@ -12,11 +12,19 @@ public class TanluConstants {
public static final String NAVI_INFO = "navi_info";
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
public static final String[] CMD_PLAY_ROAD_CONDITION = {"播放路况"};
//上报路况
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
//xx堵不堵
public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search";
public static final String NEARBYROAD_SEARCH = "com.zhidao.pathfinder.nearbyroad.search";
//播放
public static final String PLAY_VIDEO = "com.zhidao.tanlu.play";
//分享封路
public static final String SHARE_ROAD_CLOSURE = "com.zhidao.share.road.closure";
//分享交通检查
public static final String SHARE_TRAFFIC_CHECK = "com.zhidao.share.traffic.check";
//我要分享
public static final String GO_TO_SHARE = "com.zhidao.share";
}

View File

@@ -25,6 +25,7 @@ import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.amap.api.services.poisearch.PoiResult;
import com.amap.api.services.poisearch.PoiSearch;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
@@ -51,9 +52,11 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.share.ShareControl;
import com.mogo.module.tanlu.R;
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
import com.mogo.module.tanlu.callback.RoadLineCallback;
import com.mogo.module.tanlu.callback.UploadShareCallback;
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
import com.mogo.module.tanlu.constant.TanluConstants;
import com.mogo.module.tanlu.model.Center;
@@ -110,7 +113,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
IMogoLocationListener,
View.OnClickListener {
private static final String TAG = "liyz";
private static final String TAG = "TanluCardViewFragment";
SimpleCoverVideoPlayer simpleCoverVideoPlayer;
AutoZoomInImageView autoZoomInImageView;
//map
@@ -203,10 +206,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
//切换卡片操作
iMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getActivity());
mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation(getContext());
mMogoRegisterCenter.registerMogoModuleLifecycle(TanluConstants.MODEL_NAME, this);
//语音操作
//唤醒
mogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(getContext());
@@ -234,14 +236,15 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Double longit; //经度
Double lat; //维度
if (mKeywords.equals("附近")) {
Logger.d(TAG, "附近 ----1---");
longit = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
} else {
Logger.d(TAG, "其他 ---1----");
longit = latLon.getLongitude();
lat = latLon.getLatitude();
}
Log.d(TAG, "geoSearch keywords = $keywords --cityCode = $cityCode " +
"--longitude= longit --latitude = $lat");
Log.d(TAG, "geoSearch keywords =" + mKeywords + ">>longitude= " + longit + "--latitude" + lat);
getVoiceControlRoadData(mKeywords, lat, longit);
} else {
String cityCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getCityCode();
@@ -250,7 +253,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
poiSearch.setOnPoiSearchListener(new PoiSearch.OnPoiSearchListener() {
@Override
public void onPoiSearched(PoiResult p0, int p1) {
Logger.d(TAG, "setOnPoiSearchListener ------mKeywords =" + mKeywords + ">>p1 =" + p1);
Logger.d(TAG, "setOnPoiSearchListener--mKeywords =" + mKeywords + ">>p1 =" + p1);
if (p1 == 1000) {
if (p0.getPois() != null && p0.getPois().size() != 0) {
PoiItem poi = p0.getPois().get(0);
@@ -259,15 +262,16 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Double longit; //经度
Double lat; //维度
if (mKeywords.equals("附近")) {
Logger.d(TAG, "附近 ----2---");
longit = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
} else {
Logger.d(TAG, "其他 --2----");
longit = latLon.getLongitude();
lat = latLon.getLatitude();
}
getVoiceControlRoadData(mKeywords, lat, longit);
Logger.d(TAG, "poi search keywords = $keywords --cityCode = $cityCode " +
"--longitude= $long --latitude = $lat");
Log.d(TAG, "setOnPoiSearchListener keywords =" + mKeywords + ">>longitude= " + longit + "--latitude" + lat);
} else {
Logger.e(TAG, "poi == null");
}
@@ -316,12 +320,10 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mMogoRegisterCenter.registerMogoNaviListener(TanluConstants.MODEL_NAME, new IMogoNaviListener() {
@Override
public void onInitNaviFailure() {
}
@Override
public void onInitNaviSuccess() {
}
@Override
@@ -330,9 +332,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
@Override
public void onStartNavi() { //开始导航
initModelData();
getNavigationLineData();
public void onStartNavi() { //开始导航,这期先不做
// initModelData();
// getNavigationLineData();
}
@Override
@@ -360,7 +362,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
@Override
public boolean onMarkerClicked(IMogoMarker marker) {
//点击marker以后确认他的位置然后点击下一个操作 TODO
//点击marker以后确认他的位置然后点击下一个操作
mEmptyLayout.setVisibility(View.GONE);
mRootLayout.setVisibility(View.VISIBLE);
@@ -370,7 +372,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
return false;
}
//TODO 自己打的点,需要重新
//TODO 自己打的点,需要重新组装新数据,清理老的
if (exploreWay.getFileType() == 0) { //图片
refreshPhotoData(exploreWay);
} else if (exploreWay.getFileType() == 1) { //视频
@@ -412,14 +414,13 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
* 注册listener监听
*/
private void initListener() {
Logger.d(TAG, " initListener ------> ");
//某某路堵不堵,某某地点堵不堵,附近堵不堵,播放路况 TODO
//唤醒
mogoIntentManager.registerIntentListener(TanluConstants.UPLOAD_ROAD_CONDITION, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.SPECIFIEDROAD_SEARCH, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.NEARBYROAD_SEARCH, mogoIntentListener);
//免唤醒
// AIAssist.getInstance(getActivity()).registerUnWakeupCommandCallback(TanluConstants.UPLOAD_ROAD_CONDITION, mogoVoiceListener);
mogoIntentManager.registerIntentListener(TanluConstants.PLAY_VIDEO, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.SHARE_ROAD_CLOSURE, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.SHARE_TRAFFIC_CHECK, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.GO_TO_SHARE, mogoIntentListener);
}
@@ -431,12 +432,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
public void onIntentReceived(String intentStr, Intent intent) {
String data = intent.getStringExtra("data");
Logger.e(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data);
if (intentStr.equals(TanluConstants.SPECIFIEDROAD_SEARCH)) { //地点堵不堵
if (!isCurrentPage) {
//切换探路卡片
iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
if (intentStr.equals(TanluConstants.SPECIFIEDROAD_SEARCH)) { //地点堵不堵 ok
try {
JSONObject jsonObject = new JSONObject(data);
mKeywords = jsonObject.get("location").toString();
@@ -445,27 +441,24 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
} catch (Exception e) {
e.printStackTrace();
}
} else if (intentStr.equals(TanluConstants.NEARBYROAD_SEARCH)) { //附近
if (!isCurrentPage) {
//切换探路卡片
iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
try {
JSONObject jsonObject = new JSONObject(data);
mKeywords = jsonObject.get("location").toString();
Logger.d(TAG, "mogoIntentListener nearby mKeywords = " + mKeywords);
handleActionFoo(mKeywords);
} catch (Exception e) {
e.printStackTrace();
}
} else if (intentStr.equals(TanluConstants.UPLOAD_ROAD_CONDITION)) { //上报路况
} else if (intentStr.equals(TanluConstants.UPLOAD_ROAD_CONDITION)) { //上报路况 免唤醒 ok
sendShareReceiver("1");
Logger.d(TAG, "mogoIntentListener 上报路况 ----> ");
} else if (intentStr.equals(TanluConstants.PLAY_VIDEO)) { //播放视频 免唤醒
Logger.d(TAG, "mogoIntentListener 播放视频 ----> ");
//TODO
// } else if (intentStr.equals()) { //
} else if (intentStr.equals(TanluConstants.SHARE_ROAD_CLOSURE)) { //分享封路
sendShareReceiver("3");
Logger.d(TAG, "mogoIntentListener 分享封路 ----> ");
} else if (intentStr.equals(TanluConstants.SHARE_TRAFFIC_CHECK)) { //分享交通检查
sendShareReceiver("2");
Logger.d(TAG, "mogoIntentListener 分享交通检查 ----> ");
} else if (intentStr.equals(TanluConstants.GO_TO_SHARE)) { //我要分享
ShareControl shareControl = new ShareControl();
shareControl.showDialog(getActivity());
Logger.d(TAG, "mogoIntentListener 我要分享 ----> ");
}
}
};
@@ -477,32 +470,44 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
@Override
public void onCmdSelected(String cmd) {
Logger.e(TAG, "免唤醒 onCmdSelected mogoVoiceListener cmd =" + cmd);
if (cmd.equals(TanluConstants.UPLOAD_ROAD_CONDITION)) {
sendShareReceiver("1");
if (cmd.equals(TanluConstants.PLAY_VIDEO)) {
//TODO
}
}
@Override
public void onCmdAction(String speakText) {
Logger.d(TAG, "免唤醒 onCmdAction speakText =" + speakText);
}
@Override
public void onCmdCancel(String speakText) {
Logger.d(TAG, "免唤醒 onCmdCancel speakText =" + speakText);
}
@Override
public void onSpeakEnd(String speakText) {
Logger.e(TAG, "免唤醒 onSpeakEnd speakText =" + speakText);
}
@Override
public void onSpeakSelectTimeOut(String speakText) {
Logger.e(TAG, "免唤醒 onSpeakSelectTimeOut speakText =" + speakText);
}
};
/**
* 发送广播 1拥堵2交通检查3封路
*/
private void sendShareReceiver(String type) {
Logger.d(TAG, "TanluCardViewFragment sendShareReceiver ---->");
Intent intent = new Intent();
intent.setAction("com.zhidao.roadcondition.share");
intent.putExtra("type", type);
getContext().sendBroadcast(intent);
}
private MarkerExploreWay extractFromMarker(IMogoMarker marker) {
if (marker == null) {
@@ -548,23 +553,12 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
handleData(markerExploreWayList.get(currentPosition));
}
} else if (id == R.id.tv_main_empty) { //TODO上报路况,逻辑
} else if (id == R.id.tv_main_empty) { //上报路况
Logger.d(TAG, "tv_main_empty click -----> ");
sendShareReceiver("1");
}
}
/**
* 发送广播
*/
private void sendShareReceiver(String type) {
Logger.d("liyz", "LaucherShareDialog sendShareReceiver ---->");
Intent intent = new Intent();
intent.setAction("com.zhidao.roadcondition.share");
intent.putExtra("type", type);
getContext().sendBroadcast(intent);
}
/**
* 执行图片动画
*/
@@ -689,6 +683,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
*/
@Override
public void onPerform() {
//免唤醒
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO, TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener);
isCurrentPage = true;
Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
mMarkerManager = mMogoMapService.getMarkerManager(getActivity());
@@ -736,6 +733,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
public void onDisable() {
Logger.d(TAG, "tanlu卡片 无效 ----->");
isCurrentPage = false;
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.PLAY_VIDEO);
}
@Override
@@ -814,50 +812,67 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMarkerInfo(final MarkerInfo event) {
Logger.d(TAG, "onMarkerInfo ------>");
Logger.d(TAG, "onMarkerInfo ------------>");
if (event.type.equals("1")) { //上报路况
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_block_up);
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
} else if (event.type.equals("2")) { //交通检查
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_traffic_check);
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_traffic_check);
} else if (event.type.equals("3")) { //封路
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_road_closure);
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_road_closure);
} else {
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
}
mogoImageloader.downloadImage(getActivity(), event.imageUrl, new IMogoImageLoaderListener() {
@Override
public void onStart() {
Logger.d(TAG, "onMarkerInfo onStart ------>");
}
Logger.d(TAG, "onMarkerInfo onCompleted ------>");
MogoMarkerOptions options = new MogoMarkerOptions()
.icon(mMarkerIcon)
.latitude(event.lat)
.owner(TanluConstants.MODEL_NAME)
.longitude(event.lon);
IMogoMarker marker = mMarkerManager.addMarker("share_tag", options); //随便传tag不可点击
//TODO 请求分享接口
MarkerExploreWay markerExploreWay = markerExploreWayList.get(0);
if (markerExploreWay.getUserInfo() != null) {
@Override
public void onCompleted(Bitmap bitmap) {
Logger.d(TAG, "onMarkerInfo onCompleted ------>");
MogoMarkerOptions options = new MogoMarkerOptions()
.icon(mMarkerIcon)
.latitude(event.lat)
.owner(TanluConstants.MODEL_NAME)
.longitude(event.lon);
IMogoMarker marker = mMarkerManager.addMarker("share_tag", options);
//TODO 请求分享接口
}
@Override
public void onFailure(Exception e) {
Logger.e(TAG, "onMarkerInfo onFailure -----e =" + e);
}
});
}
uploadShareInfo(markerExploreWay.getType(), "", markerExploreWay.getUserInfo().getUserName(),
markerExploreWay.getUserInfo().getUserHead());
}
/**
* push 类型1为导航数据2为通勤族
* 上报分享信息
*/
private void uploadShareInfo(String poiType, String poiImgUrl, String nickname, String headImgUrl) {
double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
String addressStr = TanluServiceHandler.getLocationClient().getLastKnowLocation().getAddress();
mTanluModelData.addTrafficCheckInfo(poiType, poiImgUrl, nickname, headImgUrl, lat, lon, addressStr,
new UploadShareCallback() {
@Override
public void onSuccess(BaseData data) {
Logger.d(TAG, "uploadShareInfo onSuccess ----->");
AIAssist.getInstance(getContext()).speakTTSVoice(getString(R.string.tanlu_share_success), null);
}
@Override
public void onFail(String message, int code) {
Logger.d(TAG, "uploadShareInfo onFail ----->");
AIAssist.getInstance(getContext()).speakTTSVoice(getString(R.string.tanlu_share_failed), null);
}
});
}
/**
* push 类型1为导航数据2为通勤族 TODO
*
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPushInfo(final PushTypeInfo event) {
Logger.d(TAG, "onPushInfo ----event.type =" + event.type);
Logger.d(TAG, " onPushInfo event.type =" + event.type);
if (event.type.equals("1")) {
getNaviRoadLineInfo();
} else if (event.type.equals("2")) {
@@ -939,6 +954,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
int intervalNum = Utils.getIntervalValue(pointList.size());
Logger.d(TAG, "drawMapLine intervalNum = $intervalNum -- pointList.size = ${pointList.size}");
int listSize = pointList.size();
passedByPoints = new ArrayList<>();
//沿途最多15个点
for (int i = 0; i < listSize; i += intervalNum) {
@@ -958,33 +974,46 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
public void getVoiceControlRoadData(String keywords, final double lat, final double lon) {
String adCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getAdCode();
String cityCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getCityCode();
Logger.d(TAG, "getVoiceControlRoadData lat =" + lat + ">>>lon =" + lon + ">>>cityCode=" + cityCode + ">>>adCode =" + adCode);
//移动到具体位置
MogoLatLng latLng = new MogoLatLng(lat, lon);
mMApUIController.moveToCenter(latLng);
Logger.d(TAG, "getVoiceControlRoadData lat =" + lat + ">>>lon =" + lon + ">>>cityCode= " + cityCode + " >>>adCode = " + adCode);
mTanluModelData.getVoiceControlRoadData(keywords, cityCode, lon, lat, adCode, new VoiceSearchCallback() {
@Override
public void onSuccess(VoiceSearchResult o) {
String discription = o.getResult().getDescription();
Logger.d(TAG, "getVoiceControlRoadData discription = " + discription);
if (o.getResult().getInformations() != null && o.getResult().getInformations().size() > 0) {
//切换到探路卡片
if (!isCurrentPage) {
//切换探路卡片
iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
speakSuccessVoice(o.getResult().getInformations(), discription == null ? "" : discription);
List<Information> informationList = o.getResult().getInformations();
//移动
MogoLatLng latLng = new MogoLatLng(lat, lon);
mMApUIController.moveToCenter(latLng);
//清除探路之前的数据
mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, false);
//打点 TODO
//打点
ArrayList<MogoMarkerOptions> optionList = new ArrayList<>();
for (int i = 0; i < informationList.size(); i++) {
//根据type确定添加的图片
if (informationList.get(i).type == 0) { //图片
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_search_poi_location);
} else if (informationList.get(i).type == 1) { //视频
String trafficType = informationList.get(i).trafficInfoType;
if (trafficType.equals("traffic_jam")) { //拥堵
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
} else if (trafficType.equals("car_checking")) { //查车
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_traffic_check);
} else if (trafficType.equals("0")) {
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_traffic_check);
} else if (trafficType.equals("traffic_control")) {
multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_road_closure);
}
MogoMarkerOptions options = new MogoMarkerOptions()
.icon(multiMarkerIcon)
.latitude(informationList.get(i).lat)
@@ -993,7 +1022,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
optionList.add(options);
}
Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
//直接使用当前数据list作为切换的数据源
} else {
@@ -1055,7 +1084,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
}
private void initStrings() {
voiceGetInfoMationTts =
getContext().getResources().getString(R.string.voice_get_informations_tts);
@@ -1081,5 +1109,3 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}

View File

@@ -23,6 +23,7 @@ public class Information extends BaseData implements Parcelable {
public int distance;
public String nickName;
public String headImgUrl;
public String trafficInfoType;
@Override
@@ -42,6 +43,7 @@ public class Information extends BaseData implements Parcelable {
dest.writeInt(this.distance);
dest.writeString(this.nickName);
dest.writeString(this.headImgUrl);
dest.writeString(this.trafficInfoType);
}
public Information() {
@@ -58,6 +60,7 @@ public class Information extends BaseData implements Parcelable {
this.distance = in.readInt();
this.nickName = in.readString();
this.headImgUrl = in.readString();
this.trafficInfoType = in.readString();
}
public static final Creator<Information> CREATOR = new Creator<Information>() {

View File

@@ -5,12 +5,14 @@ import android.util.Log;
import com.alibaba.android.arouter.launcher.ARouter;
import com.google.gson.Gson;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.network.Utils;
import com.mogo.module.tanlu.callback.AlongTheWayCallback;
import com.mogo.module.tanlu.callback.RoadLineCallback;
import com.mogo.module.tanlu.callback.UploadShareCallback;
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
import com.mogo.module.tanlu.constant.HttpConst;
import com.mogo.module.tanlu.constant.TanluConstants;
@@ -66,7 +68,7 @@ public class TanluModelData {
Logger.d(TAG, "getVoiceControlRoadData -------> " + getSn());
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
.append("sn", "ZD821C1933L00974") //getSn
.append("sn", Utils.getSn())
.append("data", searchInformationStr)
.append("getSnData", locCarsWithRadiusStr)
.build();
@@ -103,7 +105,7 @@ public class TanluModelData {
public void getRoadLineData(final RoadLineCallback callback) {
Logger.d(TAG, "getRoadLineData -------> =" + Utils.getSn());
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
.append("sn", "ZD821C1933L00974")
.append("sn", Utils.getSn())
.build();
mTanluApiService.getRoadLineInfo(params)
@@ -134,12 +136,12 @@ public class TanluModelData {
}
/**
* 导航路径,监听消息自己请求路线数据
* 导航路径,监听消息自己请求路线数据 ZD821C1933L00974
*/
public void getNaviRoadLineInfo(final RoadLineCallback callback) {
Logger.d(TAG, "getNaviRoadLineInfo -------> =" + Utils.getSn());
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
.append("sn", "ZD821C1933L00974")
.append("sn", Utils.getSn())
.build();
mTanluApiService.getNaviRoadLineInfo(params)
@@ -177,6 +179,9 @@ public class TanluModelData {
Gson gson = new Gson();
NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
Logger.d(TAG, "getNavigationLineData -------> " + getSn());
if (coordinates == null) {
return;
}
List<Double> list = new ArrayList<>();
list.add(lon);
@@ -189,7 +194,7 @@ public class TanluModelData {
.append("getSnData", locCarsWithRadiusStr)
.build();
mTanluApiService.requestInformationAlongTheWay(getSn(), params)
mTanluApiService.requestInformationAlongTheWay(Utils.getSn(), params)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<InformationAndLiveCarResult>(RequestOptions.create(mContext)) {
@@ -223,14 +228,61 @@ public class TanluModelData {
Log.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
NaviLatLngInfo naviLatLngInfo = new Gson().fromJson(naviInfo, NaviLatLngInfo.class);
Log.d(TAG, "getLocNaviInfo lat = $lat -----> lon = $lon");
if (lon == 0.0 || lat == 0.0) {
return naviLatLngInfo;
if (naviLatLngInfo != null) {
if (lon == 0.0 || lat == 0.0) {
return naviLatLngInfo;
} else {
naviLatLngInfo.setFromPoiLatitude(lat + "");
naviLatLngInfo.setFromPoiLongitude(lon + "");
SharedPrefsMgr.getInstance(mContext).putString(TanluConstants.NAVI_INFO, new Gson().toJson(naviLatLngInfo));
return naviLatLngInfo;
}
} else {
naviLatLngInfo.setFromPoiLatitude(lat + "");
naviLatLngInfo.setFromPoiLongitude(lon + "");
SharedPrefsMgr.getInstance(mContext).putString(TanluConstants.NAVI_INFO, new Gson().toJson(naviLatLngInfo));
return naviLatLngInfo;
return null;
}
}
/**
* 上报交通检查和封路 TODO
*/
public void addTrafficCheckInfo(String poiType, String poiImgUrl, String nickname, String headImgUrl,
double lat, double lon, String address, final UploadShareCallback callback) {
Gson gson = new Gson();
UploadShareRoadInfo uploadShareRoadInfo = new UploadShareRoadInfo(poiType, poiImgUrl, nickname, headImgUrl, new Center(lat, lon), address);
String uploadShareStr = gson.toJson(uploadShareRoadInfo);
Logger.d(TAG, "addTrafficCheckInfo sn= " + getSn() + ">> uploadShareStr =" + uploadShareStr);
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
.append("sn", Utils.getSn())
.append("data", uploadShareStr)
.build();
mTanluApiService.searchOnLineInformation(params)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
@Override
public void onSuccess(BaseData o) {
super.onSuccess(o);
callback.onSuccess(o);
Logger.d(TAG, "addTrafficCheckInfo onSuccess ------>");
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
callback.onFail(message, code);
Logger.e(TAG, "addTrafficCheckInfo onError message= " + message + ">>code =" + code);
}
@Override
public void onError(Throwable e) {
super.onError(e);
Logger.d(TAG, "addTrafficCheckInfo onError ------> e= " + e.getMessage());
}
});
}
}

View File

@@ -0,0 +1,26 @@
package com.mogo.module.tanlu.model;
/**
* @author lixiaopeng
* @description 分享上报信息参数
* @since 2020-01-16
*/
public class UploadShareRoadInfo {
public String poiType;
public String poiImgUrl;
public String nickname;
public String headImgUrl;
private Center location;
private String address;
public UploadShareRoadInfo(String poiType, String poiImgUrl, String nickname,
String headImgUrl, Center location, String address) {
this.poiType = poiType;
this.poiImgUrl = poiImgUrl;
this.nickname = nickname;
this.headImgUrl = headImgUrl;
this.location = location;
this.address = address;
}
}

View File

@@ -1,5 +1,6 @@
package com.mogo.module.tanlu.net;
import com.mogo.commons.data.BaseData;
import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
import com.mogo.module.tanlu.model.PathLineResult;
import com.mogo.module.tanlu.model.VoiceSearchResult;
@@ -20,7 +21,7 @@ import retrofit2.http.Query;
public interface TanluApiService {
/**
* 探路沿途数据
* 探路沿途数据,只是为了通知server下发push
*/
@FormUrlEncoded
@POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
@@ -47,5 +48,11 @@ public interface TanluApiService {
@POST("deva/car/search/no/searchInforationByAddress/v1")
Observable<VoiceSearchResult> searchOnLineInformation(@FieldMap Map<String, Object> infoBody);
/**
* 上报交通检查,封路
*/
@FormUrlEncoded
@POST("deva/car/poi/no/addNovelty/v1")
Observable<BaseData> uploadCheckTrafficInfor(@FieldMap Map<String, Object> infoBody);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -129,7 +129,7 @@
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:visibility="visible">
android:visibility="gone">
<ImageView
android:id="@+id/iv_main_empty"

View File

@@ -17,7 +17,8 @@
<string name="start_mogo_share">共享计划</string>
<string name="tanlu_previous">上一条</string>
<string name="tanlu_next">下一条</string>
<string name="tanlu_share_success">分享成功</string>
<string name="tanlu_share_failed">分享失败</string>
<array name="searching_voice_string_array">
<item >正在为您搜索路况</item>