Merge branch 'qa_d82x'

1+16已封版发布

# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/mogo/launcher/MogoApplication.java
#	gradle.properties
#	modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
#	modules/mogo-module-search/src/main/res/values/dimens.xml
This commit is contained in:
tongchenfei
2020-07-29 14:42:13 +08:00
463 changed files with 8661 additions and 473 deletions

View File

@@ -45,7 +45,6 @@ dependencies {
implementation rootProject.ext.dependencies.material
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.guideshowprovider
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogomap

View File

@@ -4,22 +4,10 @@ import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.guideshow.provider.GuideShowProviderConstant;
import com.mogo.module.guideshow.provider.IGuideShowProvider;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoSocketManager;
import com.mogo.service.imageloader.IMogoImageloader;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.statusmanager.IMogoStatusManager;
/**
* author : zyz
@@ -35,13 +23,11 @@ public class AppServiceHandler {
private static IMogoServiceApis mApis;
private static IMogoCardManager mMogoCardManager;
private static IMogoAnalytics mMogoAnalytics;
private static IGuideShowProvider mMogoGuideShow;
public static void init( final Context context ) {
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( context );
mMogoCardManager = mApis.getCardManagerApi();
mMogoAnalytics = mApis.getAnalyticsApi();
mMogoGuideShow = ( IGuideShowProvider ) ARouter.getInstance().build( GuideShowProviderConstant.GUIDE_SHOW_PROVIDER ).navigation( context );
}
@@ -53,10 +39,6 @@ public class AppServiceHandler {
return mMogoAnalytics;
}
public static IGuideShowProvider getMogoGuideShow() {
return mMogoGuideShow;
}
public static IMogoServiceApis getApis() {
if ( mApis == null ) {
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( AbsMogoApplication.getApp() );

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,94 @@
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
}
override fun isPanelShow(): Boolean {
return false
}
}

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

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

View File

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

View File

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

View File

@@ -0,0 +1,103 @@
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.eventpanel.IEventPanelProvider
import com.mogo.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
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
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
/**
* 事件面板provider
*
* @author tongchenfei
*/
@Route(path = PATH_NAME)
class EventPanelModuleProvider : IEventPanelProvider {
/**
* Do your init work in this method, it well be call when processor has been load.
*
* @param context ctx
*/
override fun init(context: Context) {
Logger.d(MODULE_NAME, "模块初始化====")
MogoApiManager.init(context)
TripRecordDataManager.init(context)
}
override fun createFragment(context: Context, data: Bundle?): Fragment? {
return EventPanelFragment.getInstance()
}
/**
* 显示面板
*/
override fun showPanel() {
EventPanelFragment.getInstance().showPanel()
}
override fun isPanelShow(): Boolean {
return EventPanelFragment.getInstance().isPanelShow()
}
/**
* 隐藏面板
*/
override fun hidePanel() {
EventPanelFragment.getInstance().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,23 @@
package com.zhidao.mogo.module.event.panel.adapter
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
/**
* 事件面板viewpager2的adapter
*
* @author tongchenfei
*/
class EventPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
private val fragments:Array<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), MyShareFragment())
/**
* 目前一共就三个fragment
*/
override fun getItemCount(): Int = fragments.size
override fun createFragment(position: Int): Fragment = fragments[position]
}

View File

@@ -0,0 +1,25 @@
package com.zhidao.mogo.module.event.panel.bean
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.zhidao.mogo.module.event.panel.EventPanelConstants.ROAD_EVENT_USEFUL_STATUS_UNSET
/**
* 出行记录本地存储封装类,此类标识了数据库表名以及字段名
*
* @author tongchenfei
*/
@Entity
data class TripRecord(@PrimaryKey(autoGenerate = false)
var id: Int,
var eventId: String = "",
var eventType: Int,
/**
* 是否有用
* 1 - 没用
* 2 - 有用
* 0 - 未设置
*/
var usefulStatus: String = ROAD_EVENT_USEFUL_STATUS_UNSET,
var entity: String = "",
var recordTime: Long = System.currentTimeMillis())

View File

@@ -0,0 +1,48 @@
package com.zhidao.mogo.module.event.panel.dao
import androidx.room.*
import com.zhidao.mogo.module.event.panel.bean.TripRecord
/**
* 出行动态dao,全部使用同步方法,在线程中执行
*
* @author tongchenfei
*/
@Dao
interface TripRecordDao {
/**
* 查询当日数据
* @param limitTime 当日0点的时间戳
*/
@Query(value = "SELECT * FROM TripRecord WHERE recordTime > :limitTime ORDER BY recordTime DESC")
fun queryAllTripRecord(limitTime: Long): List<TripRecord>
/**
* 根据事件id获取出行动态
*
* @param eventId 事件id [com.mogo.module.common.entity.V2XRoadEventEntity.noveltyInfo.infoId]
*/
@Query(value = "SELECT * FROM TripRecord WHERE eventId = :eventId")
fun queryTripRecordByEventId(eventId: String): TripRecord?
@Query(value = "SELECT * FROM TripRecord WHERE id = :id")
fun queryTripRecordById(id: Int): TripRecord?
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(vararg tripRecord: TripRecord)
@Update
fun update(vararg tripRecord: TripRecord)
@Delete
fun delete(vararg tripRecord: TripRecord)
/**
* 删除超时的数据即当天0时以前的数据
* 虽然注解是Query但是目的是执行后面的sql语句所以就不要在意这些细节了
*
* @param limitTime 当日0点的时间戳
*/
@Query(value = "DELETE FROM TripRecord WHERE recordTime < :limitTime")
fun deleteOvertimeTripRecord(limitTime: Long)
}

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

@@ -0,0 +1,61 @@
package com.zhidao.mogo.module.event.panel.fragment
import android.view.View
import androidx.fragment.app.Fragment
import com.mogo.commons.mvp.MvpFragment
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
import com.zhidao.mogo.module.event.panel.R
import com.zhidao.mogo.module.event.panel.adapter.EventPagerAdapter
import com.zhidao.mogo.module.event.panel.presenter.EventPanelPresenter
import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
/**
* 事件面板主fragment
*
* @author tongchenfei
*/
class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>() {
companion object{
private val fragment = EventPanelFragment()
fun getInstance():EventPanelFragment{
return fragment
}
}
override fun getLayoutId(): Int {
return R.layout.module_event_panel_fragment_event_panel
}
override fun initViews() {
Logger.d(MODULE_NAME, "EventPanelFragment init view===")
vpEventPanel.adapter = EventPagerAdapter(this)
btnShowOrHidePanels.setOnClickListener {
if (vpEventPanel.visibility == View.GONE) {
showPanel()
}else{
hidePanel()
}
}
}
override fun createPresenter(): EventPanelPresenter {
return EventPanelPresenter(this)
}
fun showPanel(){
Logger.d(MODULE_NAME,"in fragment show panel")
vpEventPanel.visibility = View.VISIBLE
btnShowOrHidePanels.text = "隐藏面板"
}
fun hidePanel(){
Logger.d(MODULE_NAME,"in fragment hide panel")
vpEventPanel.visibility = View.GONE
btnShowOrHidePanels.text = "显示面板"
}
fun isPanelShow():Boolean{
return vpEventPanel.visibility == View.VISIBLE
}
}

View File

@@ -0,0 +1,28 @@
package com.zhidao.mogo.module.event.panel.fragment
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.event.panel.R
import com.zhidao.mogo.module.event.panel.presenter.MySharePresenter
class MyShareFragment : MvpFragment<MyShareFragment, MySharePresenter>() {
/**
* 布局资源
*
* @return
*/
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_my_share
/**
* 初始化控件必须在初始化完成之后才可以实例化presenter避免
* presenter 生命周期错乱
*/
override fun initViews() {
}
/**
* 创建 presenter 实例
*
* @return
*/
override fun createPresenter(): MySharePresenter = MySharePresenter(this)
}

View File

@@ -0,0 +1,32 @@
package com.zhidao.mogo.module.event.panel.fragment
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.event.panel.R
import com.zhidao.mogo.module.event.panel.presenter.SurroundingEventPresenter
import kotlinx.android.synthetic.main.module_event_panel_fragment_surrounding_event.*
class SurroundingEventFragment:MvpFragment<SurroundingEventFragment,SurroundingEventPresenter>(){
/**
* 布局资源
*
* @return
*/
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_surrounding_event
/**
* 初始化控件必须在初始化完成之后才可以实例化presenter避免
* presenter 生命周期错乱
*/
override fun initViews() {
tvTitle.setOnClickListener {
EventPanelFragment.getInstance().hidePanel()
}
}
/**
* 创建 presenter 实例
*
* @return
*/
override fun createPresenter(): SurroundingEventPresenter = SurroundingEventPresenter(this)
}

View File

@@ -0,0 +1,49 @@
package com.zhidao.mogo.module.event.panel.fragment
import android.util.Log
import com.mogo.commons.mvp.MvpFragment
import com.mogo.module.common.entity.V2XMessageEntity
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
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 com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
import kotlinx.android.synthetic.main.module_event_panel_fragment_trip_record.*
import kotlin.random.Random
/**
* 出行动态fragment
*/
class TripRecordFragment : MvpFragment<TripRecordFragment, TripRecordPresenter>() {
private val tripRecordList = ArrayList<TripRecord>()
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_trip_record
override fun initViews() {
btnInsert.setOnClickListener {
TripRecordDataManager.insertTripRecord(TripRecord(id = 456, eventType = 456,eventId = "456"))
}
btnUpdate.setOnClickListener {
TripRecordDataManager.syncRoadEventModifyState(eventId = "456", modifyType = "2")
}
btnQuery.setOnClickListener {
Log.d(MODULE_NAME, "local list: $tripRecordList")
mPresenter.queryAllTripRecord()
}
}
override fun createPresenter(): TripRecordPresenter = TripRecordPresenter(this)
fun refreshTripRecordList(tripRecords: List<TripRecord>) {
Logger.d(MODULE_NAME, "刷新出行动态列表:$tripRecords")
tripRecordList.clear()
tripRecordList.addAll(tripRecords)
}
/**
* 刷新单个出行动态,如果无此动态,新增动态
*/
fun refreshTripRecord(tripRecord: TripRecord) {
Logger.d(MODULE_NAME, "刷新单个出行动态: $tripRecord")
}
}

View File

@@ -0,0 +1,18 @@
package com.zhidao.mogo.module.event.panel.listener
import com.zhidao.mogo.module.event.panel.bean.TripRecord
/**
* 数据库异步操作数据回调
*/
interface ITripRecordCallback {
/**
* 查询全部出行动态成功
*/
fun queryTripRecordListSuccess(tripRecordList:List<TripRecord>)
/**
* 有出行动态新增或更新后,回调此接口
*/
fun insertOrUpdateTripRecordSuccess(tripRecord:TripRecord)
}

View File

@@ -0,0 +1,11 @@
package com.zhidao.mogo.module.event.panel.presenter
import com.mogo.commons.mvp.Presenter
import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
/**
* 事件面板presenter
*
* @author tongchenfei
*/
class EventPanelPresenter(view: EventPanelFragment) : Presenter<EventPanelFragment>(view)

View File

@@ -0,0 +1,7 @@
package com.zhidao.mogo.module.event.panel.presenter
import com.mogo.commons.mvp.Presenter
import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
class MySharePresenter(view: MyShareFragment) : Presenter<MyShareFragment>(view) {
}

View File

@@ -0,0 +1,7 @@
package com.zhidao.mogo.module.event.panel.presenter
import com.mogo.commons.mvp.Presenter
import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
class SurroundingEventPresenter(view: SurroundingEventFragment) : Presenter<SurroundingEventFragment>(view) {
}

View File

@@ -0,0 +1,33 @@
package com.zhidao.mogo.module.event.panel.presenter
import androidx.lifecycle.LifecycleOwner
import com.mogo.commons.mvp.Presenter
import com.zhidao.mogo.module.event.panel.bean.TripRecord
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
class TripRecordPresenter(view: TripRecordFragment) : Presenter<TripRecordFragment>(view),ITripRecordCallback {
init {
TripRecordDataManager.addTripRecordCallback(this)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
TripRecordDataManager.removeTripRecordCallback(this)
}
fun queryAllTripRecord(){
TripRecordDataManager.queryAllTripRecord()
}
override fun queryTripRecordListSuccess(tripRecordList: List<TripRecord>) {
mView.refreshTripRecordList(tripRecordList)
}
override fun insertOrUpdateTripRecordSuccess(tripRecord: TripRecord) {
mView.refreshTripRecord(tripRecord)
}
}

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

@@ -0,0 +1,171 @@
package com.zhidao.mogo.module.event.panel.util
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Handler
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.mogo.module.common.entity.V2XMessageEntity
import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.*
import com.mogo.module.common.entity.V2XRoadEventEntity
import com.mogo.utils.ThreadPoolService
import com.mogo.utils.logger.Logger
import com.mogo.utils.network.utils.GsonUtil
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
import com.zhidao.mogo.module.event.panel.bean.TripRecord
import com.zhidao.mogo.module.event.panel.dao.TripRecordDao
import com.zhidao.mogo.module.event.panel.dao.TripRecordDatabase
import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
import java.util.*
import kotlin.collections.ArrayList
private const val BROADCAST_SCENE_EVENT_ACTION = "com.v2x.scene_local_broadcast"
private const val BROADCAST_SCENE_MODIFY_ACTION = "com.zhidao.tanlu.dataerror"
private const val BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity"
private const val BORADCAST_SCENE_MODIFY_EVENT_ID_KEY = "id"
private const val BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY = "updateType"
/**
* 出行动态的数据管理类由于TripRecordFragment初始化时机较晚所以封装一个单例类提早初始化
*/
object TripRecordDataManager {
private lateinit var context: Context
private val sceneEventReceiver = SceneEventReceiver()
private lateinit var tripRecordDao: TripRecordDao
private val tripRecordCallbackList = ArrayList<ITripRecordCallback>()
fun init(context: Context) {
this.context = context
LocalBroadcastManager.getInstance(context).registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_EVENT_ACTION))
context.registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_MODIFY_ACTION))
tripRecordDao = TripRecordDatabase.getInstance(TripRecordDataManager.context).getTripRecordDao()
}
fun addTripRecordCallback(callback: ITripRecordCallback) {
tripRecordCallbackList.add(callback)
}
fun removeTripRecordCallback(callback: ITripRecordCallback) {
tripRecordCallbackList.remove(callback)
}
private val handler = Handler()
fun queryAllTripRecord() {
ThreadPoolService.singleExecute {
val limitTime = countLimitTime()
// 查询所有的出行动态
val tripRecordList = tripRecordDao.queryAllTripRecord(limitTime)
Logger.d(MODULE_NAME, "查询所有出行动态,limitTime: $limitTime, list: $tripRecordList")
// 删除超时的出行动态
tripRecordDao.deleteOvertimeTripRecord(limitTime)
// 切换线程回调
handler.post {
tripRecordCallbackList.forEach { callback ->
callback.queryTripRecordListSuccess(tripRecordList)
}
}
}
}
fun insertTripRecord(record: TripRecord) {
ThreadPoolService.singleExecute {
// 先查一下此数据是否存在
Logger.d(MODULE_NAME, "出行动态入库===$record")
var check = tripRecordDao.queryTripRecordById(record.id)
if (check == null) {
Logger.d(MODULE_NAME, "数据库中不存在此数据,直接插入")
check = record
tripRecordDao.insert(record)
} else {
Logger.d(MODULE_NAME, "数据库中存在此数据更新recordTime即可其他参数不变")
check.recordTime = System.currentTimeMillis()
tripRecordDao.update(check)
}
// 为了防止只进不出,所以在插入新数据时,进行过期数据删除操作
tripRecordDao.deleteOvertimeTripRecord(countLimitTime())
// 切换线程回调
handler.post {
tripRecordCallbackList.forEach { callback ->
callback.insertOrUpdateTripRecordSuccess(check)
}
}
}
}
/**
* 计算约束时间即当日0时
*/
private fun countLimitTime(): Long {
val calendar = Calendar.getInstance()
calendar.time = Date()
calendar.set(Calendar.HOUR_OF_DAY, 0)
calendar.set(Calendar.MINUTE, 0)
calendar.set(Calendar.SECOND, 0)
return calendar.timeInMillis
}
/**
* 处理道路事件推送,保存到本地数据库
* 目前只处理道路事件,违章提醒,他车求助,其他事件暂不处理
*/
private fun dealSceneMessage(type: Int, content: Any) {
if (type in arrayOf(ALERT_ROAD_WARNING, ALERT_ILLEGAL_PARK_WARNING, ALERT_SEEK_WARNING)) {
val eventId = if (type == ALERT_ROAD_WARNING) {
val event = content as V2XRoadEventEntity
event.noveltyInfo.infoId
} else {
""
}
Logger.d(MODULE_NAME, "处理场景事件,准备插入数据库===eventId: $eventId")
insertTripRecord(TripRecord(id = content.hashCode(), eventId = eventId, eventType = type, entity = GsonUtil.jsonFromObject(content)))
}
}
/**
* 本地数据库同步v2x传过来的纠错信息
*/
fun syncRoadEventModifyState(eventId: String, modifyType: String) {
Logger.d(MODULE_NAME, "准备同步纠错信息: $eventId, $modifyType")
ThreadPoolService.singleExecute {
// 找出需要纠错的数据
val willModify = tripRecordDao.queryTripRecordByEventId(eventId)
if (willModify != null) {
// 查到数据进行修改,如果查不到数据,就不做操作了
Logger.d(MODULE_NAME, "准备修改纠错状态:$willModify")
willModify.usefulStatus = modifyType
tripRecordDao.update(willModify)
// 切线程回调
handler.post {
tripRecordCallbackList.forEach { callback ->
callback.insertOrUpdateTripRecordSuccess(willModify)
}
}
}
}
}
class SceneEventReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Logger.d(MODULE_NAME, "收到V2X事件推送===")
when (intent.action) {
BROADCAST_SCENE_EVENT_ACTION -> {
// 道路事件推送
val message = intent.getSerializableExtra(BROADCAST_SCENE_EXTRA_KEY) as V2XMessageEntity<*>
Logger.d(MODULE_NAME, "道路事件推送 type: ${message.type}, content: ${message.content}")
dealSceneMessage(message.type, message.content)
}
BROADCAST_SCENE_MODIFY_ACTION -> {
// 纠错推送
syncRoadEventModifyState(intent.getStringExtra(BORADCAST_SCENE_MODIFY_EVENT_ID_KEY), intent.getStringExtra(BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY))
}
}
}
}
}

View File

@@ -0,0 +1,25 @@
<?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">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vpEventPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnShowOrHidePanels"
android:text="显示面板"
android:textSize="20sp"
android:textColor="#000"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="My Share"
android:textColor="#fff"
android:textSize="40sp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<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">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Surrounding Event"
android:textColor="#fff"
android:textSize="40sp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,77 @@
<?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">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Trip Record"
android:textColor="#000"
android:textSize="40sp" />
<Button
android:id="@+id/btnInsert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Insert"
android:textColor="#000"
android:textSize="30sp"
android:layout_marginTop="100dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btnUpdate"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnUpdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Update"
android:textColor="#000"
android:textSize="30sp"
android:layout_marginTop="100dp"
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="#000"
android:textSize="30sp"
android:layout_marginTop="100dp"
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="#000"
android:textSize="30sp"
android:layout_marginTop="100dp"
app:layout_constraintLeft_toRightOf="@+id/btnDelete"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/btnGenerate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="GenerateLimitTime"
android:textColor="#000"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnInsert" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>

View File

@@ -53,6 +53,7 @@ dependencies {
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleshare
// implementation rootProject.ext.dependencies.moduleventpanel
// implementation rootProject.ext.dependencies.mogomoduleauth
} else {
api project(":libraries:mogo-map")
@@ -62,6 +63,7 @@ dependencies {
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-share')
// implementation project(':modules:mogo-module-event-panel')
// implementation project(':modules:mogo-module-authorize')
}
}

View File

@@ -7,10 +7,12 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@@ -40,7 +42,9 @@ import com.mogo.module.common.map.Scene;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.navi.NaviInfoView;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.share.manager.ServiceApisManager;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
@@ -56,6 +60,7 @@ import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.ResourcesHelper;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import com.zhidao.roadcondition.service.DelayService;
@@ -109,6 +114,17 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
private EntrancePresenter mEntrancePresenter;
private IMogoStatusManager mStatusManager;
public static final int MAX_DISPLAY_MSG_AMOUNT = 99;
private View mWeatherContainer;
private ImageView mWeatherIcon;
private TextView mWeatherTemp;
private View mMsgContainer;
private TextView mMsgCounter;
private ImageView mUserHeadImg;
/**
* 搜索莫模块
@@ -404,6 +420,35 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
e.printStackTrace();
}
} );
mWeatherContainer = findViewById( R.id.module_ext_id_weather_container );
mWeatherIcon = findViewById( R.id.module_ext_id_weather_icon );
mWeatherTemp = findViewById( R.id.module_ext_id_weather_temp );
mUserHeadImg = findViewById(R.id.ivUserHeadImg);
mMsgContainer = findViewById( R.id.module_ext_id_msg );
mMsgContainer.setOnClickListener( view -> {
ARouter.getInstance().build( "/push/ui/message" ).navigation( getContext() );
} );
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
mUserHeadImg.setOnClickListener(view ->{
// todo 测试代码
// mApis.getEventPanelManager().showPanel();
// 原始逻辑
try {
LaunchUtils.launchByPkg(getContext(), "com.zhidao.auto.personal");
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track( "Launcher_APP_Icon", properties );
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
});
mUserHeadImg.setVisibility(DebugConfig.isLauncher()?View.VISIBLE:View.GONE);
}
public void showShareDialog() {
@@ -610,4 +655,34 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
// 30s 后无论成功与否,停止动画
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
}
@Override
public void renderWeatherInfo( String temp, String desc, int iconId ) {
boolean hidden = false;
if ( iconId != 0 ) {
mWeatherIcon.setImageResource( iconId );
mWeatherIcon.setVisibility( View.VISIBLE );
} else {
mWeatherIcon.setVisibility( View.GONE );
hidden |= true;
}
hidden |= TextUtils.isEmpty( temp );
hidden |= TextUtils.isEmpty( desc );
mWeatherTemp.setText( temp );
mWeatherContainer.setVisibility( hidden ? View.INVISIBLE : View.VISIBLE );
}
@Override
public void renderMsgInfo( boolean hasMsg, int amount ) {
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
mMsgCounter.setText( amount > MAX_DISPLAY_MSG_AMOUNT ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
}
@Override
public void renderUserInfo(UserInfo userInfo) {
if(userInfo != null){
Logger.d(TAG, "renderUserInfo: " + userInfo);
GlideApp.with(getContext()).load(userInfo.getHeadImgurl()).placeholder(R.drawable.model_ext_default_user_head).circleCrop().into(mUserHeadImg);
}
}
}

View File

@@ -1,11 +1,38 @@
package com.mogo.module.extensions.entrance;
import android.content.Context;
import android.util.ArrayMap;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.mvp.Presenter;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.net.UserInfoNetApiServices;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.userinfo.UserInfoConstant;
import com.mogo.module.extensions.userinfo.UserInfoResponse;
import com.mogo.module.extensions.utils.ExtensionsConfig;
import com.mogo.module.extensions.weather.Phenomena;
import com.mogo.module.extensions.weather.WeatherCallback;
import com.mogo.module.extensions.weather.WeatherInfo;
import com.mogo.module.extensions.weather.WeatherModel;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import com.mogo.utils.digest.DigestUtils;
import com.mogo.utils.logger.Logger;
import com.zhidao.auto.platform.util.DeviceUtil;
import java.util.Map;
import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* @author congtaowang
@@ -13,23 +40,123 @@ import com.mogo.commons.mvp.Presenter;
* <p>
* 描述
*/
public class EntrancePresenter extends Presenter<EntranceView> {
public class EntrancePresenter extends Presenter<EntranceView> implements WeatherCallback,
IMogoMsgCenterListener {
private static final String TAG = "EntrancePresenter";
private WeatherModel mWeatherModel;
private IMogoMsgCenter mMsgCenter;
private IMogoNetwork mNetWork;
public EntrancePresenter(Context context, EntranceView view) {
super(view);
mWeatherModel = new WeatherModel( getContext() );
mNetWork =
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
}
@Override
public void onResume(@NonNull LifecycleOwner owner) {
super.onResume(owner);
}
@Override
public void onCreate(@NonNull LifecycleOwner owner) {
super.onCreate(owner);
mWeatherModel.init( this );
mWeatherModel.queryWeatherInformation();
mMsgCenter = ( IMogoMsgCenter ) ARouter.getInstance().build( MogoServicePaths.PATH_MSG_CENTER ).navigation();
mMsgCenter.registerMsgCenterListener( this );
}
@Override
public void onWeatherLoaded( WeatherInfo weatherInfo ) {
if ( weatherInfo == null ) {
return;
}
String temp = getContext().getResources().getString( R.string.module_ext_str_weather_temp_format, weatherInfo.getTemperature() );
Phenomena phenomena = Phenomena.getById( weatherInfo.getPhenomena() );
String desc = phenomena == null ? "" : phenomena.nameCn;
int resId = phenomena.resId;
mView.renderWeatherInfo( temp, desc, resId );
}
@Override
public void onMsgChanged( boolean hasMsg, int amount ) {
if ( mView != null ) {
mView.renderMsgInfo( hasMsg, amount );
}
}
@Override
public void onResume( @NonNull LifecycleOwner owner ) {
super.onResume( owner );
if(ExtensionsConfig.needRequestUserInfo()){
// 相当于每次onResume都会请求一下个人信息目的是能够相对及时的同步手机端的个人信息修改
requestUserInfo();
}
}
@Override
public void onPause( @NonNull LifecycleOwner owner ) {
super.onPause( owner );
}
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
super.onDestroy( owner );
if ( mWeatherModel != null ) {
mWeatherModel.destroy();
}
if ( mMsgCenter != null ) {
mMsgCenter.unregisterMsgCenterListener( this );
}
}
private UserInfo userInfo;
public void requestUserInfo() {
Map<String, String> params = new ArrayMap<>();
params.put("sn", DeviceUtil.getSn());
params.put("source", "2");
String sign = createSign(params, "JGqZw9");
params.put("sig", sign);
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
userInfo = userInfoBaseResponse.getResult();
if(userInfo!=null) {
Logger.d(TAG, "获取个人信息成功: " + userInfo);
mView.renderUserInfo(userInfo);
}else{
Logger.e(TAG,"获取个人信息失败");
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
Logger.e(TAG, e, "获取个人信息失败==");
}
});
}
private String createSign(Map<String, String> map, String salt) {
try {
StringBuilder queryString = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet()) {
queryString.append(entry.getKey())
.append("=")
.append(entry.getValue())
.append("&");
}
queryString.append("key=").append(DigestUtils.shaHex(salt));
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
} catch (Exception e) {
e.printStackTrace();
Logger.e(TAG, e, "createSign()");
return "";
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.extensions.entrance;
import com.mogo.commons.mvp.IView;
import com.mogo.module.extensions.ExtensionsView;
import com.mogo.module.extensions.userinfo.UserInfo;
/**
@@ -9,5 +10,5 @@ import com.mogo.module.extensions.userinfo.UserInfo;
* <p>
* 描述
*/
public interface EntranceView extends IView {
public interface EntranceView extends ExtensionsView {
}

View File

@@ -55,6 +55,8 @@ public class TopViewAnimHelper {
private Transition transition = new AutoTransition();
private TextView cameraMode;
private float topHeight = 0f;
private Handler handler = new Handler();
private TopViewAnimHelper() {
@@ -261,7 +263,7 @@ public class TopViewAnimHelper {
public void startTopInAnim(View view, ViewGroup.LayoutParams params,
IMogoTopViewStatusListener statusListener) {
if ( topMotionLayout == null ) {
if (topMotionLayout == null) {
return;
}
@@ -299,7 +301,7 @@ public class TopViewAnimHelper {
topContainer.removeAllViews();
// 如果高度变化,生硬的变化一下高度
Logger.d(TAG,"container.height: "+topContainer.getHeight());
Logger.d(TAG, "container.height: " + topContainer.getHeight());
if (topContainer.getHeight() != params.height) {
constraintSet.clone(topMotionLayout);
LayoutParams p = topContainer.getLayoutParams();
@@ -309,7 +311,7 @@ public class TopViewAnimHelper {
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
computeNaviMarginTop(params.height));
constraintSet.applyTo(topMotionLayout);
Logger.d(TAG,"改变container的高度===");
Logger.d(TAG, "改变container的高度===");
}
view.setTranslationY(-(params.height));
@@ -387,9 +389,10 @@ public class TopViewAnimHelper {
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.dp_46));
constraintSet.clear(ivTurnIcon.getId(),ConstraintSet.TOP);
constraintSet.clear(ivTurnIcon.getId(), ConstraintSet.TOP);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, (int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
naviBg.getId(), ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
@@ -419,16 +422,16 @@ public class TopViewAnimHelper {
* 退出最新的也就是最上面的view
*/
private void startLatestTopOutAnim() {
if(topContainer.getChildCount()>1){
if (topContainer.getChildCount() > 1) {
removeSubView(topContainer.getChildAt(topContainer.getChildCount() - 1));
}else if (topContainer.getChildCount() > 0) {
} else if (topContainer.getChildCount() > 0) {
startTopOutAnim(topContainer.getChildAt(topContainer.getChildCount() - 1));
}
}
public void startTopOutAnim(View view) {
if ( topMotionLayout == null ) {
if (topMotionLayout == null) {
return;
}
@@ -441,7 +444,8 @@ public class TopViewAnimHelper {
// if (statusListenerMap.get(view) != null) {
// statusListenerMap.get(view).beforeViewRemoveAnim(view);
// }
// view.animate().translationY(-(view.getHeight())).setDuration(500).setListener(new Animator.AnimatorListener() {
// view.animate().translationY(-(view.getHeight())).setDuration(500).setListener
// (new Animator.AnimatorListener() {
// @Override
// public void onAnimationStart(Animator animation) {
//
@@ -472,69 +476,70 @@ public class TopViewAnimHelper {
// }
// }).start();
// } else {
// 顶部view仅剩一个view需要整体上移
// 顶部view仅剩一个view需要整体上移
// currentAnimatingView = view;
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
}
isTopViewOut = true;
if (statusListenerMap.get(view) != null) {
statusListenerMap.get(view).beforeViewRemoveAnim(view);
}
isTopViewOut = true;
// if (naviBg.getVisibility() == View.VISIBLE) {
// tvNextRoad.setTextSize(getDimen(R.dimen
// .module_ext_navi_info_panel_next_info_road_textSize));
// }
if (naviBg.getVisibility() == View.VISIBLE) {
remainDistanceGroup.setVisibility(View.VISIBLE);
remainTimeGroup.setVisibility(View.VISIBLE);
arriveTimeGroup.setVisibility(View.VISIBLE);
}
constraintSet.clone(topMotionLayout);
constraintSet.clear(R.id.module_entrance_id_top_container, ConstraintSet.TOP);
constraintSet.connect(R.id.module_entrance_id_top_container, ConstraintSet.BOTTOM,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
checkCameraModePosition(false);
if (naviBg.getVisibility() == View.VISIBLE) {
// 约束设置需要在applyTo()方法之前执行visiable设置需要在applyTo()
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
tvNextDistance.getId(), ConstraintSet.LEFT,
0);
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, 0);
constraintSet.connect(ivTurnIcon.getId(),ConstraintSet.TOP,naviBg.getId(),ConstraintSet.TOP,0);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, 0);
}
constraintSet.applyTo(topMotionLayout);
ivTurnIcon.getLayoutParams().height =
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_height);
ivTurnIcon.getLayoutParams().width =
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_width);
naviBg.getLayoutParams().height =
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.module_ext_navi_info_panel_height);
int scene = 0;
if (naviBg.getVisibility() == View.VISIBLE) {
scene = Scene.NAVI;
} else {
scene = Scene.AIMLESS;
}
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
if (naviBg.getVisibility() == View.VISIBLE) {
remainDistanceGroup.setVisibility(View.VISIBLE);
remainTimeGroup.setVisibility(View.VISIBLE);
arriveTimeGroup.setVisibility(View.VISIBLE);
}
constraintSet.clone(topMotionLayout);
constraintSet.clear(R.id.module_entrance_id_top_container, ConstraintSet.TOP);
constraintSet.connect(R.id.module_entrance_id_top_container, ConstraintSet.BOTTOM,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP);
TransitionManager.beginDelayedTransition(topMotionLayout, transition);
checkCameraModePosition(false);
if (naviBg.getVisibility() == View.VISIBLE) {
// 约束设置需要在applyTo()方法之前执行visiable设置需要在applyTo()
// 方法之后执行才能生效,所以分开了两个判断,至于为什么这么做才能生效,不得而知
constraintSet.clear(tvNextDistance.getId(), ConstraintSet.BOTTOM);
constraintSet.clear(tvNextRoad.getId(), ConstraintSet.BASELINE);
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.BOTTOM,
ivTurnIcon.getId(), ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.module_map_id_navi_next_info_road_marginBottom));
constraintSet.connect(tvNextRoad.getId(), ConstraintSet.LEFT,
tvNextDistance.getId(), ConstraintSet.LEFT,
0);
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP, 0);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.TOP, 0);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, 0);
}
constraintSet.applyTo(topMotionLayout);
ivTurnIcon.getLayoutParams().height =
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_height);
ivTurnIcon.getLayoutParams().width =
(int) getDimen(R.dimen.module_ext_navi_info_panel_turn_icon_width);
naviBg.getLayoutParams().height =
(int) topMotionLayout.getContext().getResources().getDimension(R.dimen.module_ext_navi_info_panel_height);
int scene = 0;
if (naviBg.getVisibility() == View.VISIBLE) {
scene = Scene.NAVI;
} else {
scene = Scene.AIMLESS;
}
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
}
// }
}
public void showNaviView() {
if ( topMotionLayout == null ) {
if (topMotionLayout == null) {
return;
}
@@ -564,7 +569,8 @@ public class TopViewAnimHelper {
constraintSet.connect(naviBg.getId(), ConstraintSet.TOP,
R.id.module_entrance_id_top_motion_layout, ConstraintSet.TOP,
0);
constraintSet.connect(ivTurnIcon.getId(),ConstraintSet.TOP,naviBg.getId(),ConstraintSet.TOP,0);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.TOP, 0);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, 0);
constraintSet.applyTo(topMotionLayout);
@@ -593,9 +599,10 @@ public class TopViewAnimHelper {
// naviBg.getLayoutParams().height =
// (int) topMotionLayout.getContext().getResources().getDimension(R.dimen
// .module_ext_navi_info_panel_small_height);
constraintSet.clear(ivTurnIcon.getId(),ConstraintSet.TOP);
constraintSet.clear(ivTurnIcon.getId(), ConstraintSet.TOP);
constraintSet.connect(ivTurnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, (int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
naviBg.getId(), ConstraintSet.BOTTOM,
(int) getDimen(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
constraintSet.applyTo(topMotionLayout);
scene = Scene.NAVI;
}
@@ -606,7 +613,7 @@ public class TopViewAnimHelper {
public void hideNaviView() {
if ( topMotionLayout == null ) {
if (topMotionLayout == null) {
return;
}

View File

@@ -19,18 +19,9 @@ import com.mogo.service.windowview.IMogoTopViewStatusListener;
@Route(path = MogoServicePaths.PATH_EXTENSIONS_TOP_VIEW_MANAGER)
public class TopViewManager implements IMogoTopViewManager {
// @Override
// public void addTopView(View view, ViewGroup.LayoutParams params) {
// TopViewAnimHelper.getInstance().startTopInAnim(view, params);
// }
//
// @Override
// public void removeTopView() {
// TopViewAnimHelper.getInstance().startTopOutAnim();
// }
private Context context;
private LayoutParams parentParams;
@Override
public void init(Context context) {
this.context = context;
@@ -39,13 +30,13 @@ public class TopViewManager implements IMogoTopViewManager {
@Override
public void addView(View view) {
addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) context.getResources().getDimension(R.dimen.dp_350)),null);
(int) context.getResources().getDimension(R.dimen.dp_350)), null);
}
@Override
public void addView(View view, IMogoTopViewStatusListener statusListener) {
addView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
(int) context.getResources().getDimension(R.dimen.dp_350)),statusListener);
(int) context.getResources().getDimension(R.dimen.dp_350)), statusListener);
}
@Override

View File

@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_350"
android:layout_height="wrap_content"
android:background="#ccc">
<TextView
@@ -30,8 +30,8 @@
<ImageView
android:id="@+id/iv2"
android:layout_width="@dimen/dp_150"
android:layout_height="@dimen/dp_150"
android:layout_width="@dimen/dp_250"
android:layout_height="@dimen/dp_250"
android:src="@drawable/icon_default_user_head"
app:layout_constraintLeft_toRightOf="@+id/iv1"
app:layout_constraintRight_toLeftOf="@+id/iv3"

View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/module_map_id_navi_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/module_ext_navi_info_panel_height"
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
android:focusable="true"
android:clickable="true"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintLeft_toLeftOf="@id/module_entrance_id_top_container"
app:layout_constraintRight_toRightOf="@id/module_entrance_id_top_container"
app:layout_constraintTop_toTopOf="@id/module_entrance_id_top_motion_layout" />
<ImageView
android:id="@+id/module_map_id_navi_next_info_road_turn_icon"
android:layout_width="@dimen/module_ext_navi_info_panel_turn_icon_width"
android:layout_height="@dimen/module_ext_navi_info_panel_turn_icon_height"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_turn_icon_marginLeft"
android:scaleType="fitCenter"
android:src="@drawable/ic_11"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_map_id_navi_next_info_distance_marginStart"
android:layout_marginTop="@dimen/module_map_id_navi_next_info_distance_marginTop"
android:text="53"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_next_info_road_turn_icon" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginLeft"
android:layout_marginBottom="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginBottom"
android:text="米"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_navi_next_info_distance"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_distance" />
<TextView
android:id="@+id/module_map_id_navi_next_info_turn_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginLeft"
android:layout_marginBottom="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginBottom"
android:textColor="#7FF1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_next_step_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_navi_next_info_distance_unit"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_distance_unit" />
<TextView
android:id="@+id/module_map_id_navi_next_info_road"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_ext_navi_next_info_road_marginTop"
android:layout_marginBottom="@dimen/module_map_id_navi_next_info_road_marginBottom"
android:ellipsize="end"
android:maxLines="1"
android:text="北三环东路辅路"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_road_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_next_info_road_turn_icon"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance" />
<androidx.constraintlayout.widget.Group
android:id="@+id/remainDistanceGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_remaining_distance_icon,module_map_id_remaining_distance,module_map_id_remaining_distance_unit,module_map_id_remaining_distance_notice" />
<!--remain distance-->
<ImageView
android:id="@+id/module_map_id_remaining_distance_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_117"
android:src="@drawable/module_ext_ic_navi_info1"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_distance"
app:layout_constraintRight_toLeftOf="@id/module_map_id_remaining_time_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_remaining_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_distance_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/module_map_id_remaining_distance_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_distance_icon"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_remaining_distance_icon" />
<TextView
android:id="@+id/module_map_id_remaining_distance_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="km"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_remaining_distance"
app:layout_constraintLeft_toRightOf="@id/module_map_id_remaining_distance" />
<TextView
android:id="@+id/module_map_id_remaining_distance_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_distance"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_distance" />
<androidx.constraintlayout.widget.Group
android:id="@+id/remainTimeGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_remaining_time_icon,module_map_id_remaining_time,module_map_id_remaining_time_unit,module_map_id_remaining_time_notice" />
<!--remain time-->
<ImageView
android:id="@+id/module_map_id_remaining_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_117"
android:src="@drawable/module_ext_ic_navi_info2"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_time"
app:layout_constraintRight_toLeftOf="@id/module_map_id_arrive_time_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_time_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_time_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_time_icon"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_time_icon" />
<TextView
android:id="@+id/module_map_id_remaining_time_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="km"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_time_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_remaining_time"
app:layout_constraintLeft_toRightOf="@id/module_map_id_remaining_time" />
<TextView
android:id="@+id/module_map_id_remaining_time_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="时间"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_time"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_time" />
<androidx.constraintlayout.widget.Group
android:id="@+id/arriveTimeGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_arrive_time_icon,module_map_id_arrive_time,module_map_id_arrive_time_notice" />
<!--arrive time-->
<ImageView
android:id="@+id/module_map_id_arrive_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_95"
android:src="@drawable/module_ext_ic_navi_info3"
app:layout_constraintBottom_toTopOf="@id/module_map_id_arrive_time"
app:layout_constraintRight_toRightOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_arrive_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_arrive_time_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/module_map_id_arrive_time_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_arrive_time_icon"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_arrive_time_icon" />
<TextView
android:id="@+id/module_map_id_arrive_time_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="到达"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_arrive_time"
app:layout_constraintTop_toBottomOf="@id/module_map_id_arrive_time" />
</merge>

View File

@@ -6,226 +6,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- <androidx.constraintlayout.widget.Group-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:id="@+id/naviGroup"-->
<!-- android:visibility="visible"-->
<!-- app:constraint_referenced_ids="module_map_id_navi_next_info_road,module_map_id_navi_next_info_turn_info,module_map_id_navi_bg,module_map_id_navi_next_info_road_turn_icon,module_map_id_navi_next_info_distance,module_map_id_navi_next_info_distance_unit,remainDistanceGroup,remainTimeGroup,arriveTimeGroup" />-->
<View
android:id="@+id/module_map_id_navi_bg"
<include
layout="@layout/module_ext_layout_extensions"
android:layout_width="match_parent"
android:layout_height="@dimen/module_ext_navi_info_panel_height"
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
android:focusable="true"
android:clickable="true"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintLeft_toLeftOf="@id/module_entrance_id_top_container"
app:layout_constraintRight_toRightOf="@id/module_entrance_id_top_container"
app:layout_constraintTop_toTopOf="@id/module_entrance_id_top_motion_layout" />
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/module_map_id_navi_next_info_road_turn_icon"
android:layout_width="@dimen/module_ext_navi_info_panel_turn_icon_width"
android:layout_height="@dimen/module_ext_navi_info_panel_turn_icon_height"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_turn_icon_marginLeft"
android:scaleType="fitCenter"
android:src="@drawable/ic_11"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_map_id_navi_next_info_distance_marginStart"
android:layout_marginTop="@dimen/module_map_id_navi_next_info_distance_marginTop"
android:text="53"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_road_turn_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_next_info_road_turn_icon" />
<TextView
android:id="@+id/module_map_id_navi_next_info_distance_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginLeft"
android:layout_marginBottom="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginBottom"
android:text="米"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_navi_next_info_distance"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_distance" />
<TextView
android:id="@+id/module_map_id_navi_next_info_turn_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginLeft"
android:layout_marginBottom="@dimen/module_ext_navi_info_panel_next_info_distance_unit_marginBottom"
android:textColor="#7FF1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_distance_next_step_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_navi_next_info_distance_unit"
app:layout_constraintLeft_toRightOf="@id/module_map_id_navi_next_info_distance_unit" />
<TextView
android:id="@+id/module_map_id_navi_next_info_road"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_ext_navi_next_info_road_marginTop"
android:layout_marginBottom="@dimen/module_map_id_navi_next_info_road_marginBottom"
android:ellipsize="end"
android:maxLines="1"
android:text="北三环东路辅路"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_navi_info_panel_next_info_road_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_next_info_road_turn_icon"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_navi_next_info_distance" />
<androidx.constraintlayout.widget.Group
android:id="@+id/remainDistanceGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_remaining_distance_icon,module_map_id_remaining_distance,module_map_id_remaining_distance_unit,module_map_id_remaining_distance_notice" />
<!--remain distance-->
<ImageView
android:id="@+id/module_map_id_remaining_distance_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_117"
android:src="@drawable/module_ext_ic_navi_info1"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_distance"
app:layout_constraintRight_toLeftOf="@id/module_map_id_remaining_time_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_remaining_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_distance_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/module_map_id_remaining_distance_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_distance_icon"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_remaining_distance_icon" />
<TextView
android:id="@+id/module_map_id_remaining_distance_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="km"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_remaining_distance"
app:layout_constraintLeft_toRightOf="@id/module_map_id_remaining_distance" />
<TextView
android:id="@+id/module_map_id_remaining_distance_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_distance"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_distance" />
<androidx.constraintlayout.widget.Group
android:id="@+id/remainTimeGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_remaining_time_icon,module_map_id_remaining_time,module_map_id_remaining_time_unit,module_map_id_remaining_time_notice" />
<!--remain time-->
<ImageView
android:id="@+id/module_map_id_remaining_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_117"
android:src="@drawable/module_ext_ic_navi_info2"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_time"
app:layout_constraintRight_toLeftOf="@id/module_map_id_arrive_time_icon"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_remaining_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_time_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/module_map_id_remaining_time_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_time_icon"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_time_icon" />
<TextView
android:id="@+id/module_map_id_remaining_time_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="km"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_remaining_time_unit_textSize"
app:layout_constraintBaseline_toBaselineOf="@id/module_map_id_remaining_time"
app:layout_constraintLeft_toRightOf="@id/module_map_id_remaining_time" />
<TextView
android:id="@+id/module_map_id_remaining_time_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="时间"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_remaining_time"
app:layout_constraintTop_toBottomOf="@id/module_map_id_remaining_time" />
<androidx.constraintlayout.widget.Group
android:id="@+id/arriveTimeGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="module_map_id_arrive_time_icon,module_map_id_arrive_time,module_map_id_arrive_time_notice" />
<!--arrive time-->
<ImageView
android:id="@+id/module_map_id_arrive_time_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_95"
android:src="@drawable/module_ext_ic_navi_info3"
app:layout_constraintBottom_toTopOf="@id/module_map_id_arrive_time"
app:layout_constraintRight_toRightOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toTopOf="@+id/module_map_id_navi_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/module_map_id_arrive_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3599"
android:textColor="#F1F1F1"
android:textSize="@dimen/module_ext_arrive_time_textSize"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/module_map_id_arrive_time_notice"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_arrive_time_icon"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_arrive_time_icon" />
<TextView
android:id="@+id/module_map_id_arrive_time_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="到达"
android:textColor="#7FFFFFFF"
android:textSize="@dimen/module_ext_remaining_distance_unit_textSize"
app:layout_constraintBottom_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_constraintLeft_toLeftOf="@id/module_map_id_arrive_time"
app:layout_constraintTop_toBottomOf="@id/module_map_id_arrive_time" />
<include
layout="@layout/include_navi_info_panle"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/module_ext_id_north"
@@ -241,7 +30,7 @@
android:textSize="@dimen/module_ext_north_textSize"
android:textStyle="bold"
android:visibility="gone"
tools:visibility="visible"
tools:visibility="gone"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_upload_road_condition"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop" />
@@ -265,7 +54,7 @@
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone"
tools:visibility="visible"
tools:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/module_map_id_navi_bg"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg">
@@ -384,5 +173,4 @@
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,21 +1,18 @@
<?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"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/module_ext_height"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<LinearLayout
android:id="@+id/module_ext_id_weather_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="@dimen/module_ext_height"
android:background="@drawable/module_ext_drawable_weather_bkg"
android:gravity="center"
android:paddingLeft="@dimen/module_ext_weather_container_paddingLeft"
android:paddingRight="@dimen/module_ext_weather_container_paddingRight"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="invisible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible">
@@ -71,10 +68,8 @@
android:id="@+id/ivUserHeadImg"
android:layout_width="@dimen/module_ext_height"
android:layout_height="@dimen/module_ext_height"
android:layout_marginEnd="@dimen/dp_30"
android:src="@drawable/model_ext_default_user_head"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintTop_toTopOf="@+id/module_ext_id_weather_container"
app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_weather_container"/>
</merge>

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,37 @@
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?.let {
it.text = speed.toString()
if (speed >= SPEED_THRESHOLD) {
// 速度超过90需要改变背景颜色
it.setBackgroundResource(R.drawable.module_left_panel_warn_speed_bg)
}else{
it.setBackgroundResource(R.drawable.module_left_panel_normal_speed_bg)
}
}
}
}

View File

@@ -0,0 +1,41 @@
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.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
/**
* 临时左侧车速逻辑的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 * 3.6).toInt())
}
}
// mogoApis.registerCenterApi.registerCarLocationChangedListener(MODULE_NAME,object : IMogoCarLocationChangedListener2{
// override fun onCarLocationChanged2(latLng: Location?) {
// latLng?.let {
// handler.post {
// mView.refreshSpeed(it.speed.toInt())
// }
// }
// }
//
// override fun onCarLocationChanged(latLng: MogoLatLng?) {
// }
//
// })
}
}

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

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,44 @@
<?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"
android:clickable="true"
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" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="当前车速"
android:textColor="#fff"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@id/tvModuleLeftPanelSpeed"
app:layout_constraintRight_toRightOf="@id/tvModuleLeftPanelSpeed"
app:layout_constraintTop_toBottomOf="@id/tvModuleLeftPanelSpeed"
android:layout_marginTop="@dimen/module_left_panel_simple_speed_title_margin"
android:textSize="@dimen/module_left_panel_simple_speed_title_size" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,8 @@
<?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>
<dimen name="module_left_panel_simple_speed_title_size">20px</dimen>
<dimen name="module_left_panel_simple_speed_title_margin">28px</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

@@ -20,7 +20,11 @@ import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
import com.mogo.service.obu.IMogoObuDataChangedListener;
import com.mogo.utils.logger.Logger;
import com.zhidao.smartv2x.model.obu.CarEventInfo;
import com.zhidao.smartv2x.model.obu.CarLocationInfo;
import com.zhidao.smartv2x.model.obu.TrafficLightInfo;
import java.util.Iterator;
@@ -37,7 +41,8 @@ public class EventDispatchCenter implements
IMogoCarLocationChangedListener2,
IMogoMapListener,
IMogoNaviListener2,
IMogoLocationListener {
IMogoLocationListener,
IMogoObuDataChangedListener {
private static volatile EventDispatchCenter sInstance;
@@ -459,4 +464,48 @@ public class EventDispatchCenter implements
}
}
}
@Override
public void showCarLocationInfo(CarLocationInfo info) {
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
if ( iterator == null ) {
return;
}
while ( iterator.hasNext() ) {
iterator.next().showCarLocationInfo(info);
}
}
@Override
public void showOtherInfo(String info) {
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
if ( iterator == null ) {
return;
}
while ( iterator.hasNext() ) {
iterator.next().showOtherInfo(info);
}
}
@Override
public void showTrafficLightInfo(TrafficLightInfo info) {
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
if ( iterator == null ) {
return;
}
while ( iterator.hasNext() ) {
iterator.next().showTrafficLightInfo(info);
}
}
@Override
public void showCarEventInfo(CarEventInfo info) {
Iterator< IMogoObuDataChangedListener > iterator = MogoRegisterCenterHandler.getInstance().getObuDataChangedListeners();
if ( iterator == null ) {
return;
}
while ( iterator.hasNext() ) {
iterator.next().showCarEventInfo(info);
}
}
}

View File

@@ -9,20 +9,16 @@ import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.common.utils.CarSeries;
@@ -30,19 +26,17 @@ import com.mogo.module.main.cards.MogoModulesHandler;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.module.main.service.MogoMainService;
import com.mogo.module.main.windowview.FloatingViewHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.obu.IMogoObuManager;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.logger.Logger;
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
import org.aspectj.lang.annotation.Around;
import java.util.List;
/**
@@ -64,11 +58,12 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
protected IMogoFragmentManager mMogoFragmentManager;
protected IMogoStatusManager mMogoStatusManager;
protected View mHeader;
// protected View mHeader;
protected View mApps;
protected View mEntrance;
protected FrameLayout mFloatingLayout;
protected FrameLayout mCoverUpLayout;
protected FrameLayout mLeftPanelLayout;
protected View mLeftShadowFrame;
private boolean mIsHomeKeyDown = false;
@@ -82,12 +77,13 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
getWindow().setBackgroundDrawable( null );
mHeader = findViewById( R.id.module_main_id_header_fragment_container );
// mHeader = findViewById( R.id.module_main_id_header_fragment_container );
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
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 -> {
@@ -97,14 +93,14 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
// 隐藏布局
protected void hideLayout() {
mHeader.setVisibility( View.GONE );
// mHeader.setVisibility( View.GONE );
mEntrance.setVisibility( View.GONE );
mFloatingLayout.setVisibility( View.GONE );
}
// 显示布局
protected void showLayout() {
mHeader.setVisibility( View.VISIBLE );
// mHeader.setVisibility( View.VISIBLE );
mEntrance.setVisibility( View.VISIBLE );
mFloatingLayout.setVisibility( View.VISIBLE );
}
@@ -138,6 +134,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this );
}
// IMogoObuManager obuManager = mServiceApis.getObuManager();
// if(obuManager!=null) {
// obuManager.registerObuDataChangedListener(EventDispatchCenter.getInstance());
// }
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
@@ -183,8 +184,10 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
}
protected void loadContainerModules() {
MogoModulesManager.getInstance().loadExtensionsModule( R.id.module_main_id_header_fragment_container );
// 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

@@ -18,6 +18,9 @@ import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-20
@@ -82,6 +85,9 @@ public class SchemeIntent implements IMogoStatusChangedListener {
break;
case "/main/share":
Logger.d(TAG,"收到打开分享框的scheme准备打开分享框");
Map< String, Object > properties = new HashMap<>();
properties.put( "from", "1" );
mApis.getAnalyticsApi().track("v2x_share_click", properties);
mApis.getShareManager().showShareDialog();
break;
default:

View File

@@ -59,4 +59,16 @@ public interface MogoModulesHandler {
* 2. mogo-module-service
*/
void loadBaseModule();
/**
* 加载事件面板
* @param containerId
*/
void loadEventPanelModule(int containerId);
/**
* 加载左侧面板
* @param containerId
*/
void loadLeftPanelModule(int containerId);
}

View File

@@ -11,6 +11,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.main.EventDispatchCenter;
import com.mogo.module.main.MainActivity;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.utils.ResourcesHelper;
import com.mogo.utils.logger.Logger;
@@ -130,6 +131,22 @@ public class MogoModulesManager implements MogoModulesHandler {
addFragment( provider, containerId );
}
@Override
public void loadEventPanelModule(int containerId) {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance()
.build(MogoServicePaths.PATH_EVENT_PANEL)
.navigation( getContext() );
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

@@ -12,9 +12,9 @@ import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.obu.IMogoObuDataChangedListener;
import java.util.Iterator;
import java.util.List;
/**
* @author congtaowang
@@ -100,6 +100,16 @@ public class MogoRegisterCenter implements IMogoRegisterCenter {
MogoRegisterCenterHandler.getInstance().unregisterCarLocationChangedListener( tag, listener );
}
@Override
public void registerObuDataListener(String tag, IMogoObuDataChangedListener listener) {
MogoRegisterCenterHandler.getInstance().registerObuDataListener(tag, listener);
}
@Override
public void unregisterObuDataListener(String tag) {
MogoRegisterCenterHandler.getInstance().unregisterObuDataListener(tag);
}
@Override
public void init( Context context ) {
}

View File

@@ -10,6 +10,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.obu.IMogoObuDataChangedListener;
import java.util.HashMap;
import java.util.Iterator;
@@ -32,6 +33,7 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
private Map< String, IMogoMarkerClickListener > mMarker = new HashMap<>();
private Map< String, IMogoAimlessModeListener > mAimless = new HashMap<>();
private Map< String, IMogoCarLocationChangedListener > mCarLocations = new HashMap<>();
private Map<String, IMogoObuDataChangedListener> mObus = new HashMap<>();
private MogoRegisterCenterHandler() {
}
@@ -122,6 +124,16 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
mCarLocations.remove( tag );
}
@Override
public void registerObuDataListener(String tag, IMogoObuDataChangedListener listener) {
mObus.put(tag, listener);
}
@Override
public void unregisterObuDataListener(String tag) {
mObus.remove(tag);
}
@Override
public void init( Context context ) {
}
@@ -158,6 +170,9 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
return mNavi.values().iterator();
}
public Iterator<IMogoObuDataChangedListener> getObuDataChangedListeners(){
return mObus.values().iterator();
}
@Override
public Iterator< IMogoLocationListener > getLocationListeners() {
return mLocation.values().iterator();
@@ -176,5 +191,4 @@ public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
return mCarLocations.values().iterator();
}
}

View File

@@ -19,13 +19,13 @@
android:background="@drawable/module_main_dw_left_frame_bkg"
tools:visibility="visible" />
<!-- 时间、天气、消息 -->
<FrameLayout
android:id="@+id/module_main_id_header_fragment_container"
android:layout_width="match_parent"
android:layout_height="@dimen/module_ext_height"
android:layout_marginLeft="@dimen/module_main_header_fragment_container_marginLeft"
android:layout_marginTop="@dimen/module_main_header_fragment_container_marginTop" />
<!-- 时间、天气、消息 与entrance合到了一起减少一个view -->
<!-- <FrameLayout-->
<!-- android:id="@+id/module_main_id_header_fragment_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/module_ext_height"-->
<!-- android:layout_marginLeft="@dimen/module_main_header_fragment_container_marginLeft"-->
<!-- android:layout_marginTop="@dimen/module_main_header_fragment_container_marginTop" />-->
<!-- 左边按钮 -->
<FrameLayout
@@ -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"
@@ -41,6 +47,12 @@
android:layout_height="match_parent"
android:padding="@dimen/module_main_entrance_fragment_container_padding"
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft" />
<FrameLayout
android:id="@+id/module_main_id_event_panel_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/module_main_entrance_fragment_container_padding"
android:layout_marginLeft="@dimen/module_main_id_entrance_fragment_container_marginLeft" />
<!-- 浮层-->
<FrameLayout

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

@@ -40,7 +40,6 @@ dependencies {
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.guideshowprovider
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout

View File

@@ -16,9 +16,6 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
@@ -74,9 +71,6 @@ import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -180,7 +174,7 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
mMediaVoiceListener = new MediaMogoVoiceListener();
@@ -219,12 +213,12 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
}
@Override
public void authorizeFailed(@NotNull String s) {
public void authorizeFailed(String s) {
//TipToast.shortTip("授权失败");
}
@Override
public void forbiddenVoiceWhenAuthorize(@NotNull String s) {
public void forbiddenVoiceWhenAuthorize(String s) {
Logger.d(TAG,"forbiddenVoiceWhenAuthorize");
}
});
@@ -407,7 +401,7 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
isFirstPlay = true;
}
@NonNull
@Override
protected MediaPresenter createPresenter() {
return new MediaPresenter(this);
@@ -732,7 +726,7 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
.load(bimgUrl)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
public void onResourceReady( Bitmap resource, Transition<? super Bitmap> transition) {
new Thread(new Runnable() {
@Override
@@ -752,12 +746,12 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
}
@Override
public void onLoadStarted(@Nullable Drawable placeholder) {
public void onLoadStarted(Drawable placeholder) {
super.onLoadStarted(placeholder);
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
public void onLoadFailed(Drawable errorDrawable) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -1023,10 +1017,6 @@ public class MediaCardViewFragment extends MvpFragment<MediaView, MediaPresenter
}
}
/* if (ServiceMediaHandler.getGuideShowProviderManager().isPlayingVideo()){
ServiceMediaHandler.getGuideShowProviderManager().closeGuideShowView();
}*/
} else {
if (mMusicPlay != null){
mMusicPlay.setImageResource(R.drawable.module_media_play);

Some files were not shown because too many files have changed in this diff Show More