Merge remote-tracking branch 'origin/dev_1.1.2' into dev_1.1.2

This commit is contained in:
董宏宇
2020-08-11 19:18:57 +08:00
68 changed files with 211 additions and 40 deletions

View File

@@ -79,11 +79,14 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
}
});
//数据绑定 TODO
// Glide.with(mContext)
// .load(R.drawable.icon_car_red)
// .into(mBgImageView);
//数据绑定
Glide.with(mContext)
.load(getTypeRes(surroundingConstruction.getPoiType()))
.into(mBgImageView);
Glide.with(mContext)
.load(getTypeSmallRes(surroundingConstruction.getPoiType()))
.into(mTypeImageView);
}
@Override
@@ -91,34 +94,107 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
return mPoiInfosList == null ? 0 : mPoiInfosList.size();
}
private int getTypeSmallRes(String type) {
int resId = 0;
switch (type) {
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
resId = R.drawable.mogo_image_jiaotongjiancha_small;
break;
case MarkerPoiTypeEnum.ROAD_CLOSED:
resId = R.drawable.mogo_image_fenglu_small;
break;
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
resId = R.drawable.mogo_image_daolushigong_small;
break;
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
resId = R.drawable.mogo_image_yongdu_small;
break;
case MarkerPoiTypeEnum.FOURS_PONDING:
resId = R.drawable.mogo_image_jishui_small;
break;
case MarkerPoiTypeEnum.FOURS_ICE:
resId = R.drawable.mogo_image_jiebing_small;
break;
case MarkerPoiTypeEnum.FOURS_FOG:
resId = R.drawable.mogo_image_nongwu_small;
break;
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
resId = R.drawable.mogo_image_accident_small;
break;
case MarkerPoiTypeEnum.FOURS_LIVING:
resId = R.drawable.mogo_image_shishilukuang_small;
break;
default:
resId = R.drawable.mogo_image_shishilukuang_small;
break;
}
return resId;
}
private int getTypeRes(String type) {
int resId = 0;
switch (type) {
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
resId = R.drawable.mogo_image_jiaotongjiancha_nor;
break;
case MarkerPoiTypeEnum.ROAD_CLOSED:
resId = R.drawable.mogo_image_fenglu_nor;
break;
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
resId = R.drawable.mogo_image_daolushigong_nor;
break;
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
resId = R.drawable.mogo_image_yongdu_nor;
break;
case MarkerPoiTypeEnum.FOURS_PONDING:
resId = R.drawable.mogo_image_jishui_nor;
break;
case MarkerPoiTypeEnum.FOURS_ICE:
resId = R.drawable.mogo_image_jiebing_nor;
break;
case MarkerPoiTypeEnum.FOURS_FOG:
resId = R.drawable.mogo_image_nongwu_nor;
break;
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
resId = R.drawable.mogo_image_jiaotongshigu_nor;
break;
case MarkerPoiTypeEnum.FOURS_LIVING:
resId = R.drawable.mogo_image_shishlukuang_nor;
break;
default:
resId = R.drawable.mogo_image_shishlukuang_nor;
break;
}
return resId;
}
private String getTypeName(String type) {
String typeName = "";
switch (type) {
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
typeName = "交通检查";
break;
case MarkerPoiTypeEnum.ROAD_CLOSED:
typeName = "封路";
break;
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
typeName = "道路施工";
break;
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
typeName = "道路拥堵";
break;
case MarkerPoiTypeEnum.FOURS_PONDING:
typeName = "道路积水";
break;
case MarkerPoiTypeEnum.FOURS_ICE:
typeName = "路面结冰";
break;
case MarkerPoiTypeEnum.FOURS_FOG:
typeName = "出现浓雾";
break;
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
typeName = "交通检查";
break;
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
typeName = "交通事故";
break;
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
typeName = "道路拥堵";
break;
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
typeName = "道路施工";
break;
case MarkerPoiTypeEnum.FOURS_PONDING:
typeName = "道路积水";
break;
case MarkerPoiTypeEnum.FOURS_LIVING:
typeName = "实时路况";
break;
@@ -130,5 +206,4 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
}
}

View File

@@ -125,7 +125,7 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
if (data != null) {
String poitype = data.getPoiType();
String address = data.getUploadAddress();
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(),DateTimeUtils.M_Yue_d_Ri);
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(),DateTimeUtils.MM_Yue_dd_Ri_HH_mm);
String likeNum = String.valueOf(data.getLikeNum());
String notLikeNum = String.valueOf(data.getNotLikeNum());

View File

@@ -25,6 +25,7 @@ import com.mogo.commons.voice.AIAssist;
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.MarkerPoiTypeEnum;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.v2x.R;
@@ -34,6 +35,7 @@ import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
import com.mogo.module.v2x.view.SurroundingEventView;
import com.mogo.module.v2x.view.SurroundingMarginDecoration;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.TipToast;
@@ -88,6 +90,8 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
int spacingInPixels = getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_size);
mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels));
mRecyclerView.setLayoutManager(layoutManage);
mAdapter = new SurroundingEventAdapter(getActivity(), poiInfosList, this);
@@ -149,7 +153,7 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
poiInfosList.addAll(handleMapToList(getPoiTypeMap(exploreWayList)));
mAdapter.notifyDataSetChanged();
//总条数 TODO
//总条数
String originStr = String.format(getContext().getResources().getString(R.string.v2x_surrounding_top_brief), exploreWayList.size());
SpannableString spannableString = new SpannableString(originStr);
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#256BFF")), 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@@ -166,7 +170,6 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
private Map<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
Map<String, SurroundingConstruction> mPoiTypeMarkers = new HashMap<>();
Log.d(TAG, "getPoiTypeMap list.size() = " + list.size());
for (int i = 0; i < list.size(); i++) {
MarkerExploreWay exploreWay = list.get(i);
if (!mPoiTypeMarkers.containsKey(exploreWay.getPoiType())) {
@@ -187,10 +190,11 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
List<SurroundingConstruction> valueList = new ArrayList<>(valueCollection);
Log.d(TAG, "handleMapToList valueList.size() = " + valueList.size());
return valueList;
}
// TODO 排序
/**
* 处理marker的显示
@@ -208,7 +212,7 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION);
try {
//处理 marker的显示
//处理 marker的显示 TODO 是否需要showbound
List<MarkerExploreWay> exploreWayList = construction.getConstrutList();
Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size());
if (exploreWayList != null && exploreWayList.size() > 0) {

View File

@@ -78,7 +78,7 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
@Override
public void onSuccess(SurroundingResponse data) {
super.onSuccess(data);
Log.e("SurroundingFragment", "onSuccess ------ ");
Logger.d("SurroundingFragment", "onSuccess ------> ");
if (data != null && data.getResult() != null) {
mView.showSurroudingData(data.getResult().getExploreWay());
}
@@ -87,7 +87,7 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
@Override
public void onError(String message, int code) {
super.onError(message, code);
Log.e("SurroundingFragment", "onError message = " + message + " >>> code = " + code);
Logger.e("SurroundingFragment", "onError message = " + message + " >>> code = " + code);
}
});

View File

@@ -0,0 +1,33 @@
package com.mogo.module.v2x.view;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/**
* @author lixiaopeng
* @description
* @since 2020/8/11
*/
public class SurroundingMarginDecoration extends RecyclerView.ItemDecoration {
private int margin ;
public SurroundingMarginDecoration(int space) {
margin = space;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
outRect.bottom = margin;
//由于每行都只有2个所以第一个都是2的倍数把左边距设为0
if (parent.getChildLayoutPosition(view) % 2 == 0) {
outRect.left = 0;
outRect.right = margin;
} else {
outRect.left = margin;
outRect.right = 0;
}
}
}