diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java index 3da4f2f19f..00634fca44 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java @@ -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{ - private List mPoiInfosList; +public class SurroundingEventAdapter extends RecyclerView.Adapter { + private List mPoiInfosList; private Context mContext; - private TextView mAddressTv; + private ImageView mBgImageView; + private ImageView mTypeImageView; + private TextView mTypeTv; + private TextView mTotalTv; - public SurroundingEventAdapter(Context context, List poiInfosList) { + public SurroundingEventAdapter(Context context, List poiInfosList) { mContext = context; mPoiInfosList = poiInfosList; } @@ -46,12 +50,31 @@ public class SurroundingEventAdapter extends RecyclerView.Adapter construtList; + + public String getPoiType() { + return poiType; + } + + public void setPoiType(String poiType) { + this.poiType = poiType; + } + + public List getConstrutList() { + return construtList; + } + + public void setConstrutList(List construtList) { + this.construtList = construtList; + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java index 1b491e4845..17b38e95e8 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java @@ -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 poiInfos; + private List exploreWay; - public int getTotal() { - return total; + public List getExploreWay() { + return exploreWay; } - public void setTotal(int total) { - this.total = total; - } - - public List getPoiInfos() { - return poiInfos; - } - - public void setPoiInfos(List 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 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 getCoordinates() { - return coordinates; - } - - public void setCoordinates(List coordinates) { - this.coordinates = coordinates; - } + public void setExploreWay(List exploreWay) { + this.exploreWay = exploreWay; } } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java index 26a26f6b98..1638696f8c 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java @@ -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 implements SurroundingEventView { +public class SurroundingEventFragment extends MvpFragment 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 poiInfosList = new ArrayList<>(); - + private List poiInfosList = new ArrayList<>(); + private IMogoServiceApis mApis; @Override protected int getLayoutId() { @@ -44,19 +56,21 @@ public class SurroundingEventFragment extends MvpFragment "); + 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 0) { - mRecyclerView.setVisibility(View.VISIBLE); - mEmptyLayout.setVisibility(View.GONE); + public void showSurroudingData(List 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 mConstructionList = new ArrayList<>(); + + + //TODO + private List handleCategoricalData(List list) { + List 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 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(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java index 78710b8999..053717d9f3 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java @@ -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 getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr); /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java index 014bb2a3b0..9f5c393869 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java @@ -78,15 +78,16 @@ public class SurroundingEventPresenter extends Presenter { @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); } }); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java index 28cd2a0ba0..0f0b6f26c3 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java @@ -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 exploreWayList); } diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml new file mode 100644 index 0000000000..4ef10f4bc0 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_go_to_share.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml new file mode 100644 index 0000000000..7656a1a428 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_refresh.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_surrounding.xml b/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_surrounding.xml index 913477cb5a..3c0ebad79b 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_surrounding.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_surrounding.xml @@ -2,37 +2,39 @@ + android:layout_width="642px" + android:layout_height="532px" + android:background="@color/surrounding_card_background"> + android:layout_height="60dp" + android:visibility="visible"> + android:textColor="@color/white" /> @@ -58,54 +60,68 @@ android:gravity="center_horizontal" android:visibility="gone"> - + + + android:text="周边5公里,暂无交通事件" + android:textColor="@color/transparent_white_30" + android:textSize="18px" + android:textStyle="bold" /> + android:text="你可以试着分享一个事件给其他车主" + android:textColor="@color/transparent_white_30" + android:textSize="18px" + android:textStyle="bold" /> - diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_fragment_surrounding_event_item.xml b/modules/mogo-module-v2x/src/main/res/layout/module_fragment_surrounding_event_item.xml index 557a0f0c82..97d76c6af4 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/module_fragment_surrounding_event_item.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/module_fragment_surrounding_event_item.xml @@ -1,30 +1,57 @@ - - - + android:src="@drawable/icon_default_black_logo" /> + + + + + + + + + + diff --git a/modules/mogo-module-v2x/src/main/res/values/color.xml b/modules/mogo-module-v2x/src/main/res/values/color.xml index c416a6e0d5..a061e014e3 100644 --- a/modules/mogo-module-v2x/src/main/res/values/color.xml +++ b/modules/mogo-module-v2x/src/main/res/values/color.xml @@ -2,5 +2,9 @@ #256BFF #3F4057 + #10121E + #FFFFFF + #4DFFFFFF + \ No newline at end of file