modify interface
This commit is contained in:
@@ -4,14 +4,15 @@ import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.Text;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,13 +21,16 @@ import java.util.List;
|
||||
* @description 周边
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEventViewHolder>{
|
||||
private List<SurroundingResponse.ResultBean.PoiInfosBean> mPoiInfosList;
|
||||
public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEventViewHolder> {
|
||||
private List<MarkerExploreWay> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private TextView mAddressTv;
|
||||
private ImageView mBgImageView;
|
||||
private ImageView mTypeImageView;
|
||||
private TextView mTypeTv;
|
||||
private TextView mTotalTv;
|
||||
|
||||
|
||||
public SurroundingEventAdapter(Context context, List<SurroundingResponse.ResultBean.PoiInfosBean> poiInfosList) {
|
||||
public SurroundingEventAdapter(Context context, List<MarkerExploreWay> poiInfosList) {
|
||||
mContext = context;
|
||||
mPoiInfosList = poiInfosList;
|
||||
}
|
||||
@@ -46,12 +50,31 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SurroundingEventViewHolder holder, int position) {
|
||||
final SurroundingResponse.ResultBean.PoiInfosBean poiInfosBean = mPoiInfosList.get(position);
|
||||
if (poiInfosBean == null) {
|
||||
final MarkerExploreWay exploreWay = mPoiInfosList.get(position);
|
||||
if (exploreWay == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mAddressTv = holder.itemView.findViewById(R.id.tv_information);
|
||||
mBgImageView = holder.itemView.findViewById(R.id.iv_event_bg);
|
||||
mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.tv_poitype);
|
||||
mTotalTv = holder.itemView.findViewById(R.id.tv_info_total);
|
||||
|
||||
mTypeTv.setText(getTypeName(exploreWay.getPoiType()));
|
||||
|
||||
// mTotalTv.setText(exploreWay.);
|
||||
|
||||
|
||||
//数据绑定 TODO
|
||||
// RequestOptions requestOptions = new RequestOptions()
|
||||
// .placeholder(R.drawable.tanlu_normal_image)
|
||||
// .error(R.drawable.tanlu_normal_image)
|
||||
// .fallback(R.drawable.tanlu_normal_image);
|
||||
// Glide.with(mContext)
|
||||
// .load(imageUrl)
|
||||
// .apply(requestOptions)
|
||||
// .into(mBgImageView);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,4 +82,42 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter<SurroundingEve
|
||||
return mPoiInfosList == null ? 0 : mPoiInfosList.size();
|
||||
}
|
||||
|
||||
|
||||
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.FOURS_ACCIDENT:
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
default:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 构造数据
|
||||
* @since 2020/8/7
|
||||
*/
|
||||
public class SurroundingConstructionData implements Serializable {
|
||||
private String poiType;
|
||||
private List<MarkerExploreWay> construtList;
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public List<MarkerExploreWay> getConstrutList() {
|
||||
return construtList;
|
||||
}
|
||||
|
||||
public void setConstrutList(List<MarkerExploreWay> construtList) {
|
||||
this.construtList = construtList;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -11,9 +13,8 @@ import java.util.List;
|
||||
*/
|
||||
public class SurroundingResponse extends BaseData {
|
||||
/**
|
||||
* code : 0
|
||||
* msg : success
|
||||
* result : {"total":1,"poiInfos":[{"coordinates":[116.410712,39.96833],"uploadTimestamp":1596003623000,"timeout":1596090023000,"uploadAddress":"","distance":0,"dbId":"738038266231427072","poiType":"10002","sn":"VN000017","userId":0,"userName":"伤心狼","userHead":"https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg","likeNum":1,"uploadType":2,"uploadUser":"","imgUrl":"","content":"封路了","gasStationId":"","gasStationName":"","gasImg":"","gasPrices":"","endDate":"2020-07-30 14:20:23","fabulous":false,"direction":90,"virtualLikeNum":"","status":1,"sourceType":"10002","hitId":"Odo6mXMBEXitzfRvznNL","userType":2,"data":""}]}
|
||||
* msg : null
|
||||
* result : {"exploreWay":[{"infoId":"740635251747942400","type":"CARD_TYPE_ROAD_CONDITION","location":{"lon":116.370207,"lat":39.968394,"angle":180,"address":"测试直播"},"canLive":false,"fileType":1,"addr":"测试直播","generateTime":1596622804859,"cityName":"","distance":717,"userInfo":{"sn":"E841CC2018PZD20408","userId":0,"userName":"零下的雨008","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592473692394.jpeg"},"items":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952448035.mp4?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D465089a3c078ed60c395cb65d41f61b28e9a3397","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952453342.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D6f36b4c945197737f8576e42a5c599ed3d150a4a"}],"uploadType":"2","poiType":"10011"}]}
|
||||
*/
|
||||
private ResultBean result;
|
||||
|
||||
@@ -26,322 +27,14 @@ public class SurroundingResponse extends BaseData {
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* total : 1
|
||||
* poiInfos : [{"coordinates":[116.410712,39.96833],"uploadTimestamp":1596003623000,"timeout":1596090023000,"uploadAddress":"","distance":0,"dbId":"738038266231427072","poiType":"10002","sn":"VN000017","userId":0,"userName":"伤心狼","userHead":"https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg","likeNum":1,"uploadType":2,"uploadUser":"","imgUrl":"","content":"封路了","gasStationId":"","gasStationName":"","gasImg":"","gasPrices":"","endDate":"2020-07-30 14:20:23","fabulous":false,"direction":90,"virtualLikeNum":"","status":1,"sourceType":"10002","hitId":"Odo6mXMBEXitzfRvznNL","userType":2,"data":""}]
|
||||
*/
|
||||
private int total;
|
||||
private List<PoiInfosBean> poiInfos;
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
public List<MarkerExploreWay> getExploreWay() {
|
||||
return exploreWay;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<PoiInfosBean> getPoiInfos() {
|
||||
return poiInfos;
|
||||
}
|
||||
|
||||
public void setPoiInfos(List<PoiInfosBean> poiInfos) {
|
||||
this.poiInfos = poiInfos;
|
||||
}
|
||||
|
||||
public static class PoiInfosBean {
|
||||
/**
|
||||
* coordinates : [116.410712,39.96833]
|
||||
* uploadTimestamp : 1596003623000
|
||||
* timeout : 1596090023000
|
||||
* uploadAddress :
|
||||
* distance : 0
|
||||
* dbId : 738038266231427072
|
||||
* poiType : 10002
|
||||
* sn : VN000017
|
||||
* userId : 0
|
||||
* userName : 伤心狼
|
||||
* userHead : https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg
|
||||
* likeNum : 1
|
||||
* uploadType : 2
|
||||
* uploadUser :
|
||||
* imgUrl :
|
||||
* content : 封路了
|
||||
* gasStationId :
|
||||
* gasStationName :
|
||||
* gasImg :
|
||||
* gasPrices :
|
||||
* endDate : 2020-07-30 14:20:23
|
||||
* fabulous : false
|
||||
* direction : 90
|
||||
* virtualLikeNum :
|
||||
* status : 1
|
||||
* sourceType : 10002
|
||||
* hitId : Odo6mXMBEXitzfRvznNL
|
||||
* userType : 2
|
||||
* data :
|
||||
*/
|
||||
private long uploadTimestamp;
|
||||
private long timeout;
|
||||
private String uploadAddress;
|
||||
private int distance;
|
||||
private String dbId;
|
||||
private String poiType;
|
||||
private String sn;
|
||||
private int userId;
|
||||
private String userName;
|
||||
private String userHead;
|
||||
private int likeNum;
|
||||
private int uploadType;
|
||||
private String uploadUser;
|
||||
private String imgUrl;
|
||||
private String content;
|
||||
private String gasStationId;
|
||||
private String gasStationName;
|
||||
private String gasImg;
|
||||
private String gasPrices;
|
||||
private String endDate;
|
||||
private boolean fabulous;
|
||||
private int direction;
|
||||
private String virtualLikeNum;
|
||||
private int status;
|
||||
private String sourceType;
|
||||
private String hitId;
|
||||
private int userType;
|
||||
private String data;
|
||||
private List<Double> coordinates;
|
||||
|
||||
public long getUploadTimestamp() {
|
||||
return uploadTimestamp;
|
||||
}
|
||||
|
||||
public void setUploadTimestamp(long uploadTimestamp) {
|
||||
this.uploadTimestamp = uploadTimestamp;
|
||||
}
|
||||
|
||||
public long getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public void setTimeout(long timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public String getUploadAddress() {
|
||||
return uploadAddress;
|
||||
}
|
||||
|
||||
public void setUploadAddress(String uploadAddress) {
|
||||
this.uploadAddress = uploadAddress;
|
||||
}
|
||||
|
||||
public int getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(int distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getDbId() {
|
||||
return dbId;
|
||||
}
|
||||
|
||||
public void setDbId(String dbId) {
|
||||
this.dbId = dbId;
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserHead() {
|
||||
return userHead;
|
||||
}
|
||||
|
||||
public void setUserHead(String userHead) {
|
||||
this.userHead = userHead;
|
||||
}
|
||||
|
||||
public int getLikeNum() {
|
||||
return likeNum;
|
||||
}
|
||||
|
||||
public void setLikeNum(int likeNum) {
|
||||
this.likeNum = likeNum;
|
||||
}
|
||||
|
||||
public int getUploadType() {
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
public void setUploadType(int uploadType) {
|
||||
this.uploadType = uploadType;
|
||||
}
|
||||
|
||||
public String getUploadUser() {
|
||||
return uploadUser;
|
||||
}
|
||||
|
||||
public void setUploadUser(String uploadUser) {
|
||||
this.uploadUser = uploadUser;
|
||||
}
|
||||
|
||||
public String getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(String imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getGasStationId() {
|
||||
return gasStationId;
|
||||
}
|
||||
|
||||
public void setGasStationId(String gasStationId) {
|
||||
this.gasStationId = gasStationId;
|
||||
}
|
||||
|
||||
public String getGasStationName() {
|
||||
return gasStationName;
|
||||
}
|
||||
|
||||
public void setGasStationName(String gasStationName) {
|
||||
this.gasStationName = gasStationName;
|
||||
}
|
||||
|
||||
public String getGasImg() {
|
||||
return gasImg;
|
||||
}
|
||||
|
||||
public void setGasImg(String gasImg) {
|
||||
this.gasImg = gasImg;
|
||||
}
|
||||
|
||||
public String getGasPrices() {
|
||||
return gasPrices;
|
||||
}
|
||||
|
||||
public void setGasPrices(String gasPrices) {
|
||||
this.gasPrices = gasPrices;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public boolean isFabulous() {
|
||||
return fabulous;
|
||||
}
|
||||
|
||||
public void setFabulous(boolean fabulous) {
|
||||
this.fabulous = fabulous;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public String getVirtualLikeNum() {
|
||||
return virtualLikeNum;
|
||||
}
|
||||
|
||||
public void setVirtualLikeNum(String virtualLikeNum) {
|
||||
this.virtualLikeNum = virtualLikeNum;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSourceType() {
|
||||
return sourceType;
|
||||
}
|
||||
|
||||
public void setSourceType(String sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
}
|
||||
|
||||
public String getHitId() {
|
||||
return hitId;
|
||||
}
|
||||
|
||||
public void setHitId(String hitId) {
|
||||
this.hitId = hitId;
|
||||
}
|
||||
|
||||
public int getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(int userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List<Double> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<Double> coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
public void setExploreWay(List<MarkerExploreWay> exploreWay) {
|
||||
this.exploreWay = exploreWay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,31 +11,43 @@ import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.SurroundingEventAdapter;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstructionData;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
|
||||
import com.mogo.module.v2x.view.SurroundingEventView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.view.View.OVER_SCROLL_NEVER;
|
||||
|
||||
/**
|
||||
* 周边事件
|
||||
*/
|
||||
public class SurroundingEventFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView {
|
||||
public class SurroundingEventFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView, View.OnClickListener {
|
||||
private static final String TAG = "SurroundingFragment";
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mTotalTv;
|
||||
private RelativeLayout mEmptyLayout;
|
||||
private TextView mShareTv;
|
||||
private TextView mFreshTv;
|
||||
private SurroundingEventAdapter mAdapter;
|
||||
private SurroundingEventPresenter surroundingEventPresenter;
|
||||
private List<SurroundingResponse.ResultBean.PoiInfosBean> poiInfosList = new ArrayList<>();
|
||||
|
||||
private List<MarkerExploreWay> poiInfosList = new ArrayList<>();
|
||||
private IMogoServiceApis mApis;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -44,19 +56,21 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d("liyz", "initViews --------> ");
|
||||
Log.d(TAG, "initViews --------> ");
|
||||
mRecyclerView = findViewById(R.id.surrounding_recycleview);
|
||||
mTotalTv = findViewById(R.id.tv_brief);
|
||||
mEmptyLayout = findViewById(R.id.layout_empty_data_show);
|
||||
mShareTv = findViewById(R.id.tv_main_share);
|
||||
mFreshTv = findViewById(R.id.tv_main_refresh);
|
||||
|
||||
mShareTv.setOnClickListener(this);
|
||||
mFreshTv.setOnClickListener(this);
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 1);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
|
||||
mRecyclerView.setLayoutManager(layoutManage);
|
||||
|
||||
mAdapter = new SurroundingEventAdapter(getActivity(), poiInfosList); //TODO
|
||||
mAdapter = new SurroundingEventAdapter(getActivity(), poiInfosList);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
initData();
|
||||
@@ -73,8 +87,25 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this);
|
||||
Log.d("liyz", "onViewCreated ---------");
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
|
||||
Log.d(TAG, "onViewCreated ---------");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.tv_main_share) {
|
||||
//TODO 分享, 弹出框面板消失,出现分享弹框
|
||||
V2XEventPanelFragment fragment = new V2XEventPanelFragment();
|
||||
fragment.hidePanel();
|
||||
if (mApis != null && mApis.getShareManager() != null) {
|
||||
mApis.getShareManager().showShareDialog();
|
||||
}
|
||||
} else if (id == R.id.tv_main_refresh) { //刷新
|
||||
initData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,29 +116,67 @@ public class SurroundingEventFragment extends MvpFragment<SurroundingEventView,
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示列表数据 TODO
|
||||
* 展示列表数据
|
||||
*/
|
||||
@Override
|
||||
public void showSurroudingData(SurroundingResponse data) {
|
||||
if (data.getResult() != null) {
|
||||
SurroundingResponse.ResultBean resultBean = data.getResult();
|
||||
if (resultBean != null && resultBean.getPoiInfos() != null && resultBean.getPoiInfos().size() > 0) {
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
public void showSurroudingData(List<MarkerExploreWay> exploreWayList) {
|
||||
Log.d(TAG, "showSurroudingData -------1--");
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
Log.d(TAG, "showSurroudingData -----2----");
|
||||
//对数据进行分类
|
||||
handleCategoricalData(exploreWayList);
|
||||
|
||||
poiInfosList.clear();
|
||||
poiInfosList.addAll(resultBean.getPoiInfos());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
} else {
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
//展示数据
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
|
||||
poiInfosList.clear();
|
||||
poiInfosList.addAll(exploreWayList);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
//总条数
|
||||
mTotalTv.setText(exploreWayList.size() + "");
|
||||
} else {
|
||||
Log.d(TAG, "showSurroudingData -------3---");
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<SurroundingConstructionData> mConstructionList = new ArrayList<>();
|
||||
|
||||
|
||||
//TODO
|
||||
private List<SurroundingConstructionData> handleCategoricalData(List<MarkerExploreWay> list) {
|
||||
List<SurroundingConstructionData> tempExploreWayList = new ArrayList<>();
|
||||
Log.d(TAG, "handleCategoricalData -------1---");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MarkerExploreWay exploreWay = list.get(i);
|
||||
SurroundingConstructionData constructionData = new SurroundingConstructionData();
|
||||
List<MarkerExploreWay> tempConstrutList = new ArrayList<>();
|
||||
if (exploreWay.getPoiType().equals(MarkerPoiTypeEnum.FOURS_LIVING)) { //实时路况
|
||||
tempConstrutList.add(exploreWay);
|
||||
constructionData.setPoiType(MarkerPoiTypeEnum.FOURS_LIVING);
|
||||
constructionData.setConstrutList(tempConstrutList);
|
||||
|
||||
tempExploreWayList.add(constructionData);
|
||||
} else if (exploreWay.getPoiType().equals(MarkerPoiTypeEnum.FOURS_ACCIDENT)) {
|
||||
tempConstrutList.add(exploreWay);
|
||||
constructionData.setPoiType(MarkerPoiTypeEnum.FOURS_ACCIDENT);
|
||||
constructionData.setConstrutList(tempConstrutList);
|
||||
|
||||
tempExploreWayList.add(constructionData);
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "handleCategoricalData tempExploreWayList.size() = " + tempExploreWayList.size());
|
||||
return tempExploreWayList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
@@ -131,7 +131,7 @@ public interface V2XApiService {
|
||||
*
|
||||
* */
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/deva/car/poi/no/queryNovelty/v1")
|
||||
@POST("/deva/car/path/no/getLauncherSnapshotDataResponse/v1")
|
||||
Observable<SurroundingResponse> getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr);
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,15 +78,16 @@ public class SurroundingEventPresenter extends Presenter<SurroundingEventView> {
|
||||
@Override
|
||||
public void onSuccess(SurroundingResponse data) {
|
||||
super.onSuccess(data);
|
||||
if (data != null) {
|
||||
mView.showSurroudingData(data);
|
||||
Log.e("SurroundingFragment", "onSuccess ------ ");
|
||||
if (data != null && data.getResult() != null) {
|
||||
mView.showSurroudingData(data.getResult().getExploreWay());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Log.e(TAG, "onError message = " + message + " >>> code = " + code);
|
||||
Log.e("SurroundingFragment", "onError message = " + message + " >>> code = " + code);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
@@ -10,5 +13,5 @@ import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
*/
|
||||
public interface SurroundingEventView extends IView {
|
||||
|
||||
void showSurroudingData(SurroundingResponse data);
|
||||
void showSurroudingData(List<MarkerExploreWay> exploreWayList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user