Merge branch 'dev' into dev_custom_map
# Conflicts: # libraries/mogo-map/src/main/java/com/mogo/map/MogoNavi.java # modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java
@@ -6,6 +6,13 @@
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.scene_handler_broadcast" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name=".receiver.TestPanelBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.test_panel_control" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 这是LinearLayoutManager设置Item间距的的一个辅助类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private int space;
|
||||
|
||||
public SpacesItemDecoration(int space) {
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.left = space;
|
||||
outRect.right = space;
|
||||
outRect.bottom = space;
|
||||
|
||||
// Add top margin only for the first item to avoid double space between items
|
||||
if (parent.getChildPosition(view) == 0) {
|
||||
outRect.top = space;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,14 +9,22 @@ package com.mogo.module.v2x;
|
||||
*/
|
||||
public class V2XConst {
|
||||
/**
|
||||
* 类型
|
||||
* V2X面板名称
|
||||
*/
|
||||
public static final String MODULE_NAME = "V2X_UI";
|
||||
/**
|
||||
* V2X模块地址
|
||||
*/
|
||||
public static final String PATH_V2X_UI = "/v2x/ui";
|
||||
public static final String SEEK_HELP_TIME = "seek_help_time";
|
||||
|
||||
/**
|
||||
* 事件面板名称
|
||||
*/
|
||||
public static final String MODULE_NAME_EVENT_PANEL = "MODULE_EVENT_PANEL";
|
||||
/**
|
||||
* 事件面板路径
|
||||
*/
|
||||
public static final String PATH_EVENT_PANEL = "/event/panel";
|
||||
|
||||
/**
|
||||
* V2X 场景广播 Action
|
||||
@@ -24,8 +32,15 @@ public class V2XConst {
|
||||
public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast";
|
||||
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
|
||||
|
||||
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
|
||||
/**
|
||||
* V2X 测试控制面板广播Action
|
||||
*/
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_ACTION = "com.v2x.com.v2x.test_panel_control";
|
||||
public static final String BROADCAST_TEST_PANEL_CONTROL_EXTRA_KEY = "TextPanelOpenStatus";
|
||||
|
||||
|
||||
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
|
||||
public static final String SEEK_HELP_TIME = "seek_help_time";
|
||||
public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str";
|
||||
public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str";
|
||||
public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push";
|
||||
@@ -44,6 +59,7 @@ public class V2XConst {
|
||||
*/
|
||||
public static final String V2X_ROAD_SHOW = "v2x_road_show";
|
||||
public static final String V2X_ROAD_EVET = "v2x_road_event";
|
||||
public static final String V2X_ROAD_EVET_HISTORY_BUTTON = "V2X_button_click";
|
||||
/**
|
||||
* V2X 道路事件操作类型
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-2114:03
|
||||
* desc : V2X的管理
|
||||
* version: 2.0
|
||||
*/
|
||||
@Route(path = V2XConst.PATH_EVENT_PANEL)
|
||||
public class V2XEventPanelModuleProvider implements
|
||||
IMogoModuleProvider {
|
||||
private final String TAG = "EventPanelModuleProvider";
|
||||
|
||||
@Override
|
||||
public Fragment createFragment(Context context, Bundle data) {
|
||||
return V2XEventPanelFragment.Companion.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return V2XConst.MODULE_NAME_EVENT_PANEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return ModuleType.TYPE_CARD_FRAGMENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerClickListener getMarkerClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppPackage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAppName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.e(MODULE_NAME, "事件模版 模块初始化。。。。");
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
@@ -23,7 +22,6 @@ 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.network.V2XRefreshCallback;
|
||||
@@ -31,9 +29,9 @@ import com.mogo.module.v2x.receiver.SceneBroadcastReceiver;
|
||||
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
|
||||
import com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow;
|
||||
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
@@ -76,7 +74,7 @@ public class V2XModuleProvider implements
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return ServiceConst.TYPE;
|
||||
return MODULE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,18 +119,15 @@ public class V2XModuleProvider implements
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.e(MODULE_NAME, "V2X模块初始化。。。。");
|
||||
Logger.e(MODULE_NAME, "V2X 模块初始化。。。。");
|
||||
mContext = context;
|
||||
|
||||
V2XUtils.init(context);
|
||||
V2XServiceManager.init(context);
|
||||
initVoice(context);
|
||||
handleAdas();
|
||||
V2XVoiceManager.INSTANCE.init(context);
|
||||
registerListener();
|
||||
initData();
|
||||
|
||||
|
||||
V2XServiceManager.getMogoRegisterCenter().registerMogoMapListener(V2XConst.MODULE_NAME, this);
|
||||
|
||||
// 注册广播接收场景弹窗使用的
|
||||
SceneBroadcastReceiver localReceiver = new SceneBroadcastReceiver();
|
||||
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
||||
@@ -171,33 +166,14 @@ public class V2XModuleProvider implements
|
||||
}
|
||||
// 刷新配置文件
|
||||
refreshStrategyConfig();
|
||||
|
||||
// 响应违章停车的POI点击
|
||||
V2XServiceManager
|
||||
.getMogoRegisterCenter()
|
||||
.registerMogoMarkerClickListener(V2XConst.MODULE_NAME,
|
||||
new IMogoMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
try {
|
||||
MarkerExploreWay markerExploreWay =
|
||||
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
Logger.d(V2XConst.MODULE_NAME,
|
||||
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
|
||||
|
||||
((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
|
||||
.getV2XWindow())
|
||||
.show(markerExploreWay, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// 清除V2X事件数据库中过期的数据,数据有效期为24小时
|
||||
V2XSQLiteUtils.clearYesterdayScenarioHistoryData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取疲劳驾驶的配置
|
||||
*/
|
||||
private void refreshStrategyConfig() {
|
||||
// 获取疲劳驾驶的配置
|
||||
V2XServiceManager
|
||||
.getV2XRefreshModel()
|
||||
.getStrategyPush(new V2XRefreshCallback<V2XStrategyPushRes>() {
|
||||
@@ -219,21 +195,53 @@ public class V2XModuleProvider implements
|
||||
});
|
||||
}
|
||||
|
||||
private void handleAdas() {
|
||||
/**
|
||||
* 注册各种监听
|
||||
*/
|
||||
private void registerListener() {
|
||||
// 初始化监听
|
||||
V2XServiceManager.getMogoRegisterCenter()
|
||||
.registerMogoMapListener(V2XConst.MODULE_NAME, this);
|
||||
V2XServiceManager.getMoGoStatusManager()
|
||||
.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this);
|
||||
V2XServiceManager.getMoGoStatusManager()
|
||||
.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this);
|
||||
|
||||
|
||||
// 响应违章停车的POI点击
|
||||
V2XServiceManager
|
||||
.getMogoRegisterCenter()
|
||||
.registerMogoMarkerClickListener(V2XConst.MODULE_NAME,
|
||||
marker -> {
|
||||
try {
|
||||
MarkerExploreWay markerExploreWay =
|
||||
(MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
|
||||
Logger.d(V2XConst.MODULE_NAME,
|
||||
"V2X===违章停车:onMarkerClicked=" + markerExploreWay);
|
||||
|
||||
((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
|
||||
.getV2XWindow())
|
||||
.show(markerExploreWay, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// 注册V2X场景Socket
|
||||
V2XServiceManager.getV2XSocketManager().registerSocketMessage();
|
||||
// 开启自动刷新
|
||||
// 开启自动刷新,暂时关闭间隔查询来降低流量消耗
|
||||
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
V2XServiceManager.getMapUIController().recoverLockMode();
|
||||
}
|
||||
|
||||
private void handleSeekHelp(boolean isTrue) {
|
||||
/**
|
||||
* 刷新自车求助状态
|
||||
*
|
||||
* @param isTrue
|
||||
*/
|
||||
private void refreshMeSeekHelp(boolean isTrue) {
|
||||
V2XMessageEntity<Boolean> entity = new V2XMessageEntity<>();
|
||||
entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
|
||||
entity.setContent(isTrue);
|
||||
@@ -256,16 +264,24 @@ public class V2XModuleProvider implements
|
||||
.putString(V2XConst.V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString());
|
||||
}
|
||||
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
|
||||
handleSeekHelp(isTrue);
|
||||
refreshMeSeekHelp(isTrue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是ACC ON操作
|
||||
*
|
||||
* @return true-ACC ON | false - ACC OFF
|
||||
*/
|
||||
public boolean isAccOn() {
|
||||
int accState = Settings.System.getInt(mContext.getContentResolver(), "mcu_state", -0x02);
|
||||
Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState);
|
||||
return accState == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新自车求助状态
|
||||
*/
|
||||
private void initCarForHelpStatus() {
|
||||
//本地查询是否超时
|
||||
V2XServiceManager.getV2XRefreshModel().getHelpSignal(new V2XRefreshCallback<V2XSeekHelpRes>() {
|
||||
@@ -278,12 +294,12 @@ public class V2XModuleProvider implements
|
||||
//故障车
|
||||
if (vehicleType == 4) {
|
||||
if (!V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
|
||||
handleSeekHelp(true);
|
||||
refreshMeSeekHelp(true);
|
||||
V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, true);
|
||||
}
|
||||
} else {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
|
||||
handleSeekHelp(false);
|
||||
refreshMeSeekHelp(false);
|
||||
V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,10 @@ import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoMarkerService;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.service.tanlu.IMogoTanluProvider;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
@@ -53,7 +55,6 @@ public class V2XServiceManager {
|
||||
private static IMogoLocationClient mMogoLocationClient;
|
||||
private static IMogoGeoSearch mIMogoGeoSearch;
|
||||
private static IMogoSearchManager mIMogoSearchManager;
|
||||
|
||||
private static IMogoTopViewManager mMogoTopViewManager;
|
||||
private static IMogoStatusManager mMogoStatusManager;
|
||||
private static IMogoWindowManager mIMogoWindowManager;
|
||||
@@ -64,6 +65,8 @@ public class V2XServiceManager {
|
||||
private static IMogoRegisterCenter mMogoRegisterCenter;
|
||||
private static IMogoRefreshStrategyController mIMogoRefreshStrategyController;
|
||||
private static IMogoMarkerService mIMogoMarkerService;
|
||||
private static IMogoShareManager mIMogoShareManager;
|
||||
private static IMogoTanluProvider mIMogoTanluProvider;
|
||||
|
||||
private static IMogoActionManager mMogoActionManager;
|
||||
private static ICarsChattingProvider mCarsChattingProvider;
|
||||
@@ -102,6 +105,8 @@ public class V2XServiceManager {
|
||||
mMogoTopViewManager = mMogoServiceApis.getTopViewManager();
|
||||
mIMogoSearchManager = mMogoServiceApis.getSearchManagerApi();
|
||||
mIMogoMarkerService = mMogoServiceApis.getMarkerService();
|
||||
mIMogoShareManager = mMogoServiceApis.getShareManager();
|
||||
mIMogoTanluProvider = mMogoServiceApis.getTanluApi();
|
||||
|
||||
mMarkerManager = mMapService.getMarkerManager(context);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
@@ -243,4 +248,15 @@ public class V2XServiceManager {
|
||||
public static V2XCalculateServer getV2XCalculateServer() {
|
||||
return mV2XCalculateServer;
|
||||
}
|
||||
|
||||
public static IMogoShareManager getMogoShareManager() {
|
||||
return mIMogoShareManager;
|
||||
}
|
||||
|
||||
public static IMogoTanluProvider getTanluManager() {
|
||||
return mIMogoTanluProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.v2x;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -53,6 +54,7 @@ public class V2XStatusManager {
|
||||
if (mLocation == null) {
|
||||
mLocation = new MogoLocation();
|
||||
}
|
||||
Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 V2XEventPagerAdapter(fragment: Fragment,
|
||||
private val fragments: Array<Fragment>) :
|
||||
FragmentStateAdapter(fragment) {
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
|
||||
@@ -37,27 +37,27 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
RecyclerView.ViewHolder holder;
|
||||
switch (viewType) {
|
||||
// 直播
|
||||
case V2XWindowTypeEnum.LIVE_CAR_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
|
||||
holder = new V2XLiveVideoVH(parent);
|
||||
break;
|
||||
//道路事件详情
|
||||
case V2XWindowTypeEnum.ROAD_EVENT_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
holder = new V2XRoadEventVH(parent);
|
||||
break;
|
||||
//违章停车
|
||||
case V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XIllegalParkVH(parent);
|
||||
break;
|
||||
//推送展示
|
||||
case V2XWindowTypeEnum.PUSH_EVENT_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
holder = new V2XPushEventVH(parent);
|
||||
break;
|
||||
//疲劳驾驶
|
||||
case V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
holder = new V2XFatigueDrivingVH(parent);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XWindowTypeEnum.SEEK_HELP_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XOtherSeekHelpVH(parent);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryOtherSeekHelpVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryRoadEventVH;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData;
|
||||
|
||||
public V2XScenarioHistoryAdapter(ArrayList<V2XHistoryScenarioData> v2XHistoryScenarioData) {
|
||||
if (v2XHistoryScenarioData != null) {
|
||||
this.mV2XHistoryScenarioData = v2XHistoryScenarioData;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
ViewHolder holder;
|
||||
switch (viewType) {
|
||||
//道路事件详情
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
holder = new V2XScenarioHistoryRoadEventVH(parent);
|
||||
break;
|
||||
//违章停车
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XScenarioHistoryIllegalParkVH(parent);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XScenarioHistoryOtherSeekHelpVH(parent);
|
||||
break;
|
||||
//没有更多的数据的Footer
|
||||
default:
|
||||
View footerView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.footer_nomore_view, parent, false);
|
||||
holder = new FooterViewHolder(footerView);
|
||||
break;
|
||||
}
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
if (position < mV2XHistoryScenarioData.size()) {
|
||||
if (holder instanceof V2XScenarioHistoryRoadEventVH) {
|
||||
((V2XScenarioHistoryRoadEventVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
if (holder instanceof V2XScenarioHistoryIllegalParkVH) {
|
||||
((V2XScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
if (holder instanceof V2XScenarioHistoryOtherSeekHelpVH) {
|
||||
((V2XScenarioHistoryOtherSeekHelpVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position < mV2XHistoryScenarioData.size()) {
|
||||
return mV2XHistoryScenarioData.get(position).getScenarioType();
|
||||
} else {
|
||||
// 没有更多的Footer
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// 多添加一个Footer
|
||||
return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size() + 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Footer 视图
|
||||
*/
|
||||
static class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||
public FooterViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.carchattingprovider.ICarsChattingProvider;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.SpanUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
/**
|
||||
* author : fenghualong
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/3/11 4:05 PM
|
||||
* desc : V2X 其他车辆发起的故障求助
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpAdapter extends RecyclerView.Adapter<V2XSeekHelpAdapter.MyViewHolder> {
|
||||
private static final String TAG = V2XSeekHelpAdapter.class.getSimpleName();
|
||||
private List<V2XMarkerEntity> itemList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public V2XSeekHelpAdapter(Context context) {
|
||||
itemList = new ArrayList<>();
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void addDataList(List<V2XMarkerEntity> list) {
|
||||
if (itemList == null) {
|
||||
itemList = new ArrayList<>();
|
||||
}
|
||||
itemList.addAll(list);
|
||||
}
|
||||
|
||||
public void addData(V2XMarkerEntity entity) {
|
||||
if (itemList == null) {
|
||||
itemList = new ArrayList<>();
|
||||
}
|
||||
itemList.add(entity);
|
||||
}
|
||||
|
||||
public void removeData(V2XMarkerEntity entity) {
|
||||
if (itemList != null) {
|
||||
itemList.remove(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeData(int position) {
|
||||
if (isPositionValid(position)) {
|
||||
itemList.remove(position);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearData() {
|
||||
if (itemList != null) {
|
||||
itemList.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPositionValid(int position) {
|
||||
return position > -1 && itemList != null && itemList.size() > position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_v2x_fault_help, parent, false);
|
||||
return new MyViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
if (isPositionValid(position)) {
|
||||
V2XMarkerEntity entity = itemList.get(position);
|
||||
if (entity != null) {
|
||||
V2XMarkerEntity.UserInfoBean infoBean = entity.getUserInfo();
|
||||
if (infoBean != null) {
|
||||
long time = entity.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
|
||||
String eventDistance = String.format("%d", entity.getDistance());
|
||||
String eventTime = String.format("%s发布求助信息", sdf.format(new Date(time)));
|
||||
holder.initView(infoBean.getHeadImgUrl(), infoBean.getDisplayName(), eventDistance, eventTime);
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "onBindViewHolder position=$position, entity= " + entity);
|
||||
setCallData(holder.ivCall, entity);
|
||||
//setCallDataWait(holder.ivCall, entity);
|
||||
holder.ivNavi.setOnClickListener(v -> {
|
||||
if (mListener != null && !V2XUtils.isFastClick()) {
|
||||
|
||||
mListener.onViewNaviClick(entity.getLat(), entity.getLon());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void setCallData(ImageView ivCall, V2XMarkerEntity entity) {
|
||||
ICarsChattingProvider provider = V2XServiceManager.getCarsChattingProvider();
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(entity.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
ivCall.setVisibility(VISIBLE);
|
||||
} else {
|
||||
ivCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ivCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
ivCall.setOnClickListener(v -> {
|
||||
if (!V2XUtils.isFastClick()) {
|
||||
provider.isOnLine(V2XConst.MODULE_NAME, ivCall.getContext(), entity.getSn(), new ICallChatResponse() {
|
||||
@Override
|
||||
public void isOnLine(boolean isOnline, @Nullable String s) {
|
||||
provider.canCall(V2XConst.MODULE_NAME, ivCall.getContext(), new ICallChatResponse() {
|
||||
@Override
|
||||
public void canCall(boolean canCall) {
|
||||
Logger.d(TAG, "调用车聊聊,查询状态! SN=" + entity.getSn() + " is online: " + isOnline + " canCall: " + canCall + ", thread: " + Thread.currentThread().getName());
|
||||
V2XUtils.runOnUiThread(() -> {
|
||||
if (mListener != null && isOnline && canCall) {
|
||||
mListener.onViewChatClick(entity);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return itemList != null ? itemList.size() : 0;
|
||||
}
|
||||
|
||||
static class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
MogoImageView ivHead;
|
||||
TextView tvName;
|
||||
TextView tvDistance;
|
||||
TextView tvEventTime;
|
||||
ImageView ivCall;
|
||||
ImageView ivNavi;
|
||||
|
||||
MyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ivHead = itemView.findViewById(R.id.ivFaultHelpHead);
|
||||
tvName = itemView.findViewById(R.id.tvFaultHelpName);
|
||||
tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
|
||||
tvEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
|
||||
ivCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
|
||||
ivNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
|
||||
}
|
||||
|
||||
void initView(String headUrl, String name, String distance, String eventTime) {
|
||||
if (!TextUtils.isEmpty(headUrl)) {
|
||||
V2XServiceManager.getImageLoader()
|
||||
.displayImage(headUrl, ivHead);
|
||||
}
|
||||
tvName.setText(name);
|
||||
tvDistance.setText(distance);
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + distance)
|
||||
.setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_80))
|
||||
.append("M")
|
||||
.setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_30))
|
||||
.create();
|
||||
tvEventTime.setText(eventTime);
|
||||
}
|
||||
}
|
||||
|
||||
private OnViewClickListener mListener;
|
||||
|
||||
public void setOnViewClickListener(OnViewClickListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public interface OnViewClickListener {
|
||||
/**
|
||||
* 点击事件,打电话给车聊聊
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
void onViewChatClick(V2XMarkerEntity entity);
|
||||
|
||||
/**
|
||||
* 点击事件,导航去故障车位置
|
||||
*/
|
||||
void onViewNaviClick(double lat, double lng);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
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.V2XShareEventDescription;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItem;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItemEnum;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventLoadMoreItem;
|
||||
import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.module.v2x.listener.AdapterCallback;
|
||||
import com.mogo.module.v2x.utils.EventTypeUtils;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.DateTimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
private Context context;
|
||||
private ArrayList dataArrayList;
|
||||
private final LayoutInflater shareLayoutInflater;
|
||||
private IMogoServiceApis mApis;
|
||||
private AdapterCallback callback;
|
||||
|
||||
public V2XShareEventAdapter(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 == V2XShareEventItemEnum.ITEM_TYPE_NUM_DES) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_description, parent,
|
||||
false);
|
||||
shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_item, parent,
|
||||
false);
|
||||
shareItemViewHolder holder = new shareItemViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_empty, parent,
|
||||
false);
|
||||
shareEmptyViewHolder holder = new shareEmptyViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS){
|
||||
View v = shareLayoutInflater.inflate(R.layout.item_v2x_event_share_load_more, parent,
|
||||
false);
|
||||
shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v);
|
||||
return holder;
|
||||
}else {
|
||||
View v = shareLayoutInflater.inflate(R.layout.item_v2x_event_share_no_more, parent,
|
||||
false);
|
||||
shareLoadNoMoreViewHolder holder = new shareLoadNoMoreViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
if (holder instanceof shareDescriptionViewHolder) {
|
||||
//分享次数,车友认同次数,热心指数
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventDescription.ResultBean.EnthusiasmIndexBean data = (V2XShareEventDescription.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((float) enthusiasmIndex);
|
||||
}
|
||||
}
|
||||
} else if (holder instanceof shareItemViewHolder) {
|
||||
//分享列表
|
||||
if (dataArrayList.size() > position) {
|
||||
V2XShareEventItem.ResultBean.PageBean.ContentBean data = (V2XShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
|
||||
if (data != null) {
|
||||
String poitype = data.getPoiType();
|
||||
String address = data.getUploadAddress();
|
||||
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp(),DateTimeUtils.MM_Yue_dd_Ri_HH_mm);
|
||||
String likeNum = String.valueOf(data.getLikeNum());
|
||||
String notLikeNum = String.valueOf(data.getNotLikeNum());
|
||||
|
||||
if (poitype != null) {
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setText(EventTypeUtils.getPoiTypeStr(poitype));
|
||||
((shareItemViewHolder) holder).caseStyleTextView.setBackgroundResource(EventTypeUtils.getPoiTypeBg(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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
Object item = dataArrayList.get(position);
|
||||
if (item instanceof V2XShareEventDescription.ResultBean.EnthusiasmIndexBean) {
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_NUM_DES;
|
||||
} else if (item instanceof V2XShareEventItem.ResultBean.PageBean.ContentBean) {
|
||||
return V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
} else if (item instanceof V2XShareEventLoadMoreItem) {
|
||||
return ((V2XShareEventLoadMoreItem) dataArrayList.get(position)).getViewType();
|
||||
}
|
||||
return V2XShareEventItemEnum.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 -> {
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
mApis.getShareManager().showShareDialog();
|
||||
});
|
||||
|
||||
Button refresh = itemView.findViewById(R.id.refresh_button);
|
||||
refresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
callback.getShareEventResponse();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 加载更多/没有更多
|
||||
* */
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 没有更多记录了
|
||||
* */
|
||||
class shareLoadNoMoreViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public shareLoadNoMoreViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
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.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 周边
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingViewHolder> {
|
||||
private List<SurroundingConstruction> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private ImageView mBgImageView;
|
||||
private ImageView mTypeImageView;
|
||||
private TextView mTypeTv;
|
||||
private TextView mTotalTv;
|
||||
|
||||
private SurroundingItemClickListener mClickListener;
|
||||
|
||||
|
||||
public V2XSurroundingAdapter(Context context, List<SurroundingConstruction> poiInfosList, SurroundingItemClickListener clickListener) {
|
||||
mContext = context;
|
||||
mPoiInfosList = poiInfosList;
|
||||
mClickListener = clickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public V2XSurroundingViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.module_fragment_surrounding_event_item, parent, false);
|
||||
return new V2XSurroundingViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull V2XSurroundingViewHolder holder, final int position) {
|
||||
final SurroundingConstruction surroundingConstruction = mPoiInfosList.get(position);
|
||||
if (surroundingConstruction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mBgImageView = holder.itemView.findViewById(R.id.iv_event_bg);
|
||||
mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.tv_poitype);
|
||||
mTotalTv = holder.itemView.findViewById(R.id.tv_info_total);
|
||||
|
||||
mTypeTv.setText(getTypeName(surroundingConstruction.getPoiType()));
|
||||
if (surroundingConstruction.getConstrutList() != null) {
|
||||
mTotalTv.setText(surroundingConstruction.getConstrutList().size() + "条");
|
||||
}
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onItemClickListener(v, position, surroundingConstruction);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//数据绑定
|
||||
Glide.with(mContext)
|
||||
.load(getTypeRes(surroundingConstruction.getPoiType()))
|
||||
.into(mBgImageView);
|
||||
|
||||
// CornerTransform transformation = new CornerTransform(mContext, dip2px(mContext, 15));
|
||||
// //只是绘制左上角和右上角圆角
|
||||
// transformation.setExceptCorner(true, true, false, false);
|
||||
//
|
||||
// Glide.with(mContext).
|
||||
// load(getTypeRes(surroundingConstruction.getPoiType()))
|
||||
// .asBitmap()
|
||||
// .skipMemoryCache(true)
|
||||
// .diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
// .transform(transformation)
|
||||
// .into(mBgImageView);
|
||||
//
|
||||
|
||||
Glide.with(mContext)
|
||||
.load(getTypeSmallRes(surroundingConstruction.getPoiType()))
|
||||
.into(mTypeImageView);
|
||||
}
|
||||
|
||||
public static int dip2px(Context context, float dpValue) {
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mPoiInfosList == null ? 0 : mPoiInfosList.size();
|
||||
}
|
||||
|
||||
private int getTypeSmallRes(String type) {
|
||||
int resId = 0;
|
||||
switch (type) {
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
resId = R.drawable.mogo_image_jiaotongjiancha_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
resId = R.drawable.mogo_image_fenglu_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
resId = R.drawable.mogo_image_daolushigong_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
resId = R.drawable.mogo_image_yongdu_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
resId = R.drawable.mogo_image_jishui_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
resId = R.drawable.mogo_image_jiebing_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
resId = R.drawable.mogo_image_nongwu_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
resId = R.drawable.mogo_image_accident_small;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
resId = R.drawable.mogo_image_shishilukuang_small;
|
||||
break;
|
||||
default:
|
||||
resId = R.drawable.mogo_image_shishilukuang_small;
|
||||
break;
|
||||
}
|
||||
return resId;
|
||||
}
|
||||
|
||||
private int getTypeRes(String type) {
|
||||
int resId = 0;
|
||||
switch (type) {
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
resId = R.drawable.mogo_image_jiaotongjiancha_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
resId = R.drawable.mogo_image_fenglu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
resId = R.drawable.mogo_image_daolushigong_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
resId = R.drawable.mogo_image_yongdu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
resId = R.drawable.mogo_image_jishui_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
resId = R.drawable.mogo_image_jiebing_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
resId = R.drawable.mogo_image_nongwu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
resId = R.drawable.mogo_image_jiaotongshigu_nor;
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
resId = R.drawable.mogo_image_shishlukuang_nor;
|
||||
break;
|
||||
default:
|
||||
resId = R.drawable.mogo_image_shishlukuang_nor;
|
||||
break;
|
||||
}
|
||||
return resId;
|
||||
}
|
||||
|
||||
private String getTypeName(String type) {
|
||||
String typeName = "";
|
||||
switch (type) {
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
typeName = "封路";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
typeName = "路面结冰";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
typeName = "出现浓雾";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
typeName = "交通检查";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
typeName = "道路拥堵";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
typeName = "道路施工";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
typeName = "道路积水";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
default:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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 V2XSurroundingViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public V2XSurroundingViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XBaseViewHolder
|
||||
public abstract class V2XBaseViewHolder<T>
|
||||
extends RecyclerView.ViewHolder
|
||||
implements IMogoNaviListener {
|
||||
|
||||
@@ -36,6 +36,14 @@ public abstract class V2XBaseViewHolder
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 填充View视图
|
||||
*
|
||||
* @param viewData 与视图绑定的数据
|
||||
*/
|
||||
public abstract void initView(T viewData);
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体视图
|
||||
*/
|
||||
@@ -91,10 +99,10 @@ public abstract class V2XBaseViewHolder
|
||||
*/
|
||||
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"1");
|
||||
3);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
@@ -112,10 +120,10 @@ public abstract class V2XBaseViewHolder
|
||||
*/
|
||||
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
try {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
noveltyInfo.getPoiType(),
|
||||
noveltyInfo.getInfoId(),
|
||||
"2");
|
||||
2);
|
||||
|
||||
TrackUtils.trackV2xRoadEvent(
|
||||
noveltyInfo.getInfoId(),
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private TextView mTvAddress, mTvAddressDistance;
|
||||
private ImageView mIvToNav;
|
||||
@@ -41,7 +41,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
|
||||
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.window_fatigue_driving, viewGroup, false));
|
||||
.inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
|
||||
mIvToNav = itemView.findViewById(R.id.ivToNav);
|
||||
@@ -71,6 +71,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
try {
|
||||
@@ -97,9 +98,9 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
|
||||
SpanUtils.with(mTvAddressDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_80))
|
||||
.append("M")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_30))
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,17 +7,21 @@ import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.utils.RoadConditionUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.view.HeartLikeView;
|
||||
import com.mogo.module.v2x.view.HeartUnLikeView;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants;
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
@@ -29,7 +33,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
public class V2XIllegalParkVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private TextView mAddressTv;
|
||||
private TextView mIllegalNumTv;
|
||||
private HeartLikeView mIlIllegalParkingLike;
|
||||
@@ -43,7 +47,7 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
|
||||
public V2XIllegalParkVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.window_illegal_parking, viewGroup, false));
|
||||
.inflate(R.layout.item_v2x_illegal_parking, viewGroup, false));
|
||||
|
||||
mAddressTv = itemView.findViewById(R.id.tvAddress);
|
||||
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
|
||||
@@ -75,6 +79,7 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mExploreWay = v2XEventShowEntity.getV2XIllegalPark();
|
||||
mAddressTv.setText(mExploreWay.getAddr());
|
||||
@@ -100,6 +105,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
*/
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData =new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
|
||||
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(mExploreWay));
|
||||
V2XSQLiteUtils.updateScenarioHistoryDataIsDispose(v2XHistoryScenarioData);
|
||||
itemView.postDelayed(() -> V2XIllegalParkScenario.getInstance().close(), 1000);
|
||||
}
|
||||
|
||||
@@ -108,10 +117,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
"2");
|
||||
2);
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
@@ -121,10 +130,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendDataErrorReceiverInfo(
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
"1");
|
||||
3);
|
||||
}
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@ import com.mogo.service.imageloader.MogoImageView;
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 直播类型的卡片
|
||||
* version: 1.0
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XLiveVideoVH extends V2XBaseViewHolder {
|
||||
public class V2XLiveVideoVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private V2XLiveGSYVideoView videoPlayer;
|
||||
private MogoImageView ivReportHead;
|
||||
@@ -40,6 +41,7 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder {
|
||||
ivReportHead = itemView.findViewById(R.id.ivReportHead);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XLiveCarEntity) {
|
||||
mV2XRoadEventEntity = v2XLiveCarEntity.getV2XRoadEventEntity();
|
||||
mV2XLiveCarEntity = v2XLiveCarEntity.getV2XLiveCarInfoRes();
|
||||
|
||||
@@ -16,7 +16,6 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.SpanUtils;
|
||||
@@ -41,7 +40,7 @@ import static android.view.View.VISIBLE;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private MogoImageView ivHead;
|
||||
private TextView tvName;
|
||||
@@ -84,6 +83,7 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
ivNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
|
||||
ivNavi.setOnClickListener(v -> {
|
||||
triggerStartNavi(mNoveltyInfo);
|
||||
V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn());
|
||||
});
|
||||
|
||||
// 设置视图状态监听
|
||||
@@ -116,8 +116,19 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
try {
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(mV2XPushMessageEntity.getLon());
|
||||
markerLocation.setLat(mV2XPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 只有自研车机才会 有车聊聊通话
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
@@ -137,13 +148,14 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
});
|
||||
|
||||
ivCall.setOnClickListener(v -> {
|
||||
V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn());
|
||||
if (!V2XUtils.isFastClick()) {
|
||||
try {
|
||||
mUserInfo.setSn(mV2XPushMessageEntity.getSn());
|
||||
mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName());
|
||||
mUserInfo.setGender(mV2XPushMessageEntity.getSex());
|
||||
mUserInfo.setAge(30);
|
||||
mUserInfo.setAge(mV2XPushMessageEntity.getAge());
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
@@ -152,16 +164,6 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(mV2XPushMessageEntity.getLon());
|
||||
markerLocation.setLat(mV2XPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
|
||||
V2XServiceManager.getImageLoader()
|
||||
@@ -170,9 +172,9 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
|
||||
tvName.setText(mV2XPushMessageEntity.getDisplayName());
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_80))
|
||||
.append("M")
|
||||
.setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_30))
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
|
||||
String eventTime = String.format("%s发布求助信息",
|
||||
|
||||
@@ -27,8 +27,9 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : TODO 这里是前瞻演示需求,推送的消息,
|
||||
* version: 1.0
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XPushEventVH extends V2XBaseViewHolder {
|
||||
public class V2XPushEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private MogoImageView ivImg;
|
||||
private MogoImageView ivReportHead;
|
||||
|
||||
@@ -136,6 +137,7 @@ public class V2XPushEventVH extends V2XBaseViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XPushMessageEntity();
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
@@ -49,8 +48,9 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* date : 2020/3/11 4:35 PM
|
||||
* desc : 道路事件详情
|
||||
* version: 1.0
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XRoadEventVH extends V2XBaseViewHolder {
|
||||
public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private MogoImageView ivEventImg;
|
||||
private MogoImageView ivReportHead;
|
||||
private ImageView ivEventPlay;
|
||||
@@ -156,6 +156,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
try {
|
||||
if (v2XEventShowEntity == null) {
|
||||
@@ -255,7 +256,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder {
|
||||
List<V2XEventShowEntity> eventShowEntityArrayList = new ArrayList<>();
|
||||
for (V2XLiveCarInfoEntity v2XLiveCarInfoRes : v2XEventShowEntity.getV2XLiveCarList()) {
|
||||
V2XEventShowEntity showEntity = new V2XEventShowEntity();
|
||||
showEntity.setViewType(V2XWindowTypeEnum.LIVE_CAR_WINDOW);
|
||||
showEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING);
|
||||
showEntity.setV2XLiveCarInfoRes(v2XLiveCarInfoRes);
|
||||
showEntity.setV2XRoadEventEntity(mV2XRoadEventEntity);
|
||||
eventShowEntityArrayList.add(showEntity);
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.utils.RoadConditionUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.view.HeartLikeView;
|
||||
import com.mogo.module.v2x.view.HeartUnLikeView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* 出行面板违章停车
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
|
||||
private TextView mTvAddress;
|
||||
private TextView mTvIllegalNum;
|
||||
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
|
||||
private HeartLikeView mLlIllegalParkingLike;
|
||||
private HeartUnLikeView mLlIllegalParkingUnLike;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
|
||||
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
|
||||
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
|
||||
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
|
||||
mTvAddress.setText(mExploreWay.getAddr());
|
||||
|
||||
try {
|
||||
mTvIllegalNum.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!viewData.isDispose()) {
|
||||
hideControlButton(View.VISIBLE);
|
||||
} else {
|
||||
hideControlButton(View.GONE);
|
||||
}
|
||||
|
||||
mLlIllegalParkingLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
|
||||
roadReportTrue();
|
||||
});
|
||||
|
||||
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
|
||||
roadReportErr();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
mLlIllegalParkingLike.setVisibility(gone);
|
||||
mLlIllegalParkingUnLike.setVisibility(gone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerUserInfo;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.module.v2x.utils.ChartingUtil;
|
||||
import com.mogo.module.v2x.utils.SpanUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
/**
|
||||
* 出行动态中的他人故障求助
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
|
||||
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
private MogoImageView mIvFaultHelpHead;
|
||||
private TextView mTvFaultHelpName;
|
||||
private TextView mTvFaultHelpEventTime;
|
||||
private TextView mTvFaultHelpDistance;
|
||||
private ImageView mIvFaultHelpEventCall;
|
||||
private ImageView mIvFaultHelpEventNavi;
|
||||
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
// 上传事件的用户信息
|
||||
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
|
||||
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryOtherSeekHelpVH(@NonNull ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history_other_help, viewGroup, false));
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
mIvFaultHelpHead = itemView.findViewById(R.id.ivFaultHelpHead);
|
||||
mTvFaultHelpName = itemView.findViewById(R.id.tvFaultHelpName);
|
||||
mTvFaultHelpEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
|
||||
mTvFaultHelpDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
|
||||
mIvFaultHelpEventCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
|
||||
mIvFaultHelpEventNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
V2XPushMessageEntity xPushMessageEntity = GsonUtil.objectFromJson(viewData.getEventJsonData(), V2XPushMessageEntity.class);
|
||||
|
||||
mTvFaultHelpName.setText(xPushMessageEntity.getDisplayName());
|
||||
|
||||
if (!TextUtils.isEmpty(xPushMessageEntity.getHeadImgUrl())) {
|
||||
V2XServiceManager.getImageLoader()
|
||||
.displayImage(xPushMessageEntity.getHeadImgUrl(), mIvFaultHelpHead);
|
||||
}
|
||||
|
||||
SpanUtils.with(mTvFaultHelpDistance)
|
||||
.append("" + (int) xPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
|
||||
String eventTime = String.format("%s发布求助信息",
|
||||
sdf.format(new Date(xPushMessageEntity.getCreateTime())));
|
||||
mTvFaultHelpEventTime.setText(eventTime);
|
||||
|
||||
try {
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(xPushMessageEntity.getLon());
|
||||
markerLocation.setLat(xPushMessageEntity.getLat());
|
||||
mNoveltyInfo = new MarkerExploreWay();
|
||||
mNoveltyInfo.setLocation(markerLocation);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mIvFaultHelpEventNavi.setOnClickListener(v -> {
|
||||
triggerStartNavi(mNoveltyInfo);
|
||||
});
|
||||
|
||||
// 只有自研车机才会 有车聊聊通话
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isCanCall(b -> {
|
||||
if (b) {
|
||||
// 判断是否可以打电话
|
||||
ChartingUtil.isOnLine(xPushMessageEntity.getSn(), b1 -> {
|
||||
if (b1) {
|
||||
mIvFaultHelpEventCall.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mIvFaultHelpEventCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mIvFaultHelpEventCall.setVisibility(GONE);
|
||||
}
|
||||
});
|
||||
|
||||
mIvFaultHelpEventCall.setOnClickListener(v -> {
|
||||
if (!V2XUtils.isFastClick()) {
|
||||
try {
|
||||
mUserInfo.setSn(xPushMessageEntity.getSn());
|
||||
mUserInfo.setUserHead(xPushMessageEntity.getHeadImgUrl());
|
||||
mUserInfo.setUserName(xPushMessageEntity.getDisplayName());
|
||||
mUserInfo.setGender(xPushMessageEntity.getSex());
|
||||
mUserInfo.setAge(xPushMessageEntity.getAge());
|
||||
mNoveltyInfo.setUserInfo(mUserInfo);
|
||||
triggerCallChart(mNoveltyInfo);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
V2XServiceManager.getV2XRefreshModel().respondingToHelp(mUserInfo.getSn());
|
||||
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData, v2XHistoryScenarioData);
|
||||
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.utils.EventTypeUtils;
|
||||
import com.mogo.module.v2x.utils.RoadConditionUtils;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.view.HeartLikeView;
|
||||
import com.mogo.module.v2x.view.HeartUnLikeView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* 出行面板道路事件面板
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder<V2XHistoryScenarioData> {
|
||||
private TextView mTvAddress;
|
||||
private TextView mTvIllegalNum;
|
||||
private ImageView mIvIconP;
|
||||
private TextView mTagEventType;
|
||||
private TextView mTagEventEvaluate;
|
||||
|
||||
private HeartLikeView mLlIllegalParkingLike;
|
||||
private HeartUnLikeView mLlIllegalParkingUnLike;
|
||||
|
||||
private MarkerExploreWay mExploreWay;
|
||||
private V2XHistoryScenarioData mOldScenarioData;
|
||||
|
||||
public V2XScenarioHistoryRoadEventVH(@NonNull ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_scennario_history, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
mTvIllegalNum = itemView.findViewById(R.id.tvIllegalNum);
|
||||
mIvIconP = itemView.findViewById(R.id.ivIconP);
|
||||
mTagEventType = itemView.findViewById(R.id.tagEventType);
|
||||
mTagEventEvaluate = itemView.findViewById(R.id.tagEventEvaluate);
|
||||
|
||||
mLlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
|
||||
mLlIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
try {
|
||||
mOldScenarioData = viewData;
|
||||
mExploreWay = GsonUtil.objectFromJson(viewData.getEventJsonData(), MarkerExploreWay.class);
|
||||
|
||||
mIvIconP.setVisibility(View.GONE);
|
||||
mTvAddress.setText(mExploreWay.getAddr());
|
||||
mTagEventType.setText(EventTypeUtils.getPoiTypeStr(mExploreWay.getPoiType()));
|
||||
|
||||
try {
|
||||
mTvIllegalNum.setText(mExploreWay.getUserInfo().getUserName() + " 的分享 时间:" +
|
||||
TimeUtils.millis2String(mOldScenarioData.getTriggerTime(), "MM月dd日 HH:mm"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (!viewData.isDispose()) {
|
||||
hideControlButton(View.VISIBLE);
|
||||
} else {
|
||||
hideControlButton(View.GONE);
|
||||
}
|
||||
|
||||
mLlIllegalParkingLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
|
||||
roadReportTrue();
|
||||
});
|
||||
|
||||
mLlIllegalParkingUnLike.setOnClickCallListener(v -> {
|
||||
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
|
||||
roadReportErr();
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void hideControlButton(int gone) {
|
||||
mTagEventEvaluate.setVisibility(gone);
|
||||
mLlIllegalParkingLike.setVisibility(gone);
|
||||
mLlIllegalParkingUnLike.setVisibility(gone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
try {
|
||||
hideControlButton(View.GONE);
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(mOldScenarioData.getScenarioType());
|
||||
v2XHistoryScenarioData.setTriggerTime(mOldScenarioData.getTriggerTime());
|
||||
v2XHistoryScenarioData.setEventJsonData(mOldScenarioData.getEventJsonData());
|
||||
v2XHistoryScenarioData.setDispose(true);
|
||||
V2XSQLiteUtils.updateScenarioHistoryData(mOldScenarioData,v2XHistoryScenarioData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
private void roadReportTrue() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
private void roadReportErr() {
|
||||
delayedCloseWindow();
|
||||
if (mExploreWay != null) {
|
||||
RoadConditionUtils.sendShareReceiverInfo(
|
||||
mExploreWay.getPoiType(),
|
||||
mExploreWay.getInfoId(),
|
||||
3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.ArrayUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -41,7 +41,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* @author donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/13 11:02 AM
|
||||
* desc :
|
||||
@@ -96,7 +96,6 @@ public class V2XAlarmServer {
|
||||
eventLocation.getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
// Logger.w(MODULE_NAME, "V2X预警--事件位置===" + eventLocation);
|
||||
if (0 <= eventAngle && eventAngle <= 20) {
|
||||
// 判断是否已经提示过道路事件
|
||||
boolean isAlreadyAlert = false;
|
||||
@@ -112,12 +111,12 @@ public class V2XAlarmServer {
|
||||
isAlreadyAlert = true;
|
||||
}
|
||||
}
|
||||
// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
// "\n是否已经提醒:" + isAlreadyAlert +
|
||||
// "\n事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo())
|
||||
// );
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
|
||||
"\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
"\n是否已经提醒:" + isAlreadyAlert +
|
||||
"\n事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
"\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo())
|
||||
);
|
||||
// 进行提醒
|
||||
if (!isAlreadyAlert) {
|
||||
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
|
||||
@@ -125,22 +124,23 @@ public class V2XAlarmServer {
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
|
||||
// "\n角度:" + eventAngle + " 度" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
|
||||
"\n角度:" + eventAngle + " 度" +
|
||||
"\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" +
|
||||
"\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
"\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Logger.w(MODULE_NAME,
|
||||
// "车头方向: " + currentLocation.getAngle() +
|
||||
// "\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
|
||||
// );
|
||||
Logger.w(MODULE_NAME,
|
||||
"V2X预警--车头方向与事件方向角度不一致:" +
|
||||
"\n车头方向: " + currentLocation.getBearing() +
|
||||
"\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 构造数据
|
||||
* @since 2020/8/7
|
||||
*/
|
||||
public class SurroundingConstruction implements Serializable {
|
||||
private String poiType;
|
||||
private List<MarkerExploreWay> construtList;
|
||||
|
||||
public SurroundingConstruction(String poiType) {
|
||||
this.poiType = poiType;
|
||||
construtList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getPoiType() {
|
||||
return poiType;
|
||||
}
|
||||
|
||||
public void setPoiType(String poiType) {
|
||||
this.poiType = poiType;
|
||||
}
|
||||
|
||||
public List<MarkerExploreWay> getConstrutList() {
|
||||
return construtList;
|
||||
}
|
||||
|
||||
public void addMarkerExploreWay(MarkerExploreWay item) {
|
||||
construtList.add(item);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class SurroundingResponse extends BaseData {
|
||||
/**
|
||||
* msg : null
|
||||
* result : {"exploreWay":[{"infoId":"740635251747942400","type":"CARD_TYPE_ROAD_CONDITION","location":{"lon":116.370207,"lat":39.968394,"angle":180,"address":"测试直播"},"canLive":false,"fileType":1,"addr":"测试直播","generateTime":1596622804859,"cityName":"","distance":717,"userInfo":{"sn":"E841CC2018PZD20408","userId":0,"userName":"零下的雨008","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592473692394.jpeg"},"items":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952448035.mp4?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D465089a3c078ed60c395cb65d41f61b28e9a3397","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1594952453342.jpg?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1596701407%3B1596708607%26q-key-time%3D1596701407%3B1596708607%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D6f36b4c945197737f8576e42a5c599ed3d150a4a"}],"uploadType":"2","poiType":"10011"}]}
|
||||
*/
|
||||
private ResultBean result;
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
|
||||
public List<MarkerExploreWay> getExploreWay() {
|
||||
return exploreWay;
|
||||
}
|
||||
|
||||
public void setExploreWay(List<MarkerExploreWay> exploreWay) {
|
||||
this.exploreWay = exploreWay;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class V2XShareEventDescription 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 = 0;
|
||||
private int likeNum = 0;
|
||||
private int notLikeNum = 0;
|
||||
private double enthusiasmIndex = 10;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class V2XShareEventItem extends BaseData implements Serializable {
|
||||
|
||||
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 {
|
||||
private PageBean page;
|
||||
|
||||
public PageBean getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(PageBean page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public static class PageBean {
|
||||
|
||||
private int total;
|
||||
private int pageSize;
|
||||
private int pageNum;
|
||||
private List<ContentBean> 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<ContentBean> getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(List<ContentBean> 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 +
|
||||
'}';
|
||||
}
|
||||
|
||||
private int viewType = V2XShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
private Long uploadTimestamp;
|
||||
private long timeout;
|
||||
private String uploadAddress;
|
||||
private Integer distance;
|
||||
private String dbId;
|
||||
private String poiType;
|
||||
private String sn;
|
||||
private Long userId;
|
||||
private String userName;
|
||||
private String userHead;
|
||||
private Integer likeNum;
|
||||
private int notLikeNum;
|
||||
private Integer 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 Integer direction;
|
||||
private Integer virtualLikeNum;
|
||||
private Integer status;
|
||||
private String sourceType;
|
||||
private String hitId;
|
||||
private Integer userType;
|
||||
private List<Double> coordinates;
|
||||
private List<DataBean> 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 Integer getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(Integer 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 Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long 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 Integer getLikeNum() {
|
||||
return likeNum;
|
||||
}
|
||||
|
||||
public void setLikeNum(Integer likeNum) {
|
||||
this.likeNum = likeNum;
|
||||
}
|
||||
|
||||
public int getNotLikeNum() {
|
||||
return notLikeNum;
|
||||
}
|
||||
|
||||
public void setNotLikeNum(int notLikeNum) {
|
||||
this.notLikeNum = notLikeNum;
|
||||
}
|
||||
|
||||
public Integer getUploadType() {
|
||||
return uploadType;
|
||||
}
|
||||
|
||||
public void setUploadType(Integer 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 Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public Integer getVirtualLikeNum() {
|
||||
return virtualLikeNum;
|
||||
}
|
||||
|
||||
public void setVirtualLikeNum(Integer virtualLikeNum) {
|
||||
this.virtualLikeNum = virtualLikeNum;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer 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 Integer getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(Integer userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public List<Double> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<Double> coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> 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 String 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 String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public Object getIllegalCount() {
|
||||
return illegalCount;
|
||||
}
|
||||
|
||||
public void setIllegalCount(Object illegalCount) {
|
||||
this.illegalCount = illegalCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
public interface V2XShareEventItemEnum {
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.v2x.entity.panel;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/*
|
||||
* 没有任何分享,去分享/加载更多/没有更多了
|
||||
* */
|
||||
public class V2XShareEventLoadMoreItem extends BaseData implements Serializable {
|
||||
private String statusText;
|
||||
private int viewType;
|
||||
private boolean clickable = true;
|
||||
|
||||
public boolean isClickable() {
|
||||
return clickable;
|
||||
}
|
||||
|
||||
public void setClickable(boolean clickable) {
|
||||
this.clickable = clickable;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.mogo.module.v2x.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
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.V2XServiceManager
|
||||
import com.mogo.module.v2x.adapter.V2XEventPagerAdapter
|
||||
import com.mogo.module.v2x.presenter.EventPanelPresenter
|
||||
import com.mogo.module.v2x.utils.TrackUtils
|
||||
import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
|
||||
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
|
||||
import com.mogo.module.v2x.voice.V2XVoiceConstants
|
||||
import com.mogo.module.v2x.voice.V2XVoiceManager
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.*
|
||||
|
||||
|
||||
/**
|
||||
* 事件面板主fragment
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
private val TAG = "EventPanelFragment"
|
||||
|
||||
private var isFirstLoad = false
|
||||
|
||||
private var fragments: Array<Fragment>? = null
|
||||
|
||||
private var mediator: TabLayoutMediator? = null
|
||||
|
||||
private var mV2XEventPanelHistoryCountView: V2XEventPanelHistoryCountView? = null
|
||||
|
||||
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
|
||||
|
||||
companion object {
|
||||
private val fragment = V2XEventPanelFragment()
|
||||
fun getInstance(): V2XEventPanelFragment {
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
// 打开出行动态TAB
|
||||
private val mCheckHistoryEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
try {
|
||||
rgTabSelect?.check(R.id.rbScenarioHistory)
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
// 打开周边事件TAB
|
||||
private val mCheckSurroundingCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
try {
|
||||
rgTabSelect?.check(R.id.rbSurroundingEvent)
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
// 打开我的分享TAB
|
||||
private val mCheckShearEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
try {
|
||||
rgTabSelect?.check(R.id.rbShareEvents)
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
// 打关闭事件面板
|
||||
private val mCloeEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
|
||||
try {
|
||||
hidePanel()
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_v2x_event_panel_fragment_event_panel
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(MODULE_NAME, "事件面板初始化……")
|
||||
try {
|
||||
fragments = arrayOf(
|
||||
mV2XScenarioHistoryFragment,
|
||||
V2XSurroundingFragment(),
|
||||
V2XShareEventsFragment()
|
||||
)
|
||||
//禁用预加载
|
||||
vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
|
||||
vpEventPanel.adapter = V2XEventPagerAdapter(this, fragments!!)
|
||||
vpEventPanel.isUserInputEnabled = false; //true:滑动,false:禁止滑动
|
||||
|
||||
rgTabSelect?.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rbScenarioHistory -> {
|
||||
TrackUtils.trackV2xHistoryEvent(2)
|
||||
vpEventPanel.setCurrentItem(0, false)
|
||||
}
|
||||
R.id.rbSurroundingEvent -> {
|
||||
TrackUtils.trackV2xHistoryEvent(3)
|
||||
vpEventPanel.setCurrentItem(1, false)
|
||||
}
|
||||
R.id.rbShareEvents -> {
|
||||
TrackUtils.trackV2xHistoryEvent(4)
|
||||
vpEventPanel.setCurrentItem(2, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btnHidePanels.setOnClickListener {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
}
|
||||
|
||||
mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context)
|
||||
mV2XEventPanelHistoryCountView!!.setOnClickListener {
|
||||
if (!isPanelShow()) {
|
||||
TrackUtils.trackV2xHistoryEvent(1)
|
||||
showPanel()
|
||||
}
|
||||
}
|
||||
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
|
||||
changeEventCount()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mediator?.detach()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun createPresenter(): EventPanelPresenter {
|
||||
return EventPanelPresenter(this)
|
||||
}
|
||||
|
||||
fun showPanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
clPanelContainer.visibility = View.VISIBLE
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, mCheckHistoryEventCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, mCheckSurroundingCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, mCheckShearEventCb)
|
||||
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, mCloeEventCb)
|
||||
try {
|
||||
if (isFirstLoad) {
|
||||
mV2XScenarioHistoryFragment.presenter.loadHistory()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
isFirstLoad = true
|
||||
}
|
||||
|
||||
fun hidePanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
clPanelContainer.visibility = View.GONE
|
||||
// 注册语音交互
|
||||
V2XVoiceManager.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
return clPanelContainer.visibility == View.VISIBLE
|
||||
}
|
||||
|
||||
// 修改未处理消息
|
||||
fun changeEventCount() {
|
||||
// val historyMessage = V2XSQLiteUtils.getScenarioHistoryUnDisposeData()
|
||||
// if (historyMessage != null) {
|
||||
// mV2XEventPanelHistoryCountView?.changeMsgCount(historyMessage.size)
|
||||
// } else {
|
||||
// mV2XEventPanelHistoryCountView?.changeMsgCount(0)
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.mogo.module.v2x.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
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.SpacesItemDecoration;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener;
|
||||
import com.mogo.module.v2x.manager.V2XStatusDescriptor;
|
||||
import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter;
|
||||
import com.mogo.module.v2x.utils.ThreadUtils;
|
||||
import com.mogo.module.v2x.view.V2XListEmptyView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出行动态,V2X 提示过的场景历史
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryFragment
|
||||
extends MvpFragment<V2XScenarioHistoryFragment, ScenarioHistoryPresenter> {
|
||||
private String TAG = "ScenarioHistoryFragment";
|
||||
|
||||
private V2XListEmptyView mEmptyView;
|
||||
private CoordinatorLayout mClHistoryList;
|
||||
private RecyclerView mRecyclerView;
|
||||
private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter;
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_v2x_event_panel_fragment_scenario_history;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d(TAG, "initViews --------> ");
|
||||
|
||||
mEmptyView = findViewById(R.id.viewEmpty);
|
||||
mClHistoryList = findViewById(R.id.clHistoryList);
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData);
|
||||
mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration(14));
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
initListener();
|
||||
|
||||
mEmptyView.setTripMessage("暂无交通事件");
|
||||
mEmptyView.setRefreshVisibility(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化页面用到得监听
|
||||
*/
|
||||
private void initListener() {
|
||||
mEmptyView.setOnControlListener(new V2XListEmptyView.OnControlListener() {
|
||||
@Override
|
||||
public void onShearClick() {
|
||||
V2XServiceManager.getMogoShareManager().showShareDialog();
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshClick() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
V2XServiceManager.getMoGoV2XStatusManager()
|
||||
.registerStatusChangedListener(
|
||||
TAG,
|
||||
V2XStatusDescriptor.EventPanelWindow_UI,
|
||||
new IMoGoV2XStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue) {
|
||||
Logger.d(TAG, descriptor + " initViews --------> " + isTrue);
|
||||
if (descriptor == V2XStatusDescriptor.EventPanelWindow_UI) {
|
||||
mPresenter.loadHistory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "init --------> ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表加载数据
|
||||
*
|
||||
* @param v2XHistoryScenarioData 最新数据
|
||||
*/
|
||||
public void loadHistory(List<V2XHistoryScenarioData> v2XHistoryScenarioData) {
|
||||
Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData));
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mV2XHistoryScenarioData.clear();
|
||||
if (v2XHistoryScenarioData.size() > 0) {
|
||||
mEmptyView.setVisibility(View.GONE);
|
||||
mClHistoryList.setVisibility(View.VISIBLE);
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
} else {
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
mClHistoryList.setVisibility(View.GONE);
|
||||
}
|
||||
mV2XScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mPresenter.loadHistory();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ScenarioHistoryPresenter createPresenter() {
|
||||
return new ScenarioHistoryPresenter(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.V2XShareEventAdapter;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventDescription;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItem;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItemEnum;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventLoadMoreItem;
|
||||
import com.mogo.module.v2x.listener.AdapterCallback;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.network.V2XShareNetworkModel;
|
||||
import com.mogo.module.v2x.presenter.ShareEventsPresenter;
|
||||
import com.mogo.module.v2x.view.V2XNetworkLoadingView;
|
||||
import com.mogo.utils.CheckUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class V2XShareEventsFragment extends MvpFragment implements AdapterCallback {
|
||||
|
||||
private static final String TAG = "ShareEventsFragment";
|
||||
private RecyclerView recyclerView;
|
||||
private V2XShareEventAdapter adapter;
|
||||
private ArrayList dataArrayList =new ArrayList();
|
||||
;
|
||||
private int pageNum = 1;
|
||||
private V2XShareNetworkModel v2XShareNetworkModel;
|
||||
|
||||
//动画
|
||||
private V2XNetworkLoadingView loadingView;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_v2x_event_share_recylerview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
v2XShareNetworkModel = new V2XShareNetworkModel(getContext());
|
||||
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 V2XShareEventAdapter(getActivity(), dataArrayList, this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
loadingView = mRootView.findViewById(R.id.network_loading_imageview);
|
||||
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
getShareEventResponse();
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取热心指数,分享列表等分享内容
|
||||
* */
|
||||
@Override
|
||||
public void getShareEventResponse() {
|
||||
animatioonAcction(View.VISIBLE);
|
||||
v2XShareNetworkModel.getShareEventResponse(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
if (result instanceof V2XShareEventDescription) {
|
||||
V2XShareEventDescription resultData = (V2XShareEventDescription) result;
|
||||
|
||||
if (resultData != null && resultData.getResult() != null
|
||||
&& resultData.getResult().getEnthusiasmIndex() != null) {
|
||||
dataArrayList.add(resultData.getResult().getEnthusiasmIndex());
|
||||
Log.d(TAG, "热心指数:" + resultData.getResult().getEnthusiasmIndex());
|
||||
}
|
||||
} else if (result instanceof V2XShareEventItem) {
|
||||
loadSuccessWithShareEventList(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
loadingView.stopWithError(msg,View.VISIBLE);
|
||||
loadingView.refresButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getShareEventResponse();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 我的分享列表数据处理
|
||||
* */
|
||||
private void loadSuccessWithShareEventList(Object result) {
|
||||
animatioonAcction(View.GONE);
|
||||
V2XShareEventItem resultData = (V2XShareEventItem) result;
|
||||
V2XShareEventLoadMoreItem item = new V2XShareEventLoadMoreItem();
|
||||
if (resultData != null && resultData.getResult() != null) {
|
||||
if (resultData.getResult().getPage() != null) {
|
||||
int total = resultData.getResult().getPage().getTotal();
|
||||
if (total == 0) {
|
||||
//空白
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
|
||||
dataArrayList.add(item);
|
||||
} else {
|
||||
if (dataArrayList.size() > 0) {
|
||||
Object data = dataArrayList.get(dataArrayList.size() - 1);
|
||||
if (data instanceof V2XShareEventLoadMoreItem || data instanceof V2XShareEventLoadMoreItem) {
|
||||
dataArrayList.remove(dataArrayList.size() - 1);
|
||||
}
|
||||
}
|
||||
if (resultData.getResult().getPage().getContent().size() > 0) {
|
||||
//当前页有数据
|
||||
dataArrayList.addAll(resultData.getResult().getPage().getContent());
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS);
|
||||
} else {
|
||||
//当前页没有数据
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_NO_MORE);
|
||||
}
|
||||
if (total > 10) {
|
||||
dataArrayList.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "分享列表:" + dataArrayList.get(0));
|
||||
} else {
|
||||
//空白
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
|
||||
dataArrayList.add(item);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
private void animatioonAcction(int visible) {
|
||||
if (visible == View.VISIBLE) {
|
||||
loadingView.start();
|
||||
} else {
|
||||
loadingView.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ShareEventsPresenter createPresenter() {
|
||||
Log.d(TAG, "createPresenter");
|
||||
return new ShareEventsPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMoreShareEventList() {
|
||||
Log.d(TAG, "page--" + pageNum);
|
||||
animatioonAcction(View.VISIBLE);
|
||||
pageNum += 1;
|
||||
v2XShareNetworkModel.getShareEventList(pageNum, 10, new V2XRefreshCallback() {
|
||||
@Override
|
||||
public void onSuccess(Object result) {
|
||||
loadSuccessWithShareEventList(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String msg) {
|
||||
loadingView.stopWithError(msg,View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,404 @@
|
||||
package com.mogo.module.v2x.fragment;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XSurroundingAdapter;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
|
||||
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
|
||||
import com.mogo.module.v2x.utils.animation.AnimationResources;
|
||||
import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
|
||||
import com.mogo.module.v2x.view.SurroundingEventView;
|
||||
import com.mogo.module.v2x.view.SurroundingMarginDecoration;
|
||||
import com.mogo.module.v2x.view.V2XNetworkLoadingView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static android.view.View.OVER_SCROLL_NEVER;
|
||||
|
||||
/**
|
||||
* 周边事件
|
||||
*/
|
||||
public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView,
|
||||
View.OnClickListener, SurroundingItemClickListener {
|
||||
private static final String TAG = "SurroundingFragment";
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mTotalTv;
|
||||
private RelativeLayout mTopLayout;
|
||||
private RelativeLayout mEmptyLayout;
|
||||
private TextView mTopFreshTv;
|
||||
private TextView mShareTv;
|
||||
private TextView mFreshTv;
|
||||
private V2XSurroundingAdapter mAdapter;
|
||||
private SurroundingEventPresenter surroundingEventPresenter;
|
||||
private List<SurroundingConstruction> poiInfosList = new ArrayList<>();
|
||||
private IMogoServiceApis mApis;
|
||||
private V2XNetworkLoadingView mloadingImage;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
Log.d(TAG, "getLayoutId --------> ");
|
||||
return R.layout.module_event_panel_fragment_surrounding;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d(TAG, "initViews --------> ");
|
||||
mRecyclerView = findViewById(R.id.surrounding_recycleview);
|
||||
mTotalTv = findViewById(R.id.tv_brief);
|
||||
mTopLayout = findViewById(R.id.layout_top);
|
||||
mEmptyLayout = findViewById(R.id.layout_empty_data_show);
|
||||
mTopFreshTv = findViewById(R.id.tv_top_refresh);
|
||||
mShareTv = findViewById(R.id.tv_main_share);
|
||||
mFreshTv = findViewById(R.id.tv_main_refresh);
|
||||
mloadingImage = mRootView.findViewById(R.id.loading_iv);
|
||||
mTopFreshTv.setOnClickListener(this);
|
||||
mShareTv.setOnClickListener(this);
|
||||
mFreshTv.setOnClickListener(this);
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
|
||||
int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
|
||||
mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels));
|
||||
mRecyclerView.setLayoutManager(layoutManage);
|
||||
|
||||
mAdapter = new V2XSurroundingAdapter(getActivity(), poiInfosList, this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
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);
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
|
||||
Log.d(TAG, "onViewCreated --------->");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
if (id == R.id.tv_main_share) {
|
||||
//弹出框面板消失,出现分享弹框
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
if (mApis != null && mApis.getShareManager() != null) {
|
||||
mApis.getShareManager().showShareDialog();
|
||||
}
|
||||
} else if (id == R.id.tv_main_refresh || id == R.id.tv_top_refresh) { //刷新
|
||||
initData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取和刷新数据
|
||||
*/
|
||||
private void initData() {
|
||||
mTopLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mloadingImage.start();
|
||||
surroundingEventPresenter.getSurroundingEventData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示列表数据
|
||||
*/
|
||||
@Override
|
||||
public void showSurroudingData(List<MarkerExploreWay> exploreWayList) {
|
||||
mloadingImage.stop();
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
//展示数据
|
||||
mTopLayout.setVisibility(View.VISIBLE);
|
||||
mRecyclerView.setVisibility(View.VISIBLE);
|
||||
mEmptyLayout.setVisibility(View.GONE);
|
||||
|
||||
poiInfosList.clear();
|
||||
//对数据进行分类
|
||||
poiInfosList.addAll(handleMapToList(getPoiTypeMap(exploreWayList)));
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
//总条数
|
||||
String originStr = String.format(getContext().getResources().getString(R.string.v2x_surrounding_top_brief), exploreWayList.size());
|
||||
SpannableString spannableString = new SpannableString(originStr);
|
||||
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#256BFF")), 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//设置字体大小,true表示前面的字体大小20单位为dip
|
||||
spannableString.setSpan(new AbsoluteSizeSpan(36, true), 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannableString.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 7, originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mTotalTv.setText(spannableString);
|
||||
} else {
|
||||
mTopLayout.setVisibility(View.GONE);
|
||||
mRecyclerView.setVisibility(View.GONE);
|
||||
mEmptyLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
|
||||
Map<String, SurroundingConstruction> mPoiTypeMarkers = new HashMap<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MarkerExploreWay exploreWay = list.get(i);
|
||||
if (!mPoiTypeMarkers.containsKey(exploreWay.getPoiType())) {
|
||||
mPoiTypeMarkers.put(exploreWay.getPoiType(), new SurroundingConstruction(exploreWay.getPoiType()));
|
||||
}
|
||||
SurroundingConstruction construction = mPoiTypeMarkers.get(exploreWay.getPoiType());
|
||||
construction.addMarkerExploreWay(exploreWay);
|
||||
}
|
||||
|
||||
Log.d(TAG, "getPoiTypeMap mPoiTypeMarkers.size() = " + mPoiTypeMarkers.size());
|
||||
|
||||
return mPoiTypeMarkers;
|
||||
}
|
||||
|
||||
|
||||
private List<SurroundingConstruction> handleMapToList(Map<String, SurroundingConstruction> map) {
|
||||
Collection<? extends SurroundingConstruction> valueCollection = map.values();
|
||||
List<SurroundingConstruction> list = new ArrayList<>(valueCollection);
|
||||
List<SurroundingConstruction> resultSurroundingList = new ArrayList<>();
|
||||
List<SurroundingConstruction> outSurroundingList = new ArrayList<>();
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
List<String> prioritySorts = prioritySort();
|
||||
for (String poiType : prioritySorts) {
|
||||
for (SurroundingConstruction construction : list) {
|
||||
if (!prioritySorts.contains(construction.getPoiType())) {
|
||||
outSurroundingList.add(construction);
|
||||
continue;
|
||||
} else if (poiType.equals(construction.getPoiType())) {
|
||||
resultSurroundingList.add(construction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outSurroundingList != null && outSurroundingList.size() > 0) {
|
||||
resultSurroundingList.addAll(outSurroundingList);
|
||||
}
|
||||
|
||||
Log.d(TAG, "handleMapToList resultSurroundingList.size() = " + resultSurroundingList.size());
|
||||
return resultSurroundingList;
|
||||
}
|
||||
|
||||
public static List<String> prioritySort() {
|
||||
List<String> poiTypes = new LinkedList<>();
|
||||
|
||||
// 封路
|
||||
poiTypes.add("10003");
|
||||
// 结冰
|
||||
poiTypes.add("10011");
|
||||
// 浓雾
|
||||
poiTypes.add("10010");
|
||||
// 交通检查
|
||||
poiTypes.add("10002");
|
||||
// 交通事故
|
||||
poiTypes.add("10013");
|
||||
// 拥堵
|
||||
poiTypes.add("10007");
|
||||
// 道路施工
|
||||
poiTypes.add("10006");
|
||||
// 积水
|
||||
poiTypes.add("10008");
|
||||
//实时路况
|
||||
poiTypes.add("10015");
|
||||
|
||||
return poiTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理marker的显示
|
||||
*
|
||||
* @param v
|
||||
* @param position
|
||||
* @param construction
|
||||
*/
|
||||
@Override
|
||||
public void onItemClickListener(View v, int position, SurroundingConstruction construction) {
|
||||
if (construction != null) {
|
||||
//卡片消失
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
//清除道路事件
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
|
||||
try {
|
||||
//处理 marker的显示
|
||||
List<MarkerExploreWay> exploreWayList = construction.getConstrutList();
|
||||
Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size());
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
for (int i = 0; i < exploreWayList.size(); i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(exploreWay);
|
||||
markerShowEntity.setChecked(false);
|
||||
markerShowEntity.setTextContent(exploreWay.getAddr());
|
||||
markerShowEntity.setMarkerLocation(exploreWay.getLocation());
|
||||
markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarker mogoMarker = V2XServiceManager.getIMogoMarkerService().drawMarker(markerShowEntity);
|
||||
// 点击监听,天际弹窗展示详情
|
||||
if (mogoMarker != null) {
|
||||
mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimStart() {
|
||||
Logger.d(TAG, " onItemClickListener onAnimStart -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimEnd() {
|
||||
if (mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, " onItemClickListener onAnimEnd ------> ");
|
||||
mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
|
||||
}
|
||||
});
|
||||
mogoMarker.setOwner(markerShowEntity.getMarkerType());
|
||||
mogoMarker.setObject(markerShowEntity);
|
||||
}
|
||||
}, i * 100L);
|
||||
}
|
||||
|
||||
//自适应显示
|
||||
showBonndsRoadtion(exploreWayList);
|
||||
} else {
|
||||
Logger.e(TAG, "onItemClickListener exploreWayList == null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自适应显示
|
||||
*
|
||||
* @param exploreWayList
|
||||
*/
|
||||
private void showBonndsRoadtion(List<MarkerExploreWay> exploreWayList) {
|
||||
Logger.d(TAG, "showBonndsRoadtion exploreWayList.size() = " + exploreWayList.size());
|
||||
Rect rect = new Rect(
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_left),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_top),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_right),
|
||||
(int) getContext().getResources().getDimension(R.dimen.module_v2x_map_bottom));
|
||||
|
||||
moveNotFresh();
|
||||
//第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
|
||||
//第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
|
||||
V2XServiceManager.getMapUIController().showBounds(ServiceConst.CARD_TYPE_ROAD_CONDITION, null, getMogoList(exploreWayList), rect, false);
|
||||
}
|
||||
|
||||
private void moveNotFresh() {
|
||||
V2XServiceManager.getMoGoStatusManager().setUserInteractionStatus(TAG, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造经纬度列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<MogoLatLng> getMogoList(List<MarkerExploreWay> markerExploreWayList) {
|
||||
List<MogoLatLng> list = new ArrayList<>();
|
||||
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
|
||||
if (markerExploreWayList.size() < 6) {
|
||||
for (int i = 0; i < markerExploreWayList.size(); i++) {
|
||||
MarkerLocation location = markerExploreWayList.get(i).getLocation();
|
||||
if (location != null) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
|
||||
list.add(mogoLatLng);
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() < 6 location == null");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
MarkerLocation location = markerExploreWayList.get(i).getLocation();
|
||||
if (location != null) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
|
||||
list.add(mogoLatLng);
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() location == null");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Logger.e(TAG, "getMogoList() markerExploreWay == null");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (poiInfosList != null) {
|
||||
poiInfosList.clear();
|
||||
poiInfosList = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
*/
|
||||
public interface AdapterCallback {
|
||||
//分享列表加载更多
|
||||
void loadMoreShareEventList();
|
||||
//分享列表首次刷新
|
||||
void getShareEventResponse();
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package com.mogo.module.v2x.listener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* @author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/13 11:02 AM
|
||||
* desc : 车辆速度状态回调
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/8/10
|
||||
*/
|
||||
public interface SurroundingItemClickListener {
|
||||
void onItemClickListener(View v, int position, SurroundingConstruction construction);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
|
||||
V2XServiceManager.getV2XCalculateServer().addCarStatusListener(TAG, this);
|
||||
V2XServiceManager.getV2XCalculateServer().addCarTrajectory(location);
|
||||
|
||||
// 下面是道路刷新逻辑
|
||||
// 首次定位的刷新道路事件逻辑,下面是道路刷新逻辑
|
||||
if (mLastCarLocation == null) {
|
||||
V2XServiceManager.getV2XMarkerService().refreshMarkerData(location);
|
||||
mLastCarLocation = location;
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XGiveLike;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
@@ -40,11 +36,9 @@ public class V2XMessageListener_401009 implements IMogoOnMessageListener<V2XGive
|
||||
v2XAlarmMessage.setExpireTime(20000);
|
||||
v2XAlarmMessage.setSceneId("000000");
|
||||
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), v2XAlarmMessage);
|
||||
TipToast.tip(message.getResult());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
ToastUtils.showCustomLong(LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view_feedback_img_text, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.utils.TimeConstants;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
@@ -42,38 +43,48 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener<MarkerC
|
||||
Logger.d(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:\n"
|
||||
+ GsonUtil.jsonFromObject(response));
|
||||
try {
|
||||
if (response.getExploreWay() != null && response.getExploreWay().size() > 0) {
|
||||
MarkerExploreWay markerExploreWay = response.getExploreWay().get(0);
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
// 记录道路事件
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(markerLocation);
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
|
||||
// 当前车辆数据
|
||||
MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation();
|
||||
float calculateDistance = Utils.calculateLineDistance(
|
||||
new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()),
|
||||
new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
|
||||
);
|
||||
v2XRoadEventEntity.setDistance(calculateDistance);
|
||||
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
long timeSpan = TimeUtils.getTimeSpan(TimeUtils.getNowMills(), response.getMessageTime(), TimeConstants.MIN);
|
||||
// 三分钟以内的消息才会提示用户
|
||||
if (timeSpan <= 3) {
|
||||
if (response.getExploreWay() != null && response.getExploreWay().size() > 0) {
|
||||
MarkerExploreWay markerExploreWay = response.getExploreWay().get(0);
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
// 记录道路事件
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(markerLocation);
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
|
||||
// 当前车辆数据
|
||||
MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation();
|
||||
float calculateDistance;
|
||||
if (currentLocation.getLatitude() > 0 || currentLocation.getLongitude() > 0) {
|
||||
calculateDistance = Utils.calculateLineDistance(
|
||||
new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()),
|
||||
new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
|
||||
);
|
||||
markerExploreWay.setDistance(calculateDistance);
|
||||
}
|
||||
v2XRoadEventEntity.setDistance(markerExploreWay.getDistance());
|
||||
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
|
||||
// 记录播报过的道路事件
|
||||
V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
|
||||
// 记录播报过的道路事件
|
||||
V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
|
||||
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
|
||||
}
|
||||
} else {
|
||||
Logger.e(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:消息已过期,大于3分钟了不进行消费");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -72,6 +72,11 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isFatigueDrivingWindowShow();
|
||||
|
||||
/**
|
||||
* 事件面板状态 状态
|
||||
*/
|
||||
boolean isEventPanelWindowShow();
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警POI 是否在展示
|
||||
*
|
||||
@@ -168,6 +173,14 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setFatigueDrivingWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 事件面板状态 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setEventPanelWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -67,4 +67,9 @@ public enum V2XStatusDescriptor {
|
||||
* 疲劳驾驶弹窗
|
||||
*/
|
||||
FatigueDrivingWindow_UI,
|
||||
|
||||
/**
|
||||
* 事件面板状态
|
||||
*/
|
||||
EventPanelWindow_UI,
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
|
||||
@Override
|
||||
public void drawableLastAllPOI() {
|
||||
//Logger.w(MODULE_NAME, "V2X---绘制上一次的POI,回调给Launcher底层逻辑让其进行绘制");
|
||||
Logger.w(MODULE_NAME, "V2X---绘制上一次的POI,回调给Launcher底层逻辑让其进行绘制");
|
||||
// 清除连接线
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().clearLine();
|
||||
clearAlarmPOI();
|
||||
|
||||
@@ -107,6 +107,11 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
return get_bool_val(V2XStatusDescriptor.FatigueDrivingWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEventPanelWindowShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.EventPanelWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadEventPOIShow(String tag, boolean show) {
|
||||
V2XServiceManager.getMoGoStatusManager().setV2XUIShow(V2XConst.MODULE_NAME, show);
|
||||
@@ -194,6 +199,13 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventPanelWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.EventPanelWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.EventPanelWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.EventPanelWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
|
||||
if (listener == null || descriptor == null) {
|
||||
|
||||
@@ -6,10 +6,10 @@ import android.graphics.Bitmap
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.module.service.utils.ViewUtils
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity
|
||||
import com.mogo.module.service.utils.ViewUtils
|
||||
import com.mogo.module.v2x.R
|
||||
import kotlinx.android.synthetic.main.view_marker_event_car.view.*
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ import kotlinx.android.synthetic.main.view_marker_event_car.view.*
|
||||
* version: 1.0
|
||||
*/
|
||||
class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) :
|
||||
ConstraintLayout(context) {
|
||||
ConstraintLayout(context) {
|
||||
val TAG = "V2XMarkerRoadEventView"
|
||||
|
||||
init {
|
||||
@@ -32,13 +32,13 @@ class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) :
|
||||
|
||||
fun initView(context: Context, alarmInfo: V2XRoadEventEntity) {
|
||||
if (alarmInfo.poiType == V2XPoiTypeEnum.ALERT_FRONT_CAR ||
|
||||
alarmInfo.poiType == V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING.toString()
|
||||
alarmInfo.poiType == V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING.toString()
|
||||
) {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_marker_event_car, this)
|
||||
.inflate(R.layout.view_marker_event_car, this)
|
||||
} else {
|
||||
LayoutInflater.from(context)
|
||||
.inflate(R.layout.view_marker_event_road, this)
|
||||
.inflate(R.layout.view_marker_event_road, this)
|
||||
}
|
||||
updateIcon(alarmInfo)
|
||||
}
|
||||
@@ -82,6 +82,10 @@ class V2XMarkerRoadEventView(context: Context, alarmInfo: V2XRoadEventEntity) :
|
||||
V2XPoiTypeEnum.FOURS_ACCIDENT -> {
|
||||
ivCar.setImageResource(R.drawable.v_to_x_marker_7)
|
||||
}
|
||||
//事故
|
||||
V2XPoiTypeEnum.FOURS_LIVING -> {
|
||||
ivCar.setImageResource(R.drawable.v_to_x_marker_1)
|
||||
}
|
||||
//红绿灯数据
|
||||
V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST -> {
|
||||
ivCar.setImageResource(R.drawable.v_to_x_marker_3)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.mogo.module.v2x.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.module.common.entity.MarkerCardResult;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XLivePushVoRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
|
||||
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventDescription;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItem;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,6 +22,7 @@ import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -33,7 +36,7 @@ public interface V2XApiService {
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/dataService/integratedServices/app/push/no/heartbeat/v1")
|
||||
Observable<BaseData> refreshHeartBeat(@FieldMap Map<String, String> liveBroadcast);
|
||||
Observable<BaseData> refreshHeartBeat(@FieldMap Map<String, Object> liveBroadcast);
|
||||
|
||||
/**
|
||||
* 刷新地图气泡点
|
||||
@@ -108,4 +111,40 @@ public interface V2XApiService {
|
||||
@FormUrlEncoded
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/queryIllegalPark")
|
||||
Observable<MarkerResponse> queryIllegalPark(@FieldMap Map<String, Object> parameters);
|
||||
|
||||
/**
|
||||
* 我的分享-热心指数等
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1")
|
||||
Observable<V2XShareEventDescription> getEnthusiasmIndex(@FieldMap Map<String, Object> parames);
|
||||
|
||||
/**
|
||||
* 我的分享-列表
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/pathAndPoi/no/queryInfo")
|
||||
Observable<V2XShareEventItem> getShareEventList(@FieldMap Map<String, Object> parames);
|
||||
|
||||
/*
|
||||
* 周边列表
|
||||
*
|
||||
* */
|
||||
@Headers({"Content-Type:application/json", "Accept:application/json"})
|
||||
@POST("/deva/car/path/no/getLauncherSnapshotDataResponse/v1")
|
||||
Observable<SurroundingResponse> getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr);
|
||||
|
||||
/**
|
||||
* 点赞接口
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
|
||||
Observable<BaseData> addPoiInfoFabulous(@FieldMap Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 响应求助
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/RespondingToHelp/v1")
|
||||
Observable<BaseData> respondingToHelp(@FieldMap Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.RequestBody;
|
||||
@@ -105,10 +105,9 @@ public class V2XRefreshModel {
|
||||
*/
|
||||
public void refreshHeartBeat(String sn, String videoChannel, final V2XRefreshCallback callback) {
|
||||
if (mV2XApiService != null) {
|
||||
Map<String, String> liveBroadcast = new HashMap<>();
|
||||
final Map<String, Object> liveBroadcast = new ParamsProvider.Builder(mContext).build();
|
||||
liveBroadcast.put("sn", sn);
|
||||
liveBroadcast.put("data", GsonUtil.getGson().toJson(new V2XLiveCarBroadcastReq(sn, videoChannel)));
|
||||
|
||||
mV2XApiService.refreshHeartBeat(liveBroadcast)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -473,4 +472,80 @@ public class V2XRefreshModel {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点赞接口
|
||||
*/
|
||||
public void addPoiInfoFabulous(V2XRefreshCallback<BaseData> callback,
|
||||
String infoId,
|
||||
String poiType,
|
||||
int likeOrDislike) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"infoId\":").append(infoId)
|
||||
.append(",")
|
||||
.append("\"poiType\":").append(poiType)
|
||||
.append(",")
|
||||
.append("\"likeOrdislike\":").append(likeOrDislike)
|
||||
.append(",")
|
||||
.append("\"sn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
mV2XApiService.addPoiInfoFabulous(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
message = "网络错误,请稍后重试";
|
||||
}
|
||||
callback.onFail(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应求助
|
||||
* "seekHelpSn":"testSn01",求助SN
|
||||
* "enthusiasticSn":"testSn02",响应求助SN
|
||||
*/
|
||||
public void respondingToHelp(String seekHelpSn) {
|
||||
if (mV2XApiService != null) {
|
||||
final Map<String, Object> map = new ParamsProvider.Builder(mContext).build();
|
||||
String json = new StringBuilder()
|
||||
.append("{")
|
||||
.append("\"seekHelpSn\":").append(seekHelpSn)
|
||||
.append(",")
|
||||
.append("\"enthusiasticSn\":").append(Utils.getSn())
|
||||
.append("}").toString();
|
||||
map.put("data", json);
|
||||
mV2XApiService.respondingToHelp(map).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.mogo.module.v2x.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
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.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class V2XShareNetworkModel {
|
||||
private final Context mContext;
|
||||
private V2XApiService mRefreshApiService;
|
||||
private static final String TAG = "V2XShareNetworkModel";
|
||||
|
||||
public V2XShareNetworkModel(Context context) {
|
||||
this.mContext = context;
|
||||
IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
|
||||
this.mRefreshApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
|
||||
}
|
||||
|
||||
/*
|
||||
* 两个任务串行
|
||||
* 1.分享次数,热心指数
|
||||
* 2.分享列表
|
||||
* */
|
||||
public void getShareEventResponse(int page, int size, V2XRefreshCallback callback) {
|
||||
|
||||
Observable<String> indexObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
try {
|
||||
getShareIndex(callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
emitter.onNext("1");
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
Observable<String> listObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
try {
|
||||
getShareEventList(page, size, callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
emitter.onNext("2");
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
indexObservable.flatMap(new Function<String, ObservableSource<?>>() {
|
||||
@Override
|
||||
public ObservableSource<?> apply(String s) throws Exception {
|
||||
return listObservable;
|
||||
}
|
||||
})
|
||||
.observeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Object>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 热心指数
|
||||
* */
|
||||
public void getShareIndex(V2XRefreshCallback callback) {
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("sn", Utils.getSn());
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
//热心指数
|
||||
mRefreshApiService.getEnthusiasmIndex(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create((mContext))) {
|
||||
@Override
|
||||
public void onSuccess(BaseData resultData) {
|
||||
super.onSuccess(resultData);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(resultData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
callback.onFail(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (callback != null){
|
||||
callback.onFail("网络异常,点击刷新重试");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 分享列表
|
||||
* */
|
||||
public void getShareEventList(int page, int size, V2XRefreshCallback callback) {
|
||||
|
||||
final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("sn", Utils.getSn());
|
||||
hashMap.put("pageNum", page);
|
||||
hashMap.put("pageSize", size);
|
||||
builder.append("data", GsonUtil.jsonFromObject(hashMap));
|
||||
Map<String, Object> parameters = builder.build();
|
||||
|
||||
mRefreshApiService.getShareEventList(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(mContext)) {
|
||||
@Override
|
||||
public void onSuccess(BaseData resultData) {
|
||||
super.onSuccess(resultData);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(resultData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
if (callback != null) {
|
||||
callback.onFail(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (callback != null){
|
||||
callback.onFail("网络异常,点击刷新重试");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.module.v2x.presenter
|
||||
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.v2x.fragment.V2XEventPanelFragment
|
||||
|
||||
/**
|
||||
* 事件面板presenter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPanelPresenter(view: V2XEventPanelFragment) : Presenter<V2XEventPanelFragment>(view)
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.module.v2x.presenter;
|
||||
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.fragment.V2XScenarioHistoryFragment;
|
||||
import com.mogo.module.v2x.utils.ThreadUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryPresenter extends Presenter<V2XScenarioHistoryFragment> {
|
||||
|
||||
public ScenarioHistoryPresenter(V2XScenarioHistoryFragment view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
public void loadHistory() {
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
mView.loadHistory(v2XHistoryScenarioData);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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.V2XShareEventsFragment;
|
||||
|
||||
public class ShareEventsPresenter extends Presenter <V2XShareEventsFragment>{
|
||||
public ShareEventsPresenter(IView view) {
|
||||
super((V2XShareEventsFragment) view);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
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.HttpConstant;
|
||||
import com.mogo.module.v2x.network.V2XApiService;
|
||||
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<SurroundingEventView> {
|
||||
private Context mContext;
|
||||
private IMogoNetwork mNetWork;
|
||||
private IMogoServiceApis mApis;
|
||||
private V2XApiService eventApiService;
|
||||
private static final String TAG = "V2XSurroundingFragment";
|
||||
|
||||
|
||||
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(V2XApiService.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, 5, 15);
|
||||
|
||||
eventApiService.getSurroundingEventList(Utils.getSn(), convert(GsonUtil.jsonFromObject(request)))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<SurroundingResponse>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
mView.showSurroudingData(null);
|
||||
Logger.e(TAG, "onError e = " + e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(SurroundingResponse data) {
|
||||
super.onSuccess(data);
|
||||
Logger.d(TAG, "onSuccess ------> ");
|
||||
if (data != null && data.getResult() != null) {
|
||||
mView.showSurroudingData(data.getResult().getExploreWay());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
mView.showSurroudingData(null);
|
||||
Logger.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);
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra("V2XMessageEntity");
|
||||
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
|
||||
Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.module.v2x.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* V2X 测试面板广播接收,目的是可以通过广播调用起来面板
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class TestPanelBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = V2XConst.MODULE_NAME + "_TestPanelBroadcastReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
boolean textPanelOpenStatus = intent.getBooleanExtra(V2XConst.BROADCAST_TEST_PANEL_CONTROL_EXTRA_KEY, false);
|
||||
Logger.d(TAG, "textPanelOpenStatus:" + textPanelOpenStatus);
|
||||
if (textPanelOpenStatus) {
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.addView(V2XTestConsoleWindow.getInstance(context), 0, 0, false);
|
||||
} else {
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.removeView(V2XTestConsoleWindow.getInstance(context));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -15,8 +16,11 @@ import com.mogo.module.v2x.scenario.IV2XScenario;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XButton;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -29,7 +33,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
protected String TAG = "AbsV2XScenario";
|
||||
private IV2XWindow mV2XWindow;
|
||||
private IV2XButton mV2XButton;
|
||||
private IV2XMarker<T> mV2XMarker;
|
||||
private IV2XMarker mV2XMarker;
|
||||
private IMoGoV2XStatusManager mV2XStatusManager;
|
||||
private V2XMessageEntity<T> mV2XMessageEntity;
|
||||
|
||||
@@ -62,7 +66,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
this.mV2XWindow = mV2XWindow;
|
||||
}
|
||||
|
||||
public IV2XMarker<T> getV2XMarker() {
|
||||
public IV2XMarker getV2XMarker() {
|
||||
return mV2XMarker;
|
||||
}
|
||||
|
||||
@@ -94,4 +98,17 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
|
||||
return mV2XMessageEntity.equals(v2XMessageEntity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 存储本地数据
|
||||
*
|
||||
* @param markerExploreWay 要存储的场景
|
||||
*/
|
||||
public void saveLocalStory(int scenarioType, Object markerExploreWay) {
|
||||
try {
|
||||
V2XSQLiteUtils.saveLocalStory(scenarioType,markerExploreWay);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
|
||||
import com.mogo.module.v2x.scenario.scene.animation.V2XAnimationScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
@@ -16,13 +18,10 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.sqlite.BaseDaoFactory;
|
||||
import com.mogo.utils.sqlite.IBaseDao;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -40,11 +39,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
private AbsV2XScenario mV2XScenario;
|
||||
private HashMap<Integer, AbsV2XScenario> mV2XScenarioSet = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 场景数据管理
|
||||
*/
|
||||
private static IBaseDao<V2XHistoryScenarioData> mScenarioDao;
|
||||
|
||||
private V2XScenarioManager() {
|
||||
}
|
||||
|
||||
@@ -53,13 +47,13 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
synchronized (V2XScenarioManager.class) {
|
||||
if (mV2XScenarioManager == null) {
|
||||
mV2XScenarioManager = new V2XScenarioManager();
|
||||
mScenarioDao = BaseDaoFactory.Companion.getInstance().getBaseDao(V2XUtils.getApp(), V2XHistoryScenarioData.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XScenarioManager;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handlerMessage(V2XMessageEntity v2XMessageEntity) {
|
||||
Logger.d(MODULE_NAME, "处理V2X场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
@@ -68,16 +62,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
V2XUtils.runOnUiThread(() -> {
|
||||
// 提取之前存储的场景
|
||||
if (v2XMessageEntity != null) {
|
||||
/*try {
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(v2XMessageEntity.getType());
|
||||
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
|
||||
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(v2XMessageEntity.getContent()));
|
||||
mScenarioDao.insert(v2XHistoryScenarioData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
// 广播给应用内部其它模块
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
|
||||
@@ -85,7 +69,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
|
||||
|
||||
mV2XScenario = mV2XScenarioSet.get(v2XMessageEntity.getType());
|
||||
|
||||
// 如果没有拿到之前的,根据类型分发
|
||||
if (mV2XScenario == null) {
|
||||
switch (v2XMessageEntity.getType()) {
|
||||
@@ -115,7 +98,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
|
||||
ToastUtils.showLong("当前V2X消息类型未定义。");
|
||||
TipToast.tip("当前V2X消息类型未定义");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
|
||||
@@ -106,7 +106,7 @@ public class V2XFatigueDrivingWindow extends RelativeLayout
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
|
||||
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
|
||||
|
||||
public void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "初始化直播小窗口View。。。。。");
|
||||
LayoutInflater.from(context).inflate(R.layout.window_push_live_video, this);
|
||||
LayoutInflater.from(context).inflate(R.layout.item_v2x_push_live_video, this);
|
||||
// 详情列表
|
||||
mV2XLiveGSYVideoView = findViewById(R.id.videoPlayer);
|
||||
mIvReportHead = findViewById(R.id.ivReportHead);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class V2XRoadLiveCarWindow extends RelativeLayout
|
||||
private void initView(Context context) {
|
||||
Logger.w(MODULE_NAME, "V2X===初始化道路直播视图");
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_road_live_car_detail, this);
|
||||
LayoutInflater.from(context).inflate(R.layout.item_v2x_road_live_car_detail, this);
|
||||
|
||||
mTvEventStubClose = findViewById(R.id.tvEventStubClose);
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
|
||||
@@ -95,6 +95,8 @@ public class V2XIllegalParkMarker implements IV2XMarker<List<MarkerExploreWay>>
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().clearLine();
|
||||
// 移除事件POI
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.v2x.utils.TrackUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -83,6 +84,8 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
|
||||
TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), V2XPoiTypeEnum.ALERT_ILLEGAL_PARK, "2");
|
||||
}
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), v2XRoadEventEntity);
|
||||
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
|
||||
markerExploreWay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,5 +113,4 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
|
||||
public void clearPOI() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -112,7 +112,7 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XIllegalPark(mExploreWay);
|
||||
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
// 刷新列表
|
||||
|
||||
@@ -14,8 +14,8 @@ import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
|
||||
@@ -114,7 +114,7 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(v2XRoadEventEntity);
|
||||
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.PUSH_EVENT_WINDOW);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
// 刷新列表
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.mogo.module.v2x.scenario.scene.road;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -13,6 +15,8 @@ import com.mogo.module.v2x.scenario.scene.livecar.V2XRoadLiveCarScenario;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.tanlu.IMogoTanluProvider;
|
||||
import com.mogo.service.tanlu.TanluUploadParams;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -57,6 +61,14 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
|
||||
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
|
||||
if (v2XRoadEventEntity != null) {
|
||||
//只上报事故
|
||||
// if (v2XRoadEventEntity.getPoiType() != null && v2XRoadEventEntity.getPoiType().equals(MarkerPoiTypeEnum.FOURS_ACCIDENT)) {
|
||||
//// V2XServiceManager.getMoGoStatusManager().setUploadingStatus(ServiceConst.CARD_TYPE_ROAD_CONDITION, true);
|
||||
// TanluUploadParams params = new TanluUploadParams(v2XRoadEventEntity.getPoiType(),
|
||||
// IMogoTanluProvider.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO);
|
||||
// V2XServiceManager.getTanluManager().uploadRoadCondition(params);
|
||||
// }
|
||||
|
||||
if (v2XMessageEntity.isShowState()) {
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
// 更新要提醒的数据
|
||||
@@ -78,30 +90,38 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
// 设置TTS
|
||||
getV2XMessageEntity().getContent().getTts(false);
|
||||
// 广播给ADAS
|
||||
ADASUtils.broadcastToADAS(
|
||||
V2XServiceManager.getContext(),
|
||||
getV2XMessageEntity().getContent());
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
showWindow();
|
||||
}
|
||||
try {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
// 设置TTS
|
||||
getV2XMessageEntity().getContent().getTts(false);
|
||||
// 广播给ADAS
|
||||
ADASUtils.broadcastToADAS(
|
||||
V2XServiceManager.getContext(),
|
||||
getV2XMessageEntity().getContent());
|
||||
|
||||
// 地图主动推送/触发消息 埋点
|
||||
String poiType = getV2XMessageEntity().getContent().getPoiType();
|
||||
String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat());
|
||||
String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon());
|
||||
String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId();
|
||||
String style = V2XServiceManager.getMoGoStatusManager().isMainPageOnResume() ? "1" : "2";
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", infoId);
|
||||
properties.put("type", poiType);
|
||||
properties.put("lng", lon);
|
||||
properties.put("lat", lat);
|
||||
properties.put("style", style);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties);
|
||||
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
|
||||
getV2XMessageEntity().getContent().getNoveltyInfo());
|
||||
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
// 地图主动推送/触发消息 埋点
|
||||
String poiType = getV2XMessageEntity().getContent().getPoiType();
|
||||
String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat());
|
||||
String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon());
|
||||
String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId();
|
||||
String style = V2XServiceManager.getMoGoStatusManager().isMainPageOnResume() ? "1" : "2";
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("dbid", infoId);
|
||||
properties.put("type", poiType);
|
||||
properties.put("lng", lon);
|
||||
properties.put("lat", lat);
|
||||
properties.put("style", style);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_SHOW, properties);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +189,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
|
||||
if (getV2XMarker() != null) {
|
||||
// 重置告警信息
|
||||
V2XServiceManager.getV2XStatusManager().setAlarmInfo(getV2XMessageEntity().getContent());
|
||||
getV2XMarker() .drawPOI(getV2XMessageEntity().getContent());
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -12,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
|
||||
@@ -19,7 +21,6 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.network.V2XRefreshCallback;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
@@ -44,6 +45,8 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
public class V2XRoadEventWindow extends RelativeLayout
|
||||
implements V2XRefreshCallback<V2XLiveCarRes>, IV2XWindow<V2XRoadEventEntity> {
|
||||
private String TAG = "V2XRoadEventDetailWindow";
|
||||
// 关闭按钮
|
||||
private ImageView mBtnCloseWindow;
|
||||
// 展示列表
|
||||
private RecyclerView mRecyclerView;
|
||||
// 列表数据适配器
|
||||
@@ -101,7 +104,17 @@ public class V2XRoadEventWindow extends RelativeLayout
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(R.layout.window_road_event_detail, this);
|
||||
// 详情列表
|
||||
mBtnCloseWindow = findViewById(R.id.btnCloseWindow);
|
||||
// 详情列表
|
||||
mRecyclerView = findViewById(R.id.rvRoadEventList);
|
||||
|
||||
mBtnCloseWindow.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
|
||||
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
|
||||
// 设置切换样式
|
||||
@@ -165,10 +178,12 @@ public class V2XRoadEventWindow extends RelativeLayout
|
||||
case V2XPoiTypeEnum.FOURS_FOG://浓雾
|
||||
case V2XPoiTypeEnum.FOURS_ICE://结冰
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT://事故
|
||||
case V2XPoiTypeEnum.FOURS_LIVING://实时路况
|
||||
case V2XPoiTypeEnum.FOURS_NEALY://身边
|
||||
// 展示道路事件本身详情
|
||||
if (mItemList.isEmpty()) {
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.ROAD_EVENT_WINDOW);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
|
||||
v2XEventShowEntity.setV2XRoadEventEntity(v2XRoadEventEntity);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
|
||||
|
||||
private void init(Context context) {
|
||||
mContext = context;
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_v2x_common, this);
|
||||
LayoutInflater.from(context).inflate(R.layout.dialog_v2x_seek_help, this);
|
||||
tvContent = findViewById(R.id.tvDialogContent);
|
||||
tvLeft = findViewById(R.id.tvDialogLeft);
|
||||
tvRight = findViewById(R.id.tvDialogRight);
|
||||
|
||||
@@ -5,9 +5,9 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -50,25 +50,45 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
}
|
||||
|
||||
private List<V2XMarkerEntity> mMarkerEntity;
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<List<V2XMarkerEntity>> v2XMessageEntity) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
try {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
|
||||
// 广播给ADAS和Launcher卡片
|
||||
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
|
||||
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
|
||||
eventEntity.setExpireTime(30000);
|
||||
eventEntity.setTts("发现其他车主的求助信息");
|
||||
eventEntity.setAlarmContent("其他车主求助");
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
|
||||
// 广播给ADAS和Launcher卡片
|
||||
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
|
||||
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
|
||||
eventEntity.setExpireTime(30000);
|
||||
eventEntity.setTts("发现其他车主的求助信息");
|
||||
eventEntity.setAlarmContent("其他车主求助");
|
||||
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
|
||||
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
if (getV2XMessageEntity() != null &&
|
||||
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
|
||||
mMarkerEntity = getV2XMessageEntity().getContent();
|
||||
show();
|
||||
mMarkerEntity = getV2XMessageEntity().getContent();
|
||||
|
||||
V2XMarkerEntity markerEntity = mMarkerEntity.get(0);
|
||||
mV2XPushMessageEntity = new V2XPushMessageEntity();
|
||||
mV2XPushMessageEntity.setLon(markerEntity.getLon());
|
||||
mV2XPushMessageEntity.setLat(markerEntity.getLat());
|
||||
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
|
||||
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
|
||||
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
|
||||
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
|
||||
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
|
||||
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
|
||||
mV2XPushMessageEntity.setExpireTime(20000);
|
||||
|
||||
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING, mV2XPushMessageEntity);
|
||||
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
if (getV2XMessageEntity() != null &&
|
||||
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +109,7 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
getV2XWindow().show(mV2XPushMessageEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,11 @@ import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -35,7 +34,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* desc : 他人发起的故障求助
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<List<V2XMarkerEntity>> {
|
||||
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private static final String TAG = "V2XSeekHelpWindow";
|
||||
|
||||
// 展示列表
|
||||
@@ -96,32 +95,18 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<Li
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(List<V2XMarkerEntity> entityList) {
|
||||
if (entityList != null && !entityList.isEmpty()) {
|
||||
V2XMarkerEntity markerEntity = entityList.get(0);
|
||||
|
||||
mV2XPushMessageEntity = new V2XPushMessageEntity();
|
||||
mV2XPushMessageEntity.setLon(markerEntity.getLon());
|
||||
mV2XPushMessageEntity.setLat(markerEntity.getLat());
|
||||
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
|
||||
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
|
||||
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
|
||||
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
|
||||
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
|
||||
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
|
||||
mV2XPushMessageEntity.setExpireTime(20000);
|
||||
|
||||
public void show(V2XPushMessageEntity xPushMessageEntity) {
|
||||
if (xPushMessageEntity != null) {
|
||||
mV2XPushMessageEntity = xPushMessageEntity;
|
||||
// 清空数据
|
||||
mItemList.clear();
|
||||
|
||||
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
|
||||
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
|
||||
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.SEEK_HELP_WINDOW);
|
||||
v2XEventShowEntity.setV2XPushMessageEntity(xPushMessageEntity);
|
||||
v2XEventShowEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING);
|
||||
mItemList.add(v2XEventShowEntity);
|
||||
// 刷新列表
|
||||
mV2XRoadEventAdapter.notifyDataSetChanged();
|
||||
|
||||
countDownV2XEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
|
||||
import com.mogo.module.v2x.utils.ToastUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,6 +33,8 @@ import java.util.List;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private static V2XTestConsoleWindow mV2XTestConsoleWindow;
|
||||
|
||||
private FlexboxLayout mFlTestPanel;
|
||||
private Button mBtnTriggerOpen;
|
||||
private Button mBtnTriggerRoadEvent;
|
||||
@@ -42,6 +46,17 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerSeekHelpEvent;
|
||||
private Button mBtnTriggerParkEvent;
|
||||
|
||||
public static V2XTestConsoleWindow getInstance(Context context) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
synchronized (V2XTestConsoleWindow.class) {
|
||||
if (mV2XTestConsoleWindow == null) {
|
||||
mV2XTestConsoleWindow = new V2XTestConsoleWindow(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XTestConsoleWindow;
|
||||
}
|
||||
|
||||
public V2XTestConsoleWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
@@ -69,11 +84,16 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent);
|
||||
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
|
||||
|
||||
mBtnTriggerOpen.setOnClickListener(v -> mFlTestPanel.setVisibility(GONE));
|
||||
mBtnTriggerOpen.setOnClickListener(v ->
|
||||
V2XServiceManager
|
||||
.getIMogoWindowManager()
|
||||
.removeView(V2XTestConsoleWindow.getInstance(context))
|
||||
);
|
||||
|
||||
mBtnClearRoadEvent.setOnClickListener(v -> {
|
||||
V2XAlarmServer.mAlertRoadEventList.clear();
|
||||
ToastUtils.showShort("缓存已清除");
|
||||
V2XSQLiteUtils.clearScenarioHistoryData();
|
||||
TipToast.tip("缓存已清除");
|
||||
});
|
||||
|
||||
mBtnTriggerRoadEvent.setOnClickListener(v -> {
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapResource;
|
||||
import com.bumptech.glide.util.Util;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/8/12
|
||||
*/
|
||||
public class CornerTransform implements Transformation<Bitmap> {
|
||||
private BitmapPool mBitmapPool;
|
||||
private float radius;
|
||||
private boolean exceptLeftTop, exceptRightTop, exceptLeftBottom, exceptRightBotoom;
|
||||
|
||||
/**
|
||||
* 除了那几个角不需要圆角的
|
||||
*
|
||||
* @param leftTop
|
||||
* @param rightTop
|
||||
* @param leftBottom
|
||||
* @param rightBottom
|
||||
*/
|
||||
public void setExceptCorner(boolean leftTop, boolean rightTop, boolean leftBottom, boolean rightBottom) {
|
||||
this.exceptLeftTop = leftTop;
|
||||
this.exceptRightTop = rightTop;
|
||||
this.exceptLeftBottom = leftBottom;
|
||||
this.exceptRightBotoom = rightBottom;
|
||||
}
|
||||
|
||||
public CornerTransform(Context context, float radius) {
|
||||
this.mBitmapPool = Glide.get(context).getBitmapPool();
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Resource<Bitmap> transform(@NonNull Context context, @NonNull Resource<Bitmap> resource, int outWidth, int outHeight) {
|
||||
Bitmap source = resource.get();
|
||||
int finalWidth, finalHeight;
|
||||
float ratio; //输出目标的宽高或高宽比例
|
||||
if (outWidth > outHeight) { //输出宽度>输出高度,求高宽比
|
||||
ratio = (float) outHeight / (float) outWidth;
|
||||
finalWidth = source.getWidth();
|
||||
finalHeight = (int) ((float) source.getWidth() * ratio); //固定原图宽度,求最终高度
|
||||
if (finalHeight > source.getHeight()) { //求出的最终高度>原图高度,求宽高比
|
||||
ratio = (float) outWidth / (float) outHeight;
|
||||
finalHeight = source.getHeight();
|
||||
finalWidth = (int) ((float) source.getHeight() * ratio);//固定原图高度,求最终宽度
|
||||
}
|
||||
} else if (outWidth < outHeight) { //输出宽度 < 输出高度,求宽高比
|
||||
ratio = (float) outWidth / (float) outHeight;
|
||||
finalHeight = source.getHeight();
|
||||
finalWidth = (int) ((float) source.getHeight() * ratio);//固定原图高度,求最终宽度
|
||||
if (finalWidth > source.getWidth()) { //求出的最终宽度 > 原图宽度,求高宽比
|
||||
ratio = (float) outHeight / (float) outWidth;
|
||||
finalWidth = source.getWidth();
|
||||
finalHeight = (int) ((float) source.getWidth() * ratio);
|
||||
}
|
||||
} else { //输出宽度=输出高度
|
||||
finalHeight = source.getHeight();
|
||||
finalWidth = finalHeight;
|
||||
}
|
||||
|
||||
//修正圆角
|
||||
this.radius *= (float) finalHeight / (float) outHeight;
|
||||
Bitmap outBitmap = this.mBitmapPool.get(finalWidth, finalHeight, Bitmap.Config.ARGB_8888);
|
||||
if (outBitmap == null) {
|
||||
outBitmap = Bitmap.createBitmap(finalWidth, finalHeight, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(outBitmap);
|
||||
Paint paint = new Paint();
|
||||
//关联画笔绘制的原图bitmap
|
||||
BitmapShader shader = new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
//计算中心位置,进行偏移
|
||||
int width = (source.getWidth() - finalWidth) / 2;
|
||||
int height = (source.getHeight() - finalHeight) / 2;
|
||||
if (width != 0 || height != 0) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate((float) (-width), (float) (-height));
|
||||
shader.setLocalMatrix(matrix);
|
||||
}
|
||||
|
||||
paint.setShader(shader);
|
||||
paint.setAntiAlias(true);
|
||||
RectF rectF = new RectF(0.0F, 0.0F, (float) canvas.getWidth(), (float) canvas.getHeight());
|
||||
canvas.drawRoundRect(rectF, this.radius, this.radius, paint); //先绘制圆角矩形
|
||||
|
||||
if (exceptLeftTop) { //左上角不为圆角
|
||||
canvas.drawRect(0, 0, radius, radius, paint);
|
||||
}
|
||||
if (exceptRightTop) {//右上角不为圆角
|
||||
canvas.drawRect(canvas.getWidth() - radius, 0, canvas.getWidth(), radius, paint);
|
||||
}
|
||||
|
||||
if (exceptLeftBottom) {//左下角不为圆角
|
||||
canvas.drawRect(0, canvas.getHeight() - radius, radius, canvas.getHeight(), paint);
|
||||
}
|
||||
|
||||
if (exceptRightBotoom) {//右下角不为圆角
|
||||
canvas.drawRect(canvas.getWidth() - radius, canvas.getHeight() - radius, canvas.getWidth(), canvas.getHeight(), paint);
|
||||
}
|
||||
|
||||
return BitmapResource.obtain(outBitmap, this.mBitmapPool);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.getClass().getName();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
//避免Transformation重复设置,导致图片闪烁,同一个圆角值的Transformation视为同一个对象
|
||||
return Util.hashCode(getId().hashCode(), Util.hashCode(this.radius));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
|
||||
/**
|
||||
* @ProjectName: MoGoModulSafeDriving
|
||||
@@ -59,6 +59,14 @@ public class EventTypeUtils {
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
str = "交通事故";
|
||||
break;
|
||||
// 实时路况
|
||||
case V2XPoiTypeEnum.FOURS_LIVING:
|
||||
str = "实时路况";
|
||||
break;
|
||||
// 身边
|
||||
case V2XPoiTypeEnum.FOURS_NEALY:
|
||||
str = "身边事件";
|
||||
break;
|
||||
default:
|
||||
str = "其它道路事件";
|
||||
break;
|
||||
@@ -80,6 +88,8 @@ public class EventTypeUtils {
|
||||
strBg = R.drawable.bg_v2x_event_type_blue;
|
||||
break;
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP: // 拥堵
|
||||
case V2XPoiTypeEnum.FOURS_LIVING: // 实时路况
|
||||
case V2XPoiTypeEnum.FOURS_NEALY: // 身边
|
||||
strBg = R.drawable.bg_v2x_event_type_orange;
|
||||
break;
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK:// 交通检查
|
||||
|
||||
@@ -109,9 +109,6 @@ public class MarkerUtils {
|
||||
* @param zoomScale 缩放级别
|
||||
*/
|
||||
public static void resetMapZoom(float zoomScale) {
|
||||
// V2XServiceManager.getMapUIController().changeZoom(zoomScale);
|
||||
// // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
// V2XServiceManager.getMapUIController().setLockZoom((int) zoomScale);
|
||||
V2XServiceManager.getMapUIController().loseLockMode();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
@@ -15,71 +10,24 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* date : 2020/4/16 2:25 PM
|
||||
* desc : 调用探路模块相关的工具
|
||||
* version: 1.0
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class RoadConditionUtils {
|
||||
/**
|
||||
* 向探路模块发送消息正确的确认广播
|
||||
*
|
||||
* @param poiType 当前poi信息
|
||||
*/
|
||||
public static void sendShareReceiverInfo(String poiType) {
|
||||
if (poiType != null) {
|
||||
switch (poiType) {
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
sendShareReceiver("1");
|
||||
break;
|
||||
case V2XPoiTypeEnum.TRAFFIC_CHECK:
|
||||
sendShareReceiver("2");
|
||||
break;
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED:
|
||||
sendShareReceiver("3");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向探路模块发送数据纠错广播
|
||||
*
|
||||
* @param poiType 当前poi信息
|
||||
* 提交网络
|
||||
*/
|
||||
public static void sendDataErrorReceiverInfo(String poiType, String infoId, String updateType) {
|
||||
sendDataErrorReceiver(infoId, poiType, updateType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送广播 type: 1拥堵,2交通检查,3封路
|
||||
*/
|
||||
public static void sendShareReceiver(String type) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.roadcondition.share");
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
intent.putExtra("type", type);
|
||||
V2XUtils.getApp().sendBroadcast(intent);
|
||||
Logger.d(MODULE_NAME, "通过广播通知探路正确。。。");
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据错误
|
||||
*
|
||||
* @param id 事件ID
|
||||
* @param poiType 事件类型
|
||||
*/
|
||||
public static void sendDataErrorReceiver(String id, String poiType, String updateType) {
|
||||
public static void sendShareReceiverInfo(String infoId,
|
||||
String poiType,
|
||||
int likeOrDislike) {
|
||||
showTip();
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.tanlu.dataerror");
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
intent.putExtra("id", id);
|
||||
intent.putExtra("type", poiType);
|
||||
intent.putExtra("updateType", updateType);
|
||||
V2XUtils.getApp().sendBroadcast(intent);
|
||||
Logger.d(MODULE_NAME, "通过广播通知探路纠错:id = " + id + " poiType = " + poiType + " updateType = " + updateType);
|
||||
sendShareReceiverInfo(poiType);
|
||||
V2XServiceManager
|
||||
.getV2XRefreshModel()
|
||||
.addPoiInfoFabulous(
|
||||
null,
|
||||
infoId,
|
||||
poiType,
|
||||
likeOrDislike);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,4 +39,27 @@ public class TrackUtils {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//道路事件操作埋点 V2X_button
|
||||
|
||||
/**
|
||||
* @param type type=1 桌面按钮
|
||||
* <p>
|
||||
* type=2 tab1按钮-出行动态
|
||||
* <p>
|
||||
* type=3 tab2按钮-周边事件
|
||||
* <p>
|
||||
* type=4 tab3按钮-我的分享
|
||||
* <p>
|
||||
* type=5 tab4按钮-关闭按钮
|
||||
*/
|
||||
public static void trackV2xHistoryEvent(int type) {
|
||||
try {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("type", type);
|
||||
V2XServiceManager.getMogoAnalytics().track(V2XConst.V2X_ROAD_EVET_HISTORY_BUTTON, properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.sqlite.SQLDaoFactory;
|
||||
import com.mogo.utils.sqlite.SQLIDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据库操作工具类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XSQLiteUtils {
|
||||
/**
|
||||
* 场景数据管理
|
||||
*/
|
||||
private static SQLIDao<V2XHistoryScenarioData> mScenarioHistoryDao;
|
||||
|
||||
/**
|
||||
* 场景数据管理
|
||||
*/
|
||||
public static SQLIDao<V2XHistoryScenarioData> getScenarioHistoryDao() {
|
||||
if (mScenarioHistoryDao == null) {
|
||||
synchronized (V2XSQLiteUtils.class) {
|
||||
if (mScenarioHistoryDao == null) {
|
||||
mScenarioHistoryDao = SQLDaoFactory.Companion.getInstance()
|
||||
.getBaseDao(V2XUtils.getApp(), V2XHistoryScenarioData.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mScenarioHistoryDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据库中存储的昨天的数据
|
||||
*/
|
||||
public static void clearYesterdayScenarioHistoryData() {
|
||||
try {
|
||||
List<V2XHistoryScenarioData> historyScenarioData = getScenarioHistoryDao().query(new V2XHistoryScenarioData());
|
||||
for (V2XHistoryScenarioData historyScenarioDatum : historyScenarioData) {
|
||||
Long triggerTime = historyScenarioDatum.getTriggerTime();
|
||||
if (!TimeUtils.isToday(triggerTime)) {
|
||||
int result = getScenarioHistoryDao().delete(historyScenarioDatum);
|
||||
if (result > 0) {
|
||||
Logger.d(V2XConst.MODULE_NAME, "删除过期数据成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据库中所有数据
|
||||
*/
|
||||
public static void clearScenarioHistoryData() {
|
||||
try {
|
||||
int result = getScenarioHistoryDao().delete(new V2XHistoryScenarioData());
|
||||
Logger.d(V2XConst.MODULE_NAME, "删除数据成功:" + result);
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当天的V2X数据
|
||||
*/
|
||||
public static List<V2XHistoryScenarioData> getScenarioHistoryData() {
|
||||
return getScenarioHistoryDao().query(new V2XHistoryScenarioData(), "triggerTime", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当天的指定的V2X数据
|
||||
*/
|
||||
public static List<V2XHistoryScenarioData> getTargetScenarioHistoryData(V2XHistoryScenarioData scenarioData) {
|
||||
return getScenarioHistoryDao().query(scenarioData, "triggerTime", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当天的未评价V2X数据
|
||||
*/
|
||||
public static List<V2XHistoryScenarioData> getScenarioHistoryUnDisposeData() {
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.isDispose = false;
|
||||
return getScenarioHistoryDao().query(v2XHistoryScenarioData, "triggerTime", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定的数据
|
||||
*/
|
||||
public static void updateScenarioHistoryData(V2XHistoryScenarioData oldScenarioData, V2XHistoryScenarioData newScenarioData) {
|
||||
try {
|
||||
int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData);
|
||||
Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result);
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改指定的数据为已经操作的数据
|
||||
*/
|
||||
public static void updateScenarioHistoryDataIsDispose(V2XHistoryScenarioData oldScenarioData) {
|
||||
try {
|
||||
V2XHistoryScenarioData newScenarioData = new V2XHistoryScenarioData();
|
||||
newScenarioData.setDispose(true);
|
||||
newScenarioData.setTriggerTime(TimeUtils.getNowMills());
|
||||
newScenarioData.setEventJsonData(oldScenarioData.getEventJsonData());
|
||||
newScenarioData.setScenarioType(oldScenarioData.getScenarioType());
|
||||
|
||||
int result = getScenarioHistoryDao().update(oldScenarioData, newScenarioData);
|
||||
Logger.d(V2XConst.MODULE_NAME, "修改数据成功:" + result);
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储本地数据,每个数据只能存在一次,所以存储之前先查询数据库如果已经存在则修改触碰时间
|
||||
*
|
||||
* @param markerExploreWay 要存储的场景
|
||||
*/
|
||||
public static void saveLocalStory(int scenarioType, Object markerExploreWay) {
|
||||
try {
|
||||
// 进行数据库存储
|
||||
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
|
||||
v2XHistoryScenarioData.setScenarioType(scenarioType);
|
||||
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(markerExploreWay));
|
||||
|
||||
List<V2XHistoryScenarioData> historyScenarioData = getTargetScenarioHistoryData(v2XHistoryScenarioData);
|
||||
|
||||
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
|
||||
v2XHistoryScenarioData.setDispose(false);
|
||||
|
||||
if (historyScenarioData != null && historyScenarioData.size() > 0) {
|
||||
// 更新数据
|
||||
V2XSQLiteUtils.getScenarioHistoryDao().update(historyScenarioData.get(0), v2XHistoryScenarioData);
|
||||
} else {
|
||||
// 存储新数据
|
||||
V2XSQLiteUtils.getScenarioHistoryDao().insert(v2XHistoryScenarioData);
|
||||
}
|
||||
V2XEventPanelFragment.Companion.getInstance().changeEventCount();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.module.v2x.utils.animation;
|
||||
|
||||
interface Animation {
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.module.v2x.utils.animation;
|
||||
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
|
||||
public class AnimationResources {
|
||||
public static final int loadingRes[] = {
|
||||
R.drawable.v_to_x_loading_car0000,
|
||||
R.drawable.v_to_x_loading_car0002,
|
||||
R.drawable.v_to_x_loading_car0004,
|
||||
R.drawable.v_to_x_loading_car0006,
|
||||
R.drawable.v_to_x_loading_car0008,
|
||||
R.drawable.v_to_x_loading_car0010,
|
||||
R.drawable.v_to_x_loading_car0012,
|
||||
R.drawable.v_to_x_loading_car0014,
|
||||
R.drawable.v_to_x_loading_car0016,
|
||||
R.drawable.v_to_x_loading_car0018,
|
||||
R.drawable.v_to_x_loading_car0020,
|
||||
R.drawable.v_to_x_loading_car0022,
|
||||
R.drawable.v_to_x_loading_car0024,
|
||||
R.drawable.v_to_x_loading_car0025,
|
||||
R.drawable.v_to_x_loading_car0027,
|
||||
R.drawable.v_to_x_loading_car0029,
|
||||
R.drawable.v_to_x_loading_car0031,
|
||||
R.drawable.v_to_x_loading_car0033,
|
||||
R.drawable.v_to_x_loading_car0035,
|
||||
R.drawable.v_to_x_loading_car0037,
|
||||
R.drawable.v_to_x_loading_car0039,
|
||||
R.drawable.v_to_x_loading_car0041,
|
||||
R.drawable.v_to_x_loading_car0043,
|
||||
R.drawable.v_to_x_loading_car0045,
|
||||
R.drawable.v_to_x_loading_car0047,
|
||||
R.drawable.v_to_x_loading_car0048,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.module.v2x.utils.animation;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
public class V2XAnimationManager implements Animation {
|
||||
|
||||
private static final String TAG = "V2XAnimationManager";
|
||||
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.setOneShot(false);
|
||||
drawable.addFrame(targetImageView.getResources().getDrawable(resources[i]), duration);
|
||||
}
|
||||
UiThreadHandler.post(() -> {
|
||||
targetImageView.setBackground(drawable);
|
||||
delegate = new DelegateDrawable(drawable);
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void start() {
|
||||
if (delegate != null && !isStarted) {
|
||||
targetImageView.setVisibility(View.VISIBLE);
|
||||
isStarted = true;
|
||||
delegate.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void stop() {
|
||||
if (delegate != null && isStarted) {
|
||||
isStarted = false;
|
||||
delegate.stop();
|
||||
targetImageView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void soptWithError(){
|
||||
if (delegate != null && isStarted) {
|
||||
isStarted = false;
|
||||
delegate.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
delegate = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public interface SurroundingEventView extends IView {
|
||||
|
||||
void showSurroudingData(List<MarkerExploreWay> exploreWayList);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/8/11
|
||||
*/
|
||||
public class SurroundingMarginDecoration extends RecyclerView.ItemDecoration {
|
||||
private int margin ;
|
||||
|
||||
public SurroundingMarginDecoration(int space) {
|
||||
margin = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.bottom = margin;
|
||||
outRect.right = 0;
|
||||
//由于每行都只有2个,所以第一个都是2的倍数,把左边距设为0
|
||||
if (parent.getChildLayoutPosition(view) % 2 == 0) {
|
||||
outRect.left = 0;
|
||||
} else {
|
||||
outRect.left = margin;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
|
||||
/**
|
||||
* 事件面板的提示按钮
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XEventPanelHistoryCountView extends LinearLayout {
|
||||
private RelativeLayout mLlEventMore;
|
||||
private ImageView mBtnShowOrHidePanels;
|
||||
private TextView mTvEventCount;
|
||||
|
||||
public V2XEventPanelHistoryCountView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XEventPanelHistoryCountView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater.from(context).inflate(R.layout.view_event_panel_history_count, this);
|
||||
|
||||
mLlEventMore = (RelativeLayout) findViewById(R.id.llEventMore);
|
||||
mBtnShowOrHidePanels = (ImageView) findViewById(R.id.btnShowOrHidePanels);
|
||||
mTvEventCount = (TextView) findViewById(R.id.tvEventCount);
|
||||
}
|
||||
|
||||
public void changeMsgCount(int count) {
|
||||
if (mTvEventCount != null) {
|
||||
if (count > 0) {
|
||||
mTvEventCount.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mTvEventCount.setVisibility(View.GONE);
|
||||
}
|
||||
mTvEventCount.setText("" + count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
|
||||
/**
|
||||
* 列表空白布局View
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XListEmptyView extends LinearLayout {
|
||||
|
||||
private ImageView mIvEmptyView;
|
||||
private TextView mTvTrip;
|
||||
private Button mBtnShear;
|
||||
private Button mBtnRefresh;
|
||||
|
||||
private OnControlListener mOnControlListener;
|
||||
|
||||
public V2XListEmptyView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XListEmptyView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XListEmptyView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
LayoutInflater.from(context).inflate(R.layout.view_history_empty, this);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mIvEmptyView = findViewById(R.id.ivEmptyView);
|
||||
mTvTrip = findViewById(R.id.tvTrip);
|
||||
mBtnShear = findViewById(R.id.btnShear);
|
||||
mBtnRefresh = findViewById(R.id.btnRefresh);
|
||||
|
||||
mBtnShear.setOnClickListener(v -> {
|
||||
if (mOnControlListener != null) {
|
||||
mOnControlListener.onShearClick();
|
||||
}
|
||||
});
|
||||
mBtnRefresh.setOnClickListener(v -> {
|
||||
if (mOnControlListener != null) {
|
||||
mOnControlListener.onRefreshClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTripMessage(String tripMsg) {
|
||||
if (mTvTrip != null) {
|
||||
mTvTrip.setText(tripMsg);
|
||||
}
|
||||
}
|
||||
|
||||
public void setShearVisibility(boolean visibility) {
|
||||
if (mBtnShear != null) {
|
||||
if (visibility) {
|
||||
mBtnShear.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mBtnShear.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRefreshVisibility(boolean visibility) {
|
||||
if (mBtnRefresh != null) {
|
||||
if (visibility) {
|
||||
mBtnRefresh.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mBtnRefresh.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnControlListener(OnControlListener onControlListener) {
|
||||
this.mOnControlListener = onControlListener;
|
||||
}
|
||||
|
||||
public interface OnControlListener {
|
||||
void onShearClick();
|
||||
|
||||
void onRefreshClick();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.mogo.module.v2x.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.utils.animation.AnimationResources;
|
||||
import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
|
||||
|
||||
public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
|
||||
private ImageView loadView;
|
||||
private TextView textView;
|
||||
private V2XAnimationManager v2XAnimationManager;
|
||||
public Button refresButton;
|
||||
private String loadingText = "正在获取信息…";
|
||||
|
||||
public V2XNetworkLoadingView(Context context) {
|
||||
|
||||
super(context);
|
||||
}
|
||||
|
||||
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.v2x_network_loading_item, this);
|
||||
initView();
|
||||
setLoadingImage(AnimationResources.loadingRes);
|
||||
}
|
||||
|
||||
public V2XNetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public void initView() {
|
||||
v2XAnimationManager = new V2XAnimationManager();
|
||||
loadView = findViewById(R.id.loading_imageview);
|
||||
textView = findViewById(R.id.loading_text);
|
||||
refresButton = findViewById(R.id.refresh_button);
|
||||
}
|
||||
|
||||
public void setLoadingText(String text) {
|
||||
if (textView != null) {
|
||||
textView.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLoadingImage(int[] resources) {
|
||||
v2XAnimationManager.animationWithTarget(loadView, resources, 100);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (v2XAnimationManager != null) {
|
||||
v2XAnimationManager.start();
|
||||
this.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(GONE);
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(loadingText);
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if (v2XAnimationManager != null) {
|
||||
v2XAnimationManager.stop();
|
||||
this.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopWithError(String errormsg, int showRefreshButton) {
|
||||
if (v2XAnimationManager != null) {
|
||||
v2XAnimationManager.soptWithError();
|
||||
}
|
||||
if (textView != null) {
|
||||
textView.setText(errormsg);
|
||||
}
|
||||
if (refresButton != null) {
|
||||
refresButton.setVisibility(showRefreshButton);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public class V2XVoiceConstants {
|
||||
* 关闭路况详情
|
||||
*/
|
||||
public static final String COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP = "COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP";
|
||||
public static final String[] COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP_WORDS = {"关闭"};
|
||||
public static final String[] COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP_WORDS = {"关闭", "关闭页面"};
|
||||
/**
|
||||
* 应用内免唤醒
|
||||
* 反馈"正确"语音回调
|
||||
@@ -207,6 +207,24 @@ public class V2XVoiceConstants {
|
||||
public static final String COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP";
|
||||
public static final String[] COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP_WORDS = {"没用"};
|
||||
|
||||
/**
|
||||
* 出行动态
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP";
|
||||
public static final String[] COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP_WORDS = {"出行动态"};
|
||||
|
||||
/**
|
||||
* 周边事件
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP";
|
||||
public static final String[] COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP_WORDS = {"周边事件"};
|
||||
|
||||
/**
|
||||
* 我的分享
|
||||
*/
|
||||
public static final String COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP = "COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP";
|
||||
public static final String[] COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP_WORDS = {"我的分享"};
|
||||
|
||||
static {
|
||||
// 免唤醒 默认
|
||||
sVoiceCmds.put(COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP_WORDS);
|
||||
@@ -230,6 +248,10 @@ public class V2XVoiceConstants {
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP, COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP_WORDS);
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP, COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP_WORDS);
|
||||
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP_WORDS);
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP_WORDS);
|
||||
sVoiceCmds.put(COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP_WORDS);
|
||||
|
||||
|
||||
//默认
|
||||
/* sCmds.add(COMMAND_ZHIDAO_V2X_CALL_CHATTING);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#65FFFFFF" android:state_checked="false" />
|
||||
<item android:color="#FFFFFF" android:state_checked="true" />
|
||||
</selector>
|
||||
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 701 B |
|
After Width: | Height: | Size: 561 B |
|
After Width: | Height: | Size: 293 B |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 839 B |