diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java index 4f286620ef..bbd8ccef16 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java @@ -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"; diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java index 1abbd6bf46..cadebf4b91 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java @@ -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> private List passedByPoints; private IMogoRegisterCenter mMogoRegisterCenter; private String mKeywords; + private boolean isCurrentPage; @Override @@ -296,12 +298,9 @@ public class TanluCardViewFragment extends MvpFragment> 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> 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> 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> 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> } - /** - * 处理路线数据信息,msgType - */ - private void handleRoadLineMessage() { - //TODO 广播类型判断 -// getNavigationLineData(); -// getRoadLineData(); - - } - /** * @param view */ @@ -674,6 +684,7 @@ public class TanluCardViewFragment extends MvpFragment> */ @Override public void onPerform() { + isCurrentPage = true; Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->"); mMarkerManager = mMogoMapService.getMarkerManager(getActivity()); List markers = mMarkerManager.getMarkers(TanluConstants.MODEL_NAME); @@ -719,6 +730,7 @@ public class TanluCardViewFragment extends MvpFragment> @Override public void onDisable() { Logger.d(TAG, "tanlu卡片 无效 ----->"); + isCurrentPage = false; } @Override @@ -758,11 +770,6 @@ public class TanluCardViewFragment extends MvpFragment> @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> 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 informationList = o.getInformations(); + List informationList = o.getResult().getInformations(); //移动 MogoLatLng latLng = new MogoLatLng(lat, lon); mMApUIController.moveToCenter(latLng); @@ -973,7 +980,6 @@ public class TanluCardViewFragment extends MvpFragment> } 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> 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> AIAssist.getInstance(getContext()).speakTTSVoice("未找到其他车主分享的路况信息", null); } } - } @Override diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt index f075745c2b..2ea9c8ebe7 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt @@ -5,9 +5,13 @@ class Sns { var sns: List var localUserId: String + var localNickName: String + var localHeadImgUrl: String - constructor(sns: List, localUserId: String) { + constructor(sns: List, localUserId: String, localNickName: String, localHeadImgUrl: String) { this.sns = sns this.localUserId = localUserId + this.localNickName = localNickName + this.localHeadImgUrl = localHeadImgUrl } } \ No newline at end of file diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java index a4ed3c5f26..086957fc6b 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java @@ -9,31 +9,45 @@ import java.util.List; * @since 2020-01-08 */ public class VoiceSearchResult extends BaseData { - private List informations; - private String description; - private Sns snResult; - public List getInformations() { - return informations; + private Result result; + + public Result getResult() { + return result; } - public void setInformations(List informations) { - this.informations = informations; + public void setResult(Result result) { + this.result = result; } - public String getDescription() { - return description; + public static class Result { + private List informations; + private String description; + private Sns snResult; + + public List getInformations() { + return informations; + } + + public void setInformations(List 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; - } }