diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt index d958b6bff1..24e8710884 100644 --- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt @@ -2,7 +2,6 @@ package com.zhidao.mogo.module.event.panel.adapter import androidx.fragment.app.Fragment import androidx.viewpager2.adapter.FragmentStateAdapter -import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment import com.zhidao.mogo.module.event.panel.fragment.ShareEventsFragment import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventAdapter.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventAdapter.java new file mode 100644 index 0000000000..909fd2b04f --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventAdapter.java @@ -0,0 +1,46 @@ +package com.zhidao.mogo.module.event.panel.adapter; + +import android.content.Context; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +/** + * @author lixiaopeng + * @description 周边 + * @since 2020/7/29 + */ +public class SurroundingEventAdapter extends RecyclerView.Adapter{ + + //TODO 数据 + public SurroundingEventAdapter(Context context) { + + } + + @Override + public int getItemViewType(int position) { + return super.getItemViewType(position); + } + + @NonNull + @Override + public SurroundingEventViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + + return null; + } + + @Override + public void onBindViewHolder(@NonNull SurroundingEventViewHolder holder, int position) { + + } + + @Override + public int getItemCount() { + return 0; + } + + + + +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventViewHolder.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventViewHolder.java new file mode 100644 index 0000000000..cf99d90247 --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/SurroundingEventViewHolder.java @@ -0,0 +1,19 @@ +package com.zhidao.mogo.module.event.panel.adapter; + +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public class SurroundingEventViewHolder extends RecyclerView.ViewHolder{ + + public SurroundingEventViewHolder(@NonNull View itemView) { + super(itemView); + } + +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/Center.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/Center.kt new file mode 100644 index 0000000000..3f5d4debca --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/Center.kt @@ -0,0 +1,12 @@ +package com.zhidao.mogo.module.event.panel.bean + +/** + * @description + * + * @author lixiaopeng + * @since 2019-10-24 + */ +data class Center ( + val lat: Double, + val lon: Double +) diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingRequest.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingRequest.java new file mode 100644 index 0000000000..723d4be15b --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingRequest.java @@ -0,0 +1,20 @@ +package com.zhidao.mogo.module.event.panel.bean; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public class SurroundingRequest { + private Center center; + private String[] poiTypes; + private int radius; + private int limit; + + public SurroundingRequest(Center center, String[] poiTypes, int radius, int limit) { + this.center = center; + this.poiTypes = poiTypes; + this.radius = radius; + this.limit = limit; + } +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingResponse.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingResponse.java new file mode 100644 index 0000000000..14348e6bca --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/SurroundingResponse.java @@ -0,0 +1,347 @@ +package com.zhidao.mogo.module.event.panel.bean; + +import com.mogo.commons.data.BaseData; + +import java.util.List; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +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":""}]} + */ + private ResultBean result; + + public ResultBean getResult() { + return result; + } + + public void setResult(ResultBean result) { + this.result = result; + } + + 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; + + public int getTotal() { + return total; + } + + 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; + } + } + } +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java index 20567d7ca7..f3596b3d7f 100644 --- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java @@ -3,7 +3,6 @@ package com.zhidao.mogo.module.event.panel.fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Button; @@ -26,7 +25,7 @@ import com.zhidao.mogo.module.event.panel.adapter.ShareEventAdapter; import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription; import com.zhidao.mogo.module.event.panel.bean.ShareEventItem; import com.zhidao.mogo.module.event.panel.network.HostConstant; -import com.zhidao.mogo.module.event.panel.network.ShareEventApiService; +import com.zhidao.mogo.module.event.panel.network.EventApiService; import com.zhidao.mogo.module.event.panel.network.ShareEventParameter; import com.zhidao.mogo.module.event.panel.presenter.ShareEventsPresenter; @@ -44,7 +43,7 @@ public class ShareEventsFragment extends MvpFragment parameters = new HashMap<>(); parameters.put("data", GsonUtil.jsonFromObject(parameter)); - shareEventApiService.getEnthusiasmIndex(parameters) + eventApiService.getEnthusiasmIndex(parameters) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { @@ -124,7 +123,7 @@ public class ShareEventsFragment extends MvpFragment parameters = new HashMap<>(); parameters.put("data", GsonUtil.jsonFromObject(parameter)); - shareEventApiService.getShareEventList(parameters) + eventApiService.getShareEventList(parameters) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.java new file mode 100644 index 0000000000..5d0ec07aa1 --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.java @@ -0,0 +1,91 @@ +package com.zhidao.mogo.module.event.panel.fragment; + +import android.os.Bundle; +import android.util.Log; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.commons.mvp.MvpFragment; +import com.zhidao.mogo.module.event.panel.R; +import com.zhidao.mogo.module.event.panel.adapter.SurroundingEventAdapter; +import com.zhidao.mogo.module.event.panel.bean.SurroundingResponse; +import com.zhidao.mogo.module.event.panel.presenter.SurroundingEventPresenter; +import com.zhidao.mogo.module.event.panel.view.SurroundingEventView; + +/** + * 周边事件 + */ +public class SurroundingEventFragment extends MvpFragment implements SurroundingEventView { + + private static final String TAG = "SurroundingEventFragment"; + private RecyclerView recyclerView; + private View view; + private SurroundingEventAdapter mAdapter; + private SurroundingEventPresenter surroundingEventPresenter; + + + @Override + protected int getLayoutId() { + return R.layout.module_event_panel_fragment_surrounding_event; + } + + @Override + protected void initViews() { + Log.d("liyz", "initViews --------> "); + initRecyclerView(); + initData(); + + } + + @NonNull + @Override + protected SurroundingEventPresenter createPresenter() { + return surroundingEventPresenter; + } + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this); + Log.d("liyz", "onViewCreated ---------"); + + } + + private void initRecyclerView() { +// recyclerView = view.findViewById(R.id.c); +// mAdapter = new SurroundingEventAdapter(getActivity()); //TODO +// recyclerView.setAdapter(mAdapter); +// LinearLayoutManager linearLayoutManager = +// new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); +// recyclerView.setLayoutManager(linearLayoutManager); + } + + private void initData() { + surroundingEventPresenter.getSurroundingEventData(); + } + + /** + * 展示列表数据 TODO + */ + @Override + public void showSurroudingData(SurroundingResponse data) { + if (data.getResult() != null) { + SurroundingResponse.ResultBean resultBean = data.getResult(); + + } + } + + @Override + public void onDestroy() { + super.onDestroy(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + } + +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt deleted file mode 100644 index b9ffbd4e46..0000000000 --- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.zhidao.mogo.module.event.panel.fragment - -import com.mogo.commons.mvp.MvpFragment -import com.zhidao.mogo.module.event.panel.R -import com.zhidao.mogo.module.event.panel.presenter.SurroundingEventPresenter -import kotlinx.android.synthetic.main.module_event_panel_fragment_surrounding_event.* - -class SurroundingEventFragment:MvpFragment(){ - /** - * 布局资源 - * - * @return - */ - override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_surrounding_event - - /** - * 初始化控件,必须在初始化完成之后才可以实例化presenter,避免 - * presenter 生命周期错乱 - */ - override fun initViews() { - tvTitle.setOnClickListener { - EventPanelFragment.getInstance().hidePanel() - } - } - - /** - * 创建 presenter 实例 - * - * @return - */ - override fun createPresenter(): SurroundingEventPresenter = SurroundingEventPresenter(this) -} \ No newline at end of file diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/EventApiService.java similarity index 62% rename from modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java rename to modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/EventApiService.java index e449c87c38..027d3346b4 100644 --- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/EventApiService.java @@ -2,16 +2,21 @@ package com.zhidao.mogo.module.event.panel.network; import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription; import com.zhidao.mogo.module.event.panel.bean.ShareEventItem; +import com.zhidao.mogo.module.event.panel.bean.SurroundingResponse; import java.util.Map; import io.reactivex.Observable; +import okhttp3.RequestBody; +import retrofit2.http.Body; import retrofit2.http.FieldMap; import retrofit2.http.FormUrlEncoded; +import retrofit2.http.Headers; import retrofit2.http.POST; +import retrofit2.http.Query; import retrofit2.http.QueryMap; -public interface ShareEventApiService { +public interface EventApiService { //我的分享-热心指数等 @FormUrlEncoded @@ -23,4 +28,9 @@ public interface ShareEventApiService { @POST("/deva/car/pathAndPoi/no/queryInfo") Observable getShareEventList(@FieldMap Map parames); + //周边列表 + @Headers({"Content-Type:application/json", "Accept:application/json"}) + @POST("/deva/car/poi/no/queryNovelty/v1") + Observable getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr); + } diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.java new file mode 100644 index 0000000000..bbb3cfe1ca --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.java @@ -0,0 +1,112 @@ +package com.zhidao.mogo.module.event.panel.presenter; + +import android.content.Context; +import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.lifecycle.Lifecycle; +import androidx.lifecycle.LifecycleOwner; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.mvp.Presenter; +import com.mogo.commons.network.SubscribeImpl; +import com.mogo.commons.network.Utils; +import com.mogo.map.location.MogoLocation; +import com.mogo.service.IMogoServiceApis; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.network.IMogoNetwork; +import com.mogo.utils.logger.Logger; +import com.mogo.utils.network.RequestOptions; +import com.mogo.utils.network.utils.GsonUtil; +import com.zhidao.mogo.module.event.panel.bean.Center; +import com.zhidao.mogo.module.event.panel.bean.SurroundingRequest; +import com.zhidao.mogo.module.event.panel.bean.SurroundingResponse; +import com.zhidao.mogo.module.event.panel.network.HostConstant; +import com.zhidao.mogo.module.event.panel.network.EventApiService; +import com.zhidao.mogo.module.event.panel.view.SurroundingEventView; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; +import okhttp3.RequestBody; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public class SurroundingEventPresenter extends Presenter { + private Context mContext; + private IMogoNetwork mNetWork; + private IMogoServiceApis mApis; + private EventApiService eventApiService; + private static final String TAG = "SurroundingEvent"; + + + public SurroundingEventPresenter(Context context, SurroundingEventView view) { + super(view); + mContext = context; + mNetWork = + ((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi(); + mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext()); + this.eventApiService = mNetWork.create(EventApiService.class, HostConstant.getNetHost()); + } + + @Override + public void onCreate(@NonNull LifecycleOwner owner) { + super.onCreate(owner); + } + + public void getSurroundingEventData() { + MogoLocation location = mApis.getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation(); + if (location == null) { + return; + } + Center center = new Center(location.getLatitude(), location.getLongitude()); + String[] poiTypes = {"10002", "10003", "10006", "10007", "10008", "10010", "10011", "10013", "10015"}; + SurroundingRequest request = new SurroundingRequest(center, poiTypes, 5000, 20); + + eventApiService.getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request))) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + @Override + public void onError(Throwable e) { + super.onError(e); + e.printStackTrace(); + } + + @Override + public void onSuccess(SurroundingResponse data) { + super.onSuccess(data); + if (data != null) { + mView.showSurroudingData(data); + } + } + + @Override + public void onError(String message, int code) { + super.onError(message, code); + Log.e(TAG, "onError message = " + message + " >>> code = " + code); + } + }); + + } + + + public static RequestBody convert(String json) { +// String json = GsonUtil.getGson().toJson( map ); + Logger.d(TAG, "request params: %s", json); + RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), json); + return requestBody; + } + + @Override + public void onDestroy(@NonNull LifecycleOwner owner) { + super.onDestroy(owner); + } + + @Override + public void onLifecycleChanged(@NonNull LifecycleOwner owner, @NonNull Lifecycle.Event event) { + super.onLifecycleChanged(owner, event); + } +} diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt deleted file mode 100644 index 871272bb5b..0000000000 --- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.zhidao.mogo.module.event.panel.presenter - -import com.mogo.commons.mvp.Presenter -import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment - -class SurroundingEventPresenter(view: SurroundingEventFragment) : Presenter(view) { -} \ No newline at end of file diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/view/SurroundingEventView.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/view/SurroundingEventView.java new file mode 100644 index 0000000000..a5fbb0a0fa --- /dev/null +++ b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/view/SurroundingEventView.java @@ -0,0 +1,14 @@ +package com.zhidao.mogo.module.event.panel.view; + +import com.mogo.commons.mvp.IView; +import com.zhidao.mogo.module.event.panel.bean.SurroundingResponse; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public interface SurroundingEventView extends IView { + + void showSurroudingData(SurroundingResponse data); +} diff --git a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml index 58d69b494e..22fcfcc273 100644 --- a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml +++ b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml @@ -12,4 +12,6 @@ android:text="Surrounding Event" android:textColor="#fff" android:textSize="40sp" /> + + \ No newline at end of file