opt net request
This commit is contained in:
@@ -9,6 +9,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.share.R;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -30,6 +31,7 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
public LaucherShareDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context, int themeResId) {
|
||||
@@ -65,16 +67,14 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.btn_block_layout) {
|
||||
sendShareReceiver();
|
||||
sendShareReceiver("1");
|
||||
} else if (id == R.id.oil_price_layout) {
|
||||
//TODO
|
||||
|
||||
} else if (id == R.id.traffic_check_layout) {
|
||||
//TODO
|
||||
|
||||
sendShareReceiver("2");
|
||||
} else if (id == R.id.road_closure_layout) {
|
||||
//TODO
|
||||
|
||||
sendShareReceiver("2");
|
||||
}
|
||||
|
||||
dismiss();
|
||||
@@ -83,12 +83,11 @@ public class LaucherShareDialog extends Dialog implements View.OnClickListener {
|
||||
/**
|
||||
* 发送广播
|
||||
*/
|
||||
private void sendShareReceiver() {
|
||||
private void sendShareReceiver(String type) {
|
||||
Logger.d("liyz", "LaucherShareDialog sendShareReceiver ---->");
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.roadcondition.share");
|
||||
intent.putExtra("type", "1");
|
||||
intent.putExtra("keyWords", "xx");
|
||||
intent.putExtra("type", type);
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.tanlu.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
@@ -17,6 +18,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
@@ -39,6 +41,7 @@ import com.mogo.module.tanlu.callback.AlongTheWayCallback;
|
||||
import com.mogo.module.tanlu.callback.RoadLineCallback;
|
||||
import com.mogo.module.tanlu.callback.VoiceSearchCallback;
|
||||
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.PathLineResult;
|
||||
@@ -46,6 +49,7 @@ import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.VoiceSearchResult;
|
||||
import com.mogo.module.tanlu.util.Utils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
@@ -68,6 +72,7 @@ import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
|
||||
import static com.mogo.module.tanlu.util.Utils.handleDistance;
|
||||
@@ -96,6 +101,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private IMogoMapService mMogoMapService;
|
||||
private IMogoSocketManager mMogoSocketManager;
|
||||
private IMogoLocationClient mLocationClient;
|
||||
private IMogoCardManager iMogoCardManager;
|
||||
|
||||
//声音控制文字
|
||||
private String voiceGetInfoMationTts;
|
||||
@@ -150,10 +156,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
|
||||
autoZoomInImageView.setVisibility(View.GONE);
|
||||
|
||||
//视频配置
|
||||
//视频配置 TODO 需要去掉
|
||||
gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG)
|
||||
.build(simpleCoverVideoPlayer);
|
||||
// simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -161,22 +166,34 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, "东城区环球贸易中心", 1300000300);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void initInterface() {
|
||||
//图片配置
|
||||
mogoImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation();
|
||||
//地图marker
|
||||
mMogoMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(getActivity());
|
||||
//切换卡片操作
|
||||
iMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getActivity());
|
||||
|
||||
mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation(getContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
EventBus.getDefault().register(this);
|
||||
initInterface();
|
||||
mTanluModelData = new TanluModelData(getContext());
|
||||
handleRoadLineMessage();
|
||||
initMap();
|
||||
initStrings();
|
||||
|
||||
//TODO切换探路卡片
|
||||
// iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +201,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 初始化导航 TODO
|
||||
*/
|
||||
private void initMap() {
|
||||
mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation(getContext());
|
||||
mMogoRegisterCenter.registerMogoNaviListener(TanluConstants.MODEL_NAME, new IMogoNaviListener() {
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
@@ -221,30 +237,56 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理路线数据信息,msgType TODO
|
||||
*/
|
||||
private void handleRoadLineMessage() {
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoSocketManager.registerOnMessageListener(401005, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
//监听marker点击
|
||||
mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public Class<MarkerResponse> target() {
|
||||
return MarkerResponse.class;
|
||||
}
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击marker以后,确认他的位置?然后点击下一个操作 TODO
|
||||
MarkerExploreWay exploreWay = (MarkerExploreWay) marker.getObject();
|
||||
handleData(exploreWay);
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e(TAG, "handleRoadLineMessage onMsgReceived obj= " + obj);
|
||||
getRoadLineData();
|
||||
//更新位置currentPosition
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
if (markerExploreWayList.get(i).getAddr().equals(exploreWay.getAddr())) {
|
||||
currentPosition = i;
|
||||
break;
|
||||
}
|
||||
Logger.d(TAG, "onMarkerClicked currentPosition = " + currentPosition);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理路线数据信息,msgType
|
||||
*/
|
||||
private void handleRoadLineMessage() {
|
||||
// mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
// mMogoSocketManager.registerOnMessageListener(401005, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
// @Override
|
||||
// public Class<MarkerResponse> target() {
|
||||
// return MarkerResponse.class;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMsgReceived(MarkerResponse obj) {
|
||||
// Logger.e(TAG, "handleRoadLineMessage onMsgReceived obj= " + obj);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
//TODO 更加广播类型判断
|
||||
// getNavigationLineData();
|
||||
// getRoadLineData();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
@Override
|
||||
@@ -252,15 +294,20 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_previous_res) { //上一个
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
Logger.d(TAG, " tv_previous_res --1-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (currentPosition < 0) {
|
||||
return;
|
||||
}
|
||||
currentPosition--;
|
||||
Logger.d(TAG, " tv_previous_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
}
|
||||
// Logger.d(TAG, " tv_previous_res --1-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
// if (currentPosition < 0) {
|
||||
// return;
|
||||
// }
|
||||
// currentPosition--;
|
||||
// Logger.d(TAG, " tv_previous_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
// if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
// handleData(markerExploreWayList.get(currentPosition));
|
||||
// }
|
||||
|
||||
// getRoadLineData();
|
||||
// getVoiceControlRoadData("中关村");
|
||||
// getNavigationLineData();
|
||||
getNaviRoadLineInfo();
|
||||
|
||||
} else if (id == R.id.tv_next_res) { //下一个
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
@@ -274,12 +321,23 @@ 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) { //TODO上报路况,逻辑
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行图片动画
|
||||
*/
|
||||
@@ -302,19 +360,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击marker以后,确认他的位置?然后点击下一个操作
|
||||
MarkerExploreWay exploreWay = (MarkerExploreWay) marker.getObject();
|
||||
handleData(exploreWay);
|
||||
|
||||
//更新位置currentPosition
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
if (markerExploreWayList.get(i).getAddr().equals(exploreWay.getAddr())) {
|
||||
currentPosition = i;
|
||||
break;
|
||||
}
|
||||
Logger.d(TAG, "onMarkerClicked currentPosition = " + currentPosition);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -534,6 +579,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
*/
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMarkerInfo(final MarkerInfo event) {
|
||||
Logger.d(TAG, "onMarkerInfo ------>");
|
||||
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_search_poi_location);
|
||||
mogoImageloader.downloadImage(getActivity(), event.imageUrl, new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
@@ -568,14 +614,17 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
public void getNavigationLineData() {
|
||||
Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
Logger.e(TAG, "getNavigationLineData lon = " + lon + ">>>>> lat= " + lat);
|
||||
mTanluModelData.getNavigationLineData(lon, lat, new AlongTheWayCallback() {
|
||||
@Override
|
||||
public void onSuccess(InformationAndLiveCarResult data) {
|
||||
|
||||
Logger.d(TAG, "getNavigationLineData onSuccess ");
|
||||
//不做任何处理,直接出发推送,重新请求接口,划线
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
Logger.e(TAG, "getNavigationLineData onFail message = " + message + ">>>code= " + code);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -590,103 +639,139 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
public void onSuccess(PathLineResult o) {
|
||||
//绘制线路线
|
||||
if (o != null && o.getPointList() != null && o.getPointList().size() > 0) {
|
||||
int intervalNum = Utils.getIntervalValue(o.getPointList().size());
|
||||
Logger.d(TAG, "intervalNum = $intervalNum -- pointList.size = ${pointList.size}");
|
||||
int listSize = o.getPointList().size();
|
||||
|
||||
//沿途最多15个点
|
||||
for (int i = 0; i < listSize; i += intervalNum) {
|
||||
passedByPoints.add(new MogoLatLng(o.getPointList().get(i).getLat(), (o.getPointList().get(i).getLon())));
|
||||
}
|
||||
|
||||
Logger.d(TAG, "passedByPoints.size() ----> " + passedByPoints.size());
|
||||
MogoLatLng startLatLng = new MogoLatLng(o.getPointList().get(0).getLat(), o.getPointList().get(0).getLon());
|
||||
MogoLatLng endLatLng = new MogoLatLng(o.getPointList().get(listSize - 1).getLat(), o.getPointList().get(listSize - 1).getLon());
|
||||
mMarkerManager.addRouteWay(getContext(), startLatLng, endLatLng, passedByPoints);
|
||||
drawMapLine(o.getPointList());
|
||||
} else {
|
||||
Logger.e(TAG, "getRoadLineData onSuccess o.getPointList() == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
|
||||
Logger.d(TAG, "getRoadLineData onFail message =" + message + ">>>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航路线,监听消息自己请求路线数据
|
||||
*/
|
||||
public void getNaviRoadLineInfo() {
|
||||
mTanluModelData.getNaviRoadLineInfo(new RoadLineCallback() {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
//绘制线路线
|
||||
if (o != null && o.getPointList() != null && o.getPointList().size() > 0) {
|
||||
drawMapLine(o.getPointList());
|
||||
} else {
|
||||
Logger.e(TAG, "getNaviRoadLineInfo onSuccess o.getPointList() == null");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onFail message =" + message + ">>>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 声音控制道理数据
|
||||
* 绘制线路
|
||||
*/
|
||||
private void drawMapLine(List<Center> pointList) {
|
||||
int intervalNum = Utils.getIntervalValue(pointList.size());
|
||||
Logger.d(TAG, "drawMapLine intervalNum = $intervalNum -- pointList.size = ${pointList.size}");
|
||||
int listSize = pointList.size();
|
||||
|
||||
//沿途最多15个点
|
||||
for (int i = 0; i < listSize; i += intervalNum) {
|
||||
passedByPoints.add(new MogoLatLng(pointList.get(i).getLat(), (pointList.get(i).getLon())));
|
||||
}
|
||||
|
||||
Logger.d(TAG, "drawMapLine passedByPoints.size() ----> " + passedByPoints.size());
|
||||
MogoLatLng startLatLng = new MogoLatLng(pointList.get(0).getLat(), pointList.get(0).getLon());
|
||||
MogoLatLng endLatLng = new MogoLatLng(pointList.get(listSize - 1).getLat(), pointList.get(listSize - 1).getLon());
|
||||
mMarkerManager.addRouteWay(getContext(), startLatLng, endLatLng, passedByPoints);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 声音控制道路数据
|
||||
*/
|
||||
public void getVoiceControlRoadData(String keywords) {
|
||||
Double lat = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLatitude();
|
||||
Double lon = TanluServiceHandler.getLocationClient().getLastKnowLocation().getLongitude();
|
||||
String cityCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getCityCode();
|
||||
String adCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getAdCode();
|
||||
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.getDescription();
|
||||
Logger.d(TAG, "discription = " + discription);
|
||||
Logger.d(TAG, "getVoiceControlRoadData discription = " + discription);
|
||||
if (o.getInformations() != null && o.getInformations().size() > 0) {
|
||||
speakSuccessVoice(o.getInformations(), discription == null ? "" : discription);
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(discription)) {
|
||||
// VoiceController.speakVoice(discription);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(discription, null);
|
||||
} else {
|
||||
// VoiceController.speakVoice("未找到其他车主分享的路况信息");
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice("未找到其他车主分享的路况信息", null);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 展示数据
|
||||
//清除探路之前的数据
|
||||
|
||||
//直接使用当前数据list,作为切换的数据源
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String message, int code) {
|
||||
|
||||
Logger.e(TAG, "getVoiceControlRoadData onFail message = " + message + ">>>code= " + code);
|
||||
speakFailVoice(searchfaileVoiceStrings[2]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
private void speakSuccessVoice(List<Information> informations, String trafficStatus) {
|
||||
// switch (informations.size()) {
|
||||
// case 0:
|
||||
// speakFailVoice();
|
||||
// break;
|
||||
//
|
||||
// case 1:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "1"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
// case 2:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "2"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
//
|
||||
// case 3:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "3"
|
||||
// ) + trafficStatus
|
||||
// );
|
||||
//
|
||||
// default:
|
||||
// trackVoiceSearch(1);
|
||||
// VoiceController.speakVoice(
|
||||
// String.format(
|
||||
// voiceGetInfoMationTts,
|
||||
// "多"
|
||||
// ) + trafficStatus);
|
||||
// }
|
||||
switch (informations.size()) {
|
||||
case 0:
|
||||
Logger.d(TAG, "speakSuccessVoice ----> " + random.nextInt(3));
|
||||
speakFailVoice(searchfaileVoiceStrings[random.nextInt(3)]);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
trackVoiceSearch(1);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice((
|
||||
String.format(voiceGetInfoMationTts, "1") + trafficStatus), null);
|
||||
|
||||
case 2:
|
||||
trackVoiceSearch(1);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice((
|
||||
String.format(
|
||||
voiceGetInfoMationTts,
|
||||
"2"
|
||||
) + trafficStatus), null);
|
||||
|
||||
|
||||
case 3:
|
||||
trackVoiceSearch(1);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice((
|
||||
String.format(
|
||||
voiceGetInfoMationTts,
|
||||
"3"
|
||||
) + trafficStatus), null);
|
||||
|
||||
default:
|
||||
trackVoiceSearch(1);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice((
|
||||
String.format(
|
||||
voiceGetInfoMationTts,
|
||||
"多"
|
||||
) + trafficStatus), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -700,19 +785,13 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
private void speakFailVoice(String string) {
|
||||
// VoiceController.speakVoice(string);
|
||||
trackVoiceSearch(2);
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(string, null);
|
||||
}
|
||||
|
||||
//上报语音搜索
|
||||
private void trackVoiceSearch(int type) {
|
||||
// trackNormalEvent(
|
||||
// CarNet_Voice_Search, mutableMapOf("type" to type, "searchtext" to keywords, "inputlon" to inputLon,
|
||||
// "inputlat" to inputLat, "datalon" to dataLon, "datalat" to dataLat),
|
||||
// BaseApplication.getAppContext()
|
||||
// )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ public class NaviLatLngInfo implements Serializable {
|
||||
public String ToPoiLatitude = "";
|
||||
public String ToPoiLongitude= "";
|
||||
|
||||
// public Start fromStart() {
|
||||
// return Start(Double.parseDouble(FromPoiLatitude), Double.parseDouble(FromPoiLongitude));
|
||||
// }
|
||||
//
|
||||
// public End toEnd() {
|
||||
// return End(ToPoiLatitude.toDouble(), ToPoiLongitude.toDouble());
|
||||
// }
|
||||
public Start fromStart() {
|
||||
return new Start(Double.parseDouble(FromPoiLatitude), Double.parseDouble(FromPoiLongitude));
|
||||
}
|
||||
|
||||
public End toEnd() {
|
||||
return new End(Double.parseDouble(ToPoiLatitude), Double.parseDouble(ToPoiLongitude));
|
||||
}
|
||||
|
||||
public String getFromPoiLatitude() {
|
||||
return FromPoiLatitude;
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.google.gson.Gson;
|
||||
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.VoiceSearchCallback;
|
||||
@@ -21,6 +22,7 @@ import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -41,6 +43,7 @@ public class TanluModelData {
|
||||
private static final String TAG = "TanluModelData";
|
||||
|
||||
public TanluModelData(Context context) {
|
||||
Logger.d(TAG, "TanluModelData ------->");
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
mTanluApiService = network.create(TanluApiService.class, DebugConfig.getNetMode() == 3 ? HttpConst.HOST_PRODUCT : HttpConst.HOST_TEST);
|
||||
@@ -60,9 +63,10 @@ public class TanluModelData {
|
||||
list.add(lat);
|
||||
LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
Logger.d(TAG, "getVoiceControlRoadData -------> " + getSn());
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", getSn())
|
||||
.append("sn", "ZD821C1933L00974") //getSn
|
||||
.append("data", searchInformationStr)
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
@@ -83,37 +87,86 @@ public class TanluModelData {
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getVoiceControlRoadData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getVoiceControlRoadData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通勤族 事件,监听消息自己请求路线数据
|
||||
* 通勤族 事件,监听消息自己请求路线数据 ZD821C1933L00974 query.get("sn")
|
||||
*/
|
||||
public void getRoadLineData(final RoadLineCallback callback) {
|
||||
if (mTanluApiService != null) {
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", getSn())
|
||||
.build();
|
||||
mTanluApiService.getRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getRoadLineData onSuccess ------>");
|
||||
}
|
||||
Logger.d(TAG, "getRoadLineData -------> =" + Utils.getSn());
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", "ZD821C1933L00974")
|
||||
.build();
|
||||
|
||||
mTanluApiService.getRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getRoadLineData onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getRoadLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getRoadLineData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航路径,监听消息自己请求路线数据
|
||||
*/
|
||||
public void getNaviRoadLineInfo(final RoadLineCallback callback) {
|
||||
Logger.d(TAG, "getNaviRoadLineInfo -------> =" + Utils.getSn());
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
.append("sn", "ZD821C1933L00974")
|
||||
.build();
|
||||
|
||||
mTanluApiService.getNaviRoadLineInfo(params)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<PathLineResult>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(PathLineResult o) {
|
||||
super.onSuccess(o);
|
||||
callback.onSuccess(o);
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onSuccess ------>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNaviRoadLineInfo onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getNaviRoadLineInfo onError ------> e= " + e.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getRoadLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +175,8 @@ public class TanluModelData {
|
||||
*/
|
||||
public void getNavigationLineData(Double lon, Double lat, final AlongTheWayCallback callback) {
|
||||
Gson gson = new Gson();
|
||||
// NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
|
||||
NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
|
||||
Logger.d(TAG, "getNavigationLineData -------> " + getSn());
|
||||
|
||||
List<Double> list = new ArrayList<>();
|
||||
list.add(lon);
|
||||
@@ -131,7 +185,7 @@ public class TanluModelData {
|
||||
String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
|
||||
|
||||
final Map<String, Object> params = new ParamsProvider.Builder(mContext)
|
||||
// .append("onTheWayData", gson.toJson(coordinates))
|
||||
.append("onTheWayData", gson.toJson(coordinates))
|
||||
.append("getSnData", locCarsWithRadiusStr)
|
||||
.build();
|
||||
|
||||
@@ -152,6 +206,13 @@ public class TanluModelData {
|
||||
callback.onFail(message, code);
|
||||
Logger.e(TAG, "getNavigationLineData onError message= " + message + ">>code =" + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.d(TAG, "getNavigationLineData onError ------> e= " + e.getMessage());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ public interface TanluApiService {
|
||||
|
||||
/**
|
||||
* 探路沿途数据
|
||||
*
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
|
||||
@@ -34,6 +33,13 @@ public interface TanluApiService {
|
||||
@POST("yycp-travel-condition/travelDetail/info/no/commuter/v1")
|
||||
Observable<PathLineResult> getRoadLineInfo(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 获取导航路线的坐标集
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("deva/car/path/no/getOnWayPushData/v1")
|
||||
Observable<PathLineResult> getNaviRoadLineInfo(@FieldMap Map<String, Object> infoBody);
|
||||
|
||||
/**
|
||||
* 基于地理信息词缀的空间情报检索
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user