modify currentposition and marcker click
This commit is contained in:
@@ -244,7 +244,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
longit = latLon.getLongitude();
|
||||
lat = latLon.getLatitude();
|
||||
}
|
||||
Log.d(TAG, "geoSearch keywords =" + mKeywords + ">>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();
|
||||
@@ -258,7 +258,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
if (p0.getPois() != null && p0.getPois().size() != 0) {
|
||||
PoiItem poi = p0.getPois().get(0);
|
||||
LatLonPoint latLon = poi.getLatLonPoint();
|
||||
|
||||
Double longit; //经度
|
||||
Double lat; //维度
|
||||
if (mKeywords.equals("附近")) {
|
||||
@@ -356,48 +355,56 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
//点击marker以后,确认他的位置?然后点击下一个操作
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
mRootLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
Log.d(TAG, "onMarkerClicked registerMogoMarkerClickListener --1---- ");
|
||||
MarkerExploreWay exploreWay = extractFromMarker(marker);
|
||||
if (exploreWay == null) {
|
||||
Log.e(TAG, "onMarkerClicked registerMogoMarkerClickListener --2---- ");
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO 自己打的点,需要重新组装新数据,清理老的
|
||||
if (exploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(exploreWay);
|
||||
} else if (exploreWay.getFileType() == 1) { //视频
|
||||
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) {
|
||||
currentPosition = i;
|
||||
break;
|
||||
if (exploreWay == null) { // 自己打点数据
|
||||
double lat = marker.getPosition().lat;
|
||||
//更新当前位置
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
if (markerExploreWayList.get(i).getLocation().getLat() == lat) {
|
||||
currentPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "onMarkerClicked currentPosition = " + currentPosition);
|
||||
Log.d(TAG, "onMarkerClicked 自己打点数据 currentPosition = " + currentPosition);
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
} else { //大而全数据
|
||||
double lat = exploreWay.getLocation().getLat();
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
if (markerExploreWayList.get(i).getLocation().getLat() == lat) {
|
||||
currentPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "onMarkerClicked 大而全数据 currentPosition = " + currentPosition);
|
||||
handleMarkerExploreWay(exploreWay);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) {
|
||||
if (markerExploreWay != null) {
|
||||
if (markerExploreWay.getFileType() == 0) { //图片
|
||||
refreshPhotoData(markerExploreWay);
|
||||
} else if (markerExploreWay.getFileType() == 1) { //视频
|
||||
handleData(markerExploreWay);
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "handleMarkerExploreWay == null");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理关键词搜索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void handleActionFoo(String keywords) {
|
||||
Logger.d(TAG, "handleActionFoo keywords = " + keywords);
|
||||
Log.d(TAG, "handleActionFoo keywords = " + keywords);
|
||||
speakSearchingVoice();
|
||||
GeocodeQuery geocodeQuery;
|
||||
String cityCode = TanluServiceHandler.getLocationClient().getLastKnowLocation().getCityCode();
|
||||
@@ -411,7 +418,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 注册listener监听
|
||||
*/
|
||||
private void initListener() {
|
||||
//唤醒
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.UPLOAD_ROAD_CONDITION, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.SPECIFIEDROAD_SEARCH, mogoIntentListener);
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.SHARE_ROAD_CLOSURE, mogoIntentListener);
|
||||
@@ -419,6 +425,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
mogoIntentManager.registerIntentListener(TanluConstants.GO_TO_SHARE, mogoIntentListener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 唤醒语音
|
||||
*/
|
||||
@@ -461,7 +468,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private IMogoVoiceCmdCallBack mogoVoiceListener = new IMogoVoiceCmdCallBack() {
|
||||
@Override
|
||||
public void onCmdSelected(String cmd) {
|
||||
Logger.d(TAG, "免唤醒 onCmdSelected mogoVoiceListener cmd =" + cmd);
|
||||
if (cmd.equals(TanluConstants.PLAY_VIDEO)) { //播放路况 --ok
|
||||
FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, mImageUrl, mTitle, mGenerateTime);
|
||||
}
|
||||
@@ -506,6 +512,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
return ((MarkerExploreWay) showEntity.getBindObj());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -518,28 +525,28 @@ 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());
|
||||
Log.e(TAG, " tv_previous_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition < 0) {
|
||||
return;
|
||||
// return;
|
||||
currentPosition = markerExploreWayList.size();
|
||||
}
|
||||
currentPosition--;
|
||||
Logger.d(TAG, " tv_previous_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
}
|
||||
|
||||
} else if (id == R.id.tv_next_res) { //下一个
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
Logger.d(TAG, " tv_next_res --1-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
if (currentPosition > markerExploreWayList.size()) {
|
||||
return;
|
||||
Log.e(TAG, " tv_next_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition >= markerExploreWayList.size()) {
|
||||
// return;
|
||||
currentPosition = 0;
|
||||
}
|
||||
currentPosition++;
|
||||
Logger.d(TAG, " tv_next_res --2-> currentPosition =" + currentPosition + ">> size= " + markerExploreWayList.size());
|
||||
Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
handleData(markerExploreWayList.get(currentPosition));
|
||||
}
|
||||
|
||||
} else if (id == R.id.tv_main_empty) { //上报路况
|
||||
sendShareReceiver("1");
|
||||
}
|
||||
@@ -664,7 +671,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* TODO
|
||||
* C位事件,如何获取数据,需要有默认数据
|
||||
* 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面
|
||||
*/
|
||||
@@ -989,7 +996,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
@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 (markerExploreWayList != null && markerExploreWayList.size() > 0) {
|
||||
markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
|
||||
@@ -1015,7 +1021,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
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")) { //查车
|
||||
@@ -1059,7 +1064,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
* 将探路的数据结构转换成 MarkerExploreWay的列表
|
||||
*/
|
||||
private void convertData(List<Information> informations) {
|
||||
for (int i = 0 ; i < informations.size(); i++) {
|
||||
for (int i = 0; i < informations.size(); i++) {
|
||||
MarkerExploreWay markerExploreWay = new MarkerExploreWay();
|
||||
markerExploreWay.setAddr(informations.get(i).addr);
|
||||
markerExploreWay.setCityName(informations.get(i).cityName);
|
||||
@@ -1076,6 +1081,7 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
|
||||
/**
|
||||
* 转换媒体数据
|
||||
*
|
||||
* @param items
|
||||
* @return
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user