This commit is contained in:
wangcongtao
2020-07-07 20:51:52 +08:00
71 changed files with 1962 additions and 100 deletions

3
.idea/gradle.xml generated
View File

@@ -29,11 +29,14 @@
<option value="$PROJECT_DIR$/modules/mogo-module-back" />
<option value="$PROJECT_DIR$/modules/mogo-module-common" />
<option value="$PROJECT_DIR$/modules/mogo-module-event-panel" />
<option value="$PROJECT_DIR$/modules/mogo-module-event-panel-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-extensions" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-debug" />
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-guide" />
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel" />
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-main" />
<option value="$PROJECT_DIR$/modules/mogo-module-map" />
<option value="$PROJECT_DIR$/modules/mogo-module-media" />

View File

@@ -114,6 +114,13 @@ android {
buildConfigField 'int', 'AIType','1'
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
}
// d系列 1+16 版本
d82x{
dimension "product"
// 使用同行者语音
buildConfigField 'int', 'AIType','1'
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
}
qa {
dimension "env"
buildConfigField 'int', 'NET_ENV', '2'
@@ -210,7 +217,16 @@ dependencies {
releaseImplementation rootProject.ext.dependencies.gpssimulatornoop
implementation rootProject.ext.dependencies.modulemedia
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.moduleventpanel
// 事件面板分渠道引用
d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
d8xxImplementation rootProject.ext.dependencies.moduleventpanel
e8xxImplementation rootProject.ext.dependencies.moduleventpanel
f8xxImplementation rootProject.ext.dependencies.moduleventpanel
// 左侧面板分渠道引用
d82xImplementation rootProject.ext.dependencies.moduleleftpanel
d8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
e8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
f8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
} else {
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
// launcherImplementation project(':modules:mogo-module-main')
@@ -224,7 +240,16 @@ dependencies {
releaseImplementation project(':modules:mogo-module-gps-simulator-noop')
implementation project(':modules:mogo-module-media')
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-event-panel')
// 事件面板分渠道引用
d82xImplementation project(':modules:mogo-module-event-panel-noop')
d8xxImplementation project(':modules:mogo-module-event-panel')
e8xxImplementation project(':modules:mogo-module-event-panel')
f8xxImplementation project(':modules:mogo-module-event-panel')
// 左侧面板分渠道引用
d82xImplementation project(':modules:mogo-module-left-panel')
d8xxImplementation project(':modules:mogo-module-left-panel-noop')
e8xxImplementation project(':modules:mogo-module-left-panel-noop')
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
}
}

View File

@@ -25,6 +25,7 @@ import com.mogo.utils.logger.LogLevel;
import com.mogo.utils.logger.Logger;
import com.zhidao.boot.persistent.lib.PersistentManager;
import com.zhidao.mogo.module.event.panel.EventPanelConstants;
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
/**
* @author congtaowang
@@ -63,6 +64,8 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule(new MogoModule(EventPanelConstants.PATH_NAME,
EventPanelConstants.MODULE_NAME));
MogoModulePaths.addModule(new MogoModule(LeftPanelConst.PATH_NAME,
LeftPanelConst.MODULE_NAME));
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );

View File

@@ -160,6 +160,12 @@ ext {
// obu sdk
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.1",
//事件面板
moduleventpanel : "com.mogo.module:module-event-panel:${MOGO_MODULE_EVENT_PANEL_VERSION}"
moduleventpanel : "com.mogo.module:module-event-panel:${MOGO_MODULE_EVENT_PANEL_VERSION}",
// 事件面板空实现
moduleventpanelnoop : "com.mogo.module:module-event-panel-noop:${MOGO_MODULE_EVENT_PANEL_VERSION}",
// 左侧面板
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
// 左侧面板空实现
moduleleftpanelnoop : "com.mogo.module:module-left-panel-noop:${MOGO_MODULE_LEFT_PANEL_VERSION}"
]
}

View File

@@ -27,45 +27,44 @@ PASSWORD=xintai2018
RELEASE=false
# 模块版本
## 工程内模块
MOGO_COMMONS_VERSION=1.2.1.11
MOGO_UTILS_VERSION=1.2.1.11
MAP_AMAP_VERSION=1.2.1.11
MAP_AUTONAVI_VERSION=1.2.1.11
MOGO_MAP_VERSION=1.2.1.11
MOGO_MAP_API_VERSION=1.2.1.11
MOGO_SERVICE_VERSION=1.2.1.11
MOGO_SERVICE_API_VERSION=1.2.1.11
MOGO_CONNECTION_VERSION=1.2.1.11
MOGO_MODULE_APPS_VERSION=1.2.1.11
MOGO_MODULE_NAVI_VERSION=1.2.1.11
MOGO_MODULE_SHARE_VERSION=1.2.1.11
MOGO_MODULE_COMMON_VERSION=1.2.1.11
MOGO_MODULE_MAIN_VERSION=1.2.1.11
MOGO_MODULE_MAP_VERSION=1.2.1.11
MOGO_MODULE_SERVICE_VERSION=1.2.1.11
MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.11
MOGO_MODULE_SEARCH_VERSION=1.2.1.11
MOGO_MODULE_BACK_VERSION=1.2.1.11
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.11
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.11
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.11
MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.11
MOGO_MODULE_GUIDE_VERSION=1.2.1.11
MOGO_MODULE_MEDIA_VERSION=1.2.1.11
MOGO_COMMONS_VERSION=1.2.1.13
MOGO_UTILS_VERSION=1.2.1.13
MAP_AMAP_VERSION=1.2.1.13
MAP_AUTONAVI_VERSION=1.2.1.13
MOGO_MAP_VERSION=1.2.1.13
MOGO_MAP_API_VERSION=1.2.1.13
MOGO_SERVICE_VERSION=1.2.1.13
MOGO_SERVICE_API_VERSION=1.2.1.13
MOGO_CONNECTION_VERSION=1.2.1.13
MOGO_MODULE_APPS_VERSION=1.2.1.13
MOGO_MODULE_NAVI_VERSION=1.2.1.13
MOGO_MODULE_SHARE_VERSION=1.2.1.13
MOGO_MODULE_COMMON_VERSION=1.2.1.14
MOGO_MODULE_MAIN_VERSION=1.2.1.13
MOGO_MODULE_MAP_VERSION=1.2.1.13
MOGO_MODULE_SERVICE_VERSION=1.2.1.13
MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.13
MOGO_MODULE_SEARCH_VERSION=1.2.1.13
MOGO_MODULE_BACK_VERSION=1.2.1.13
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.13
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.13
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.13
MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.13
MOGO_MODULE_GUIDE_VERSION=1.2.1.13
MOGO_MODULE_MEDIA_VERSION=1.2.1.13
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.11
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.11
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.13
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.13
MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
## 工程外部模块
# 探路
MOGO_MODULE_TANLU_VERSION=1.2.1.12
MOGO_MODULE_TANLU_VERSION=1.3.0.1-SNAPSHOT
# 车聊聊
CARCHATTING_VERSION=1.2.0
CARCHATTING_VERSION=1.3.0
# 车聊聊接口
CARCHATTINGPROVIDER_VERSION=1.2.0
CARCHATTINGPROVIDER_VERSION=1.3.0
# 视频引导
MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT
# 视频引导接口
@@ -73,14 +72,18 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
# 在线车辆F
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
# v2x
MOGO_MODULE_V2X_VERSION=1.1.53
MOGO_MODULE_V2X_VERSION=1.2.3-dev
# 推送
MOGO_MODULE_PUSH_VERSION=1.0.1
# 广告资源位
MOGO_MODULE_AD_CARD_VERSION=1.0.1
# 探路上报和分享模块
TANLULIB_VERSION=1.2.1.12
TANLULIB_VERSION=1.3.0.1-SNAPSHOT
MOGO_MODULE_EVENT_PANEL_VERSION = 1.0.0-SNAPSHOT
MOGO_MODULE_EVENT_PANEL_NOOP_VERSION = 1.0.0-SNAPSHOT
#左侧面板模块
MOGO_MODULE_LEFT_PANEL_VERSION = 1.2.1.10-SNAPSHOT
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION = 1.2.1.10-SNAPSHOT
# Boost分包
BOOST_MULTIDEX_VERSION=1.0.0

View File

@@ -0,0 +1,88 @@
package com.mogo.module.common.entity;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/3/11 4:25 PM
* desc : V2X事件列表展示
* version: 1.0
*/
public class V2XEventShowEntity implements Serializable {
// 0---默认展示详情1--直播4--道路事件详情
private int viewType;
// 道路事件详情
private V2XRoadEventEntity v2XRoadEventEntity;
// 直播车机 @see viewType = 1
private V2XLiveCarInfoEntity v2XLiveCarInfoRes;
// 直播车机列表
private List<V2XLiveCarInfoEntity> v2XLiveCarList;
public int getViewType() {
return viewType;
}
public void setViewType(int viewType) {
this.viewType = viewType;
}
public V2XRoadEventEntity getV2XRoadEventEntity() {
return v2XRoadEventEntity;
}
public void setV2XRoadEventEntity(V2XRoadEventEntity v2XRoadEventEntity) {
this.v2XRoadEventEntity = v2XRoadEventEntity;
}
public V2XLiveCarInfoEntity getV2XLiveCarInfoRes() {
return v2XLiveCarInfoRes;
}
public void setV2XLiveCarInfoRes(V2XLiveCarInfoEntity v2XLiveCarInfoRes) {
this.v2XLiveCarInfoRes = v2XLiveCarInfoRes;
}
public List<V2XLiveCarInfoEntity> getV2XLiveCarList() {
return v2XLiveCarList;
}
public void setV2XLiveCarList(List<V2XLiveCarInfoEntity> v2XLiveCarList) {
this.v2XLiveCarList = v2XLiveCarList;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V2XEventShowEntity that = (V2XEventShowEntity) o;
return viewType == that.viewType &&
Objects.equals(v2XRoadEventEntity, that.v2XRoadEventEntity) &&
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
Objects.equals(v2XLiveCarList, that.v2XLiveCarList);
}
@Override
public int hashCode() {
return Objects.hash(viewType, v2XRoadEventEntity, v2XLiveCarInfoRes, v2XLiveCarList);
}
@Override
public String toString() {
return "V2XEventShowEntity{" +
"viewType=" + viewType +
", v2XRoadEventEntity=" + v2XRoadEventEntity +
", v2XLiveCarInfoRes=" + v2XLiveCarInfoRes +
", v2XLiveCarList=" + v2XLiveCarList +
'}';
}
}

View File

@@ -0,0 +1,66 @@
package com.mogo.module.common.entity;
import java.util.Objects;
/**
* 可直播车机基本信息,再通过 appDataService/integratedServices/app/push/no/livePush/v1
* 获取直播信息
* @author donghongyu
*/
public class V2XLiveCarInfoEntity {
private String sn;
private double lon;
private double lat;
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V2XLiveCarInfoEntity that = (V2XLiveCarInfoEntity) o;
return Double.compare(that.lon, lon) == 0 &&
Double.compare(that.lat, lat) == 0 &&
Objects.equals(sn, that.sn);
}
@Override
public int hashCode() {
return Objects.hash(sn, lon, lat);
}
@Override
public String toString() {
return "V2XLiveCarEntity{" +
"sn='" + sn + '\'' +
", lon=" + lon +
", lat=" + lat +
'}';
}
}

View File

@@ -0,0 +1,125 @@
package com.mogo.module.common.entity;
import androidx.annotation.IntDef;
import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Objects;
/**
* e-mail : 1358506549@qq.com
* date : 2020/5/15 4:35 PM
* desc : V2X 场景消息聚合
* version: 1.0
*
* @author donghongyu
*/
public class V2XMessageEntity<T> implements Serializable {
/**
* 场景类型
*
* @see V2XTypeEnum
*/
@MessageType
int type;
/**
* 是否展示对话框
* true-展示false-不展示
*/
boolean showState;
/**
* 场景具体的数据内容
*/
T content;
public int getType() {
return type;
}
public void setType(@MessageType int type) {
this.type = type;
}
public boolean isShowState() {
return showState;
}
public void setShowState(boolean showState) {
this.showState = showState;
}
public T getContent() {
return content;
}
public void setContent(T content) {
this.content = content;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V2XMessageEntity<?> that = (V2XMessageEntity<?>) o;
return type == that.type &&
content.equals(that.content);
}
@Override
public int hashCode() {
return Objects.hash(type, content);
}
/**
* V2X 场景类型
*/
public interface V2XTypeEnum {
// 道路事件预警
int ALERT_ROAD_WARNING = 1_000;
// 他车求助预警
int ALERT_SEEK_WARNING = 1_001;
// 疲劳驾驶预警
int ALERT_FATIGUE_DRIVING = 1_002;
// 后台推送展示 Window
int ALERT_PUSH_WINDOW_WARNING = 1_003;
// 后台推送展示 Toast
int ALERT_PUSH_TOAST_WARNING = 1_004;
// 后台推送展示 展示的直播
int ALERT_PUSH_LIVE_CAR_WARNING = 1_005;
// V2X场景动画展示
int ALERT_ANIMATION_WARNING = 1_006;
// 道路事件直播预警
int ALERT_ROAD_LIVE_CAR_WARNING = 1_007;
// 道路事件违章停车
int ALERT_ILLEGAL_PARK_WARNING = 1_008;
// 自车求助
int ALERT_CAR_FOR_HELP = 8_000;
}
@IntDef(value = {
V2XTypeEnum.ALERT_ROAD_WARNING,
V2XTypeEnum.ALERT_SEEK_WARNING,
V2XTypeEnum.ALERT_FATIGUE_DRIVING,
V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
V2XTypeEnum.ALERT_ANIMATION_WARNING,
V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
V2XTypeEnum.ALERT_CAR_FOR_HELP,
})
@Target({
ElementType.PARAMETER,
ElementType.FIELD,
ElementType.METHOD,
}) //表示注解作用范围,参数注解,成员注解,方法注解
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
public @interface MessageType { //接口,定义新的注解类型
}
}

View File

@@ -0,0 +1,31 @@
package com.mogo.module.common.entity;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/3/31 4:53 PM
* desc : V2X 道路事件类型
* version: 1.0
*/
public interface V2XPoiTypeEnum extends MarkerPoiTypeEnum {
// 前方静止or慢速车辆报警
String ALERT_FRONT_CAR = "99999";
// 限行管理
String ALERT_TRAFFIC_CONTROL = "99998";
// 红绿灯事件、是建议以多少速度驶过
String ALERT_TRAFFIC_LIGHT_SUGGEST = "99997";
// 红绿灯事件、一种是绿灯不足3秒
String ALERT_TRAFFIC_LIGHT_WARNING = "99996";
// 故障车辆
int ALERT_CAR_TROUBLE_WARNING = 20007;
// TODO 这里目前是演示DEMO会用到想着是打算商用先这么处理的
// 取快递
String ALERT_TRAFFIC_EXPRESS = "99995";
// 顺风车
String ALERT_TRAFFIC_TAXI = "99994";
// 疲劳驾驶
String ALERT_FATIGUE_DRIVING = "99993";
// 违章停车
String ALERT_ILLEGAL_PARK = "99992";
}

View File

@@ -0,0 +1,264 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
import java.util.Objects;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-02-0315:49
* desc : V2X警报数据
* version: 1.0
*/
public class V2XPushMessageEntity implements Serializable {
// 0---默认展示详情1--直播2--停车场3--加油站4--道路事件详情
private int viewType;
private String sceneId;
private String sceneName;
private short sceneCategory;
private short sceneLevel;
private String sceneDescription;
private boolean zoom;
private int zoomScale;
private String alarmContent;
private String tts;
private String videoUrl;
private String videoSn;
private String videoChannel;
private int expireTime;
private double lat;
private double lon;
private String sn;
private String headImgUrl;
private String msgImgUrl;
private String address;
private double distance;
private boolean isShowWindow;
public int getViewType() {
return viewType;
}
public void setViewType(int viewType) {
this.viewType = viewType;
}
public String getSceneId() {
return sceneId;
}
public void setSceneId(String sceneId) {
this.sceneId = sceneId;
}
public String getSceneName() {
return sceneName;
}
public void setSceneName(String sceneName) {
this.sceneName = sceneName;
}
public short getSceneCategory() {
return sceneCategory;
}
public void setSceneCategory(short sceneCategory) {
this.sceneCategory = sceneCategory;
}
public short getSceneLevel() {
return sceneLevel;
}
public void setSceneLevel(short sceneLevel) {
this.sceneLevel = sceneLevel;
}
public String getSceneDescription() {
return sceneDescription;
}
public void setSceneDescription(String sceneDescription) {
this.sceneDescription = sceneDescription;
}
public boolean isZoom() {
return zoom;
}
public void setZoom(boolean zoom) {
this.zoom = zoom;
}
public String getAlarmContent() {
if (TextUtils.isEmpty(alarmContent)) {
return "";
}
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public String getTts() {
if (TextUtils.isEmpty(tts)) {
return "";
}
return tts;
}
public void setTts(String tts) {
this.tts = tts;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getVideoSn() {
return videoSn;
}
public void setVideoSn(String videoSn) {
this.videoSn = videoSn;
}
public String getVideoChannel() {
return videoChannel;
}
public void setVideoChannel(String videoChannel) {
this.videoChannel = videoChannel;
}
public int getExpireTime() {
return expireTime;
}
public void setExpireTime(int expireTime) {
this.expireTime = expireTime;
}
public int getZoomScale() {
return zoomScale;
}
public void setZoomScale(int zoomScale) {
this.zoomScale = zoomScale;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getHeadImgUrl() {
return headImgUrl;
}
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
public String getMsgImgUrl() {
return msgImgUrl;
}
public void setMsgImgUrl(String msgImgUrl) {
this.msgImgUrl = msgImgUrl;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public boolean isShowWindow() {
return isShowWindow;
}
public void setShowWindow(boolean showWindow) {
isShowWindow = showWindow;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V2XPushMessageEntity that = (V2XPushMessageEntity) o;
return Objects.equals(sceneId, that.sceneId) &&
Objects.equals(tts, that.tts);
}
@Override
public int hashCode() {
return Objects.hash(sceneId, tts);
}
@Override
public String toString() {
return "V2XPushMessageEntity{" +
"viewType=" + viewType +
", sceneId='" + sceneId + '\'' +
", sceneName='" + sceneName + '\'' +
", sceneCategory=" + sceneCategory +
", sceneLevel=" + sceneLevel +
", sceneDescription='" + sceneDescription + '\'' +
", zoom=" + zoom +
", zoomScale=" + zoomScale +
", alarmContent='" + alarmContent + '\'' +
", tts='" + tts + '\'' +
", videoUrl='" + videoUrl + '\'' +
", videoSn='" + videoSn + '\'' +
", videoChannel='" + videoChannel + '\'' +
", expireTime=" + expireTime +
", lat=" + lat +
", lon=" + lon +
", sn='" + sn + '\'' +
", headImgUrl='" + headImgUrl + '\'' +
", msgImgUrl='" + msgImgUrl + '\'' +
", address='" + address + '\'' +
", distance=" + distance +
", isShowWindow=" + isShowWindow +
'}';
}
}

View File

@@ -0,0 +1,298 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
import java.util.Objects;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/13 11:17 AM
* desc : 道路事件的聚合位置、详情用于V2X情况下展示
* version: 1.0
*/
public class V2XRoadEventEntity implements Serializable {
/**
* @see MarkerPoiTypeEnum
*/
// 事件类型
private String poiType;
// 事件位置
private MarkerLocation location;
// 具体的信息
private MarkerExploreWay noveltyInfo;
// tts 提示
private String tts;
// ADAS 展示文案
private String alarmContent;
// 距离当前车辆的距离
private double distance;
// 默认展示时间
private int expireTime;
// 展示Button
private boolean isShowEventButton;
// 绑定 MarkerView 的数据, 业务需要啥数据就传入啥数据
private Object bindObj;
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getPoiType() {
if (TextUtils.isEmpty(poiType)) {
return "";
}
return poiType;
}
public void setPoiType(String poiType) {
this.poiType = poiType;
}
public String getTts(boolean haveLiveCar) {
tts = "前方#" + (int) getDistance() + "米#";
switch (getPoiType()) {
// 停车场
case V2XPoiTypeEnum.FOURS_PARKING:
tts += "停车场";
break;
// 加油站
case V2XPoiTypeEnum.GAS_STATION:
tts += "加油站";
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
tts += "交通检查";
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
tts += "道路封路";
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
tts += "道路施工";
break;
// 拥堵
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
tts += "道路拥堵";
break;
// 积水
case V2XPoiTypeEnum.FOURS_PONDING:
tts += "道路积水";
break;
// 浓雾
case V2XPoiTypeEnum.FOURS_FOG:
tts += "出现浓雾";
break;
// 结冰
case V2XPoiTypeEnum.FOURS_ICE:
tts += "路面结冰";
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
tts += "交通事故";
break;
default:
tts += "道路事件";
break;
}
if (haveLiveCar) {
tts += ",查看实况请说确定。";
setShowEventButton(true);
} else {
tts += ",请注意躲避。";
setShowEventButton(false);
}
return tts;
}
/**
* 检测到附近#道路施工#,确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。
*/
public String getTtsWithFeedback() {
tts = "检测到附近";
switch (getPoiType()) {
// 停车场
case V2XPoiTypeEnum.FOURS_PARKING:
tts += "有停车场";
break;
// 加油站
case V2XPoiTypeEnum.GAS_STATION:
tts += "有加油站";
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
tts += "交通检查";
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
tts += "封路";
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
tts += "施工";
break;
// 拥堵
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
tts += "道路拥堵";
break;
// 积水
case V2XPoiTypeEnum.FOURS_PONDING:
tts += "道路积水";
break;
// 浓雾
case V2XPoiTypeEnum.FOURS_FOG:
tts += "出现浓雾";
break;
// 结冰
case V2XPoiTypeEnum.FOURS_ICE:
tts += "路面结冰";
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
tts += "交通事故";
break;
default:
tts += "道路事件";
break;
}
tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。";
return tts;
}
public String getTts() {
return tts;
}
public void setTts(String tts) {
this.tts = tts;
}
public boolean isShowEventButton() {
return isShowEventButton;
}
public void setShowEventButton(boolean showEventButton) {
isShowEventButton = showEventButton;
}
public String getAlarmContent() {
switch (getPoiType()) {
// 停车场
case V2XPoiTypeEnum.FOURS_PARKING:
alarmContent = "停车场附近";
break;
// 加油站
case V2XPoiTypeEnum.GAS_STATION:
alarmContent = "加油站附近";
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
alarmContent = "前方交通检查";
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
alarmContent = "前方封路";
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
alarmContent = "前方施工";
break;
// 拥堵
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
alarmContent = "前方道路拥堵";
break;
// 积水
case V2XPoiTypeEnum.FOURS_PONDING:
alarmContent = "前方道路积水";
break;
// 浓雾
case V2XPoiTypeEnum.FOURS_FOG:
alarmContent = "前方出现浓雾";
break;
// 结冰
case V2XPoiTypeEnum.FOURS_ICE:
alarmContent = "前方路面结冰";
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
alarmContent = "前方交通事故";
break;
default:
tts += "道路事件";
break;
}
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public int getExpireTime() {
return expireTime;
}
public void setExpireTime(int expireTime) {
this.expireTime = expireTime;
}
public MarkerExploreWay getNoveltyInfo() {
return noveltyInfo;
}
public void setNoveltyInfo(MarkerExploreWay noveltyInfo) {
this.noveltyInfo = noveltyInfo;
}
public Object getBindObj() {
return bindObj;
}
public void setBindObj(Object bindObj) {
this.bindObj = bindObj;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V2XRoadEventEntity that = (V2XRoadEventEntity) o;
return Objects.equals(noveltyInfo.getInfoId(), that.noveltyInfo.getInfoId()) &&
Objects.equals(poiType, that.poiType);
}
@Override
public int hashCode() {
return Objects.hash(poiType, noveltyInfo.getInfoId());
}
@Override
public String toString() {
return "V2XRoadEventEntity{" +
"poiType='" + poiType + '\'' +
", location=" + location +
", noveltyInfo=" + noveltyInfo +
", tts='" + tts + '\'' +
", alarmContent='" + alarmContent + '\'' +
", distance=" + distance +
", expireTime=" + expireTime +
", isShowEventButton=" + isShowEventButton +
", bindObj=" + bindObj +
'}';
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.module.common.entity;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/3/31 4:53 PM
* desc : V2X 道路提醒类型
* version: 1.0
*/
public interface V2XWindowTypeEnum {
// 默认展示详情
int DEFAULT_WINDOW = 0;
// 直播
int LIVE_CAR_WINDOW = 1;
// 道路事件详情
int ROAD_EVENT_WINDOW = 2;
// 推送事件详情
int PUSH_EVENT_WINDOW = 3;
// 演示动画场景
int ANIMATION_WINDOW = 4;
// 疲劳驾驶
int FATIGUE_DRIVING_WINDOW = 5;
// 他人故障求助
int SEEK_HELP_WINDOW = 6;
// 违章停车
int ILLEGAL_PARK_WINDOW = 7;
}

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,55 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
compileOnly project(':modules:mogo-module-common')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-event-panel-noop
VERSION_CODE=1

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,24 @@
package com.zhidao.mogo.module.event.panel
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.zhidao.mogo.module.event.panel.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.mogo.module.event.panel">
/
</manifest>

View File

@@ -0,0 +1,11 @@
package com.zhidao.mogo.module.event.panel
/**
* 事件面板相关常量
*
* @author tongchenfei
*/
object EventPanelConstants {
const val MODULE_NAME = "MODULE_EVENT_PANEL"
const val PATH_NAME = "/event/panel"
}

View File

@@ -0,0 +1,90 @@
package com.zhidao.mogo.module.event.panel
import android.content.Context
import android.os.Bundle
import android.view.View
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.service.MogoServicePaths
import com.mogo.service.eventpanel.IEventPanelProvider
import com.mogo.service.module.IMogoModuleLifecycle
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
/**
* 事件面板provider的空方法实现
*
* @author tongchenfei
*/
const val TAG = "EventPanelNoopModule"
@Route(path = MogoServicePaths.PATH_EVENT_PANEL)
class EventPanelModuleProvider : IEventPanelProvider {
override fun init(context: Context) {
Logger.d(TAG, "模块初始化====")
}
override fun createFragment(context: Context, data: Bundle?): Fragment? {
return null
}
/**
* 显示面板
*/
override fun showPanel() {
}
/**
* 隐藏面板
*/
override fun hidePanel() {
}
override fun createView(context: Context): View? {
return null
}
override fun getModuleName(): String {
return MODULE_NAME
}
override fun getCardLifecycle(): IMogoModuleLifecycle? {
return null
}
override fun getMapListener(): IMogoMapListener? {
return null
}
override fun getType(): Int {
return 0
}
override fun getNaviListener(): IMogoNaviListener? {
return null
}
override fun getLocationListener(): IMogoLocationListener? {
return null
}
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
return null
}
override fun getAppPackage(): String? {
return null
}
override fun getAppName(): String? {
return null
}
}

View File

@@ -0,0 +1,17 @@
package com.zhidao.mogo.module.event.panel
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -49,6 +49,9 @@ dependencies {
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxviewpager2
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.room
kapt rootProject.ext.dependencies.roomAnnotationProcessor
implementation rootProject.ext.dependencies.roomRxjava
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon

View File

@@ -1,26 +0,0 @@
package com.zhidao.mogo.module.event.panel;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.zhidao.mogo.module.event.panel.test", appContext.getPackageName());
}
}

View File

@@ -16,6 +16,7 @@ import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
import com.zhidao.mogo.module.event.panel.EventPanelConstants.PATH_NAME
import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
import com.zhidao.mogo.module.event.panel.util.MogoApiManager
/**
* 事件面板provider
@@ -31,6 +32,7 @@ class EventPanelModuleProvider : IEventPanelProvider {
*/
override fun init(context: Context) {
Logger.d(MODULE_NAME, "模块初始化====")
MogoApiManager.init(context)
}
override fun createFragment(context: Context, data: Bundle?): Fragment? {

View File

@@ -0,0 +1,17 @@
package com.zhidao.mogo.module.event.panel.bean
import androidx.room.Entity
import androidx.room.PrimaryKey
/**
* 出行记录本地存储封装类
*
* @author
*/
@Entity
data class TripRecord(@PrimaryKey(autoGenerate = true)
var id: Int = 0,
var canUsed: Boolean = true,
var isUsed: Boolean = false,
var entity: String? = null,
var recordTime: Long = 0)

View File

@@ -0,0 +1,21 @@
package com.zhidao.mogo.module.event.panel.dao
import androidx.room.*
import com.zhidao.mogo.module.event.panel.bean.TripRecord
import io.reactivex.Flowable
@Dao
interface TripRecordDao {
@Query(value = "SELECT * FROM TripRecord")
fun getAllTripRecord():Flowable<List<TripRecord>>
@Insert
fun insert(vararg tripRecord: TripRecord)
@Update
fun update(vararg tripRecord: TripRecord)
@Delete
fun delete(vararg tripRecord: TripRecord)
}

View File

@@ -0,0 +1,25 @@
package com.zhidao.mogo.module.event.panel.dao
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.zhidao.mogo.module.event.panel.bean.TripRecord
@Database(entities = [TripRecord::class], version = 1, exportSchema = false)
abstract class TripRecordDatabase : RoomDatabase() {
companion object{
private var instance:TripRecordDatabase? = null
fun getInstance(context: Context):TripRecordDatabase{
if (instance == null) {
synchronized(TripRecordDatabase::class.java) {
if (instance == null) {
instance = Room.databaseBuilder(context, TripRecordDatabase::class.java, "TripRecordDatabase.db").build()
}
}
}
return instance!!
}
}
abstract fun getTripRecordDao():TripRecordDao
}

View File

@@ -1,31 +1,55 @@
package com.zhidao.mogo.module.event.panel.fragment
import android.util.Log
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.event.panel.R
import com.zhidao.mogo.module.event.panel.bean.TripRecord
import com.zhidao.mogo.module.event.panel.presenter.TripRecordPresenter
import kotlinx.android.synthetic.main.module_event_panel_fragment_trip_record.*
import kotlin.random.Random
/**
* 出行动态fragment
*/
const val TAG = "TripRecordFragment"
class TripRecordFragment: MvpFragment<TripRecordFragment, TripRecordPresenter>() {
/**
* 布局资源
*
* @return
*/
private val tripRecordList = ArrayList<TripRecord>()
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_trip_record
/**
* 初始化控件必须在初始化完成之后才可以实例化presenter避免
* presenter 生命周期错乱
*/
override fun initViews() {
btnInsert.setOnClickListener {
val tripRecord = TripRecord()
val random = Random.nextInt(10)
tripRecord.entity = "entity: $random"
tripRecord.recordTime = System.currentTimeMillis()
tripRecordList.add(tripRecord)
mPresenter.insertTripRecord(tripRecord)
Log.d(TAG, "insert over: $tripRecord")
}
btnDelete.setOnClickListener {
val random = Random.nextInt(tripRecordList.size)
val tripRecord = tripRecordList.removeAt(random)
mPresenter.deleteTripRecords(tripRecord)
Log.d(TAG, "delete over: $tripRecord")
}
btnUpdate.setOnClickListener {
val random = Random.nextInt(tripRecordList.size)
val tripRecord = tripRecordList[random]
Log.d(TAG,"before update: $tripRecord")
tripRecord.recordTime = System.currentTimeMillis()
mPresenter.updateTripRecords(tripRecord)
Log.d(TAG, "update over: $tripRecord")
}
btnQuery.setOnClickListener {
Log.d(TAG, "local list: $tripRecordList")
mPresenter.queryAllTripRecord()
}
}
/**
* 创建 presenter 实例
*
* @return
*/
override fun createPresenter(): TripRecordPresenter = TripRecordPresenter(this)
}

View File

@@ -1,7 +1,36 @@
package com.zhidao.mogo.module.event.panel.presenter
import android.util.Log
import com.mogo.commons.mvp.Presenter
import com.mogo.utils.ThreadPoolService
import com.zhidao.mogo.module.event.panel.bean.TripRecord
import com.zhidao.mogo.module.event.panel.dao.TripRecordDatabase
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
import io.reactivex.schedulers.Schedulers
import kotlin.concurrent.thread
class TripRecordPresenter(view: TripRecordFragment) : Presenter<TripRecordFragment>(view) {
}
fun queryAllTripRecord() {
val disposable = TripRecordDatabase.getInstance(context).getTripRecordDao().getAllTripRecord().subscribeOn(Schedulers.io()).subscribe {
Log.d("TripRecordFragment", "db query: $it")
}
}
fun insertTripRecord(vararg records: TripRecord) {
ThreadPoolService.execute {
TripRecordDatabase.getInstance(context).getTripRecordDao().insert(*records)
}
}
fun updateTripRecords(vararg records: TripRecord) {
ThreadPoolService.execute {
TripRecordDatabase.getInstance(context).getTripRecordDao().update(*records)
}
}
fun deleteTripRecords(vararg records: TripRecord) {
ThreadPoolService.execute {
TripRecordDatabase.getInstance(context).getTripRecordDao().delete(*records)
}
}
}

View File

@@ -0,0 +1,14 @@
package com.zhidao.mogo.module.event.panel.util
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
object MogoApiManager {
lateinit var serviceApis:IMogoServiceApis
fun init(context: Context) {
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
}
}

View File

@@ -2,8 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clPanelContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
android:layout_height="match_parent">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vpEventPanel"

View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/clPanelContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:visibility="gone">
<TextView
android:id="@+id/tvTitle"
@@ -12,4 +14,49 @@
android:text="Trip Record"
android:textColor="#fff"
android:textSize="40sp" />
<Button
android:id="@+id/btnInsert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Insert"
android:textColor="#fff"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btnUpdate"/>
<Button
android:id="@+id/btnUpdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Update"
android:textColor="#fff"
android:textSize="30sp"
app:layout_constraintLeft_toRightOf="@+id/btnInsert"
app:layout_constraintRight_toLeftOf="@+id/btnDelete"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delete"
android:textColor="#fff"
android:textSize="30sp"
app:layout_constraintLeft_toRightOf="@+id/btnUpdate"
app:layout_constraintRight_toLeftOf="@+id/btnQuery"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnQuery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Query"
android:textColor="#fff"
android:textSize="30sp"
app:layout_constraintLeft_toRightOf="@+id/btnDelete"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,17 +0,0 @@
package com.zhidao.mogo.module.event.panel;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,55 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
compileOnly project(':modules:mogo-module-common')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-left-panel-noop
VERSION_CODE=1

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,24 @@
package com.zhidao.mogo.module.left.panel
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.zhidao.mogo.module.left.panel.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.mogo.module.left.panel">
/
</manifest>

View File

@@ -0,0 +1,6 @@
package com.zhidao.mogo.module.left.panel
object LeftPanelConst {
const val MODULE_NAME = "MODULE_LEFT_PANEL"
const val PATH_NAME = "/left/panel"
}

View File

@@ -0,0 +1,73 @@
package com.zhidao.mogo.module.left.panel
import android.content.Context
import android.os.Bundle
import android.view.View
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.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
import com.zhidao.mogo.module.left.panel.LeftPanelConst.PATH_NAME
/**
* 适配1+16增加的位于左侧的面板页provider的空实现
*
* @author tongchenfei
*/
@Route(path = PATH_NAME)
class LeftPanelProvider:IMogoModuleProvider {
override fun getNaviListener(): IMogoNaviListener? {
return null
}
override fun getLocationListener(): IMogoLocationListener? {
return null
}
override fun getType(): Int {
return 0
}
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
return null
}
override fun init(context: Context?) {
Logger.d(MODULE_NAME, "左侧面板noop模块初始化===")
}
override fun getMapListener(): IMogoMapListener? {
return null
}
override fun getAppPackage(): String {
return ""
}
override fun createView(context: Context?): View? {
return null
}
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
return null
}
override fun getModuleName(): String {
return MODULE_NAME
}
override fun getAppName(): String {
return ""
}
override fun getCardLifecycle(): IMogoModuleLifecycle? {
return null
}
}

View File

@@ -0,0 +1,17 @@
package com.zhidao.mogo.module.left.panel
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,58 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
// buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.rxjava
implementation rootProject.ext.dependencies.rxandroid
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
compileOnly project(':modules:mogo-module-common')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-left-panel
VERSION_CODE=1

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,24 @@
package com.zhidao.mogo.module.left.panel
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.zhidao.mogo.module.left.panel.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.mogo.module.left.panel">
/
</manifest>

View File

@@ -0,0 +1,6 @@
package com.zhidao.mogo.module.left.panel
object LeftPanelConst {
const val MODULE_NAME = "MODULE_LEFT_PANEL"
const val PATH_NAME = "/left/panel"
}

View File

@@ -0,0 +1,75 @@
package com.zhidao.mogo.module.left.panel
import android.content.Context
import android.os.Bundle
import android.view.View
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.location.MogoLocation
import com.mogo.map.marker.IMogoMarkerClickListener
import com.mogo.map.navi.IMogoNaviListener
import com.mogo.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
import com.zhidao.mogo.module.left.panel.LeftPanelConst.PATH_NAME
import com.zhidao.mogo.module.left.panel.fragment.SimpleSpeedFragment
/**
* 适配1+16增加的位于左侧的面板页provider
*
* @author tongchenfei
*/
@Route(path = PATH_NAME)
class LeftPanelProvider:IMogoModuleProvider {
override fun getNaviListener(): IMogoNaviListener? {
return null
}
override fun getLocationListener(): IMogoLocationListener? {
return null
}
override fun getType(): Int {
return 0
}
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
return null
}
override fun init(context: Context?) {
Logger.d(MODULE_NAME, "左侧面板模块初始化===")
}
override fun getMapListener(): IMogoMapListener? {
return null
}
override fun getAppPackage(): String {
return ""
}
override fun createView(context: Context?): View? {
return null
}
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
return SimpleSpeedFragment()
}
override fun getModuleName(): String {
return MODULE_NAME
}
override fun getAppName(): String {
return ""
}
override fun getCardLifecycle(): IMogoModuleLifecycle? {
return null
}
}

View File

@@ -0,0 +1,35 @@
package com.zhidao.mogo.module.left.panel.fragment
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.left.panel.R
import com.zhidao.mogo.module.left.panel.presenter.SimpleSpeedPresenter
import kotlinx.android.synthetic.main.module_left_panel_simple_speed.*
/**
* 临时车速界面的fragment
*
* @author tongchenfei
*/
private const val SPEED_THRESHOLD = 90
class SimpleSpeedFragment: MvpFragment<SimpleSpeedFragment, SimpleSpeedPresenter>() {
override fun getLayoutId(): Int {
return R.layout.module_left_panel_simple_speed
}
override fun initViews() {
}
override fun createPresenter(): SimpleSpeedPresenter {
return SimpleSpeedPresenter(this)
}
fun refreshSpeed(speed: Int) {
tvModuleLeftPanelSpeed.text = speed.toString()
if (speed >= SPEED_THRESHOLD) {
// 速度超过90需要改变背景颜色
tvModuleLeftPanelSpeed.setBackgroundResource(R.drawable.module_left_panel_warn_speed_bg)
}else{
tvModuleLeftPanelSpeed.setBackgroundResource(R.drawable.module_left_panel_normal_speed_bg)
}
}
}

View File

@@ -0,0 +1,32 @@
package com.zhidao.mogo.module.left.panel.presenter
import android.os.Handler
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.mvp.Presenter
import com.mogo.map.location.IMogoLocationListener
import com.mogo.map.location.MogoLocation
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.zhidao.mogo.module.left.panel.LeftPanelConst.MODULE_NAME
import com.zhidao.mogo.module.left.panel.fragment.SimpleSpeedFragment
import java.lang.Thread.sleep
import kotlin.concurrent.thread
import kotlin.random.Random
/**
* 临时左侧车速逻辑的presenter
*
* @author tongchenfei
*/
class SimpleSpeedPresenter(view: SimpleSpeedFragment) : Presenter<SimpleSpeedFragment>(view) {
private val handler = Handler()
private var mogoApis: IMogoServiceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.context) as IMogoServiceApis
init {
// 注册相关回调,监测速度变化
mogoApis.registerCenterApi.registerMogoLocationListener(MODULE_NAME) {
handler.post {
mView.refreshSpeed(it.speed.toInt())
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/ivContainerBg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/module_left_panel_speed_container_bg"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvModuleLeftPanelSpeed"
android:text="0"
android:gravity="center"
android:textStyle="bold"
android:textSize="@dimen/module_left_panel_simple_speed_text_size"
app:layout_constraintLeft_toLeftOf="@id/ivContainerBg"
app:layout_constraintRight_toRightOf="@id/ivContainerBg"
app:layout_constraintTop_toTopOf="@id/ivContainerBg"
android:layout_marginTop="@dimen/module_left_panel_simple_speed_text_margin_top"
android:textColor="#fff"
android:background="@drawable/module_left_panel_normal_speed_bg" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_left_panel_simple_speed_text_size">80px</dimen>
<dimen name="module_left_panel_simple_speed_text_margin_top">69.6px</dimen>
</resources>

View File

@@ -0,0 +1,17 @@
package com.zhidao.mogo.module.left.panel
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -53,7 +53,6 @@ dependencies {
api rootProject.ext.dependencies.mogoconnection
api rootProject.ext.dependencies.moduleextensions
api rootProject.ext.dependencies.mogomoduleback
// implementation rootProject.ext.dependencies.moduleventpanel
} else {
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
@@ -66,7 +65,6 @@ dependencies {
api project(':foudations:mogo-connection')
api project(':modules:mogo-module-extensions')
api project(':modules:mogo-module-back')
// implementation project(':modules:mogo-module-event-panel')
}
}

View File

@@ -61,6 +61,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
protected View mEntrance;
protected FrameLayout mFloatingLayout;
protected FrameLayout mCoverUpLayout;
protected FrameLayout mLeftPanelLayout;
protected View mLeftShadowFrame;
private boolean mIsHomeKeyDown = false;
@@ -80,6 +81,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
mLeftPanelLayout = findViewById(R.id.module_main_id_left_panel_fragment_container);
// 避免事件穿透导致地图被滑动
mLeftShadowFrame.setOnClickListener( view -> {
@@ -183,6 +185,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
// MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
MogoModulesManager.getInstance().loadLeftPanelModule(R.id.module_main_id_left_panel_fragment_container);
}
@Override

View File

@@ -65,4 +65,10 @@ public interface MogoModulesHandler {
* @param containerId
*/
void loadEventPanelModule(int containerId);
/**
* 加载左侧面板
* @param containerId
*/
void loadLeftPanelModule(int containerId);
}

View File

@@ -139,6 +139,14 @@ public class MogoModulesManager implements MogoModulesHandler {
addFragment( provider, containerId );
}
@Override
public void loadLeftPanelModule(int containerId) {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
.build(MogoServicePaths.PATH_LEFT_PANEL)
.navigation( getContext() );
addFragment( provider, containerId );
}
@Override
public void loadBaseModule() {
List< MogoModule > baseModules = MogoModulePaths.getBaseModules();

View File

@@ -34,6 +34,12 @@
android:layout_height="match_parent"
android:padding="@dimen/module_main_apps_fragment_container_padding" />
<!-- 左侧浮层,布局位置目前只考虑了1+16独立app情况 -->
<FrameLayout
android:layout_width="@dimen/module_main_id_left_panel_fragment_container_width"
android:layout_height="match_parent"
android:id="@+id/module_main_id_left_panel_fragment_container" />
<!--快捷操作浮层-->
<FrameLayout
android:id="@+id/module_main_id_entrance_fragment_container"

View File

@@ -22,4 +22,6 @@
<dimen name="module_main_id_entrance_fragment_container_marginLeft">800px</dimen>
<dimen name="module_main_entrance_fragment_container_padding">30px</dimen>
<dimen name="module_main_id_left_panel_fragment_container_width">340px</dimen>
</resources>

View File

@@ -21,6 +21,7 @@
<dimen name="module_main_header_fragment_container_marginTop">15px</dimen>
<dimen name="module_main_header_fragment_container_marginLeft">460px</dimen>
<dimen name="module_main_id_entrance_fragment_container_marginLeft">444px</dimen>
<dimen name="module_main_id_left_panel_fragment_container_width">350px</dimen>
<dimen name="module_main_entrance_fragment_container_padding">16px</dimen>
</resources>

View File

@@ -191,5 +191,15 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_OBU = "/obu/api";
/**
* 事件面板
*/
@Deprecated
public static final String PATH_EVENT_PANEL = "/event/panel";
/**
* 左侧面板
*/
@Deprecated
public static final String PATH_LEFT_PANEL = "/left/panel";
}

View File

@@ -1,3 +1,6 @@
include ':modules:mogo-module-left-panel-noop'
include ':modules:mogo-module-left-panel'
include ':modules:mogo-module-event-panel-noop'
include ':modules:mogo-module-event-panel'
include ':modules:mogo-module-obu'
rootProject.name = 'MogoLauncher'

View File

@@ -27,5 +27,8 @@
./gradlew :modules:mogo-module-guide:clean :modules:mogo-module-guide:uploadArchives
./gradlew :main-extensions:mogo-module-main-independent:clean :main-extensions:mogo-module-main-independent:uploadArchives
./gradlew :main-extensions:mogo-module-main-launcher:clean :main-extensions:mogo-module-main-launcher:uploadArchives
./gradlew :modules:mogo-module-event-panel:clean :modules:mogo-module-event-panel:uploadArchives
./gradlew :modules:mogo-module-event-panel-noop:clean :modules:mogo-module-event-panel-noop:uploadArchives
./gradlew :modules:mogo-module-left-panel:clean :modules:mogo-module-left-panel:uploadArchives
./gradlew :modules:mogo-module-left-panel-noop:clean :modules:mogo-module-left-panel-noop:uploadArchives