voice and search info

This commit is contained in:
lixiaopeng
2020-01-15 21:36:55 +08:00
parent 10b261dfbc
commit 8b61c0df9b
4 changed files with 81 additions and 60 deletions

View File

@@ -13,7 +13,7 @@ public class TanluConstants {
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
public static final String UPLOAD_ROAD_CONDITION = "upload_road_condition";
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search";
public static final String NEARBYROAD_SEARCH = "com.zhidao.pathfinder.nearbyroad.search";

View File

@@ -86,6 +86,7 @@ import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
@@ -153,6 +154,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
private List<MogoLatLng> passedByPoints;
private IMogoRegisterCenter mMogoRegisterCenter;
private String mKeywords;
private boolean isCurrentPage;
@Override
@@ -296,12 +298,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
EventBus.getDefault().register(this);
initInterface();
initModelData();
handleRoadLineMessage();
initMap();
initStrings();
initListener();
//TODO 切换探路卡片
// iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
private void initModelData() {
@@ -360,11 +359,13 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mEmptyLayout.setVisibility(View.GONE);
mRootLayout.setVisibility(View.VISIBLE);
Logger.d(TAG, "onMarkerClicked registerMogoMarkerClickListener = ");
MarkerExploreWay exploreWay = extractFromMarker(marker);
if (exploreWay == null) {
return false;
}
//TODO 自己打的点,需要重新
if (exploreWay.getFileType() == 0) { //图片
refreshPhotoData(exploreWay);
} else if (exploreWay.getFileType() == 1) { //视频
@@ -409,6 +410,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
Logger.d(TAG, " initListener ------> ");
//某某路堵不堵,某某地点堵不堵,附近堵不堵,播放路况 TODO
//唤醒
mogoIntentManager.registerIntentListener(TanluConstants.UPLOAD_ROAD_CONDITION, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.SPECIFIEDROAD_SEARCH, mogoIntentListener);
mogoIntentManager.registerIntentListener(TanluConstants.NEARBYROAD_SEARCH, mogoIntentListener);
//免唤醒
@@ -424,19 +426,37 @@ 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);
JsonObject jsonObject = new JsonObject();
mKeywords = jsonObject.get("location").toString();
Logger.d(TAG, "mogoIntentListener mKeywords = " + mKeywords);
handleActionFoo(mKeywords);
if (intentStr.equals(TanluConstants.SPECIFIEDROAD_SEARCH)) { //地点堵不堵
if (!isCurrentPage) {
//切换探路卡片
iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
}
} else if (intentStr.equals(TanluConstants.NEARBYROAD_SEARCH)) { //附件
try {
JSONObject jsonObject = new JSONObject(data);
mKeywords = jsonObject.get("location").toString();
Logger.d(TAG, "mogoIntentListener specified mKeywords = " + mKeywords);
handleActionFoo(mKeywords);
} 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)) { //上报路况
sendShareReceiver("1");
// } else if (intentStr.equals()) { //上报路况
// sendShareReceiver("1");
//
// } else if (intentStr.equals()) { //
}
@@ -493,16 +513,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
}
/**
* 处理路线数据信息msgType
*/
private void handleRoadLineMessage() {
//TODO 广播类型判断
// getNavigationLineData();
// getRoadLineData();
}
/**
* @param view
*/
@@ -674,6 +684,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
*/
@Override
public void onPerform() {
isCurrentPage = true;
Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
mMarkerManager = mMogoMapService.getMarkerManager(getActivity());
List<IMogoMarker> markers = mMarkerManager.getMarkers(TanluConstants.MODEL_NAME);
@@ -719,6 +730,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
@Override
public void onDisable() {
Logger.d(TAG, "tanlu卡片 无效 ----->");
isCurrentPage = false;
}
@Override
@@ -758,11 +770,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
@Override
public void onLocationChanged(MogoLocation location) {
// if (location.getErrCode() == 0) {
// Logger.d(TAG, "onLocationChanged 当前位置 -->" + location.getAddress());
// } else {
// Logger.d(TAG, "onLocationChanged 定位失败 -->" + location.getErrInfo());
// }
}
@Override
@@ -950,12 +957,12 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
mTanluModelData.getVoiceControlRoadData(keywords, cityCode, lon, lat, adCode, new VoiceSearchCallback() {
@Override
public void onSuccess(VoiceSearchResult o) {
String discription = o.getDescription();
Logger.d(TAG, "getVoiceControlRoadData discription = " + discription);
if (o.getInformations() != null && o.getInformations().size() > 0) {
speakSuccessVoice(o.getInformations(), discription == null ? "" : discription);
String discription = o.getResult().getDescription();
Logger.d(TAG, "getVoiceControlRoadData discription = " + discription);
if (o.getResult().getInformations() != null && o.getResult().getInformations().size() > 0) {
speakSuccessVoice(o.getResult().getInformations(), discription == null ? "" : discription);
List<Information> informationList = o.getInformations();
List<Information> informationList = o.getResult().getInformations();
//移动
MogoLatLng latLng = new MogoLatLng(lat, lon);
mMApUIController.moveToCenter(latLng);
@@ -973,7 +980,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
} else if (informationList.get(i).type == 1) { //视频
}
MogoMarkerOptions options = new MogoMarkerOptions()
.icon(multiMarkerIcon)
.latitude(informationList.get(i).lat)
@@ -982,11 +988,9 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
optionList.add(options);
}
Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
//直接使用当前数据list作为切换的数据源
} else {
if (!TextUtils.isEmpty(discription)) {
AIAssist.getInstance(getContext()).speakTTSVoice(discription, null);
@@ -994,7 +998,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
AIAssist.getInstance(getContext()).speakTTSVoice("未找到其他车主分享的路况信息", null);
}
}
}
@Override

View File

@@ -5,9 +5,13 @@ class Sns {
var sns: List<CarsLive>
var localUserId: String
var localNickName: String
var localHeadImgUrl: String
constructor(sns: List<CarsLive>, localUserId: String) {
constructor(sns: List<CarsLive>, localUserId: String, localNickName: String, localHeadImgUrl: String) {
this.sns = sns
this.localUserId = localUserId
this.localNickName = localNickName
this.localHeadImgUrl = localHeadImgUrl
}
}

View File

@@ -9,31 +9,45 @@ import java.util.List;
* @since 2020-01-08
*/
public class VoiceSearchResult extends BaseData {
private List<Information> informations;
private String description;
private Sns snResult;
public List<Information> getInformations() {
return informations;
private Result result;
public Result getResult() {
return result;
}
public void setInformations(List<Information> informations) {
this.informations = informations;
public void setResult(Result result) {
this.result = result;
}
public String getDescription() {
return description;
public static class Result {
private List<Information> informations;
private String description;
private Sns snResult;
public List<Information> getInformations() {
return informations;
}
public void setInformations(List<Information> informations) {
this.informations = informations;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Sns getSnResult() {
return snResult;
}
public void setSnResult(Sns snResult) {
this.snResult = snResult;
}
}
public void setDescription(String description) {
this.description = description;
}
public Sns getSnResult() {
return snResult;
}
public void setSnResult(Sns snResult) {
this.snResult = snResult;
}
}