diff --git a/app/build.gradle b/app/build.gradle index aac18fc73d..04a375ea0d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -289,7 +289,7 @@ dependencies { apply from: "./functions/baseservices.gradle" apply from: "./functions/socketpush.gradle" apply from: "./functions/gpssimulator.gradle" - apply from: "./functions/eventpanel.gradle" + //apply from: "./functions/eventpanel.gradle" apply from: "./functions/leftpanel.gradle" } diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index d37549c3ee..1bb920237d 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -29,7 +29,6 @@ import com.mogo.utils.UiThreadHandler; import com.mogo.utils.logger.LogLevel; import com.mogo.utils.logger.Logger; import com.zhidao.boot.persistent.lib.PersistentManager; -import com.zhidao.mogo.module.event.panel.EventPanelConstants; import com.zhidao.mogo.module.left.panel.LeftPanelConst; /** @@ -67,11 +66,10 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) ); MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) ); - MogoModulePaths.addModule( new MogoModule( EventPanelConstants.PATH_NAME, EventPanelConstants.MODULE_NAME ) ); MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME ) ); MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) ); - MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) ); + MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) ); MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) ); MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_LOG_LIB, "LogLib")); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java index 270da46d61..90b0cddc96 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java @@ -11,11 +11,11 @@ public class V2XConst { /** * 类型 */ - public static final String MODULE_NAME = "V2X_UI"; + public static final String MODULE_NAME = "MODULE_EVENT_PANEL"; /** * V2X模块地址 */ - public static final String PATH_V2X_UI = "/v2x/ui"; + public static final String PATH_V2X_UI = "/event/panel"; public static final String SEEK_HELP_TIME = "seek_help_time"; /** diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java index 1cc0229ed5..5c1642cb20 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java @@ -22,9 +22,9 @@ import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XMessageEntity; -import com.mogo.module.service.ServiceConst; import com.mogo.module.v2x.entity.net.V2XSeekHelpRes; import com.mogo.module.v2x.entity.net.V2XStrategyPushRes; +import com.mogo.module.v2x.fragment.EventPanelFragment; import com.mogo.module.v2x.network.V2XRefreshCallback; import com.mogo.module.v2x.receiver.SceneBroadcastReceiver; import com.mogo.module.v2x.scenario.impl.V2XScenarioManager; @@ -65,7 +65,7 @@ public class V2XModuleProvider implements @Override public Fragment createFragment(Context context, Bundle data) { - return null; + return EventPanelFragment.Companion.getInstance(); } @Override @@ -76,7 +76,7 @@ public class V2XModuleProvider implements @NonNull @Override public String getModuleName() { - return ServiceConst.TYPE; + return MODULE_NAME; } @Override @@ -91,7 +91,7 @@ public class V2XModuleProvider implements @Override public int getType() { - return ModuleType.TYPE_SERVICE; + return ModuleType.TYPE_CARD_FRAGMENT; } @Override diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/EventPagerAdapter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/EventPagerAdapter.kt new file mode 100644 index 0000000000..994b257e4a --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/EventPagerAdapter.kt @@ -0,0 +1,21 @@ +package com.mogo.module.v2x.adapter + +import androidx.fragment.app.Fragment +import androidx.viewpager2.adapter.FragmentStateAdapter + +/** + * 事件面板viewpager2的adapter + * + * @author tongchenfei + */ +class EventPagerAdapter(fragment: Fragment, + private val fragments: Array) : + FragmentStateAdapter(fragment) { + + /** + * 目前一共就三个fragment + */ + override fun getItemCount(): Int = fragments.size + + override fun createFragment(position: Int): Fragment = fragments[position] +} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ScenarioHistoryAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ScenarioHistoryAdapter.java new file mode 100644 index 0000000000..ba63d8f8a7 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ScenarioHistoryAdapter.java @@ -0,0 +1,55 @@ +package com.mogo.module.v2x.adapter; + +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.module.common.entity.V2XHistoryScenarioData; +import com.mogo.module.common.entity.V2XWindowTypeEnum; +import com.mogo.module.v2x.adapter.holder.ScenarioHistoryIllegalParkVH; + +import java.util.ArrayList; + +/** + * @author donghongyu + */ +public class ScenarioHistoryAdapter extends RecyclerView.Adapter { + + private ArrayList mV2XHistoryScenarioData; + + public ScenarioHistoryAdapter(ArrayList v2XHistoryScenarioData) { + if (v2XHistoryScenarioData != null) { + this.mV2XHistoryScenarioData = v2XHistoryScenarioData; + } + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + RecyclerView.ViewHolder holder; + switch (viewType) { + // 直播 + case V2XWindowTypeEnum.LIVE_CAR_WINDOW: + holder = new ScenarioHistoryIllegalParkVH(parent); + break; + default: + holder = new ScenarioHistoryIllegalParkVH(parent); + } + return holder; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + if (holder instanceof ScenarioHistoryIllegalParkVH) { + ((ScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position)); + } + } + + + @Override + public int getItemCount() { + return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size(); + } + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ShareEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ShareEventAdapter.java new file mode 100644 index 0000000000..9057df5af1 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/ShareEventAdapter.java @@ -0,0 +1,238 @@ +package com.mogo.module.v2x.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.RatingBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.module.v2x.R; +import com.mogo.module.v2x.entity.panel.ShareEventDescription; +import com.mogo.module.v2x.entity.panel.ShareEventItem; +import com.mogo.module.v2x.entity.panel.ShareEventItemEnum; +import com.mogo.module.v2x.entity.panel.ShareEventLoadMoreItem; +import com.mogo.module.v2x.fragment.EventPanelFragment; +import com.mogo.module.v2x.listener.AdapterCallback; +import com.mogo.service.IMogoServiceApis; +import com.mogo.service.MogoServicePaths; +import com.mogo.utils.DateTimeUtils; + +import java.util.ArrayList; + +public class ShareEventAdapter extends RecyclerView.Adapter { + private Context context; + private ArrayList dataArrayList; + private final LayoutInflater shareLayoutInflater; + private IMogoServiceApis mApis; + private AdapterCallback callback; + + public ShareEventAdapter(Context context, ArrayList dataArrayList, AdapterCallback callback) { + this.context = context; + this.dataArrayList = dataArrayList; + this.callback = callback; + shareLayoutInflater = LayoutInflater.from(context); + mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context); + } + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + //根据viewType创建自定义布局 + if (viewType == ShareEventItemEnum.ITEM_TYPE_NUM_DES) { + View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_description, parent, + false); + shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v); + return holder; + } else if (viewType == ShareEventItemEnum.ITEM_TYPE_SHARE_LIST) { + View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_item, parent, + false); + shareItemViewHolder holder = new shareItemViewHolder(v); + return holder; + } else if (viewType == ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY) { + View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_empty, parent, + false); + shareEmptyViewHolder holder = new shareEmptyViewHolder(v); + return holder; + } else { + View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_load_status, parent, + false); + shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v); + return holder; + } + } + + private float getEnthusuasmIndex(double score) { + if (score <= 0) { + return 0; + } else if (0 < score && score <= 5) { + return (float) 0.5; + } else if (5 < score && score <= 10) { + return 1; + } else if (10 < score && score <= 15) { + return (float) 1.5; + } else if (15 < score && score <= 20) { + return 2; + } else if (20 < score && score <= 25) { + return (float) 2.5; + } else if (25 < score && score <= 30) { + return 3; + } else if (30 < score && score <= 35) { + return (float) 3.5; + } else if (35 < score && score <= 40) { + return 4; + } else if (40 < score && score <= 45) { + return (float) 4.5; + } + return 5; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + + if (holder instanceof shareDescriptionViewHolder) { + //分享次数,车友认同次数,热心指数 + if (dataArrayList.size() > position) { + ShareEventDescription.ResultBean.EnthusiasmIndexBean data = (ShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position); + if (data != null) { + String shareNum = String.valueOf(data.getShareNum()); + String likeNum = String.valueOf(data.getLikeNum()); + double enthusiasmIndex = data.getEnthusiasmIndex(); + if (shareNum != null) { + ((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum); + } + if (likeNum != null) { + ((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum); + } + ((shareDescriptionViewHolder) holder).ratingBar.setRating(getEnthusuasmIndex(enthusiasmIndex)); + } + } + } else if (holder instanceof shareItemViewHolder) { + //分享列表 + if (dataArrayList.size() > position) { + ShareEventItem.ResultBean.PageBean.ContentBean data = (ShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position); + if (data != null) { + String poitype = data.getPoiType(); + String address = data.getUploadAddress(); + String time = DateTimeUtils.getTimeText(data.getUploadTimestamp()); + String likeNum = String.valueOf(data.getLikeNum()); + String notLikeNum = String.valueOf(data.getNotLikeNum()); + if (poitype != null) { + ((shareItemViewHolder) holder).caseStyleTextView.setText(poitype); + } + if (address != null) { + ((shareItemViewHolder) holder).caseAddressTextView.setText(address); + } + if (time != null) { + ((shareItemViewHolder) holder).caseTimeTextView.setText(time); + } + if (likeNum != null) { + ((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum); + } + if (notLikeNum != null) { + ((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum); + } + } + + } + } else if (holder instanceof shareLoadStatusViewHolder) { + ShareEventLoadMoreItem item = (ShareEventLoadMoreItem) dataArrayList.get(dataArrayList.size() - 1); + ((shareLoadStatusViewHolder) holder).statusButton.setText(item.getStatusText()); + } + + } + + @Override + public int getItemCount() { + int size = dataArrayList.size(); + return dataArrayList.size(); + } + + @Override + public int getItemViewType(int position) { + Object item = dataArrayList.get(position); + if (item instanceof ShareEventDescription.ResultBean.EnthusiasmIndexBean) { + return ShareEventItemEnum.ITEM_TYPE_NUM_DES; + } else if (item instanceof ShareEventItem.ResultBean.PageBean.ContentBean) { + return ShareEventItemEnum.ITEM_TYPE_SHARE_LIST; + } else if (item instanceof ShareEventLoadMoreItem) { + return ((ShareEventLoadMoreItem) dataArrayList.get(position)).getViewType(); + } + return ShareEventItemEnum.ITEM_TYPE_SHARE_LIST; + } + + /* + * 分享列表 + * */ + class shareItemViewHolder extends RecyclerView.ViewHolder { + private TextView caseStyleTextView; + private TextView caseAddressTextView; + private TextView caseTimeTextView; + private TextView caseUsefulTextView; + private TextView caseUselessTextView; + + public shareItemViewHolder(@NonNull View itemView) { + super(itemView); + caseStyleTextView = itemView.findViewById(R.id.road_case_style); + caseAddressTextView = itemView.findViewById(R.id.road_case_address); + caseTimeTextView = itemView.findViewById(R.id.road_case_share_time); + caseUsefulTextView = itemView.findViewById(R.id.road_case_useful_num); + caseUselessTextView = itemView.findViewById(R.id.road_case_useless_num); + } + } + + /* + * 分享次数,热心指数... + * */ + class shareDescriptionViewHolder extends RecyclerView.ViewHolder { + private TextView shareNumTextView; + private TextView approveNumTextView; + private RatingBar ratingBar; + + public shareDescriptionViewHolder(@NonNull View itemView) { + super(itemView); + shareNumTextView = itemView.findViewById(R.id.share_num); + approveNumTextView = itemView.findViewById(R.id.share_approve); + ratingBar = itemView.findViewById(R.id.rating_bar); + } + } + + /* + * 去分享 + * */ + class shareEmptyViewHolder extends RecyclerView.ViewHolder { + public shareEmptyViewHolder(@NonNull View itemView) { + super(itemView); + + Button shareBtn = itemView.findViewById(R.id.share_event_button); + shareBtn.setOnClickListener(view -> { + EventPanelFragment.Companion.getInstance().hidePanel(); + mApis.getShareManager().showShareDialog(); + }); + } + } + + /* + * 加载更多/没有更多 + * */ + class shareLoadStatusViewHolder extends RecyclerView.ViewHolder { + private TextView statusButton; + + public shareLoadStatusViewHolder(@NonNull View itemView) { + super(itemView); + statusButton = itemView.findViewById(R.id.event_share_load_status); + statusButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + callback.loadMoreShareEventList(); + } + }); + } + } +} 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 new file mode 100644 index 0000000000..fded6a7d32 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java @@ -0,0 +1,46 @@ +package com.mogo.module.v2x.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-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java new file mode 100644 index 0000000000..0472e09e58 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java @@ -0,0 +1,19 @@ +package com.mogo.module.v2x.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-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/ScenarioHistoryIllegalParkVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/ScenarioHistoryIllegalParkVH.java new file mode 100644 index 0000000000..7a034af1d3 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/ScenarioHistoryIllegalParkVH.java @@ -0,0 +1,29 @@ +package com.mogo.module.v2x.adapter.holder; + +import android.view.LayoutInflater; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; + +import com.mogo.module.common.entity.V2XHistoryScenarioData; +import com.mogo.module.v2x.R; + +/** + * @author donghongyu + */ +public class ScenarioHistoryIllegalParkVH extends V2XBaseViewHolder { + public ScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) { + super(LayoutInflater.from(viewGroup.getContext()) + .inflate(R.layout.module_event_panel_share_item, viewGroup, false)); + } + + @Override + public void initView(V2XHistoryScenarioData viewData) { + + } + + @Override + public void delayedCloseWindow() { + + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt new file mode 100644 index 0000000000..c8a758acfa --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt @@ -0,0 +1,12 @@ +package com.mogo.module.v2x.entity.panel + +/** + * @description + * + * @author lixiaopeng + * @since 2019-10-24 + */ +data class Center ( + val lat: Double, + val lon: Double +) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java new file mode 100644 index 0000000000..cd0fe1d10a --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java @@ -0,0 +1,158 @@ +package com.mogo.module.v2x.entity.panel; + +import com.mogo.commons.data.BaseData; + +import java.io.Serializable; + +public class ShareEventDescription extends BaseData implements Serializable { + + /** + * detailMsg : + * result : {"enthusiasmIndex":{"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"}} + */ + + private String detailMsg; + private ResultBean result; + + public String getDetailMsg() { + return detailMsg; + } + + public void setDetailMsg(String detailMsg) { + this.detailMsg = detailMsg; + } + + public ResultBean getResult() { + return result; + } + + public void setResult(ResultBean result) { + this.result = result; + } + + public static class ResultBean { + /** + * enthusiasmIndex : {"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"} + */ + + private EnthusiasmIndexBean enthusiasmIndex; + + public EnthusiasmIndexBean getEnthusiasmIndex() { + return enthusiasmIndex; + } + + public void setEnthusiasmIndex(EnthusiasmIndexBean enthusiasmIndex) { + this.enthusiasmIndex = enthusiasmIndex; + } + + public static class EnthusiasmIndexBean{ + @Override + public String toString() { + return "EnthusiasmIndexBean{" + + ", id=" + id + + ", sn='" + sn + '\'' + + ", score=" + score + + ", shareNum=" + shareNum + + ", likeNum=" + likeNum + + ", notLikeNum=" + notLikeNum + + ", enthusiasmIndex=" + enthusiasmIndex + + ", createTime='" + createTime + '\'' + + ", updateTime='" + updateTime + '\'' + + '}'; + } + + /** + * id : 68 + * sn : ZD802B1932L00622 + * score : 10 + * shareNum : 1024 + * likeNum : 0 + * notLikeNum : 0 + * enthusiasmIndex : 1.0 + * createTime : 2020-07-28T06:21:11.523+0000 + * updateTime : 2020-07-28T06:21:11.523+0000 + */ + private int id; + private String sn; + private int score; + private int shareNum; + private int likeNum; + private int notLikeNum; + private double enthusiasmIndex; + private String createTime; + private String updateTime; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSn() { + return sn; + } + + public void setSn(String sn) { + this.sn = sn; + } + + public int getScore() { + return score; + } + + public void setScore(int score) { + this.score = score; + } + + public int getShareNum() { + return shareNum; + } + + public void setShareNum(int shareNum) { + this.shareNum = shareNum; + } + + public int getLikeNum() { + return likeNum; + } + + public void setLikeNum(int likeNum) { + this.likeNum = likeNum; + } + + public int getNotLikeNum() { + return notLikeNum; + } + + public void setNotLikeNum(int notLikeNum) { + this.notLikeNum = notLikeNum; + } + + public double getEnthusiasmIndex() { + return enthusiasmIndex; + } + + public void setEnthusiasmIndex(double enthusiasmIndex) { + this.enthusiasmIndex = enthusiasmIndex; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + } + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java new file mode 100644 index 0000000000..10068ff7a7 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java @@ -0,0 +1,488 @@ +package com.mogo.module.v2x.entity.panel; + +import com.mogo.commons.data.BaseData; + +import java.io.Serializable; +import java.util.List; + +public class ShareEventItem extends BaseData implements Serializable { + + + /** + * detailMsg : + * result : {"page":{"total":1024,"pageSize":1,"pageNum":4,"content":[{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}]}} + */ + + private String detailMsg; + private ResultBean result; + + public String getDetailMsg() { + return detailMsg; + } + + public void setDetailMsg(String detailMsg) { + this.detailMsg = detailMsg; + } + + public ResultBean getResult() { + return result; + } + + public void setResult(ResultBean result) { + this.result = result; + } + + public static class ResultBean { + /** + * page : {"total":1024,"pageSize":1,"pageNum":4,"content":[{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}]} + */ + + private PageBean page; + + public PageBean getPage() { + return page; + } + + public void setPage(PageBean page) { + this.page = page; + } + + public static class PageBean { + /** + * total : 1024 + * pageSize : 1 + * pageNum : 4 + * content : [{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}] + */ + + private int total; + private int pageSize; + private int pageNum; + private List content; + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPageNum() { + return pageNum; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public List getContent() { + return content; + } + + public void setContent(List content) { + this.content = content; + } + + public static class ContentBean { + @Override + public String toString() { + return "ContentBean{" + + "viewType=" + viewType + + ", uploadTimestamp=" + uploadTimestamp + + ", timeout=" + timeout + + ", uploadAddress='" + uploadAddress + '\'' + + ", distance=" + distance + + ", dbId='" + dbId + '\'' + + ", poiType='" + poiType + '\'' + + ", sn='" + sn + '\'' + + ", userId=" + userId + + ", userName='" + userName + '\'' + + ", userHead='" + userHead + '\'' + + ", likeNum=" + likeNum + + ", notLikeNum=" + notLikeNum + + ", uploadType=" + uploadType + + ", uploadUser='" + uploadUser + '\'' + + ", imgUrl=" + imgUrl + + ", content=" + content + + ", gasStationId=" + gasStationId + + ", gasStationName=" + gasStationName + + ", gasImg=" + gasImg + + ", gasPrices=" + gasPrices + + ", endDate='" + endDate + '\'' + + ", fabulous=" + fabulous + + ", direction=" + direction + + ", virtualLikeNum=" + virtualLikeNum + + ", status=" + status + + ", sourceType='" + sourceType + '\'' + + ", hitId='" + hitId + '\'' + + ", userType=" + userType + + ", coordinates=" + coordinates + + ", data=" + data + + '}'; + } + + /** + * coordinates : [116.407653,39.966487] + * uploadTimestamp : 1592901273966 + * timeout : 1593100800000 + * uploadAddress : 安定门外大街 + * distance : 0 + * dbId : 725026095564550144 + * poiType : 10002 + * sn : ZD802B1932L00622 + * userId : 0 + * userName : 小松鼠艾德蒙 + * userHead : http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png + * likeNum : 18 + * notLikeNum : 0 + * uploadType : 2 + * uploadUser : 123 + * imgUrl : null + * content : null + * gasStationId : null + * gasStationName : null + * gasImg : null + * gasPrices : null + * endDate : 2020-06-26 00:00:00 + * fabulous : false + * direction : 180 + * virtualLikeNum : 822 + * status : 1 + * sourceType : 10002 + * hitId : 0K-mf3MBeovPWpwE9IfR + * userType : 2 + * data : [{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}] + */ + + private int viewType = ShareEventItemEnum.ITEM_TYPE_SHARE_LIST; + 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 notLikeNum; + private int uploadType; + private String uploadUser; + private Object imgUrl; + private Object content; + private Object gasStationId; + private Object gasStationName; + private Object gasImg; + private Object gasPrices; + private String endDate; + private boolean fabulous; + private int direction; + private int virtualLikeNum; + private int status; + private String sourceType; + private String hitId; + private int userType; + private List coordinates; + private List data; + + 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 getNotLikeNum() { + return notLikeNum; + } + + public void setNotLikeNum(int notLikeNum) { + this.notLikeNum = notLikeNum; + } + + 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 Object getImgUrl() { + return imgUrl; + } + + public void setImgUrl(Object imgUrl) { + this.imgUrl = imgUrl; + } + + public Object getContent() { + return content; + } + + public void setContent(Object content) { + this.content = content; + } + + public Object getGasStationId() { + return gasStationId; + } + + public void setGasStationId(Object gasStationId) { + this.gasStationId = gasStationId; + } + + public Object getGasStationName() { + return gasStationName; + } + + public void setGasStationName(Object gasStationName) { + this.gasStationName = gasStationName; + } + + public Object getGasImg() { + return gasImg; + } + + public void setGasImg(Object gasImg) { + this.gasImg = gasImg; + } + + public Object getGasPrices() { + return gasPrices; + } + + public void setGasPrices(Object 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 int getVirtualLikeNum() { + return virtualLikeNum; + } + + public void setVirtualLikeNum(int 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 List getCoordinates() { + return coordinates; + } + + public void setCoordinates(List coordinates) { + this.coordinates = coordinates; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public static class DataBean { + /** + * url : http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4 + * thumbnail : http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4 + * content : null + * illegalCount : null + */ + + private String url; + private String thumbnail; + private Object content; + private Object illegalCount; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getThumbnail() { + return thumbnail; + } + + public void setThumbnail(String thumbnail) { + this.thumbnail = thumbnail; + } + + public Object getContent() { + return content; + } + + public void setContent(Object content) { + this.content = content; + } + + public Object getIllegalCount() { + return illegalCount; + } + + public void setIllegalCount(Object illegalCount) { + this.illegalCount = illegalCount; + } + } + } + } + } +} + + diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java new file mode 100644 index 0000000000..a7446411c0 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java @@ -0,0 +1,11 @@ +package com.mogo.module.v2x.entity.panel; + +public interface ShareEventItemEnum { + + int ITEM_TYPE_NUM_DES = 0; + int ITEM_TYPE_SHARE_LIST = 1; + int ITEM_TYPE_SHARE_EMPTY = 2; + int ITEM_TYPE_LOAD_MORE_STATUS = 3; + int ITEM_TYPE_NO_MORE = 4; + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java new file mode 100644 index 0000000000..880b10c957 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java @@ -0,0 +1,29 @@ +package com.mogo.module.v2x.entity.panel; + +import com.mogo.commons.data.BaseData; + +import java.io.Serializable; + +/* + * 没有任何分享,去分享/加载更多/没有更多了 + * */ +public class ShareEventLoadMoreItem extends BaseData implements Serializable { + private String statusText; + private int viewType; + + public int getViewType() { + return viewType; + } + + public void setViewType(int viewType) { + this.viewType = viewType; + } + + public void setStatusText(String statusText) { + this.statusText = statusText; + } + + public String getStatusText() { + return statusText; + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java new file mode 100644 index 0000000000..f0664eab84 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java @@ -0,0 +1,21 @@ +package com.mogo.module.v2x.entity.panel; + + +/** + * @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-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 new file mode 100644 index 0000000000..1b491e4845 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java @@ -0,0 +1,347 @@ +package com.mogo.module.v2x.entity.panel; + +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-v2x/src/main/java/com/mogo/module/v2x/fragment/EventPanelFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/EventPanelFragment.kt new file mode 100644 index 0000000000..ef399efbd7 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/EventPanelFragment.kt @@ -0,0 +1,140 @@ +package com.mogo.module.v2x.fragment + +import android.content.res.ColorStateList +import android.graphics.Typeface +import android.view.Gravity +import android.view.View +import android.widget.TextView +import androidx.fragment.app.Fragment +import androidx.viewpager2.widget.ViewPager2 +import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback +import com.google.android.material.tabs.TabLayoutMediator +import com.google.android.material.tabs.TabLayoutMediator.TabConfigurationStrategy +import com.mogo.commons.mvp.MvpFragment +import com.mogo.module.v2x.R +import com.mogo.module.v2x.V2XConst.MODULE_NAME +import com.mogo.module.v2x.adapter.EventPagerAdapter +import com.mogo.module.v2x.presenter.EventPanelPresenter +import com.mogo.utils.logger.Logger +import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.* + + +/** + * 事件面板主fragment + * + * @author tongchenfei + */ +class EventPanelFragment : MvpFragment() { + + + private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享") + private var fragments: Array? = null + + private var mediator: TabLayoutMediator? = null + + private val activeColor: Int = android.graphics.Color.parseColor("#ff678f") + private val normalColor: Int = android.graphics.Color.parseColor("#EE00FF") + + private val activeSize = 40 + private val normalSize = 30 + + private var selectPosition = 0 + + companion object { + private val fragment = EventPanelFragment() + fun getInstance(): EventPanelFragment { + return fragment + } + } + + override fun getLayoutId(): Int { + return R.layout.module_event_panel_fragment_event_panel + } + + override fun initViews() { + Logger.d(MODULE_NAME, "EventPanelFragment init view===") + fragments = arrayOf( + ScenarioHistoryFragment(), + SurroundingEventFragment(), + ShareEventsFragment() + ) + //禁用预加载 + vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT + vpEventPanel.adapter = EventPagerAdapter(this, fragments!!) + //viewPager 页面切换监听 + vpEventPanel.registerOnPageChangeCallback(changeCallback) + + //这里可以自定义TabView + mediator = TabLayoutMediator(tabLayout, vpEventPanel, TabConfigurationStrategy { tab, position -> + val tabView = TextView(context) + tabView.gravity = Gravity.CENTER + val states = arrayOfNulls(2) + states[0] = intArrayOf(android.R.attr.state_selected) + states[1] = intArrayOf() + val colors = intArrayOf(activeColor, normalColor) + val colorStateList = ColorStateList(states, colors) + tabView.text = tabsTitle[position] + tabView.textSize = normalSize.toFloat() + tabView.setTextColor(colorStateList) + tab.customView = tabView + }) + //要执行这一句才是真正将两者绑定起来 + mediator!!.attach() + + btnShowOrHidePanels.setOnClickListener { + if (clPanelContainer.visibility == View.GONE) { + showPanel() + // 选中指定的Tab + tabLayout.getTabAt(selectPosition)?.select() + vpEventPanel.setCurrentItem(selectPosition, false) + } else { + hidePanel() + } + } + } + + private val changeCallback: OnPageChangeCallback = object : OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + selectPosition = position + //可以来设置选中时tab的大小 + val tabCount = tabLayout.tabCount + for (i in 0 until tabCount) { + val tab = tabLayout.getTabAt(i) + val tabView = tab!!.customView as TextView? + if (tab.position == position) { + tabView!!.textSize = activeSize.toFloat() + tabView.typeface = Typeface.DEFAULT_BOLD + } else { + tabView!!.textSize = normalSize.toFloat() + tabView.typeface = Typeface.DEFAULT + } + } + } + } + + override fun onDestroyView() { + mediator?.detach() + vpEventPanel?.unregisterOnPageChangeCallback(changeCallback) + super.onDestroyView() + } + + override fun createPresenter(): EventPanelPresenter { + return EventPanelPresenter(this) + } + + fun showPanel() { + Logger.d(MODULE_NAME, "in fragment show panel") + clPanelContainer.visibility = View.VISIBLE + btnShowOrHidePanels.text = "隐藏面板" + } + + fun hidePanel() { + Logger.d(MODULE_NAME, "in fragment hide panel") + clPanelContainer.visibility = View.GONE + btnShowOrHidePanels.text = "显示面板" + } + + fun isPanelShow(): Boolean { + return clPanelContainer.visibility == View.VISIBLE + } +} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/MyShareFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/MyShareFragment.kt new file mode 100644 index 0000000000..c6f50e62fd --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/MyShareFragment.kt @@ -0,0 +1,28 @@ +package com.mogo.module.v2x.fragment + +import com.mogo.commons.mvp.MvpFragment +import com.mogo.module.v2x.R +import com.mogo.module.v2x.presenter.MySharePresenter + +class MyShareFragment : MvpFragment() { + /** + * 布局资源 + * + * @return + */ + override fun getLayoutId(): Int = R.layout.module_event_panel_share_item + + /** + * 初始化控件,必须在初始化完成之后才可以实例化presenter,避免 + * presenter 生命周期错乱 + */ + override fun initViews() { + } + + /** + * 创建 presenter 实例 + * + * @return + */ + override fun createPresenter(): MySharePresenter = MySharePresenter(this) +} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ScenarioHistoryFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ScenarioHistoryFragment.java new file mode 100644 index 0000000000..94d75d505a --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ScenarioHistoryFragment.java @@ -0,0 +1,73 @@ +package com.mogo.module.v2x.fragment; + +import android.util.Log; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.PagerSnapHelper; +import androidx.recyclerview.widget.RecyclerView; + +import com.mogo.commons.mvp.MvpFragment; +import com.mogo.module.common.entity.V2XHistoryScenarioData; +import com.mogo.module.v2x.R; +import com.mogo.module.v2x.adapter.ScenarioHistoryAdapter; +import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter; +import com.mogo.module.v2x.utils.V2XSQLiteUtils; +import com.mogo.utils.logger.Logger; + +import java.util.ArrayList; +import java.util.List; + +/** + * 出行动态,V2X 提示过的场景历史 + * + * @author donghongyu + */ +public class ScenarioHistoryFragment + extends MvpFragment { + + private RecyclerView mRecyclerView; + private ScenarioHistoryAdapter mScenarioHistoryAdapter; + private ArrayList mV2XHistoryScenarioData = new ArrayList<>(); + + @Override + protected int getLayoutId() { + return R.layout.module_event_panel_fragment_scenario_history; + } + + @Override + protected void initViews() { + Log.d("ScenarioHistoryFragment", "initViews --------> "); + + mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + mScenarioHistoryAdapter = new ScenarioHistoryAdapter(mV2XHistoryScenarioData); + mRecyclerView.setAdapter(mScenarioHistoryAdapter); + // 设置切换样式 + new PagerSnapHelper().attachToRecyclerView(mRecyclerView); + // 配置列表朝向 + LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); + mRecyclerView.setLayoutManager(layoutManager); + + List v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData(); + Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + v2XHistoryScenarioData); + mV2XHistoryScenarioData.clear(); + mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData); + mScenarioHistoryAdapter.notifyDataSetChanged(); + } + + @Override + public void onResume() { + super.onResume(); + List v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData(); + Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + v2XHistoryScenarioData); + mV2XHistoryScenarioData.clear(); + mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData); + mScenarioHistoryAdapter.notifyDataSetChanged(); + } + + @NonNull + @Override + protected ScenarioHistoryPresenter createPresenter() { + return new ScenarioHistoryPresenter(this); + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ShareEventsFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ShareEventsFragment.java new file mode 100644 index 0000000000..1f9c11dcd8 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/ShareEventsFragment.java @@ -0,0 +1,211 @@ +package com.mogo.module.v2x.fragment; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.mvp.MvpFragment; +import com.mogo.commons.network.SubscribeImpl; +import com.mogo.module.v2x.R; +import com.mogo.module.v2x.adapter.ShareEventAdapter; +import com.mogo.module.v2x.entity.panel.ShareEventDescription; +import com.mogo.module.v2x.entity.panel.ShareEventItem; +import com.mogo.module.v2x.entity.panel.ShareEventItemEnum; +import com.mogo.module.v2x.entity.panel.ShareEventLoadMoreItem; +import com.mogo.module.v2x.listener.AdapterCallback; +import com.mogo.module.v2x.network.EventApiService; +import com.mogo.module.v2x.network.HttpConstant; +import com.mogo.module.v2x.network.ShareEventParameter; +import com.mogo.module.v2x.presenter.ShareEventsPresenter; +import com.mogo.module.v2x.utils.animation.AnimationManager; +import com.mogo.module.v2x.utils.animation.AnimationResources; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.network.IMogoNetwork; +import com.mogo.utils.network.RequestOptions; +import com.mogo.utils.network.utils.GsonUtil; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CountDownLatch; + +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.schedulers.Schedulers; + +public class ShareEventsFragment extends MvpFragment implements AdapterCallback { + + private static final String TAG = "ShareEventsFragment"; + private RecyclerView recyclerView; + private ShareEventAdapter adapter; + private ArrayList dataArrayList = new ArrayList(); + private EventApiService eventApiService; + private int pageNum = 1; + final CountDownLatch countDownLatch = new CountDownLatch(2); + private IMogoNetwork network; + + //动画 + private ImageView loadingImageView; + private AnimationManager animationHandler; + + @Override + protected int getLayoutId() { + return R.layout.module_event_panel_share_recylerview; + } + + @Override + protected void initViews() { + network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getContext()); + eventApiService = network.create(EventApiService.class, HttpConstant.Companion.getNetHost()); + animationHandler = new AnimationManager(); + initRecyclerView(); + initData(); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + super.onCreateView(inflater, container, savedInstanceState); + return mRootView; + } + + private void initRecyclerView() { + recyclerView = mRootView.findViewById(R.id.road_case_share_list); + adapter = new ShareEventAdapter(getActivity(), dataArrayList, this); + recyclerView.setAdapter(adapter); + LinearLayoutManager linearLayoutManager = + new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); + recyclerView.setLayoutManager(linearLayoutManager); + } + + private void initData() { + loadingImageView = mRootView.findViewById(R.id.loading_imageview); + animationHandler.animationWithTarget(loadingImageView, AnimationResources.loadingRes,300); + getShareEventDescription(); + getShareEventList(pageNum, 10); + } + + /* + * 热心指数等 + * */ + private void getShareEventDescription() { + //ZD802B1932L00622 测试数据sn + ShareEventParameter parameter = new ShareEventParameter("ZD802B1932L00622"); + Map parameters = new HashMap<>(); + parameters.put("data", GsonUtil.jsonFromObject(parameter)); + + eventApiService.getEnthusiasmIndex(parameters) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + @Override + public void onSuccess(ShareEventDescription resultData) { + if (resultData != null && resultData.getResult() != null + && resultData.getResult().getEnthusiasmIndex() != null) { + dataArrayList.add(resultData.getResult().getEnthusiasmIndex()); + Log.d(TAG, "热心指数---:" + resultData.getResult().getEnthusiasmIndex()); + } + countDownLatch.countDown(); + } + + @Override + public void onError(String message, int code) { + super.onError(message, code); + countDownLatch.countDown(); + } + + }); + } + + /* + * 分享列表 + * */ + public void getShareEventList(int page, int size) { + ShareEventParameter parameter = new ShareEventParameter("ZD802B1932L00622", page, 10); + HashMap parameters = new HashMap<>(); + parameters.put("data", GsonUtil.jsonFromObject(parameter)); + + eventApiService.getShareEventList(parameters) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) { + @Override + public void onSuccess(ShareEventItem resultData) { + ShareEventLoadMoreItem item = new ShareEventLoadMoreItem(); + if (resultData != null && resultData.getResult() != null) { + if (resultData.getResult().getPage() != null) { + int total = resultData.getResult().getPage().getTotal(); + if (total == 0) { + //空白 + item.setViewType(ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY); + dataArrayList.add(item); + } else { + if (resultData.getResult().getPage().getContent().size() > 0) { + //当前页有数据 + if (dataArrayList.size() > 0) { + Object data = dataArrayList.get(dataArrayList.size() - 1); + if (data instanceof ShareEventLoadMoreItem) { + dataArrayList.remove(dataArrayList.size() - 1); + } + } + dataArrayList.addAll(resultData.getResult().getPage().getContent()); + item.setViewType(ShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS); + item.setStatusText("查看更早记录"); + } else { + //当前页没有数据 + item.setViewType(ShareEventItemEnum.ITEM_TYPE_NO_MORE); + item.setStatusText("没有更多了"); + } + dataArrayList.add(item); + } + } + Log.d(TAG, "分享列表---:" + dataArrayList.get(0)); + } else { + //空白 + item.setViewType(ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY); + dataArrayList.add(item); + } + adapter.notifyDataSetChanged(); + countDownLatch.countDown(); + animationHandler.stop(); + } + + @Override + public void onError(String message, int code) { + super.onError(message, code); + countDownLatch.countDown(); + } + }); + } + + private void addLastData(ArrayList dataArray, int total) { + ShareEventLoadMoreItem item = new ShareEventLoadMoreItem(); + if (total > 10) { + if (pageNum <= 1) {//没有分享 + item.setViewType(ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY); + } else {//没有更多了 + item.setViewType(ShareEventItemEnum.ITEM_TYPE_NO_MORE); + } + dataArray.add(item); + } + } + + @NonNull + @Override + protected ShareEventsPresenter createPresenter() { + Log.d(TAG, "createPresenter"); + return new ShareEventsPresenter(this); + } + + @Override + public void loadMoreShareEventList() { + getShareEventList(pageNum + 1, 10); + } +} 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 new file mode 100644 index 0000000000..1171cd649a --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java @@ -0,0 +1,91 @@ +package com.mogo.module.v2x.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.mogo.module.v2x.R; +import com.mogo.module.v2x.adapter.SurroundingEventAdapter; +import com.mogo.module.v2x.entity.panel.SurroundingResponse; +import com.mogo.module.v2x.presenter.SurroundingEventPresenter; +import com.mogo.module.v2x.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-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java new file mode 100644 index 0000000000..ac6f96ed01 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java @@ -0,0 +1,6 @@ +package com.mogo.module.v2x.listener; + +public interface AdapterCallback { + //分享列表加载更多 + public void loadMoreShareEventList(); +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/EventApiService.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/EventApiService.java new file mode 100644 index 0000000000..30d0b0442b --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/EventApiService.java @@ -0,0 +1,36 @@ +package com.mogo.module.v2x.network; + + +import com.mogo.module.v2x.entity.panel.ShareEventDescription; +import com.mogo.module.v2x.entity.panel.ShareEventItem; +import com.mogo.module.v2x.entity.panel.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; + +public interface EventApiService { + + //我的分享-热心指数等 + @FormUrlEncoded + @POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1") + Observable getEnthusiasmIndex(@FieldMap Map parames); + + //我的分享-列表 + @FormUrlEncoded + @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-v2x/src/main/java/com/mogo/module/v2x/network/ShareEventParameter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/ShareEventParameter.java new file mode 100644 index 0000000000..c497d51720 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/ShareEventParameter.java @@ -0,0 +1,18 @@ +package com.mogo.module.v2x.network; + +public class ShareEventParameter { + private String sn; + private int pageNum; + private int pageSize; + + public ShareEventParameter(String sn) { + this.sn = sn; + } + + public ShareEventParameter(String sn, int pageNum, int pageSize) { + this.sn = sn; + this.pageNum = pageNum; + this.pageSize = pageSize; + } + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt new file mode 100644 index 0000000000..9aaf3b2a38 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/EventPanelPresenter.kt @@ -0,0 +1,11 @@ +package com.mogo.module.v2x.presenter + +import com.mogo.commons.mvp.Presenter +import com.mogo.module.v2x.fragment.EventPanelFragment + +/** + * 事件面板presenter + * + * @author tongchenfei + */ +class EventPanelPresenter(view: EventPanelFragment) : Presenter(view) \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/MySharePresenter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/MySharePresenter.kt new file mode 100644 index 0000000000..1d4d7e3054 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/MySharePresenter.kt @@ -0,0 +1,7 @@ +package com.mogo.module.v2x.presenter + +import com.mogo.commons.mvp.Presenter +import com.mogo.module.v2x.fragment.MyShareFragment + +class MySharePresenter(view: MyShareFragment) : Presenter(view) { +} \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java new file mode 100644 index 0000000000..6983b65b86 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ScenarioHistoryPresenter.java @@ -0,0 +1,16 @@ +package com.mogo.module.v2x.presenter; + + +import com.mogo.commons.mvp.Presenter; +import com.mogo.module.v2x.fragment.ScenarioHistoryFragment; + +/** + * @author donghongyu + */ +public class ScenarioHistoryPresenter extends Presenter { + + public ScenarioHistoryPresenter(ScenarioHistoryFragment view) { + super(view); + } + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java new file mode 100644 index 0000000000..2516a98f9b --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/ShareEventsPresenter.java @@ -0,0 +1,11 @@ +package com.mogo.module.v2x.presenter; + +import com.mogo.commons.mvp.IView; +import com.mogo.commons.mvp.Presenter; +import com.mogo.module.v2x.fragment.ShareEventsFragment; + +public class ShareEventsPresenter extends Presenter { + public ShareEventsPresenter(IView view) { + super((ShareEventsFragment) view); + } +} 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 new file mode 100644 index 0000000000..c77fa834ed --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/presenter/SurroundingEventPresenter.java @@ -0,0 +1,112 @@ +package com.mogo.module.v2x.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.module.v2x.entity.panel.Center; +import com.mogo.module.v2x.entity.panel.SurroundingRequest; +import com.mogo.module.v2x.entity.panel.SurroundingResponse; +import com.mogo.module.v2x.network.EventApiService; +import com.mogo.module.v2x.network.HttpConstant; +import com.mogo.module.v2x.view.SurroundingEventView; +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 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, HttpConstant.Companion.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-v2x/src/main/java/com/mogo/module/v2x/utils/animation/Animation.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/Animation.java new file mode 100644 index 0000000000..a91503d370 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/Animation.java @@ -0,0 +1,9 @@ +package com.mogo.module.v2x.utils.animation; + +interface Animation { + + void start(); + + void stop(); + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationManager.java new file mode 100644 index 0000000000..bec61ececb --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationManager.java @@ -0,0 +1,49 @@ +package com.mogo.module.v2x.utils.animation; + +import android.graphics.drawable.AnimationDrawable; +import android.widget.ImageView; + +import com.mogo.utils.ThreadPoolService; +import com.mogo.utils.UiThreadHandler; + +public class AnimationManager implements Animation { + + private ImageView targetImageView; + private Animation delegate; + private boolean isStarted = false; + + public void animationWithTarget(ImageView imageView, int[] resources, int duration) { + targetImageView = imageView; + ThreadPoolService.execute(() -> { + final AnimationDrawable drawable = new AnimationDrawable(); + for (int i = 0; i < resources.length; i++) { + drawable.addFrame(targetImageView.getResources().getDrawable(resources[i]), duration); + } + UiThreadHandler.post(() -> { + targetImageView.setBackground(drawable); + delegate = new DelegateDrawable(drawable); + }); + }); + + } + + @Override + synchronized public void start() { + if (delegate != null && !isStarted) { + isStarted = true; + delegate.start(); + } + } + + @Override + synchronized public void stop() { + if (delegate != null && isStarted) { + isStarted = false; + delegate.stop(); + } + } + + public void release() { + delegate = null; + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationResources.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationResources.java new file mode 100644 index 0000000000..e8f134e908 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/AnimationResources.java @@ -0,0 +1,12 @@ +package com.mogo.module.v2x.utils.animation; + + +import com.mogo.module.v2x.R; + +public class AnimationResources { + public static final int loadingRes[] = { + R.drawable.icon_enthusiasm_choose, + R.drawable.icon_enthusiasm_unchoose, + }; + +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/DelegateDrawable.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/DelegateDrawable.java new file mode 100644 index 0000000000..0959e58281 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/animation/DelegateDrawable.java @@ -0,0 +1,27 @@ +package com.mogo.module.v2x.utils.animation; + +import android.graphics.drawable.AnimationDrawable; + +public class DelegateDrawable implements Animation { + + private AnimationDrawable drawable; + + public DelegateDrawable(AnimationDrawable drawable) { + this.drawable = drawable; + } + + + @Override + public void start() { + if (drawable != null) { + drawable.start(); + } + } + + @Override + public void stop() { + if (drawable != null) { + drawable.stop(); + } + } +} 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 new file mode 100644 index 0000000000..28cd2a0ba0 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/SurroundingEventView.java @@ -0,0 +1,14 @@ +package com.mogo.module.v2x.view; + +import com.mogo.commons.mvp.IView; +import com.mogo.module.v2x.entity.panel.SurroundingResponse; + +/** + * @author lixiaopeng + * @description + * @since 2020/7/29 + */ +public interface SurroundingEventView extends IView { + + void showSurroudingData(SurroundingResponse data); +} diff --git a/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_choose.png b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_choose.png new file mode 100644 index 0000000000..3a8c9b318b Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_choose.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_second.png b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_second.png new file mode 100644 index 0000000000..4894b507b2 Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_second.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_unchoose.png b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_unchoose.png new file mode 100644 index 0000000000..f64d27d31f Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable/icon_enthusiasm_unchoose.png differ diff --git a/modules/mogo-module-v2x/src/main/res/drawable/share_rating_bar.xml b/modules/mogo-module-v2x/src/main/res/drawable/share_rating_bar.xml new file mode 100644 index 0000000000..afded5aacb --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/drawable/share_rating_bar.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_event_panel.xml b/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_event_panel.xml new file mode 100644 index 0000000000..ea56d33d13 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/layout/module_event_panel_fragment_event_panel.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + +