add showbound

This commit is contained in:
lixiaopeng
2020-08-12 15:02:18 +08:00
parent 84d1a155f7
commit cc927f8980
5 changed files with 77 additions and 6 deletions

View File

@@ -55,7 +55,6 @@ public class V2XServiceManager {
private static IMogoLocationClient mMogoLocationClient;
private static IMogoGeoSearch mIMogoGeoSearch;
private static IMogoSearchManager mIMogoSearchManager;
private static IMogoTopViewManager mMogoTopViewManager;
private static IMogoStatusManager mMogoStatusManager;
private static IMogoWindowManager mIMogoWindowManager;

View File

@@ -48,7 +48,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
Logger.d(MODULE_NAME, "事件面板初始化……")
fragments = arrayOf(
V2XScenarioHistoryFragment(),
SurroundingEventFragment(),
V2XSurroundingFragment(),
V2XShareEventsFragment()
)
//禁用预加载

View File

@@ -1,6 +1,7 @@
package com.mogo.module.v2x.fragment;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
@@ -22,9 +23,11 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.ServiceConst;
@@ -54,7 +57,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* 周边事件
*/
public class SurroundingEventFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView,
public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView,
View.OnClickListener, SurroundingItemClickListener {
private static final String TAG = "SurroundingFragment";
private RecyclerView mRecyclerView;
@@ -193,9 +196,6 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
return valueList;
}
// TODO 排序
/**
* 处理marker的显示
*
@@ -249,6 +249,9 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
}
}, i * 100L);
}
//自适应显示
showBonndsRoadtion(exploreWayList);
} else {
Logger.e(TAG, "onItemClickListener exploreWayList == null");
}
@@ -258,6 +261,66 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
}
}
/**
* 自适应显示
*
* @param exploreWayList
*/
private void showBonndsRoadtion(List<MarkerExploreWay> exploreWayList) {
Logger.e(TAG, "showBonndsRoadtion exploreWayList.size() = " + exploreWayList.size());
Rect rect = new Rect(
(int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
(int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
(int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
(int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
moveNotFresh();
//第一个参数调用者,第二个参数当前自车的位置,第三个参数需要显示在范围内的点不包含自车的位置
//第四个参数显示范围的UI边界,第五个参数是否锁定自车位置看业务需要
V2XServiceManager.getMapUIController().showBounds(ServiceConst.CARD_TYPE_ROAD_CONDITION, null, getMogoList(exploreWayList), rect, false);
}
private void moveNotFresh() {
V2XServiceManager.getMoGoStatusManager().setUserInteractionStatus(TAG, true, false);
}
/**
* 构造经纬度列表
*
* @return
*/
private List<MogoLatLng> getMogoList(List<MarkerExploreWay> markerExploreWayList) {
List<MogoLatLng> list = new ArrayList<>();
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
if (markerExploreWayList.size() < 6) {
for (int i = 0; i < markerExploreWayList.size(); i++) {
MarkerLocation location = markerExploreWayList.get(i).getLocation();
if (location != null) {
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
list.add(mogoLatLng);
} else {
Logger.e(TAG, "getMogoList() < 6 location == null");
}
}
} else {
for (int i = 0; i < 6; i++) {
MarkerLocation location = markerExploreWayList.get(i).getLocation();
if (location != null) {
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
list.add(mogoLatLng);
} else {
Logger.e(TAG, "getMogoList() location == null");
}
}
}
} else {
Logger.e(TAG, "getMogoList() markerExploreWay == null");
}
return list;
}
@Override
public void onDestroy() {
super.onDestroy();

View File

@@ -25,4 +25,9 @@
<dimen name="module_v2x_history_event_icon_size">80px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_size">6px</dimen>
<dimen name="tanlu_module_map_left">550px</dimen>
<dimen name="tanlu_module_map_top">200px</dimen>
<dimen name="tanlu_module_map_right">200px</dimen>
<dimen name="tanlu_module_map_bottom">100px</dimen>
</resources>

View File

@@ -26,5 +26,9 @@
<dimen name="module_v2x_history_event_icon_size">40px</dimen>
<dimen name="module_v2x_surrounding_item_bottom_size">6px</dimen>
<dimen name="module_v2x_surrounding_item_size">16px</dimen>
<dimen name="tanlu_module_map_left">550px</dimen>
<dimen name="tanlu_module_map_top">200px</dimen>
<dimen name="tanlu_module_map_right">200px</dimen>
<dimen name="tanlu_module_map_bottom">100px</dimen>
</resources>