This commit is contained in:
zhongchao
2022-01-24 20:35:03 +08:00
692 changed files with 3066 additions and 14200 deletions

View File

@@ -1,29 +1,8 @@
package com.mogo.module.adas;
import com.mogo.commons.debug.DebugConfig;
/**
* Created by XuYong on 2021/5/28 15:24
*/
public class AdasConstant {
public static final String MODULE_TAG = "AdasConstant";
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
public static String getBaseUrl() {
switch (DebugConfig.getNetMode()) {
case DebugConfig.NET_MODE_DEV:
return HOST_DEV;
case DebugConfig.NET_MODE_QA:
return HOST_TEST;
case DebugConfig.NET_MODE_DEMO:
return HOST_DEMO;
default:
return HOST_PRODUCT;
}
}
}

View File

@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import com.google.gson.Gson;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
@@ -281,4 +282,14 @@ public class AdasEventManager implements
}
}
@Override
public void onAutopilotRecordResult(AutoPilotRecordResult result) {
if (result != null) {
for (IAdasDataListener listener : iAdasEventListeners) {
if (listener != null) {
listener.onAutopilotRecordResult(result);
}
}
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.adas;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
@@ -62,4 +63,10 @@ public interface IAdasDataListener {
}
/**
* 采集任务结果回调
* @param record 结果数据
*/
default void onAutopilotRecordResult(AutoPilotRecordResult record) {}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.module.adas;
import android.util.Log;
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo;
import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo;
@@ -24,12 +25,12 @@ import com.zhidao.support.adas.high.bean.AutopilotStatus;
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
import com.zhidao.support.adas.high.bean.CarLaneInfo;
import com.zhidao.support.adas.high.bean.CarStateInfo;
import com.zhidao.support.adas.high.bean.IPCPowerResultInfo;
import com.zhidao.support.adas.high.bean.IPCUpgradePatchDownloadStatusInfo;
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo;
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
import com.zhidao.support.adas.high.bean.LightStatueInfo;
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.SSHResult;
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
@@ -60,65 +61,71 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onCarStateData(CarStateInfo carStateInfo) {
if (HdMapBuildConfig.isMapLoaded) {
// Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString());
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
//can数据转发
CarStateInfo.ValuesBean bean = carStateInfo.getValues();
// Log.w("DHY-location", bean.getLon() + "," + bean.getLat() + " OnAdasListenerAdapter-onCarStateData");
if (bean != null) {
int turnLight = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turnLight);
int brakeLight = bean.getBrake_light(); //TODO
//Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
if (bean != null) {
int turnLight = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转
AmiClientManager.getInstance().setTurnLightState(turnLight);
int brakeLight = bean.getBrake_light(); //TODO
// Logger.d(TAG, "onCarStateData ---- turnLight = " + turnLight + "---brakeLight = " + brakeLight);
//设置转向灯
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
//设置转向灯
CallerHmiManager.INSTANCE.showTurnLight(turnLight);
//设置刹车信息
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
} else {
Logger.e(TAG, "bean == null ");
//设置刹车信息
CallerHmiManager.INSTANCE.showBrakeLight(brakeLight);
} else {
Logger.e(TAG, "bean == null ");
}
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
}
AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo);
CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo);
}
@Override
public void autopilotStatus(AutopilotStatus autopilotStatus) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (HdMapBuildConfig.isMapLoaded) {
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
if (autopilotStatusValues != null) {
// 初始化自动驾驶状态信息
AutopilotStatusInfo autopilotStatusInfo = CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo();
autopilotStatusInfo.setState(autopilotStatusValues.getState());
autopilotStatusInfo.setPilotmode(autopilotStatusValues.getPilotmode());
autopilotStatusInfo.setControl_pilotmode(autopilotStatusValues.getControl_pilotmode());
autopilotStatusInfo.setReason(autopilotStatusValues.getReason());
autopilotStatusInfo.setCamera(autopilotStatusValues.getCamera());
autopilotStatusInfo.setRtk(autopilotStatusValues.getRtk());
autopilotStatusInfo.setRadar(autopilotStatusValues.getRadar());
autopilotStatusInfo.setSpeed(autopilotStatusValues.getSpeed());
// 初始化自动驾驶状态信息
autopilotStatusInfo.setVersion(AdasManager.getInstance().getAdasConfig().getVersion());
autopilotStatusInfo.setConnectIP(AdasManager.getInstance().getAdasConfig().getAddress());
autopilotStatusInfo.setDockVersion(AdasManager.getInstance().getAdasConfig().getDockVersion());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutoPilotStatus();
}
}
}
@Override
public void autopilotArrive(AutopilotWayArrive autopilotWayArrive) {
Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "autopilotArrive : " + autopilotWayArrive);
if (autopilotWayArrive != null) {
AutopilotWayArrive.ResultBean result = autopilotWayArrive.getResult();
if (result != null) {
AutopilotWayArrive.ResultBean.EndLatLonBean endLatLon = result.getEndLatLon();
if (endLatLon != null) {
AutopilotStationInfo stationInfo = new AutopilotStationInfo(result.getCarType(), endLatLon.getLon(), endLatLon.getLat());
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeArriveAtStation(stationInfo);
}
}
}
}
@@ -126,32 +133,36 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onAutopilotRoute(AutopilotRoute route) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotRoute : " + route.toString());
AutopilotRouteInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAdasAutopilotRoute(route);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotRotting(autopilotRoute);
}
}
@Override
public void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList) {
Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
if (HdMapBuildConfig.isMapLoaded) {
Logger.d(TAG, "onAutopilotTrajectory : " + trajectoryList);
ArrayList<ADASTrajectoryInfo> trajectoryInfoArrayList = new ArrayList<>();
if (trajectoryList != null && trajectoryList.size() > 0) {
for (TrajectoryInfo trajectory : trajectoryList) {
ADASTrajectoryInfo adasTrajectoryInfo = new ADASTrajectoryInfo();
adasTrajectoryInfo.setLat(trajectory.getLat());
adasTrajectoryInfo.setLon(trajectory.getLon());
adasTrajectoryInfo.setAcceleration(trajectory.getAcceleration());
adasTrajectoryInfo.setAccumulatedDis(trajectory.getAccumulatedDis());
adasTrajectoryInfo.setTime(trajectory.getTime());
adasTrajectoryInfo.setVelocity(trajectory.getVelocity());
adasTrajectoryInfo.setAlt(trajectory.getAlt());
adasTrajectoryInfo.setKappa(trajectory.getKappa());
adasTrajectoryInfo.setTheta(trajectory.getTheta());
trajectoryInfoArrayList.add(adasTrajectoryInfo);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
}
Log.e(TAG, "time:" + System.currentTimeMillis() + "trajectoryInfoArrayList:" + trajectoryInfoArrayList);
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
CallerAutopilotPlanningListenerManager.INSTANCE.invokeAutopilotTrajectory(trajectoryInfoArrayList);
}
@Override
@@ -161,13 +172,28 @@ public class OnAdasListenerAdapter implements OnAdasListener {
@Override
public void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
if (HdMapBuildConfig.isMapLoaded) {
AutopilotGuardianStatusInfo autopilotRoute = AdasObjectUtils.INSTANCE.fromAutopilotGuardianInfo(guardianInfo);
CallerAutoPilotStatusListenerManager.INSTANCE.invokeAutopilotGuardian(autopilotRoute);
}
}
@Override
public void onAutopilotRecord(AutopilotRecordResult result) {
if (result != null) {
AutoPilotRecordResult real = new AutoPilotRecordResult();
real.setDiskFree(result.getDiskFree());
real.setId(result.getId());
real.setDuration(result.getDuration());
real.setNote(result.getNote());
real.setTotal(result.getTotalSize());
real.setType(result.getType());
real.setFileName(result.getFilename());
real.setKey(result.getKey());
real.setStat(result.getStat());
real.setTimestamp(result.getTimestamp());
CallerAutopilotIdentifyListenerManager.INSTANCE.invokeAutopilotRecordResult(real);
}
}
@@ -198,32 +224,49 @@ public class OnAdasListenerAdapter implements OnAdasListener {
}
/**
* 工控机电源返回
* @param info 域控制器电源返回结果
*/
@Override
public void onIPCPowerResultInfo(IPCPowerResultInfo info) {
}
/**
* 工控机升级状态
* @param info 工控机升级状态
*/
@Override
public void onUpgradeStateInfo(IPCUpgradeStateInfo info) {
// if(info!=null){
// Logger.d(TAG,"onUpgradeStateInfo : "+info.getUpgradeStatus());
// boolean upgradeStatus=false;//工控机升级状态true代表升级成功 false代表升级失败,默认为false
// if(info.getUpgradeStatus() == IPCUpgradeStateInfo.Status.SUCCESSFUL.code){
// upgradeStatus=true;//升级成功
// //升级结束确认
// AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.upgradeFinishAffirm());
// }else if(info.getUpgradeStatus() == IPCUpgradeStateInfo.Status.FAILED.code){
// upgradeStatus=false;//升级失败
// }
// Logger.d(TAG,"onUpgradeStateInfo : "+(upgradeStatus ? "升级成功" :"升级失败"));
// CallerHmiManager.INSTANCE.showAdUpgradeStatus(upgradeStatus);
// }else{
// Logger.d(TAG,"onUpgradeStateInfo : upgrade status info is null");
// }
}
/**
* 工控机下载状态
* @param info 工控机升级包下载进度
*/
// /**
// * 工控机下载状态
// * @param info 工控机升级包下载进度
// */
// @Override
// public void onUpgradePatchDownloadStatus(IPCUpgradePatchDownloadStatusInfo info) {
// if(info!=null){
// Logger.d(TAG,"onUpgradePatchDownloadStatus : status="+info.getDownloadStatus() +
// " version="+info.getDownloadVersion()+ " progress="+info.getDownloadProgress());
// CallerHmiManager.INSTANCE.showAdDownloadStatus(info.getDownloadVersion(),info.getDownloadStatus(),info.getDownloadProgress());
// }else{
// Logger.d(TAG,"onUpgradePatchDownloadStatus : download status info is null");
// }
//
// }
@Override
public void onUpgradePatchDownloadStatus(IPCUpgradePatchDownloadStatusInfo info) {
public void onSSHResult(SSHResult info) {
}
}

View File

@@ -536,7 +536,6 @@ class CallingWindowManager private constructor() : IVoiceIntentListener {
fun resetStatus() {
isLauncherCallingViewShown = false
serviceApi?.entranceButtonController?.removeLeftFeatureView(launcherCallingView)
launcherCallingView = null
}

View File

@@ -3,7 +3,6 @@
-keep class com.mogo.module.common.constants.*{*;}
-keep class com.mogo.module.common.drawer.marker.*{*;}
-keep class com.mogo.module.common.entity.*{*;}
-keep class com.mogo.module.common.utils.SPConst{*;}
-keep class com.mogo.module.common.view.*{*;}
-keep class com.mogo.module.common.widget.*{*;}
-keep class com.mogo.module.common.wm.* {*;}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.common.adapter;
import android.view.MotionEvent;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.VisualAngleMode;
/**
* @author congtaowang
* @since 2020-01-10
* <p>
* 适配器
*/
public abstract class MogoMapListenerAdapter implements IMogoMapListener {
@Override
public void onMapLoaded() {
}
@Override
public void onTouch( MotionEvent motionEvent ) {
}
@Override
public void onPOIClick( MogoPoi poi ) {
}
@Override
public void onMapClick( MogoLatLng latLng ) {
}
@Override
public void onLockMap( boolean isLock ) {
}
@Override
public void onMapModeChanged( EnumMapUI ui ) {
}
@Override
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
}
@Override
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
}
}

View File

@@ -1,33 +0,0 @@
package com.mogo.module.common.constants;
public
/**
* @author congtaowang
* @since 2020/10/29
*
* 车模型类型
*/
enum CarModelType {
Other( "other" ),
OtherLeft( "other_left" ),
OtherRight( "other_right" ),
OtherLeftReverse( "other_left_reverse" ),
OtherRightReverse( "other_right_reverse" ),
OtherReverse( "other_reverse" ),
Self( "self" ),
SelfLeft( "self_left" ),
SelfRight( "self_right" );
private String res;
CarModelType( String res ) {
this.res = res;
}
public String getRes() {
return res;
}
}

View File

@@ -1,32 +0,0 @@
package com.mogo.module.common.constants;
public
/**
* @author congtaowang
* @since 2020/10/29
*
* 描述
*/
enum SafeType {
Normal( "normal", "安全" ),
SpeedWarm( "warm", "注意/超速" ),
DistanceWarm( "warm", "注意/保持车距" ),
SpeedDangerous( "dangerous", "危险/严重超速" ),
DistanceDangerous( "dangerous", "危险/距离过近" );
private String msg;
private String res;
SafeType( String res, String msg ) {
this.msg = msg;
this.res = res;
}
public String getRes() {
return res;
}
public String getMsg() {
return msg;
}
}

View File

@@ -1,18 +0,0 @@
package com.mogo.module.common.constants;
/**
* 用于内部标识红绿灯颜色
*
* @author tongchenfei
*/
public class TrafficLightConst {
public static final int TRAFFIC_LIGHT_COLOR_GRAY = 0;
public static final int TRAFFIC_LIGHT_COLOR_RED = 1;
public static final int TRAFFIC_LIGHT_COLOR_YELLOW = 2;
public static final int TRAFFIC_LIGHT_COLOR_GREEN = 3;
public static final int TRAFFIC_LIGHT_DIRECTION_TURN_AROUND = 0;
public static final int TRAFFIC_LIGHT_DIRECTION_TURN_LEFT = 1;
public static final int TRAFFIC_LIGHT_DIRECTION_STRAIGHT = 2;
public static final int TRAFFIC_LIGHT_DIRECTION_TURN_RIGHT = 3;
}

View File

@@ -1,24 +0,0 @@
package com.mogo.module.common.constants;
public
/**
* @author congtaowang
* @since 2020/10/29
*
* 描述
*/
enum VisionMode {
Machine( "machine" ),
User( "user" );
private String res;
VisionMode( String res ) {
this.res = res;
}
public String getRes() {
return res;
}
}

View File

@@ -3,11 +3,7 @@ package com.mogo.module.common.drawer;
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.marker.IMogoMarker;
@@ -99,11 +95,11 @@ public class BaseDrawer {
public int getModelRes(int type) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
if (recognizedType == AdasRecognizedType.classIdCar) {
return R.raw.special_vehicle;
return R.raw.traffic_tachexiaoche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return R.raw.daba;
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
return R.raw.motuoche;
return R.raw.traffic_motuoche;
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
return R.raw.stopline;
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
@@ -111,11 +107,11 @@ public class BaseDrawer {
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
return R.raw.special_vehicle;
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
return R.raw.zixingche;
return R.raw.traffic_zixingche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
return R.raw.daba;
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdPerson) {
return R.raw.people;
return R.raw.traffic_people;
}
return R.raw.special_vehicle;
}

View File

@@ -34,6 +34,11 @@ public class IdentifyDataDrawer {
*/
private final ConcurrentHashMap<String, TrafficData> mDirtyPositions = new ConcurrentHashMap<>();
/**
* 过滤后的数据集合
*/
private final ArrayList<TrafficData> mFilterTrafficData = new ArrayList<>();
private IdentifyDataDrawer() {
mContext = AbsMogoApplication.getApp();
addPreVehicleModel();
@@ -73,18 +78,21 @@ public class IdentifyDataDrawer {
}
// 循环将集合中的数据提取记录
ArrayList<String> trafficDataUuidList = new ArrayList<>();
for (TrafficData trafficData : resultList) {
trafficDataUuidList.add(trafficData.getUuid());
}
// 找出上一针数据中已经不在本次数据中存在的数据
for (String uuid : mMarkersCaches.keySet()) {
if (!trafficDataUuidList.contains(uuid)) {
mDirtyPositions.put(uuid, mMarkersCaches.get(uuid));
}
}
// ArrayList<String> trafficDataUuidList = new ArrayList<>();
// for (TrafficData trafficData : resultList) {
// // 过滤掉未知感知数据
// if (trafficData.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) {
// //Logger.w(TAG, "未知感知类型数据,丢弃,不渲染");
// continue;
// }
// trafficDataUuidList.add(trafficData.getUuid());
// }
// // 找出上一针数据中已经不在本次数据中存在的数据
// for (String uuid : mMarkersCaches.keySet()) {
// if (!trafficDataUuidList.contains(uuid)) {
// mDirtyPositions.put(uuid, mMarkersCaches.get(uuid));
// }
// }
// // 移除脏数据
// for (String uuid : mDirtyPositions.keySet()) {
// MogoApisHandler.getInstance().getApis()
@@ -97,10 +105,28 @@ public class IdentifyDataDrawer {
MogoApisHandler.getInstance().getApis()
.getMapServiceApi()
.getMarkerManager(mContext)
.updateBatchMarkerPosition(resultList);
.updateBatchMarkerPosition(filterTrafficData(resultList));
}
/**
* 数据过滤器
*
* @return 过滤后的数据集合
*/
private ArrayList<TrafficData> filterTrafficData(ArrayList<TrafficData> trafficData) {
mFilterTrafficData.clear();
for (TrafficData data : trafficData) {
// 过滤掉未知感知数据
if (data.getType() == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI) {
//Logger.w(TAG, "未知感知类型数据,丢弃,不渲染");
continue;
}
mFilterTrafficData.add(data);
}
return mFilterTrafficData;
}
/**
* 清除旧的 marker 数据

View File

@@ -71,7 +71,7 @@ class MarkerDrawer {
}
/**
* add marker, {@link OnlineCarDrawer 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
* add marker, { 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
*
* @param markerShowEntity marker展示数据结构体
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段

View File

@@ -1,202 +0,0 @@
package com.mogo.module.common.drawer;
import android.graphics.Rect;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerCarPois;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public
/**
* @author congtaowang
* @since 2020/10/28
*
* 描述
*/
class OnlineCarDrawer implements IMogoStatusChangedListener {
private static final String TAG = "OnlineCarDrawer";
// 平滑移动事件间隔(单位:秒)
private static final int SMOOTH_DURATION = 15;
private static volatile OnlineCarDrawer sInstance;
private OnlineCarDrawer() {
MogoApisHandler.getInstance().getApis()
.getStatusManagerApi()
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, this );
}
public static OnlineCarDrawer getInstance() {
if ( sInstance == null ) {
synchronized ( OnlineCarDrawer.class ) {
if ( sInstance == null ) {
sInstance = new OnlineCarDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
public void clearMarkers(){
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA );
}
/**
* 绘制在线车辆marker
*
* @param onlineCarList
*/
public void drawOnlineCarMarkers( List< MarkerOnlineCar > onlineCarList,
int maxAmount,
boolean clearOld,
boolean showBounds,
Rect bound,
MogoLatLng centerPoint,
IMogoMarkerClickListener listener ) {
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
clearMarkers();
return;
}
if ( clearOld ) {
clearMarkers();
}
int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, onlineCarList );
Map< String, IMogoMarker > existCarMap = MarkerDrawer.getInstance().purgeMarkerData( onlineCarList, ModuleNames.CARD_TYPE_USER_DATA );
List< MogoLatLng > carPoints = new ArrayList<>();
for ( int i = 0; i < size; i++ ) {
MarkerOnlineCar markerOnlineCar = onlineCarList.get( i );
MarkerLocation markerLocation = markerOnlineCar.getLocation();
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setBindObj( markerOnlineCar );
markerShowEntity.setMarkerLocation( markerLocation );
markerShowEntity.setMarkerType( markerOnlineCar.getType() );
if ( markerOnlineCar.getCarInfo() != null ) {
markerShowEntity.setTextContent( markerOnlineCar.getUserInfo().getUserName() );
markerShowEntity.setIconUrl( markerOnlineCar.getUserInfo().getUserHead() );
}
if ( i <= 5 ) {
carPoints.add( new MogoLatLng( markerLocation.getLat(), markerLocation.getLon() ) );
}
String sn = MarkerDrawer.getInstance().getPrimaryKeyFromEntity( markerOnlineCar );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
mogoMarker = MarkerDrawer.getInstance().drawMapMarkerImpl( markerShowEntity, false, MarkerDrawer.MARKER_Z_INDEX_LOW, 0, listener );
}
if ( mogoMarker != null ) {
mogoMarker.setVisible( true );
}
startSmooth( mogoMarker, markerOnlineCar, markerLocation );
}
if ( showBounds && bound != null ) {
// 将前6个点显示在固定范围内
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().showBounds( TAG, centerPoint, carPoints, bound, false );
}
}
// 平滑移动
private void startSmooth( IMogoMarker iMogoMarker, MarkerOnlineCar markerOnlineCar,
MarkerLocation markerLocation ) {
if ( iMogoMarker == null ) {
return;
}
List< MarkerCarPois > poiList = markerOnlineCar.getPois();
if ( filterErrorPoint( poiList ) ) {
return;
}
if ( poiList == null || poiList.size() < 2 ) {
return;
}
List< MogoLatLng > points = new ArrayList<>();
double lastLat = 0.0d;
double lastLon = 0.0d;
for ( int j = 0; j < poiList.size(); j++ ) {
MarkerCarPois poi = poiList.get( j );
if ( poi == null || poi.getCoordinates() == null && poi.getCoordinates().size() != 2 ) {
continue;
}
try {
double lat = Double.valueOf( poi.getCoordinates().get( 1 ) + "" );
double lng = Double.valueOf( poi.getCoordinates().get( 0 ) + "" );
float distance = MarkerDrawer.calculateLineDistance( lastLon, lastLat, lng, lat );
lastLon = lng;
lastLat = lat;
if ( distance < 0.2f ) {// 距离过短,认为静止不动
continue;
}
points.add( new MogoLatLng( lat, lng ) );
} catch ( Exception e ) {
}
}
if ( points.size() >= 1 ) {
iMogoMarker.startSmooth( points, SMOOTH_DURATION );
} else {
Logger.d( TAG, "静止小车,但是有相同的连续坐标" );
}
}
/**
* 有可能出现终点到起点跳跃的情况,需要用"500M"约束起点和终点
*
* @param poiList
*/
private boolean filterErrorPoint( List< MarkerCarPois > poiList ) {
if ( poiList == null || poiList.size() < 2 ) {
return false;
}
MarkerCarPois start = poiList.get( 0 );
MarkerCarPois end = poiList.get( poiList.size() - 1 );
try {
double lat1 = Double.valueOf( start.getCoordinates().get( 1 ) + "" );
double lng1 = Double.valueOf( start.getCoordinates().get( 0 ) + "" );
double lat2 = Double.valueOf( end.getCoordinates().get( 1 ) + "" );
double lng2 = Double.valueOf( end.getCoordinates().get( 0 ) + "" );
if ( MarkerDrawer.calculateLineDistance( new MogoLatLng( lat1, lng1 ), new MogoLatLng( lat2, lng2 ) ) >= 500 ) {
Logger.d( TAG, "filter point" );
return true;
}
} catch ( Exception e ) {
}
return false;
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
clearMarkers();
}
}

View File

@@ -1,44 +0,0 @@
package com.mogo.module.common.drawer;
import com.mogo.map.overlay.IMogoPolyline;
/**
* @author donghongyu
* @since 2020/10/30
* TODO 推送路况信息绘制,用于演示
*/
public class PushRoadConditionDrawer {
private static final String TAG = "PushRoadConditionDrawer";
private static volatile PushRoadConditionDrawer sInstance;
private static IMogoPolyline mMogoPolyline;
private PushRoadConditionDrawer() {
}
public static PushRoadConditionDrawer getInstance() {
if (sInstance == null) {
synchronized (PushRoadConditionDrawer.class) {
if (sInstance == null) {
sInstance = new PushRoadConditionDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
clearPolyline();
mMogoPolyline = null;
sInstance = null;
}
public void clearPolyline() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
}
}
}

View File

@@ -30,7 +30,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
private static final String TAG = "V2XWarnDataDrawer";
private static volatile V2XWarnDataDrawer sInstance;
private boolean mChangeCarModeStatus;
private V2XWarnDataDrawer() {
super();
@@ -59,7 +58,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
Logger.d(TAG, "%s - %s", descriptor, isTrue);
mChangeCarModeStatus = true;
}
public boolean isVrMode() {
@@ -133,26 +131,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
marker.setRotateAngle(rotate);
}
/*
* 2D资源绘制marker底部的红色圆圈
* */
private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) {
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(newLocation.getLat())
.longitude(newLocation.getLon())
.anchor(1.0f, 1.0f)
.setGps(false)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple);
marker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new MarkerBaseFloor(mContext)));
marker.showInfoWindow();
return marker;
}
/**
* 绘制停止线 marker

View File

@@ -1,73 +0,0 @@
package com.mogo.module.common.drawer.bean;
import com.mogo.map.marker.IMogoMarker;
/**
* 速度显示对象
*/
public class SpeedData {
public IMogoMarker marker;
public double speed;
public String uuid;
public int type;
public double heading;
public boolean isVrMode;
public SpeedData(IMogoMarker marker, double speed, String uuid, int type, double heading, boolean isVrMode) {
this.marker = marker;
this.speed = speed;
this.uuid = uuid;
this.type = type;
this.heading = heading;
this.isVrMode = isVrMode;
}
public IMogoMarker getMarker() {
return marker;
}
public void setMarker(IMogoMarker marker) {
this.marker = marker;
}
public double getSpeed() {
return speed;
}
public void setSpeed(double speed) {
this.speed = speed;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public double getHeading() {
return heading;
}
public void setHeading(double heading) {
this.heading = heading;
}
public boolean getIsVrMode() {
return isVrMode;
}
public void setIsVrMode(boolean isVrMode) {
this.isVrMode = isVrMode;
}
}

View File

@@ -1,56 +0,0 @@
package com.mogo.module.common.map;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.util.AppUtils;
public
/**
* @author congtaowang
* @since 2020/6/5
* <p>
* 自定义导航功能拦截器
*/
class CustomNaviInterrupter implements Interrupter {
private static final String TAG = "CustomNaviInterrupter";
private static volatile CustomNaviInterrupter sInstance;
private CustomNaviInterrupter() {
}
public static CustomNaviInterrupter getInstance() {
if ( sInstance == null ) {
synchronized ( CustomNaviInterrupter.class ) {
if ( sInstance == null ) {
sInstance = new CustomNaviInterrupter();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 判断是否用自己的导航
* 1. 项目是否强制使用自己的导航
* 2. 是否安装了高德车机版地图
* 3. 默认使用自己的导航
*
* @return true-用高德公版车机版地图 false-用Launcher自己的导航
*/
@Override
public boolean interrupt() {
if ( DebugConfig.isUseCustomNavi() ) {
return false;
}
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), "com.autonavi.amapauto" ) ) {
return true;
}
return false;
}
}

View File

@@ -1,319 +0,0 @@
package com.mogo.module.common.map;
import android.util.Log;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-10
* <p>
* 地图中心点策略
*/
public class MapCenterPointStrategy {
private static final String TAG = "MapCenterPointStrategy";
private static Map< Integer, Map< String, MapCenterPoint > > sCommonStrategies = new HashMap<>();
private static Map< Integer, Map< String, MapCenterPoint > > sVrStrategies = new HashMap<>();
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
public static void init() {
{
// 选点场景,定位中心点
Map< String, MapCenterPoint > choosePoint = new HashMap<>();
final MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
choosePoint.put( "d80x", point );
choosePoint.put( "em4", point );
choosePoint.put( "em3", point );
choosePoint.put( "e8xx", point );
choosePoint.put( "f80x", point );
choosePoint.put( "f8xx", point );
choosePoint.put( "f8Amap", point );
sCommonStrategies.put( Scene.CHOOSE_POINT, choosePoint );
}
{
// 导航场景,定位视图右下角偏下
Map< String, MapCenterPoint > navi = new HashMap<>();
final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.573333333333D );
navi.put( "em4", em4 );
navi.put( "em3", em4 );
navi.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.575D );
navi.put( "f80x", f80x );
navi.put( "f8xx", f80x );
navi.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.NAVI, navi );
}
{
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.73936170212766D );
naviWithRoadEvent.put( "em4", em4 );
naviWithRoadEvent.put( "em3", em4 );
naviWithRoadEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.683333333333D );
naviWithRoadEvent.put( "f80x", f80x );
naviWithRoadEvent.put( "f8xx", f80x );
naviWithRoadEvent.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
}
{
// 巡航场景
Map< String, MapCenterPoint > aimless = new HashMap<>();
final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.5D );
aimless.put( "em4", em4 );
aimless.put( "em3", em4 );
aimless.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.5D );
aimless.put( "f80x", f80x );
aimless.put( "f8xx", f80x );
aimless.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.AIMLESS, aimless );
}
{
// 巡航场景 vs 道路事件展示场景
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
final MapCenterPoint em4 = new MapCenterPoint( 0.734375D, 0.68617 );
aimlessWithRoadEvent.put( "em4", em4 );
aimlessWithRoadEvent.put( "em3", em4 );
aimlessWithRoadEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.599074074D );
aimlessWithRoadEvent.put( "f80x", f80x );
aimlessWithRoadEvent.put( "f8xx", f80x );
aimlessWithRoadEvent.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
}
{
// 规划路线,定位视图右边
Map< String, MapCenterPoint > calculatePath = new HashMap<>();
final MapCenterPoint d80x = new MapCenterPoint( 0.733398D, 0.610833D );
calculatePath.put( "d80x", d80x );
calculatePath.put( "em4", d80x );
calculatePath.put( "em3", d80x );
calculatePath.put( "e8xx", d80x );
final MapCenterPoint f80x = new MapCenterPoint( 0.703125D, 0.6083333D );
calculatePath.put( "f80x", f80x );
calculatePath.put( "f8xx", f80x );
calculatePath.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.CALCULATE_PATH, calculatePath );
}
{
// 分类搜索,定位视图右边
Map< String, MapCenterPoint > categorySearch = new HashMap<>();
final MapCenterPoint d80x = new MapCenterPoint( 0.733398D, 0.5D );
categorySearch.put( "d80x", d80x );
categorySearch.put( "em4", d80x );
categorySearch.put( "em3", d80x );
categorySearch.put( "e8xx", d80x );
final MapCenterPoint f80x = new MapCenterPoint( 0.733594D, 0.5D );
categorySearch.put( "f80x", f80x );
categorySearch.put( "f8xx", f80x );
categorySearch.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
}
{
// V2X场景视图右边
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.669444444444444, 0.7D ) );
final MapCenterPoint em4 = new MapCenterPoint( 0.677734375D, 0.7D );
categoryV2XEvent.put( "em4", em4 );
categoryV2XEvent.put( "em3", em4 );
categoryV2XEvent.put( "e8xx", em4 );
final MapCenterPoint f80x = new MapCenterPoint( 0.6963541D, 0.65D );
categoryV2XEvent.put( "f80x", f80x );
categoryV2XEvent.put( "f8xx", f80x );
categoryV2XEvent.put( "f8Amap", f80x );
sCommonStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
// --vr mode
{
// 选点场景,定位中心点
Map< String, MapCenterPoint > choosePoint = new HashMap<>();
MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
choosePoint.put( "d80x", point );
choosePoint.put( "em4", point );
choosePoint.put( "e8xx", point );
choosePoint.put( "f80x", point );
choosePoint.put( "f8xx", point );
choosePoint.put( "f8Amap", point );
sVrStrategies.put( Scene.CHOOSE_POINT, choosePoint );
}
{
// 导航场景,定位视图右下角偏下
Map< String, MapCenterPoint > navi = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.573333333333D );
navi.put( "d80x", point1 );
navi.put( "em4", point1 );
navi.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.575D );
navi.put( "f80x", point2 );
navi.put( "f8xx", point2 );
navi.put( "f8Amap", point2 );
sVrStrategies.put( Scene.NAVI, navi );
}
{
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.73936170212766D );
naviWithRoadEvent.put( "d80x", point1 );
naviWithRoadEvent.put( "em4", point1 );
naviWithRoadEvent.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.683333333333D );
naviWithRoadEvent.put( "f80x", point2 );
naviWithRoadEvent.put( "f8xx", point2 );
naviWithRoadEvent.put( "f8Amap", point2 );
sVrStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
}
{
// 巡航场景
Map< String, MapCenterPoint > aimless = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.575D );
aimless.put( "d80x", point1 );
aimless.put( "em4", point1 );
aimless.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.8D );
aimless.put( "f80x", point2 );
aimless.put( "f8xx", point2 );
aimless.put( "f8Amap", point2 );
sVrStrategies.put( Scene.AIMLESS, aimless );
}
{
// 巡航场景 vs 道路事件展示场景
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.68617 );
aimlessWithRoadEvent.put( "d80x", point1 );
aimlessWithRoadEvent.put( "em4", point1 );
aimlessWithRoadEvent.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.599074074D );
aimlessWithRoadEvent.put( "f80x", point2 );
aimlessWithRoadEvent.put( "f8xx", point2 );
aimlessWithRoadEvent.put( "f8Amap", point2 );
sVrStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
}
{
// 规划路线,定位视图右边
Map< String, MapCenterPoint > calculatePath = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.610833D );
calculatePath.put( "d80x", point1 );
calculatePath.put( "em4", point1 );
calculatePath.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.6083333D );
calculatePath.put( "f80x", point2 );
calculatePath.put( "f8xx", point2 );
calculatePath.put( "f8Amap", point2 );
sVrStrategies.put( Scene.CALCULATE_PATH, calculatePath );
}
{
// 分类搜索,定位视图右边
Map< String, MapCenterPoint > categorySearch = new HashMap<>();
MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
categorySearch.put( "d80x", point );
categorySearch.put( "em4", point );
categorySearch.put( "e8xx", point );
categorySearch.put( "f80x", point );
categorySearch.put( "f8xx", point );
categorySearch.put( "f8Amap", point );
sVrStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
}
{
// V2X场景视图右边
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
MapCenterPoint point1 = new MapCenterPoint( 0.5, 0.7D );
categoryV2XEvent.put( "d80x", point1 );
categoryV2XEvent.put( "em4", point1 );
categoryV2XEvent.put( "e8xx", point1 );
MapCenterPoint point2 = new MapCenterPoint( 0.5, 0.65D );
categoryV2XEvent.put( "f80x", point2 );
categoryV2XEvent.put( "f8xx", point2 );
categoryV2XEvent.put( "f8Amap", point2 );
sVrStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
}
public static void resetByChangeMode() {
setMapCenterPointByScene( MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController(), Scene.AIMLESS );
}
/**
* 根据场景触发地图视图改变
*
* @param controller
* @param scene
*/
public static void setMapCenterPointByScene( IMogoMapUIController controller, int scene ) {
if ( controller == null ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
//Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
strategies = sVrStrategies;
}
if ( !strategies.containsKey( scene ) ) {
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
return;
}
Map< String, MapCenterPoint > points = strategies.get( scene );
String car = DebugConfig.getProductFlavor();
if ( !points.containsKey( car ) ) {
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
return;
}
MapCenterPoint point = points.get( car );
if ( point == null ) {
Logger.w( TAG, "no strategy config for series: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
return;
}
controller.setPointToCenter( point.x, point.y );
}
/**
* 根据场景触发地图视图改变
*
* @param controller
* @param scene
*/
public static void setMapCenterPointBySceneAndDelay( final IMogoMapUIController controller, final int scene, long delay, final Interrupter interrupter ) {
UiThreadHandler.postDelayed( () -> {
if ( interrupter != null ) {
if ( interrupter.interrupt() ) {
return;
}
}
setMapCenterPointByScene( controller, scene );
}, delay );
}
}

View File

@@ -1,124 +0,0 @@
package com.mogo.module.common.map;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.eagle.core.utilcode.util.ViewUtils;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
/**
* 自车图标工具类
*
* @author tongchenfei
*/
public class MyLocationUtil {
private static boolean isLoadingIcon = false;
private static boolean needEmphasizeMyLocation = false;
static {
MogoApisHandler.getInstance().getApis().getDataManagerApi()
.registerDataListener( "ADAS", data ->{
if ( data == null ) {
emphasizeMyLocation();
} else if( data instanceof String ){
setMyLocationIconUrl( ContextHolderUtil.getContext(), ( ( String ) data ));
}
} );
}
public static void emphasizeMyLocation(){
if (!isLoadingIcon) {
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().emphasizeMyLocation();
}else{
needEmphasizeMyLocation = true;
}
}
private static final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
.build();
public static void setMyLocationIconUrl(Context context){
setMyLocationIconUrl( context, SharedPrefsMgr.getInstance( context ).getString( "MY_LOCATION_CONFIG", "" ) );
}
public static void setMyLocationIconUrl(Context context, String url) {
if (url == null || url.isEmpty()) {
return;
}
if (Looper.myLooper() != Looper.getMainLooper()) {
UiThreadHandler.post(() -> loadMyLocationIconInUiThread(context, url));
} else {
loadMyLocationIconInUiThread(context, url);
}
}
private static void loadMyLocationIconInUiThread(Context context, String url) {
if (!url.isEmpty()) {
isLoadingIcon = true;
RequestOptions options = new RequestOptions()
.placeholder(DEFAULT_OPTION.getCarCursorRes())
.error(DEFAULT_OPTION.getCarCursorRes())
.dontAnimate();
GlideApp.with(context)
.asBitmap()
.load(url)
.apply(options)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource,
@Nullable Transition<? super Bitmap> transition) {
DEFAULT_OPTION.setCarCursorBmp(inflateMyLocation(context, resource));
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setCarCursorOption(DEFAULT_OPTION);
if (needEmphasizeMyLocation) {
needEmphasizeMyLocation = false;
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().emphasizeMyLocation();
}
isLoadingIcon = false;
}
@Override
public void onLoadStarted(@Nullable Drawable placeholder) {
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
@Override
public void onLoadFailed(@Nullable Drawable errorDrawable) {
}
});
}
}
private static Bitmap inflateMyLocation(Context context, Bitmap res) {
if (res == null) {
throw new IllegalArgumentException("inflate myLocation bitmap can not be null!");
}
View root = LayoutInflater.from(context).inflate(R.layout.module_common_my_location, null, false);
ImageView iv = root.findViewById(R.id.module_map_amap_my_location_iv);
iv.setImageBitmap(res);
return ViewUtils.fromView(root);
}
}

View File

@@ -1,44 +0,0 @@
package com.mogo.module.common.utils;
import android.util.Log;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 10:31 AM
* desc : 基于位置工具类
* version: 1.0
*/
public class LocationUtils {
private static final String TAG = "LocationUtils";
/**
* 获取传入的经纬度在车辆的什么位置
*
* @return 顺时针true-前false-后
*/
public static boolean isPointOnCarFront(MogoLocation carLocal, MogoLatLng pointLocal) {
double carLon = carLocal.getLongitude();
double carLat = carLocal.getLatitude();
double poiLon = pointLocal.getLon();
double poiLat = pointLocal.getLat();
float carAngle = carLocal.getBearing();
// 计算车辆与点之间的夹角
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
carLon, carLat, poiLon, poiLat, (int) carAngle);
if (diffAngle <= 90) {
Log.i(TAG, "目标点在车辆--前方");
return true;
} else {
Log.i(TAG, "目标点在车辆--后方");
return false;
}
}
}

View File

@@ -1,18 +0,0 @@
package com.mogo.module.common.utils;
/**
* 多模块之间SP状态公共类
*/
public class SPConst {
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
//用于多模块之间引导状态判断
public static String getSpGuide() {
return SP_GUIDE;
}
private static String SP_GUIDE_FIRST_TIME_RECORD = "SP_GUIDE_FIRST_TIME_RECORD";
}

View File

@@ -1,30 +0,0 @@
package com.mogo.module.common.utils;
import android.os.Handler;
import android.os.HandlerThread;
/**
* 简单HandlerThread线程池实现
*
* @author tongchenfei
*/
public class SimpleHandlerThreadPool {
private static final String TAG = "SimpleHandlerThreadPool";
private final HandlerThread renderThread = new HandlerThread( "one-frame-render-thread" );
private final Handler renderHandler;
private SimpleHandlerThreadPool() {
renderThread.start();
renderHandler = new Handler( renderThread.getLooper() );
}
private static final SimpleHandlerThreadPool INSTANCE = new SimpleHandlerThreadPool();
public static SimpleHandlerThreadPool getInstance() {
return INSTANCE;
}
public void postRender( Runnable runnable ) {
renderHandler.post( runnable );
}
}

View File

@@ -68,7 +68,6 @@ dependencies {
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleshare
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.mogo_core_utils
@@ -81,7 +80,6 @@ dependencies {
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-share')
implementation project(':modules:mogo-module-service')
implementation project(':core:mogo-core-utils')

View File

@@ -3,7 +3,5 @@
-keep class com.mogo.module.extensions.live.PushCameraLiveWindow{*;}
-keep class com.mogo.module.extensions.navi.*{*;}
-keep class com.mogo.module.extensions.userinfo.*{*;}
-keep class com.mogo.module.extensions.weather.Phenomena{*;}
-keep class com.mogo.module.extensions.weather.StrokeTextView{*;}
-keep class com.mogo.module.extensions.view.*{*;}
-keep class com.mogo.module.extensions.bean.*{*;}

View File

@@ -23,8 +23,6 @@
#-----ExtensionModule-----
-keep class com.mogo.module.extensions.userinfo.**{*;}
-keep class com.mogo.module.extensions.weather.Phenomena
-keep class com.mogo.module.extensions.weather.WeatherCallback
-keep interface com.mogo.module.extensions.net.UserInfoNetApiServices
-keep class com.mogo.module.extensions.utils.TopViewAnimHelper
-keep class com.mogo.module.extensions.ExtensionsView
-keep class com.mogo.module.extensions.ExtensionsModuleConst

View File

@@ -8,56 +8,6 @@ package com.mogo.module.extensions;
*/
public class ExtensionsModuleConst {
public static final String TYPE = "extension";
public static final String TYPE_ENTRANCE = "entrance";
/*** 分享 开始 **/
//免唤醒语音命令
public static final String[] CMD_CANCLE_SHARE = {"取消分享"};
public static final String[] CMD_CLOSE_PAGE = {"关闭页面"};
public static final String[] CMD_CLOSE = {"关闭"};
public static final String CANCLE_SHARE = "com.zhidao.launcher.cancle.share";
public static final String CLOSE_PAGE = "com.zhidao.launcher.close.page";
public static final String CLOSE = "com.zhidao.launcher.close";
//唤醒指令
//分享路况/上报路况/上报拥堵/上报交通检查/上报封路 唤醒
public static final String UPLOAD_ROAD_CONDITION_AWAKEN = "com.zhidao.pathfinder.report.roadCondition";
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
//关闭分享框 唤醒
public static final String SHARE_DIALOG_CLOSE = "com.zhidao.share.close";
// 两次未回复关闭分享对话框
public static final String NO_REPLY_SHARE_DIALOG_CLOSE = "com.zhidao.share.dialog.close";
//我要分享
public static final String GO_TO_SHARE = "com.zhidao.share";
/*** 分享 结束 **/
/*** 探路 开始 免唤醒 **/
public static final String[] CMD_UPLOAD_BLOCK = {"上报拥堵"};
public static final String[] CMD_TRAFFIC_CHECK = {"上报交通检查"};
public static final String[] CMD_ROAD_CLOSURE = {"上报封路"};
// public static final String[] CMD_SHARE_OIL_PRICE = {"分享油价"};
//上报拥堵
public static final String UPLOAD_ROAD_BLOCK = "command_upload_block";
//上报交通检查
public static final String UPLOAD_TRAFFIC_CHECK = "command_upload_traffic_check";
//上报封路
public static final String UPLOAD_ROAD_CLOSURE = "command_upload_road_closure";
//分享油价
// public static final String SHARE_OIL_PRICE = "command_share_oil_price";
/*** 探路 结束 **/
//埋点
//分享分类 1路况2油价3交通检查4封路
public static final String LAUNCHER_SHARE_TYPE = "v2x_share_type";
//分享/上报按钮点击 from=1 手动点击 from=2 语音打开
public static final String LAUNCHER_SHARE_CLICK = "v2x_share_click";
public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
}

View File

@@ -1,8 +1,6 @@
package com.mogo.module.extensions;
import com.mogo.commons.mvp.IView;
import com.mogo.module.extensions.userinfo.UserInfo;
import com.mogo.module.extensions.weather.WeatherInfo;
/**
* @author congtaowang
@@ -12,21 +10,4 @@ import com.mogo.module.extensions.weather.WeatherInfo;
*/
public interface ExtensionsView extends IView {
/**
* 天气信息
*
* @param desc 天气描述:晴转多云
* @param temp 温度
* @param iconId 图标
*/
void renderWeatherInfo( String temp, String desc, int iconId );
/**
* 刷新消息信息
*
* @param hasMsg 是否有消息
* @param amount 消息数量
*/
void renderMsgInfo( boolean hasMsg, int amount );
}

View File

@@ -1,68 +0,0 @@
package com.mogo.module.extensions.bean;
import android.view.View;
import java.util.Objects;
/**
* 底层view封装
*
* @author tongchenfei
*/
public class BottomLayerViewWrapper {
private View view;
private int x;
private int y;
public BottomLayerViewWrapper() {
}
public BottomLayerViewWrapper(View view, int x, int y) {
this.view = view;
this.x = x;
this.y = y;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BottomLayerViewWrapper wrapper = (BottomLayerViewWrapper) o;
return x == wrapper.x &&
y == wrapper.y &&
view.equals(wrapper.view);
}
@Override
public int hashCode() {
return Objects.hash(view);
}
public View getView() {
return view;
}
public void setView(View view) {
this.view = view;
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}

View File

@@ -1,81 +1,43 @@
package com.mogo.module.extensions.entrance;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.ONE_DAY_TIME;
import static com.mogo.module.share.constant.ShareConstants.VOICE_ALERT_COUNT;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.mogo.toast.ResourcesHelper;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.WMDialog;
import com.mogo.module.common.map.CustomNaviInterrupter;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.utils.CameraLiveNoticeHelper;
import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.module.extensions.utils.NoMapTopViewShaderHelper;
import com.mogo.module.extensions.utils.TopViewAnimHelper;
import com.mogo.module.extensions.utils.TopViewNoLinkageAnimHelper;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cloud.socket.IMogoOnMessageListener;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.fragmentmanager.IFragmentProvider;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.statusmanager.StatusDescriptor;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
@@ -93,61 +55,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private static final String TAG = "EntranceFragment";
private View mUploadRoadCondition;
private TextView mUpload;
private ImageView mUploading;
private ImageButton mMove2CurrentLocation;
private TextView mExitNavi;
private View mDisplayOverview;
private TextView mDisplayOverviewText;
private IMogoServiceApis mApis;
private IMogoMapService mService;
private IMogoMapUIController mMApUIController;
private IMogoNavi mMogoNavi;
private IMogoFragmentManager mMogoFragmentManager;
private IMogoRegisterCenter mMogoRegisterCenter;
private IMogoAnalytics mAnalytics;
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 String[] mClickShareVoiceStrings;
private boolean isShowGuide;
/**
* 搜索模块
*/
private boolean mIsLock = true;
private TextView mCameraMode;
public static boolean isClickShare;
private Rect mDisplayOverviewBounds;
private TextView tvEnterVrMode;
private TextView tvExitVrMode;
/**
* 内部变量标识是否在vrMode用于方法执行过滤避免重复或异常调用
*/
private boolean localIsVrMode = false;
private final Runnable mLockCarRunnable = new Runnable() {
@Override
public void run() {
@@ -155,17 +70,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
mStatusManager.setDisplayOverview(TAG, false);
mMApUIController.recoverLockMode();
}
};
private Group seekHelpGroup;
private UploadButtonAnimatorController mUploadButtonAnimatorController;
private IFragmentProvider mMessageHistoryPanelProvider;
private TextView seekHelpNum;
private final CameraLiveNoticeHelper mCameraLiveNoticeHelper = new CameraLiveNoticeHelper();
@@ -186,160 +93,20 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraLiveNoticeHelper.init(getContext());
mEntrancePresenter = new EntrancePresenter(getContext(), this);
mMogoFragmentManager = mApis.getFragmentManagerApi();
EntranceViewHolder.getInstance().initRootViewGroup(mRootView);
mStatusManager = mApis.getStatusManagerApi();
seekHelpGroup = findViewById(R.id.module_ext_id_seek_help_notice_group);
seekHelpNum = findViewById(R.id.module_ext_id_seek_help_notice_number);
NoMapTopViewShaderHelper.getInstance().initShaderView(findViewById(R.id.module_ext_id_top_container_shader));
mUploadRoadCondition = findViewById(R.id.module_entrance_id_upload_road_condition);
mUpload = findViewById(R.id.module_entrance_id_upload);
mUploading = findViewById(R.id.module_entrance_id_uploading);
mUploadRoadCondition.setOnClickListener(clickListener);
mDisplayOverview = findViewById(R.id.module_ext_id_display_overview);
mDisplayOverviewText = findViewById(R.id.module_ext_id_display_overview_text);
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
groupFix = findViewById(R.id.groupFix);
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
if (rootView != null) {
TopViewAnimHelper.getInstance().init(rootView);
TopViewNoLinkageAnimHelper.getInstance().init(rootView);
}
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
mCameraMode = findViewById(R.id.module_ext_id_north);
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
MogoEntranceButtons.save(ButtonIndex.BUTTON1, findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2, findViewById(R.id.module_entrance_id_button2));
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_left_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_top_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_right_margin),
ResourcesHelper.getDimensionPixelSize(getContext(),
R.dimen.module_map_display_overview_bottom_margin)
);
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);
mMsgContainer = findViewById(R.id.module_ext_id_msg);
mMsgCounter = findViewById(R.id.module_ext_id_msg_counter);
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
mStatusManager);
tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode);
tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode);
tvEnterVrMode.setOnClickListener(clickListener);
tvExitVrMode.setOnClickListener(clickListener);
mMsgContainer.setOnClickListener(clickListener);
mMove2CurrentLocation.setOnClickListener(clickListener);
mDisplayOverview.setOnClickListener(clickListener);
mExitNavi.setOnClickListener(clickListener);
mCameraMode.setOnClickListener(clickListener);
dealWeatherContainer();
listenSeekNumber();
debugCrashWarn();
etTimes = findViewById(R.id.etTimes);
findViewById(R.id.btnFix).setOnClickListener(clickListener);
findViewById(R.id.debugPanel).setOnClickListener(clickListener);
initDebugPanel();
// 检查是否在vr模式
if (mStatusManager.isVrMode()) {
enterVrMode();
localIsVrMode = true;
}
}
private int debugPanelClickCount = 0;
private long lastDebugPanelClickTime = 0;
private EditText etTimes;
private Group groupFix;
private void enterVrMode() {
tvEnterVrMode.setVisibility(View.GONE);
mMove2CurrentLocation.setVisibility(View.GONE);
mUploadRoadCondition.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
// tvExitVrMode.setVisibility(View.VISIBLE);
TopViewAnimHelper.getInstance().enterVrMode();
TopViewNoLinkageAnimHelper.getInstance().enterVrMode();
mCameraLiveNoticeHelper.enterVrMode();
localIsVrMode = true;
}
private void exitVrMode() {
EntranceViewHolder.getInstance().forceHideNoticeView();
tvEnterVrMode.setVisibility(View.VISIBLE);
mMove2CurrentLocation.setVisibility(View.VISIBLE);
mUploadRoadCondition.setVisibility(View.VISIBLE);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isSeekHelping()) {
seekHelpGroup.setVisibility(View.VISIBLE);
}
TopViewAnimHelper.getInstance().exitVrMode();
TopViewNoLinkageAnimHelper.getInstance().exitVrMode();
mCameraLiveNoticeHelper.exitVrMode();
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().unregisterMogoLocationListener(TAG);
localIsVrMode = false;
}
private void debugCrashWarn() {
mUploadRoadCondition.setOnLongClickListener(v -> {
mApis.getAdasControllerApi().closeADAS();
return true;
});
if (!DebugConfig.isMapBased()) {
// 不基于地图的版本需要隐藏一些按钮
mMove2CurrentLocation.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
}
}
private void playShareGuideVoice() {
long intervalTime = SharedPrefsMgr.getInstance(getContext()).getLong(KEY_CLICK_SHARE_TIME, 0);
int shareItemSum = SharedPrefsMgr.getInstance(getContext()).getInt(KEY_CLICK_SHARE_BUTTON, 0);
if (shareItemSum < VOICE_ALERT_COUNT) {
long time = System.currentTimeMillis();
Logger.d(TAG, " playShareGuideVoice shareItemSum = " + shareItemSum + "---- intervalTime = " + intervalTime + ">>> time = " + time);
if (intervalTime == 0) {
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
} else {
Logger.d(TAG, " playShareGuideVoice else interval = " + (time - intervalTime));
if ((time - intervalTime) > ONE_DAY_TIME) {
if (shareItemSum == 1) {
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[1]);
} else {
AIAssist.getInstance(getContext()).speakTTSVoice(mClickShareVoiceStrings[0]);
}
SharedPrefsMgr.getInstance(getContext()).putLong(KEY_CLICK_SHARE_TIME, time);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_CLICK_SHARE_BUTTON, ++shareItemSum);
} else {
Logger.e(TAG, " playShareGuideVoice else < ONE_DAY_TIME ");
}
}
}
}
/**
* 地图移动和缩放回调
@@ -372,27 +139,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
}
/**
* 由于Launcher和Independent对于天气的表现形式不太一样所以通过此方法区分处理
*/
private void dealWeatherContainer() {
if (!DebugConfig.isLauncher()) {
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone((ConstraintLayout) getView());
constraintSet.clear(R.id.module_ext_id_weather_container, ConstraintSet.START);
constraintSet.connect(R.id.module_ext_id_weather_container, ConstraintSet.END,
getView().getId(), ConstraintSet.END);
constraintSet.applyTo((ConstraintLayout) getView());
}
}
public void showShareDialog() {
isClickShare = true;
mApis.getShareManager().showShareDialog();
traceData("1");
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
"AUTONAVI_STANDARD_BROADCAST_RECV";
@@ -405,11 +151,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mService = mApis.getMapServiceApi();
mMogoRegisterCenter = mApis.getRegisterCenterApi();
mMApUIController = mService.getMapUIController();
mMogoNavi = mService.getNavi(getContext());
mAnalytics = mApis.getAnalyticsApi();
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
@@ -418,16 +160,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this);
TopViewAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
TopViewNoLinkageAnimHelper.getInstance().setIMogoMapUIController(mMApUIController);
mClickShareVoiceStrings =
getContext().getResources().getStringArray(R.array.click_share_voice_guide_array);
//TODO 因为衡阳6.30交付没有2D模式临时方案进入vr模式不可缩放地图
// 进入鹰眼模式,设置手势缩放地图失效
Logger.d(TAG, "进入vr模式");
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.Type_VR);
@@ -453,24 +188,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
TopViewNoLinkageAnimHelper.getInstance().removeAllView();
TopViewNoLinkageAnimHelper.getInstance().clear();
NoMapTopViewShaderHelper.getInstance().release();
EntranceViewHolder.getInstance().release();
mCameraLiveNoticeHelper.release();
}
@Override
public void onIntentReceived(String intentStr, Intent intent) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
int type = intent.getIntExtra("EXTRA_TYPE", -1);
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
if (key_type == 10027) {
if (opera_type == 0) {
mCameraMode.setSelected(false);
} else if (opera_type == 1) {
mCameraMode.setSelected(true);
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
} else if (key_type == 10021) {
if (key_type == 10021) {
try {
onStopNavi();
} catch (Exception e) {
@@ -481,9 +205,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
if (naviinfo == null) {
return;
}
}
@Override
@@ -492,19 +214,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
TopViewAnimHelper.getInstance().showNaviView();
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
EnumMapUI.CarUp_2D);
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
, () -> !mMogoNavi.isNaviing());
if (CustomNaviInterrupter.getInstance().interrupt()) {
mDisplayOverview.setVisibility(View.GONE);
mCameraMode.setVisibility(View.GONE);
mExitNavi.setVisibility(View.GONE);
} else {
mExitNavi.setVisibility(View.VISIBLE);
mDisplayOverview.setVisibility(View.VISIBLE);
mCameraMode.setVisibility(View.VISIBLE);
}
mApis.getAnalyticsApi().track("Navigation_begin", new HashMap<>());
}
@@ -514,11 +223,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
return;
}
TopViewAnimHelper.getInstance().hideNaviView();
mExitNavi.setVisibility(View.GONE);
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mDisplayOverview.setVisibility(View.GONE);
mCameraMode.setVisibility(View.GONE);
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.AIMLESS);
}
@Override
@@ -527,128 +231,21 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void onLockMap(boolean isLock) {
mIsLock = isLock;
if (isLock) {
mExitNavi.setText(R.string.module_ext_str_exit_navi);
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
}
} else {
mExitNavi.setText(R.string.module_ext_str_continue_navi);
}
// if ( isLock ) {
// if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
// }
// } else {
// mMove2CurrentLocation.setImageResource( R.drawable.module_map_ic_move2_current_location );
// }
}
private void traceData(String from) {
Map<String, Object> properties = new HashMap<>();
properties.put("from", from);
mAnalytics.track("v2x_share_click", properties);
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
Logger.d(TAG, "descriptor=" + descriptor + " isTrue=" + isTrue);
if (mUploadRoadCondition == null) {
return;
}
if (descriptor == StatusDescriptor.UPLOADING && DebugConfig.isLauncher()) {
if (isTrue) {
mUploading.setVisibility(View.VISIBLE);
mUpload.setVisibility(View.GONE);
mUploadButtonAnimatorController.doFrameAnimOnUploadButton();
} else {
mUploadButtonAnimatorController.stopAnimation();
mUploading.setVisibility(View.GONE);
mUpload.setVisibility(View.VISIBLE);
}
} else if (descriptor == StatusDescriptor.DISPLAY_OVERVIEW) {
if (!mMogoNavi.isNaviing()) {
return;
}
if (isTrue) {
mDisplayOverviewText.setText("退出全览");
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
AbsMogoApplication.getApp().getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize));
mCameraMode.setVisibility(View.GONE);
} else {
mDisplayOverviewText.setText("全览");
mDisplayOverviewText.setTextSize(TypedValue.COMPLEX_UNIT_PX,
AbsMogoApplication.getApp().getResources().getDimensionPixelSize(R.dimen.module_ext_display_overview_textSize_large));
if (CustomNaviInterrupter.getInstance().interrupt()) {
mCameraMode.setVisibility(View.GONE);
} else {
mCameraMode.setVisibility(View.VISIBLE);
}
}
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
if (!isTrue) {
handler.post(() -> seekHelpGroup.setVisibility(View.GONE));
}
} else if (descriptor == StatusDescriptor.VR_MODE) {
try {
if (isTrue) {
enterVrMode();
} else {
exitVrMode();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Override
public void renderWeatherInfo(String temp, String desc, int iconId) {
if (!DebugConfig.isMapBased()) {
return;
}
if (mApis.getStatusManagerApi().isVrMode()) {
return;
}
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) {
if (!DebugConfig.isMapBased()) {
return;
}
if (mApis.getStatusManagerApi().isVrMode()) {
return;
}
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 onMapModeChanged(EnumMapUI ui) {
if (mCameraMode == null) {
return;
}
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
}
@Override
@@ -656,33 +253,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
private static final int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
//求助已通知周围XX位车主
private final IMogoOnMessageListener<String> seekHelpNoticeListener =
new IMogoOnMessageListener<String>() {
@Override
public Class<String> target() {
return String.class;
}
@Override
public void onMsgReceived(String obj) {
if (mStatusManager.isSeekHelping()) {
int seekNum = SharedPrefsMgr.getInstance(getContext()).getInt("seek_help_num", 0);
final int finalSeekNum = ++seekNum;
SharedPrefsMgr.getInstance(getContext()).putInt("seek_help_num", seekNum);
handler.post(() -> {
seekHelpGroup.setVisibility(localIsVrMode ? View.INVISIBLE : View.VISIBLE);
seekHelpNum.setText("" + finalSeekNum);
});
}
}
};
private final Handler handler = new Handler();
private void listenSeekNumber() {
mApis.getSocketManagerApi(getContext()).registerOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
mStatusManager.registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this);
}
@@ -705,189 +278,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
if (mApis.getIntentManagerApi() != null) {
mApis.getIntentManagerApi().unregisterIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
}
mApis.getSocketManagerApi(getContext()).unregisterOnMessageListener(SEEK_HELP_NOTICE_NUM_MSG_TYPE, seekHelpNoticeListener);
}
MogoEntranceButtons.clear();
}
private Group debugPanelGroup;
private void initDebugPanel() {
debugPanelGroup = findViewById(R.id.groupDebugPanel);
ImageButton ibDebugPanelClose = findViewById(R.id.ibDebugPanelClose);
Button btnOpenLog = findViewById(R.id.btnOpenLog);
Button btnCloseLog = findViewById(R.id.btnCloseLog);
Button btnOpenV2XPanel = findViewById(R.id.btnOpenV2xPanel);
RadioButton rbCidi = findViewById(R.id.rbCidiObu);
RadioButton rbHuali = findViewById(R.id.rbHualiObu);
RadioButton rbGohigh = findViewById(R.id.rbGoHighObu);
ibDebugPanelClose.setOnClickListener(v -> debugPanelGroup.setVisibility(View.GONE));
btnOpenLog.setOnClickListener(v -> {
Intent intent = new Intent("com.mogo.ACTION");
intent.putExtra("oper", 1);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
btnCloseLog.setOnClickListener(v -> {
Intent intent = new Intent("com.mogo.ACTION");
intent.putExtra("oper", 2);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
btnOpenV2XPanel.setOnClickListener(v -> {
Intent intent = new Intent("com.v2x.test_panel_control");
intent.putExtra("TextPanelOpenStatus", true);
getContext().sendBroadcast(intent);
debugPanelGroup.setVisibility(View.GONE);
});
switch (DebugConfig.getObuType()) {
case DebugConfig.OBU_TYPE_CIDI:
rbCidi.setChecked(true);
break;
case DebugConfig.OBU_TYPE_HUALI:
rbHuali.setChecked(true);
break;
default:
rbGohigh.setChecked(true);
break;
}
rbCidi.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_CIDI));
rbHuali.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_HUALI));
rbGohigh.setOnClickListener(v -> exchangeObuType(DebugConfig.OBU_TYPE_GOHIGH));
}
private void exchangeObuType(int obuType) {
SharedPrefsMgr.getInstance(getContext()).putInt("OBU_TYPE", obuType);
DebugConfig.setObuType(obuType);
Intent intent = new Intent("com.mogo.launcher.v2x.action.EXCHANGE_OBU_TYPE");
intent.putExtra("obuType", obuType);
getContext().sendBroadcast(intent);
}
private final OnPreventFastClickListener clickListener = new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
if (v.getId() == R.id.module_entrance_id_upload_road_condition) {
// 分享按钮点击
showShareDialog();
playShareGuideVoice();
} else if (v.getId() == R.id.module_ext_id_display_overview) {
// 全览按钮点击
if (getContext() != null) {
// 加此判断是解决下面setDisplayOverview后本Fragment回调中出现not attached to a context问题
if (!mStatusManager.isDisplayOverview()) {
mMApUIController.displayOverview(mDisplayOverviewBounds);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
UiThreadHandler.postDelayed(mLockCarRunnable, 20_000);
} else {
mMApUIController.recoverLockMode();
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setDisplayOverview(TAG, !mStatusManager.isDisplayOverview());
}
} else if (v.getId() == R.id.module_entrance_id_move2_current_location) {
// 回到自车位置
if (mStatusManager.isDisplayOverview()) {
mStatusManager.setDisplayOverview(TAG, false);
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
if (!mApis.getStatusManagerApi().isVrMode()) {
if (!mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime(0)) {
mStatusManager.setUserInteractionStatus(TAG, true, false);
mMApUIController.recoverLockMode();
}
} else {
mMApUIController.recoverLockMode();
}
} else if (v.getId() == R.id.module_entrance_id_exit_navi) {
// 退出导航
if (mMogoNavi != null) {
if (mIsLock) {
new WMDialog.Builder(getContext())
.setOkButton(R.string.module_commons_button_ok, (dlg, which) -> {
dlg.dismiss();
mMogoNavi.stopNavi();
})
.setCancelButton(R.string.module_commons_button_cancel,
(dlg, which) -> {
dlg.dismiss();
})
.setContent(R.string.module_commons_exit_navi_content)
.build()
.show();
} else {
MapCenterPointStrategy.setMapCenterPointByScene(mMApUIController, Scene.NAVI);
mMApUIController.recoverLockMode();
}
}
} else if (v.getId() == R.id.module_ext_id_north) {
// 车头朝上 正北朝上
if (mCameraMode.isSelected()) {
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
}
} else if (v.getId() == R.id.module_ext_id_msg) {
// 消息框
try {
if (mMessageHistoryPanelProvider == null) {
mMessageHistoryPanelProvider = (IFragmentProvider) ARouter.getInstance().build("/push/ui/message").navigation(getContext());
}
mMessageHistoryPanelProvider.createFragment(getActivity(), mMogoFragmentManager.getMessageHistoryContainerId(), null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (v.getId() == R.id.module_ext_enter_vr_mode) {
// 进入vr模式
mMApUIController.changeMapMode(EnumMapUI.Type_VR);
} else if (v.getId() == R.id.module_ext_exit_vr_mode) {
// 退出vr模式
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
} else if (v.getId() == R.id.btnFix) {
// 修改上报时间间隔
try {
String times = etTimes.getText().toString().trim();
int fixTime = Integer.parseInt(times);
Logger.d(TAG, "修改上报时间间隔: " + times + " fixTime: " + fixTime);
if (fixTime > 0) {
Intent intent = new Intent("com.mogo.launcher.action.FIX_UPLOAT_DELAY");
intent.putExtra("fixTime", fixTime);
getContext().sendBroadcast(intent);
TipToast.tip("已经发送修改广播");
} else {
TipToast.tip("fixTime为0不发送广播");
}
} catch (Exception e) {
TipToast.tip("fixTime异常");
e.printStackTrace();
}
} else if (v.getId() == R.id.debugPanel) {
// 简易调试面板
long diff = SystemClock.elapsedRealtime() - lastDebugPanelClickTime;
Logger.d("DebugPanel", "diff: " + diff);
if (diff > 3000) {
debugPanelClickCount = 1;
} else {
debugPanelClickCount++;
}
lastDebugPanelClickTime = SystemClock.elapsedRealtime();
if (debugPanelClickCount == 10) {
// show panel
debugPanelGroup.setVisibility(View.VISIBLE);
}
}
}
};
}

View File

@@ -1,33 +1,21 @@
package com.mogo.module.extensions.entrance;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
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.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.network.utils.digest.DigestUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.HostConst;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.bean.CommonConfig;
import com.mogo.module.extensions.bean.CommonConfigResponse;
import com.mogo.module.extensions.net.GetConfigApiServices;
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.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoMsgCenter;
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
import java.util.Map;
@@ -42,85 +30,22 @@ import io.reactivex.schedulers.Schedulers;
* <p>
* 描述
*/
public class EntrancePresenter extends Presenter<EntranceView> implements WeatherCallback,
IMogoMsgCenterListener {
public class EntrancePresenter extends Presenter<EntranceView> {
private static final String TAG = "EntrancePresenter";
private WeatherModel mWeatherModel;
private IMogoMsgCenter mMsgCenter;
private IMogoNetwork mNetWork;
private Context context;
private boolean isResumed = false;
public EntrancePresenter(Context context, EntranceView view) {
super(view);
this.context = context;
mWeatherModel = new WeatherModel(getContext());
mNetWork = MogoApisHandler.getInstance().getApis().getNetworkApi();
}
@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;
}
Phenomena phenomena = Phenomena.getById(weatherInfo.getPhenomena());
if (phenomena == null) {
return;
}
String temp =
getContext().getResources().getString(R.string.module_ext_str_weather_temp_format
, weatherInfo.getTemperature());
String desc = 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);
isResumed = true;
getCommonConfig();
}
@Override
public void onPause(@NonNull LifecycleOwner owner) {
super.onPause(owner);
isResumed = false;
}
@Override
public void onDestroy(@NonNull LifecycleOwner owner) {
super.onDestroy(owner);
if (mWeatherModel != null) {
mWeatherModel.destroy();
}
if (mMsgCenter != null) {
mMsgCenter.unregisterMsgCenterListener(this);
}
}
public void getCommonConfig() {
Map<String, Object> params = new ArrayMap<>();
params.put("sn", MoGoAiCloudClientConfig.getInstance().getSn());
@@ -137,16 +62,7 @@ public class EntrancePresenter extends Presenter<EntranceView> implements Weathe
public void onSuccess(CommonConfigResponse config) {
Logger.d(TAG, "getCommonConfig onSuccess -----> ");
if (config != null && config.result != null) {
CommonConfig.Speech speech = config.result.speech;
CommonConfig.ReportStrategy strategy = config.result.reportStrategy;
if (speech != null) {
Logger.d(TAG,
"getCommonConfig onSuccess speech.count = " + speech.count);
SharedPrefsMgr.getInstance(getContext()).putInt(KEY_SERVER_SHOW_DAY_COUNT, speech.count);
} else {
Logger.e(TAG, "getCommonConfig onSuccess speech == null ");
}
if (strategy != null) {
Logger.d(TAG,
"getCommonConfig onSuccess strategy.open = " + strategy.open);

View File

@@ -1,8 +1,6 @@
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;
/**
* @author congtaowang

View File

@@ -1,62 +0,0 @@
package com.mogo.module.extensions.entrance;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.module.extensions.utils.EntranceViewHolder;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.entrance.IMogoEntranceButtonController;
/**
* @author congtaowang
* @since 2020-04-16
* <p>
* 描述
*/
@Route(path = MogoServicePaths.PATH_ENTRANCE_BUTTON_API)
public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonController {
@Override
public TextView getButton(ButtonIndex index) {
return MogoEntranceButtons.getButton(index);
}
@Override
public void addBottomLayerView(View view, int x, int y) {
EntranceViewHolder.getInstance().addBottomLayerView(view, x, y);
}
@Override
public void removeBottomLayerView(View view) {
EntranceViewHolder.getInstance().removeBottomLayerView(view);
}
@Override
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
EntranceViewHolder.getInstance().showLeftNoticeByType(noticeType, iconRes, content);
}
@Override
public void hideLeftNoticeByType(int noticeType) {
EntranceViewHolder.getInstance().hideLeftNoticeByType(noticeType);
}
@Override
public void init(Context context) {
}
@Override
public void addLeftFeatureView(View view) {
EntranceViewHolder.getInstance().addLeftFeatureView(view);
}
@Override
public void removeLeftFeatureView(View view) {
EntranceViewHolder.getInstance().removeLeftFeatureView(view);
}
}

View File

@@ -1,31 +0,0 @@
package com.mogo.module.extensions.entrance;
import android.widget.TextView;
import com.mogo.service.entrance.ButtonIndex;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-16
* <p>
* 描述
*/
public class MogoEntranceButtons {
private static final Map< ButtonIndex, TextView > sButtons = new HashMap<>();
public static void save( ButtonIndex index, TextView btn ) {
sButtons.put( index, btn );
}
public static TextView getButton( ButtonIndex index ) {
return sButtons.get( index );
}
public static void clear() {
sButtons.clear();
}
}

View File

@@ -1,130 +0,0 @@
package com.mogo.module.extensions.entrance;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import com.mogo.module.extensions.R;
import com.mogo.service.statusmanager.IMogoStatusManager;
public
/**
* @author congtaowang
* @since 2020/7/16
*
* 上传按钮动画
*/
class UploadButtonAnimatorController {
private static final String TAG = "UploadButtonAnimator";
private ImageView mUploading;
private TextView mUpload;
private IMogoStatusManager mStatusManager;
private int mCurrentUploadFrame = 0;
public static final int MSG_FRAME_ANIM = 307;
public static final int MSG_STOP_ANIM = 308;
public static final long TIME_FRAME_INTERVAL_TIME = 80;
private Handler mUploadFrameAnimHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
if ( msg.what == MSG_FRAME_ANIM ) {
if ( mUploadingFrameRes == null || mUploadingFrameRes.length == 0 ) {
if ( mUploading != null ) {
mUploading.setVisibility( View.GONE );
}
if ( mUpload != null ) {
mUpload.setVisibility( View.VISIBLE );
}
return;
}
if ( !mStatusManager.isUploading() ) {
mCurrentUploadFrame = 0;
return;
}
if ( mUploading != null ) {
if ( mCurrentUploadFrame == mUploadingFrameRes.length ) {
mCurrentUploadFrame = 12;
}
mUploading.setImageResource( mUploadingFrameRes[mCurrentUploadFrame++ % mUploadingFrameRes.length] );
}
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_FRAME_ANIM,
TIME_FRAME_INTERVAL_TIME );
} else if ( msg.what == MSG_STOP_ANIM ) {
mStatusManager.setUploadingStatus( TAG, false );
}
}
};
@DrawableRes
private int[] mUploadingFrameRes = {
R.drawable.module_ext_ic_uploading_00000,
R.drawable.module_ext_ic_uploading_00001,
R.drawable.module_ext_ic_uploading_00002,
R.drawable.module_ext_ic_uploading_00003,
R.drawable.module_ext_ic_uploading_00004,
R.drawable.module_ext_ic_uploading_00005,
R.drawable.module_ext_ic_uploading_00006,
R.drawable.module_ext_ic_uploading_00007,
R.drawable.module_ext_ic_uploading_00008,
R.drawable.module_ext_ic_uploading_00009,
R.drawable.module_ext_ic_uploading_00010,
R.drawable.module_ext_ic_uploading_00011,
R.drawable.module_ext_ic_uploading_00012,
R.drawable.module_ext_ic_uploading_00013,
R.drawable.module_ext_ic_uploading_00014,
R.drawable.module_ext_ic_uploading_00015,
R.drawable.module_ext_ic_uploading_00016,
R.drawable.module_ext_ic_uploading_00017,
R.drawable.module_ext_ic_uploading_00018,
R.drawable.module_ext_ic_uploading_00019,
R.drawable.module_ext_ic_uploading_00020,
R.drawable.module_ext_ic_uploading_00021,
R.drawable.module_ext_ic_uploading_00022,
R.drawable.module_ext_ic_uploading_00023,
R.drawable.module_ext_ic_uploading_00024,
R.drawable.module_ext_ic_uploading_00025,
R.drawable.module_ext_ic_uploading_00026,
R.drawable.module_ext_ic_uploading_00027,
R.drawable.module_ext_ic_uploading_00028,
R.drawable.module_ext_ic_uploading_00029,
R.drawable.module_ext_ic_uploading_00030,
R.drawable.module_ext_ic_uploading_00031,
R.drawable.module_ext_ic_uploading_00032,
R.drawable.module_ext_ic_uploading_00033,
R.drawable.module_ext_ic_uploading_00034,
R.drawable.module_ext_ic_uploading_00035,
R.drawable.module_ext_ic_uploading_00036,
R.drawable.module_ext_ic_uploading_00037,
R.drawable.module_ext_ic_uploading_00038,
R.drawable.module_ext_ic_uploading_00039,
R.drawable.module_ext_ic_uploading_00040
};
public UploadButtonAnimatorController( ImageView mUploading, TextView mUpload, IMogoStatusManager mStatusManager ) {
this.mUploading = mUploading;
this.mUpload = mUpload;
this.mStatusManager = mStatusManager;
}
public void doFrameAnimOnUploadButton() {
mUploadFrameAnimHandler.removeMessages( MSG_STOP_ANIM );
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
mUploadFrameAnimHandler.sendEmptyMessage( MSG_FRAME_ANIM );
// 30s 后无论成功与否,停止动画
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
}
public void stopAnimation() {
mCurrentUploadFrame = 0;
mUploadFrameAnimHandler.removeMessages( MSG_FRAME_ANIM );
}
}

View File

@@ -6,11 +6,7 @@ import android.view.View;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapCameraInfoView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.drawer.marker.MapMarkerView;
import com.mogo.module.common.entity.MarkerShowEntity;
/**
* @author lixiaopeng

View File

@@ -2,18 +2,10 @@ package com.mogo.module.extensions.live;
import android.content.Context;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.map.IMogoMapService;
public class ExtensionServiceManager {
private static boolean isInit;
private static Context mContext;
private static IMogoServiceApis mMogoServiceApis;
private static IMogoMapService mMapService;
private static IMogoNavi mNavi;
private ExtensionServiceManager() {
@@ -23,10 +15,6 @@ public class ExtensionServiceManager {
if (!isInit) {
isInit = true;
mContext = context;
mMogoServiceApis = MogoApisHandler.getInstance().getApis();
mMapService = mMogoServiceApis.getMapServiceApi();
mNavi = mMapService.getNavi(context);
}
}
@@ -34,9 +22,5 @@ public class ExtensionServiceManager {
return mContext;
}
public static IMogoNavi getNavi() {
return mNavi;
}
}

View File

@@ -2,8 +2,6 @@ package com.mogo.module.extensions.live.impl;
import android.view.View;
import com.mogo.module.extensions.live.listener.CameraLiveWindowStatusListener;
public interface ICameraWindow<T> {
/**

View File

@@ -1,7 +0,0 @@
package com.mogo.module.extensions.live.listener;
public interface CameraLiveWindowStatusListener {
void onViewShow();
void onViewClose();
}

View File

@@ -1,237 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.transition.TransitionManager;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.constraintlayout.widget.Group;
import com.mogo.eagle.core.utilcode.util.LaunchUtils;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.module.extensions.R;
import java.util.HashMap;
import java.util.Map;
/**
* 带动画的导航框
*
* @author tongchenfei
*/
public class AnimNavInfoView extends BaseNaviInfoView {
private final ImageView turnIcon;
private final TextView distance;
private final TextView distanceUnit;
private final TextView nextRoad;
private final TextView remainingDistance;
private final TextView remainingDistanceUnit;
private final TextView remainingTime;
private final TextView remainingTimeUnit;
private final TextView arriveTime;
private final View naviBg;
private final TextView tvDestinationOnlineCar;
private final Group remainTimeGroup, remainDistanceGroup, arriveTimeGroup;
private final ConstraintSet constraintSet = new ConstraintSet();
public AnimNavInfoView(Context context) {
this(context, null);
}
public AnimNavInfoView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AnimNavInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.include_navi_info_panle, this);
naviBg = findViewById(R.id.module_map_id_navi_bg);
turnIcon = findViewById(R.id.module_map_id_navi_next_info_road_turn_icon);
distance = findViewById(R.id.module_map_id_navi_next_info_distance);
distanceUnit = findViewById(R.id.module_map_id_navi_next_info_distance_unit);
nextRoad = findViewById(R.id.module_map_id_navi_next_info_road);
remainingDistance = findViewById(R.id.module_map_id_remaining_distance);
remainingDistanceUnit = findViewById(R.id.module_map_id_remaining_distance_unit);
remainingTime = findViewById(R.id.module_map_id_remaining_time);
remainingTimeUnit = findViewById(R.id.module_map_id_remaining_time_unit);
arriveTime = findViewById(R.id.module_map_id_arrive_time);
remainTimeGroup = findViewById(R.id.remainTimeGroup);
remainDistanceGroup = findViewById(R.id.remainDistanceGroup);
arriveTimeGroup = findViewById(R.id.arriveTimeGroup);
tvDestinationOnlineCar = findViewById(R.id.module_ext_id_destination_online_car);
if ( tvDestinationOnlineCar != null ) {
tvDestinationOnlineCar.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().showPanel();
Map<String, Object> properties = new HashMap<>();
properties.put("type", 1);
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track("APP_Find_Mogoer", properties);
}
});
}
naviBg.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
try {
LaunchUtils.launchByPkg(getContext(), "com.autonavi.amapauto");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
@Override
public boolean isVisible() {
return getVisibility() == View.VISIBLE;
}
@Override
public void notifyChanged(MogoNaviInfo naviInfo) {
if (naviInfo == null) {
return;
}
fillNextCrossDistance(distance, distanceUnit, naviInfo.getCurStepRetainDistance());
fillNextCrossIconType(turnIcon, naviInfo.getIconResId());
nextRoad.setText(naviInfo.getNextRoadName());
remainingDistance.setText(getFormatSurplusDistance(naviInfo.getPathRetainDistance()));
remainingDistanceUnit.setText(getFormatSurplusDistanceUnit());
remainingTime.setText(getFormatSurplusTime(naviInfo.getPathRetainTime()));
remainingTimeUnit.setText(getFormatSurplusTimeUnit());
arriveTime.setText(getArriveTime(naviInfo.getPathRetainTime()));
}
public void exchangeToSmall(boolean smooth) {
if (!isVisible()) {
return;
}
if (smooth) {
TransitionManager.beginDelayedTransition(this);
}
remainDistanceGroup.setVisibility(View.GONE);
remainTimeGroup.setVisibility(View.GONE);
arriveTimeGroup.setVisibility(View.GONE);
distance.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize_small));
distanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize_small));
// 调整约束
constraintSet.clone(this);
constraintSet.connect(distance.getId(), ConstraintSet.BOTTOM,
turnIcon.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(turnIcon.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_marginLeft));
constraintSet.connect(nextRoad.getId(), ConstraintSet.BOTTOM,
distance.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_map_id_navi_next_info_road_marginBottom_small));
constraintSet.connect(nextRoad.getId(), ConstraintSet.LEFT,
R.id.module_map_id_navi_next_info_turn_info, ConstraintSet.RIGHT,
getResources().getDimensionPixelSize(R.dimen.dp_46));
constraintSet.clear(turnIcon.getId(), ConstraintSet.TOP);
constraintSet.connect(turnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_turn_icon_margin_bottom));
// 目的地车友
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.LEFT);
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.TOP);
constraintSet.connect(tvDestinationOnlineCar.getId(),
ConstraintSet.BOTTOM, naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_small_margin_bottom));
constraintSet.connect(tvDestinationOnlineCar.getId(),
ConstraintSet.RIGHT, naviBg.getId(), ConstraintSet.RIGHT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_small_margin_right));
constraintSet.applyTo(this);
turnIcon.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_height);
turnIcon.getLayoutParams().width =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_small_width);
naviBg.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_small_height);
tvDestinationOnlineCar.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_button_height_small);
tvDestinationOnlineCar.setBackgroundResource(R.drawable.module_ext_dw_navi_info_panel_small_bkg);
}
public void exchangeToBig(boolean smooth) {
if (!isVisible()) {
return;
}
if (smooth) {
TransitionManager.beginDelayedTransition(this);
}
remainDistanceGroup.setVisibility(View.VISIBLE);
remainTimeGroup.setVisibility(View.VISIBLE);
arriveTimeGroup.setVisibility(View.VISIBLE);
distance.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_textSize));
distanceUnit.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_next_info_distance_unit_textSize));
// 调整约束
constraintSet.clone(this);
constraintSet.clear(distance.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(turnIcon.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT,
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_marginLeft));
constraintSet.connect(nextRoad.getId(), ConstraintSet.BOTTOM, turnIcon.getId(),
ConstraintSet.BOTTOM);
constraintSet.connect(nextRoad.getId(), ConstraintSet.LEFT,
distance.getId(), ConstraintSet.LEFT,
0);
constraintSet.connect(turnIcon.getId(), ConstraintSet.TOP, naviBg.getId(),
ConstraintSet.TOP, 0);
constraintSet.connect(turnIcon.getId(), ConstraintSet.BOTTOM,
naviBg.getId(), ConstraintSet.BOTTOM, 0);
// 目的地车友
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.RIGHT);
constraintSet.clear(tvDestinationOnlineCar.getId(), ConstraintSet.BOTTOM);
constraintSet.connect(tvDestinationOnlineCar.getId(), ConstraintSet.LEFT,
naviBg.getId(), ConstraintSet.LEFT);
constraintSet.connect(tvDestinationOnlineCar.getId(), ConstraintSet.TOP,
naviBg.getId(), ConstraintSet.BOTTOM,
getResources().getDimensionPixelSize(R.dimen.module_ext_camera_button_marginTop));
constraintSet.applyTo(this);
turnIcon.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_height);
turnIcon.getLayoutParams().width =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_turn_icon_width);
naviBg.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_navi_info_panel_height);
tvDestinationOnlineCar.getLayoutParams().height =
getResources().getDimensionPixelSize(R.dimen.module_ext_button_height);
tvDestinationOnlineCar.setBackgroundResource(R.drawable.module_ext_dw_navi_info_panel_bkg);
}
}

View File

@@ -1,162 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.map.navi.MogoNaviInfo;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* @author congtaowang
* @since 2019-10-03
* <p>
* 描述
*/
public abstract class BaseNaviInfoView extends ConstraintLayout {
public BaseNaviInfoView(Context context) {
this(context,null);
}
public BaseNaviInfoView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BaseNaviInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public abstract void notifyChanged(MogoNaviInfo naviInfo );
protected void fillNextCrossIconType( ImageView target, int iconId ) {
if ( iconId > 0 ) {
target.setImageResource( iconId );
}
}
protected void fillNextCrossDistance( TextView target, TextView unit, int distance ) {
if ( distance >= 1000 ) {
target.setText( String.format( "%.1f", distance / 1000f ) );
unit.setText( "公里" );
} else {
target.setText( distance + "" );
unit.setText( "" );
}
}
protected void fillFormatSurplusDistance( int m, StringBuilder builder ) {
if ( m >= 1000 ) {
builder.append( String.format( "%.1f公里", m / 1000f ) );
} else {
builder.append( m ).append( "" );
}
}
protected String getFormatSurplusDistance( int m ) {
if ( m >= 1000 ) {
mFormatSurplusDistanceUnit = "公里";
return String.format( "%.1f", m / 1000f );
} else {
mFormatSurplusDistanceUnit = "";
return String.format( "%d", m );
}
}
private String mFormatSurplusDistanceUnit = "";
protected String getFormatSurplusDistanceUnit() {
return mFormatSurplusDistanceUnit;
}
protected String getFormatSurplusTime( int seconds ) {
if ( seconds > 60 * 60 ) {
mFormatSurplusTimeUnit = "小时";
return String.format( "%.1f", ( ( float ) seconds ) / ( 60 * 60 ) );
}
if ( seconds > 60 ) {
mFormatSurplusTimeUnit = "分钟";
return String.format( "%.1f", ( ( float ) seconds ) / 60 );
}
mFormatSurplusTimeUnit = "";
return String.format( "%d", seconds );
}
private String mFormatSurplusTimeUnit = "";
protected String getFormatSurplusTimeUnit() {
return mFormatSurplusTimeUnit;
}
protected void fillFormatTime( int seconds, StringBuilder builder ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
builder.append( days ).append( "" );
}
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
if ( hours > 0 ) {
builder.append( hours ).append( "小时" );
}
seconds -= hours * 60 * 60;
int min = seconds / 60;
builder.append( min > 1 ? min : 1 ).append( "分钟" );
}
protected String getArriveTime( int seconds ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
return String.format( "%d天后", days );
} else {
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
seconds -= hours * 60 * 60;
int min = seconds / 60;
Calendar calendar = Calendar.getInstance();
int curHour = calendar.get( Calendar.HOUR_OF_DAY );
int curMin = calendar.get( Calendar.MINUTE );
if ( curHour + hours + ( curMin + min ) / 60 > 24 ) {
return "一天后";
} else {
calendar.add( Calendar.HOUR_OF_DAY, hours );
calendar.add( Calendar.MINUTE, min );
SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm" );
return dateFormat.format( calendar.getTime() );
}
}
}
protected void fillArriveTime( int seconds, StringBuilder builder ) {
int days = seconds / ( 24 * 60 * 60 );
if ( days > 0 ) {
builder.append( days ).append( "天后" );
} else {
seconds -= days * 24 * 60 * 60;
int hours = seconds / ( 60 * 60 );
seconds -= hours * 60 * 60;
int min = seconds / 60;
Calendar calendar = Calendar.getInstance();
int curHour = calendar.get( Calendar.HOUR_OF_DAY );
int curMin = calendar.get( Calendar.MINUTE );
if ( curHour + hours + ( curMin + min ) / 60 > 24 ) {
builder.append( "一天后" );
} else {
calendar.add( Calendar.HOUR_OF_DAY, hours );
calendar.add( Calendar.MINUTE, min );
SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm" );
builder.append( dateFormat.format( calendar.getTime() ) );
}
}
builder.append( "到达" );
}
public abstract boolean isVisible();
}

View File

@@ -1,83 +0,0 @@
package com.mogo.module.extensions.navi;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.module.extensions.R;
/**
* @author congtaowang
* @since 2019-09-29
* <p>
* 导航信息
*
* @deprecated 已经废弃
*/
@Deprecated
public class NaviInfoView extends BaseNaviInfoView {
private ImageView turnIcon;
private TextView distance;
private TextView distanceUnit;
private TextView nextRoad;
private TextView remainingDistance;
private TextView remainingDistanceUnit;
private TextView remainingTime;
private TextView remainingTimeUnit;
private TextView arriveTime;
public NaviInfoView(Context context) {
this(context,null);
}
public NaviInfoView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public NaviInfoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
// public NaviInfoView(View view) {
// super(view);
// turnIcon = view.findViewById( R.id.module_map_id_navi_next_info_road_turn_icon );
// distance = view.findViewById( R.id.module_map_id_navi_next_info_distance );
// distanceUnit = view.findViewById( R.id.module_map_id_navi_next_info_distance_unit );
// nextRoad = view.findViewById( R.id.module_map_id_navi_next_info_road );
//
// remainingDistance = view.findViewById( R.id.module_map_id_remaining_distance );
// remainingDistanceUnit = view.findViewById( R.id.module_map_id_remaining_distance_unit );
// remainingTime = view.findViewById( R.id.module_map_id_remaining_time );
// remainingTimeUnit = view.findViewById( R.id.module_map_id_remaining_time_unit );
// arriveTime = view.findViewById( R.id.module_map_id_arrive_time );
// }
@Override
public boolean isVisible() {
return turnIcon != null && turnIcon.getVisibility() == View.VISIBLE;
}
@Override
public void notifyChanged( MogoNaviInfo naviInfo ) {
if ( naviInfo == null ) {
return;
}
fillNextCrossDistance( distance, distanceUnit, naviInfo.getCurStepRetainDistance() );
fillNextCrossIconType( turnIcon, naviInfo.getIconResId() );
nextRoad.setText( naviInfo.getNextRoadName() );
remainingDistance.setText( getFormatSurplusDistance( naviInfo.getPathRetainDistance() ) );
remainingDistanceUnit.setText( getFormatSurplusDistanceUnit() );
remainingTime.setText( getFormatSurplusTime( naviInfo.getPathRetainTime() ) );
remainingTimeUnit.setText( getFormatSurplusTimeUnit() );
arriveTime.setText( getArriveTime( naviInfo.getPathRetainTime() ) );
}
}

View File

@@ -1,25 +0,0 @@
package com.mogo.module.extensions.net;
import com.mogo.module.extensions.weather.WebWeatherData;
import io.reactivex.Observer;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 描述
*/
public interface NetApiServices {
/**
* 天气接口
*
* @param area 城市Id
* @return
*/
@GET( "/common/?type=observe&key=a2c37c5b84a29761bf0abf8b98e6b708" )
Observer< WebWeatherData > requestWeatherData( @Query( "area" ) String area );
}

View File

@@ -1,25 +0,0 @@
package com.mogo.module.extensions.net;
import com.mogo.module.extensions.userinfo.UserInfoResponse;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.Single;
import retrofit2.http.GET;
import retrofit2.http.QueryMap;
/**
* 个人信息的获取api接口baseUrl跟其他不太一样
*
* @author tongchenfei
*/
public interface UserInfoNetApiServices {
/**
* 获取用户个人信息
* @param params 参数
* @return Observer
*/
@GET("carlife/carMachine/getAccountInfo")
Single<UserInfoResponse> requestUserInfo(@QueryMap Map<String, String> params);
}

View File

@@ -1,27 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户的家和公司位置信息封装,用于接口获取
*
* @author tongchenfei
*/
public class Address {
private String companyAddress;
private String homeAddress;
public String getCompanyAddress() {
return companyAddress;
}
public void setCompanyAddress(String companyAddress) {
this.companyAddress = companyAddress;
}
public String getHomeAddress() {
return homeAddress;
}
public void setHomeAddress(String homeAddress) {
this.homeAddress = homeAddress;
}
}

View File

@@ -1,113 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户的个人信息
*
* @author tongchenfei
*/
public class UserInfo {
private String userId;
private String phone;
private String displayName;
private Address additionalOne;
private String headImgurl;
private int ownerAuthState;
private int score;
private String memberLevel;
private String activeTime;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public Address getAdditionalOne() {
return additionalOne;
}
public void setAdditionalOne(Address additionalOne) {
this.additionalOne = additionalOne;
}
public String getHeadImgurl() {
return headImgurl;
}
public void setHeadImgurl(String headImgurl) {
this.headImgurl = headImgurl;
}
public int getOwnerAuthState() {
return ownerAuthState;
}
public void setOwnerAuthState(int ownerAuthState) {
this.ownerAuthState = ownerAuthState;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String getMemberLevel() {
return memberLevel;
}
public void setMemberLevel(String memberLevel) {
this.memberLevel = memberLevel;
}
public String getActiveTime() {
return activeTime;
}
public void setActiveTime(String activeTime) {
this.activeTime = activeTime;
}
@Override
public String toString() {
return "UserInfo{" +
"userId='" + userId + '\'' +
", phone='" + phone + '\'' +
", displayName='" + displayName + '\'' +
", additionalOne=" + additionalOne +
", headImgurl='" + headImgurl + '\'' +
", ownerAuthState=" + ownerAuthState +
", score=" + score +
", memberLevel='" + memberLevel + '\'' +
", activeTime='" + activeTime + '\'' +
'}';
}
}

View File

@@ -1,36 +0,0 @@
package com.mogo.module.extensions.userinfo;
/**
* 用户信息响应封装类
*
* @author tongchenfei
*/
public class UserInfoResponse {
private String errmsg;
private int errno;
private UserInfo result;
public String getErrmsg() {
return errmsg;
}
public void setErrmsg(String errmsg) {
this.errmsg = errmsg;
}
public int getErrno() {
return errno;
}
public void setErrno(int errno) {
this.errno = errno;
}
public UserInfo getResult() {
return result;
}
public void setResult(UserInfo result) {
this.result = result;
}
}

View File

@@ -63,16 +63,6 @@ public class CameraLiveNoticeHelper implements IMogoCloudOnMsgListener {
mContext = null;
}
public void enterVrMode() {
Logger.d(TAG, "进入vr模式=========");
isVrMode = true;
}
public void exitVrMode() {
Logger.d(TAG, "退出vr模式=========");
isVrMode = false;
}
/**
* PushRoadConditionDrawer
* vr模式

View File

@@ -1,287 +0,0 @@
package com.mogo.module.extensions.utils;
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.extensions.R;
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
import com.mogo.service.windowview.IMogoEntranceViewListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 入口页view管理
*
* @author tongchenfei
*/
public class EntranceViewHolder {
private static final String TAG = "EntranceViewHolder";
private EntranceViewHolder() {
}
private volatile static EntranceViewHolder instance = null;
public static EntranceViewHolder getInstance() {
if (instance == null) {
synchronized (EntranceViewHolder.class) {
if (instance == null) {
instance = new EntranceViewHolder();
}
}
}
return instance;
}
private final List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
private final List<View> leftFeaturePreAddView = new ArrayList<>();
private View preAddLeftNoticeView = null;
private ViewGroup rootViewGroup = null;
private ViewGroup featureViewGroup = null;
private ViewGroup leftNoticeContainer = null;
public void initRootViewGroup(View rootView) {
Logger.i(TAG, "initRootViewGroup==");
if (rootView instanceof ViewGroup) {
Logger.d(TAG, "initRootViewGroup 赋值");
rootViewGroup = (ViewGroup) rootView.getParent();
leftNoticeContainer =
rootView.findViewById(R.id.module_ext_vr_mode_left_notice_container);
featureViewGroup = rootView.findViewById(R.id.module_entrance_id_buttons_container);
if (!preAddView.isEmpty()) {
Logger.d(TAG, "initRootViewGroup 增加底层view: " + preAddView.size());
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
while (iterator.hasNext()) {
BottomLayerViewWrapper wrapper = iterator.next();
realAddView(wrapper);
iterator.remove();
}
}
if (!leftFeaturePreAddView.isEmpty()) {
Logger.d(TAG, "initRootViewGroup 增加左下角FeatureView " + leftFeaturePreAddView.size());
for (View view : leftFeaturePreAddView) {
featureViewGroup.addView(view);
}
}
if (preAddLeftNoticeView != null) {
realShowLeftNoticeView(preAddLeftNoticeView);
}
}
}
public void addBottomLayerView(View view) {
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null));
addBottomLayerView(view, 0, 0);
}
public void addBottomLayerView(View view, int x, int y) {
Logger.d(TAG, "addBottomLayerView, rootViewGroup is null: " + (rootViewGroup == null) +
"\n x: " + x + ", y: " + y);
BottomLayerViewWrapper wrapper = new BottomLayerViewWrapper(view, x, y);
if (rootViewGroup == null) {
if (!preAddView.contains(wrapper)) {
preAddView.add(wrapper);
}
} else {
if (!containView(view)) {
realAddView(wrapper);
}
}
}
private boolean containView(View view) {
int count = rootViewGroup.getChildCount();
for (int i = 0; i < count; i++) {
if (rootViewGroup.getChildAt(i).equals(view)) {
return true;
}
}
return false;
}
private boolean containFeatureView(View view) {
int count = featureViewGroup.getChildCount();
for (int i = 0; i < count; i++) {
if (featureViewGroup.getChildAt(i).equals(view)) {
return true;
}
}
return false;
}
/**
* 使用的时候需要预先判断rootViewGroup是否为空本方法默认rootViewGroup不为空
*/
private void realAddView(BottomLayerViewWrapper wrapper) {
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
params.topMargin = wrapper.getY();
params.leftMargin = wrapper.getX();
View v = wrapper.getView();
v.setLayoutParams(params);
rootViewGroup.addView(v, 0);
// rootViewGroup.setBackgroundColor(Color.WHITE);
}
public void removeBottomLayerView(View view) {
if (rootViewGroup != null) {
rootViewGroup.removeView(view);
}
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
while (iterator.hasNext()) {
BottomLayerViewWrapper wrapper = iterator.next();
if (wrapper.getView().equals(view)) {
iterator.remove();
}
}
}
public void addLeftFeatureView(View view) {
Logger.d(TAG, "addLeftFeatureView==" + view);
if (featureViewGroup == null) {
// 先缓存起来,等待时机加载
if (!leftFeaturePreAddView.contains(view)) {
leftFeaturePreAddView.add(view);
}
} else {
// 直接加载
if (!containFeatureView(view)) {
featureViewGroup.addView(view);
}
}
}
public void removeLeftFeatureView(View view) {
if (featureViewGroup != null) {
featureViewGroup.removeView(view);
}
Iterator<View> iterator = leftFeaturePreAddView.iterator();
while (iterator.hasNext()) {
View wrapper = iterator.next();
if (wrapper.equals(view)) {
iterator.remove();
}
}
}
public void showLeftNoticeView(View view) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (leftNoticeContainer != null) {
realShowLeftNoticeView(view);
} else {
preAddLeftNoticeView = view;
}
}
}
public void hideLeftNoticeView(View view) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
preAddLeftNoticeView = null;
}
if (leftNoticeContainer != null) {
realHideLeftNoticeView(view);
}
}
}
public void forceHideNoticeView() {
for (IMogoEntranceViewListener listener : listeners) {
listener.onViewRemoved(currentShowNoticeType);
}
preAddLeftNoticeView = null;
currentShowNoticeType = 0;
if (leftNoticeContainer != null) {
leftNoticeContainer.removeAllViews();
}
}
private int currentShowNoticeType = 0;
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (currentShowNoticeType != noticeType && currentShowNoticeType != 0) {
for (IMogoEntranceViewListener listener : listeners) {
listener.onViewRemoved(currentShowNoticeType);
}
}
currentShowNoticeType = noticeType;
if (leftNoticeContainer != null) {
realShowLeftNoticeView(generateNoticeViewByType(noticeType, iconRes, content));
} else {
preAddLeftNoticeView = generateNoticeViewByType(noticeType, iconRes, content);
}
}
}
public void hideLeftNoticeByType(int noticeType) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (currentShowNoticeType == noticeType) {
forceHideNoticeView();
}
}
}
private View generateNoticeViewByType(int noticeType, int iconRes, String content) {
View view =
LayoutInflater.from(leftNoticeContainer.getContext()).inflate(R.layout.item_vr_left_notice, leftNoticeContainer, false);
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
if (noticeType == NOTICE_TYPE_SEEK_HELP) {
// 自车求助,是橘色的背景
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_orange_bg);
} else {
// 其他是红色背景
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_red_bg);
}
icon.setImageResource(iconRes);
TextView tvContent = view.findViewById(R.id.module_ext_tv_left_notice_content);
tvContent.setText(content);
return view;
}
private void realShowLeftNoticeView(View view) {
leftNoticeContainer.setVisibility(View.VISIBLE);
leftNoticeContainer.removeAllViews();
leftNoticeContainer.addView(view);
preAddLeftNoticeView = null;
for (IMogoEntranceViewListener listener : listeners) {
listener.onViewAdded(currentShowNoticeType);
}
}
private void realHideLeftNoticeView(View view) {
leftNoticeContainer.removeView(view);
leftNoticeContainer.setVisibility(View.GONE);
}
private final List<IMogoEntranceViewListener> listeners = new ArrayList<>();
public void addEntranceViewListener(IMogoEntranceViewListener listener) {
listeners.add(listener);
}
public void removeEntranceViewListener(IMogoEntranceViewListener listener) {
listeners.remove(listener);
}
public void release() {
rootViewGroup = null;
featureViewGroup = null;
leftNoticeContainer = null;
}
}

View File

@@ -1,19 +1,15 @@
package com.mogo.module.extensions.utils;
import android.animation.Animator;
import android.os.Handler;
import android.util.ArrayMap;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.extensions.ExtensionsModuleConst;
import com.mogo.module.extensions.R;
@@ -54,11 +50,6 @@ public class TopViewAnimHelper {
return instance;
}
private IMogoMapUIController mogoMapUIController;
public void setIMogoMapUIController(IMogoMapUIController mogoMapUIController) {
this.mogoMapUIController = mogoMapUIController;
}
public void init(ConstraintLayout rootView) {
init(rootView, null);
@@ -314,7 +305,6 @@ public class TopViewAnimHelper {
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
topContainer.animate().translationY(params.height).setListener(mainAnimListener).start();
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
} catch (Exception e) {
Logger.e(TAG, e, "添加view异常");
e.printStackTrace();
@@ -364,7 +354,6 @@ public class TopViewAnimHelper {
int scene = 0;
scene = Scene.AIMLESS;
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
}
}
@@ -383,7 +372,6 @@ public class TopViewAnimHelper {
scene = Scene.NAVI;
}
Logger.d(TAG, "navi show setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
checkCameraModePosition(true);
}
@@ -400,7 +388,6 @@ public class TopViewAnimHelper {
scene = Scene.AIMLESS_WITH_ROAD_EVENT;
}
Logger.d(TAG, "hide navi setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
checkCameraModePosition(true);
}
@@ -448,8 +435,6 @@ public class TopViewAnimHelper {
topContainer.setTranslationY(0);
topContainer.removeAllViews();
hideNaviView();
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
}
public void removeAllView() {

View File

@@ -10,12 +10,12 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
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.TopView;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import java.util.Map;
@@ -98,7 +98,6 @@ public class TopViewNoLinkageAnimHelper {
topContainerNoLinkage.animate().translationY(child.getHeight()).setListener(mainAnimListener).start();
int scene = Scene.AIMLESS_WITH_ROAD_EVENT;
Logger.d(TAG, "show top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
});
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, true);
@@ -135,7 +134,6 @@ public class TopViewNoLinkageAnimHelper {
topContainerNoLinkage.animate().translationY(-topContainerNoLinkage.getTranslationY()).setListener(mainAnimListener).start();
int scene = Scene.AIMLESS;
Logger.d(TAG, "hide top setMapCenterPointByScene: " + scene);
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, scene);
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setTopViewShow(ExtensionsModuleConst.TYPE_ENTRANCE, false);
}
}
@@ -159,7 +157,6 @@ public class TopViewNoLinkageAnimHelper {
}
topContainerNoLinkage.removeAllViews();
}
MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS);
}
public void clear() {
@@ -167,16 +164,6 @@ public class TopViewNoLinkageAnimHelper {
topContainerNoLinkage = null;
}
public void enterVrMode() {
removeAllView();
topContainerNoLinkage.getLayoutParams().width = (int) getDimen(R.dimen.module_ext_top_view_no_link_width_in_vr_mode);
}
public void exitVrMode() {
removeAllView();
topContainerNoLinkage.getLayoutParams().width = LayoutParams.MATCH_PARENT;
}
private final Animator.AnimatorListener mainAnimListener = new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {

View File

@@ -1,141 +0,0 @@
package com.mogo.module.extensions.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.IntDef;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.module.common.constants.TrafficLightConst;
import com.mogo.module.extensions.R;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GRAY;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_GREEN;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_RED;
import static com.mogo.module.common.constants.TrafficLightConst.TRAFFIC_LIGHT_COLOR_YELLOW;
/**
* vr模式下的纵向显示的红绿灯封装
*
* @author tongchenfei
*/
public class VerticalTrafficLightView extends ConstraintLayout {
private static final String TAG = "VerticalTrafficLightView";
private ImageView ivTrafficLight, ivNoLeftTime;
private TextView tvLeftTime, tvLeftTimeUnit;
private Group groupLeftTime;
private static final int[] TURN_AROUND_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_around_gray, R.drawable.module_ext_dw_traffic_turn_around_red, R.drawable.module_ext_dw_traffic_turn_around_yellow, R.drawable.module_ext_dw_traffic_turn_around_green};
private static final int[] TURN_LEFT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_left_gray, R.drawable.module_ext_dw_traffic_turn_left_red, R.drawable.module_ext_dw_traffic_turn_left_yellow, R.drawable.module_ext_dw_traffic_turn_left_green};
private static final int[] STRAIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_straight_gray, R.drawable.module_ext_dw_traffic_straight_red, R.drawable.module_ext_dw_traffic_straight_yellow, R.drawable.module_ext_dw_traffic_straight_green};
private static final int[] TURN_RIGHT_ICON_RES = new int[]{R.drawable.module_ext_dw_traffic_turn_right_gray, R.drawable.module_ext_dw_traffic_turn_right_red, R.drawable.module_ext_dw_traffic_turn_right_yellow, R.drawable.module_ext_dw_traffic_turn_right_green};
private final int[] iconRes;
private final int[] colorRes = new int[]{-1, Color.parseColor("#F63A35"), Color.parseColor("#FFA71F"), Color.parseColor("#11FF89")};
public VerticalTrafficLightView(Context context) {
this(context, null);
}
public VerticalTrafficLightView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public VerticalTrafficLightView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.merge_vertical_traffic_light_in_vr, this);
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.VerticalTrafficLightView, 0, 0);
int lightType = typedArray.getInt(R.styleable.VerticalTrafficLightView_iconRes, 0);
typedArray.recycle();
switch (lightType) {
case 1:
// turn left
iconRes = TURN_LEFT_ICON_RES;
break;
case 2:
// straight
iconRes = STRAIGHT_ICON_RES;
break;
case 3:
// turn right
iconRes = TURN_RIGHT_ICON_RES;
break;
default:
// turn around
iconRes = TURN_AROUND_ICON_RES;
break;
}
initView();
}
private void initView() {
ivTrafficLight = findViewById(R.id.module_ext_id_traffic_light_icon);
ivNoLeftTime = findViewById(R.id.module_ext_id_traffic_light_no_left_time);
tvLeftTime = findViewById(R.id.module_ext_id_traffic_light_left_time);
tvLeftTimeUnit = findViewById(R.id.module_ext_id_traffic_light_left_time_unit);
groupLeftTime = findViewById(R.id.module_ext_id_group_left_time);
ivTrafficLight.setImageResource(iconRes[0]);
}
/**
* 设置红绿灯的颜色,根据颜色来展示不同的效果
*
* @param color 红绿灯颜色{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_GRAY},{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_RED}等四个颜色
*/
private void setTrafficLightColor(@TrafficLightColor int color) {
if (iconRes == null) {
Logger.e(TAG, "红绿灯Icon数据为空无法进行设置");
return;
}
ivTrafficLight.setImageResource(iconRes[color]);
if (color != TRAFFIC_LIGHT_COLOR_GRAY) {
tvLeftTime.setTextColor(colorRes[color]);
tvLeftTimeUnit.setTextColor(colorRes[color]);
}
}
/**
* 设置红绿灯剩余时长
*
* @param leftTime 剩余时长null或者empty表示没有时长数据
*/
private void setTrafficLightLeftTime(String leftTime) {
if (leftTime == null || leftTime.isEmpty()) {
groupLeftTime.setVisibility(View.GONE);
ivNoLeftTime.setVisibility(View.VISIBLE);
} else {
groupLeftTime.setVisibility(View.VISIBLE);
ivNoLeftTime.setVisibility(View.GONE);
tvLeftTime.setText(leftTime);
}
}
/**
* 设置红绿灯状态,需设置颜色及时长
*
* @param color 红绿灯颜色,使用{@link TrafficLightConst#TRAFFIC_LIGHT_COLOR_RED}等四个值
* @param leftTime 剩余时长null或者empty表示没有时长数据
*/
public void setTrafficLightStatus(@TrafficLightColor int color, String leftTime) {
setTrafficLightColor(color);
setTrafficLightLeftTime(leftTime);
}
@IntDef({TRAFFIC_LIGHT_COLOR_GRAY, TRAFFIC_LIGHT_COLOR_GREEN, TRAFFIC_LIGHT_COLOR_RED, TRAFFIC_LIGHT_COLOR_YELLOW})
@Retention(RetentionPolicy.SOURCE)
public @interface TrafficLightColor {
}
}

View File

@@ -1,101 +0,0 @@
package com.mogo.module.extensions.weather;
import android.text.TextUtils;
import com.mogo.module.extensions.R;
import java.util.HashMap;
import java.util.Map;
/**
* @author Lzq
*/
public enum Phenomena {
Sunny( "00", "", "Sunny", R.drawable.module_ext_ic_sunny ),
Cloudy( "01", "多云", "Cloudy", R.drawable.module_ext_ic_cloudy ),
Overcast( "02", "", "Overcast", R.drawable.module_ext_ic_overcast ),
Shower( "03", "阵雨", "Shower", R.drawable.module_ext_ic_shower ),
Thundershower( "04", "雷阵雨", "Thundershower", R.drawable.module_ext_ic_thundershower ),
ThundershowerWithHail( "05", "雷阵雨伴有冰雹", "Thundershower with hail", R.drawable.module_ext_ic_thundershower ),
Sleet( "06", "雨夹雪", "Sleet", R.drawable.module_ext_ic_snow ),
LightRain( "07", "小雨", "Light rain", R.drawable.module_ext_ic_light_rain ),
ModerateRain( "08", "中雨", "Moderate rain", R.drawable.module_ext_ic_light_rain ),
HeavyRain( "09", "大雨", "Heavy rain", R.drawable.module_ext_ic_heavy_rain ),
Storm( "10", "暴雨", "Storm", R.drawable.module_ext_ic_heavy_rain ),
HeavyStorm( "11", "大暴雨", "Heavy storm", R.drawable.module_ext_ic_heavy_rain ),
SevereStorm( "12", "特大暴雨", "Severe storm", R.drawable.module_ext_ic_severe_storm ),
SnowFlurry( "13", "阵雪", "Snow flurry", R.drawable.module_ext_ic_snow ),
LightSnow( "14", "小雪", "Light snow", R.drawable.module_ext_ic_snow ),
ModerateSnow( "15", "中雪", "Moderate snow", R.drawable.module_ext_ic_snow ),
HeavySnow( "16", "大雪", "Heavy snow", R.drawable.module_ext_ic_snow ),
Snowstorm( "17", "暴雪", "Snowstorm", R.drawable.module_ext_ic_snow ),
Foggy( "18", "", "Foggy", R.drawable.module_ext_ic_fog ),
IceRain( "19", "冻雨", "Ice rain", R.drawable.module_ext_ic_heavy_rain ),
Duststorm( "20", "沙尘暴", "Duststorm", R.drawable.module_ext_ic_duststorm ),
LightToModerateRain( "21", "小到中雨", "Light to moderate rain", R.drawable.module_ext_ic_moderate_rain ),
ModerateToHeavyRain( "22", "中到大雨", "Moderate to heavy rain", R.drawable.module_ext_ic_heavy_rain ),
HeavyRainToStorm( "23", "大到大雨", "Heavy rain to storm", R.drawable.module_ext_ic_heavy_rain ),
StormToHeavyStorm( "24", "暴雨到大暴雨", "Storm to heavy storm", R.drawable.module_ext_ic_severe_storm ),
HeavyToSevereStorm( "25", "大暴雨到特大暴雨", "Heavy to severe storm", R.drawable.module_ext_ic_severe_storm ),
LightToModerateSnow( "26", "小到中雪", "Light to moderate snow", R.drawable.module_ext_ic_snow ),
ModerateToHeavySnow( "27", "中到大雪", "Moderate to heavy snow", R.drawable.module_ext_ic_snow ),
HeavySnowToSnowStorm( "28", "大到暴雪", "Heavy snow to snowstorm", R.drawable.module_ext_ic_snow ),
Dust( "29", "浮尘", "Dust", R.drawable.module_ext_ic_dust_sand ),
Sand( "30", "扬沙", "Sand", R.drawable.module_ext_ic_dust_sand ),
SandStorm( "31", "强沙尘暴", "Sandstorm", R.drawable.module_ext_ic_duststorm ),
Densefog( "32", "浓雾", "Dense fog", R.drawable.module_ext_ic_fog ),
StrongFog( "49", "强浓雾", "Strong fog", R.drawable.module_ext_ic_fog ),
DenseFog( "57", "大雾", "Dense fog", R.drawable.module_ext_ic_fog ),
ExtraHeavyFog( "58", "特强浓雾", "Extra heavy fog", R.drawable.module_ext_ic_fog ),
Haze( "53", "", "Haze", R.drawable.module_ext_ic_haze ),
ModerateHaze( "54", "中度霾", "Moderate haze", R.drawable.module_ext_ic_haze ),
Severehaze( "55", "重度霾", "Severe haze", R.drawable.module_ext_ic_haze ),
SevereHaze( "56", "严重霾", "Severe haze", R.drawable.module_ext_ic_haze ),
Unknown( "99", "", "Unknown", R.drawable.module_ext_ic_unknown ),
Rain( "301", "", "rain", R.drawable.module_ext_ic_heavy_rain ),
Snow( "302", "", "snow", R.drawable.module_ext_ic_snow );
public final String id;
public final String nameCn;
public final String nameEn;
public final int resId;
Phenomena( String id, String nameCn, String nameEn, int resId ) {
this.id = id;
this.nameCn = nameCn;
this.nameEn = nameEn;
this.resId = resId;
}
static Map< String, Phenomena > mPhenomenas;
static {
if ( mPhenomenas == null ) {
synchronized ( Phenomena.class ) {
if ( mPhenomenas == null ) {
mPhenomenas = new HashMap<>();
for ( Phenomena weather : Phenomena.values() ) {
mPhenomenas.put( weather.id, weather );
}
}
}
}
}
public static synchronized Phenomena getById( String id ) {
if ( TextUtils.isEmpty( id ) ) {
return null;
}
return mPhenomenas.get( id );
}
}

View File

@@ -1,91 +0,0 @@
package com.mogo.module.extensions.weather;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.Layout;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;
import java.lang.reflect.Field;
/**
* 带边框的textView
*
* @author tongchenfei
*/
public class StrokeTextView extends AppCompatTextView {
public StrokeTextView(Context context) {
this(context,null);
}
public StrokeTextView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public StrokeTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void setTextAppearance(Context context, int resId) {
super.setTextAppearance(context, resId);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = getMeasuredWidth();
if (widthMode == MeasureSpec.AT_MOST) {
widthSize += 20;
Layout mLayout = getLayout();
if (mLayout != null) {
mLayout.increaseWidthTo(widthSize);
}
setMeasuredDimension(widthSize, getMeasuredHeight());
}
}
@Override
protected void onDraw(Canvas canvas) {
int oriColor = getCurrentTextColor();
// 先画边框
TextPaint paint = getPaint();
setCurTextColor(Color.YELLOW);
paint.setStyle(Paint.Style.STROKE);
paint.setShadowLayer(10F, 0F, 0F, Color.YELLOW);
float b = getTextSize() / 20;
float shadowWidth = Math.max(b, 2f);
paint.setStrokeWidth(shadowWidth);
super.onDraw(canvas);
// 再画文字
setCurTextColor(oriColor);
paint.setStyle(Paint.Style.FILL);
super.onDraw(canvas);
}
/**
* 通过反射直接设置mCurTextColor这个变量直接调用{@link #setTextColor(int)}会出现重复递归的问题
*
* @param color 要设置的颜色值
*/
private void setCurTextColor(int color) {
try {
Field mCurTextColor = TextView.class.getDeclaredField("mCurTextColor");
mCurTextColor.setAccessible(true);
mCurTextColor.set(this,color);
mCurTextColor.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,5 +0,0 @@
package com.mogo.module.extensions.weather;
public interface WeatherCallback {
void onWeatherLoaded( WeatherInfo weatherInfo );
}

View File

@@ -1,32 +0,0 @@
package com.mogo.module.extensions.weather;
/**
* 天气
*/
public class WeatherConstants {
public final static String WEATHER_URI = "content://com.zhidao.weather/weatherinfo";
/**
* 天气
*/
public static final String TEMPERATURE = "observetemperature";
/**
* 气象
*/
public static final String PHENOMENA = "observephenomena";
/**
* 风向
*/
public static final String WIND_DIRECTION = "observewinddirection";
/**
* 风力
*/
public static final String WIND_FORCE = "observewindforce";
/**
* 天气消息加载完毕
*/
public static final int MSG_WEATHER_LOADED = 0x1000;
}

View File

@@ -1,142 +0,0 @@
package com.mogo.module.extensions.weather;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import java.util.Objects;
/**
* 天气
*/
public class WeatherInfo implements Parcelable {
/**
* 温度
*/
private String temperature;
/**
* 描述信息
*/
private String phenomena;
/**
* 风向
*/
private String windDirection;
/**
* 风力
*/
private String windForce;
@Override
public String toString() {
return "WeatherInfo{" +
"temperature='" + temperature + '\'' +
", phenomena='" + phenomena + '\'' +
", windDirection='" + windDirection + '\'' +
", windForce='" + windForce + '\'' +
'}';
}
@Override
public boolean equals( Object o ) {
if ( this == o ) {
return true;
}
if ( !( o instanceof WeatherInfo ) ) {
return false;
}
WeatherInfo that = ( WeatherInfo ) o;
return Objects.equals( temperature, that.temperature ) &&
Objects.equals( phenomena, that.phenomena ) &&
Objects.equals( windDirection, that.windDirection ) &&
Objects.equals( windForce, that.windForce );
}
@Override
public int hashCode() {
return Objects.hash( temperature, phenomena, windDirection, windForce );
}
public WeatherInfo() {
}
public WeatherInfo( String temperature, String phenomena, String windDirection, String windForce ) {
this.temperature = temperature;
this.phenomena = phenomena;
this.windDirection = windDirection;
this.windForce = windForce;
}
public String getTemperature() {
return temperature;
}
public void setTemperature( String temperature ) {
this.temperature = temperature;
}
public String getPhenomena() {
return phenomena;
}
public void setPhenomena( String phenomena ) {
this.phenomena = phenomena;
}
public String getWindDirection() {
return windDirection;
}
public void setWindDirection( String windDirection ) {
this.windDirection = windDirection;
}
public String getWindForce() {
return windForce;
}
public void setWindForce( String windForce ) {
this.windForce = windForce;
}
public boolean isLegal() {
return !TextUtils.isEmpty( phenomena )
&& !TextUtils.isEmpty( temperature );
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel( Parcel dest, int flags ) {
dest.writeString( this.temperature );
dest.writeString( this.phenomena );
dest.writeString( this.windDirection );
dest.writeString( this.windForce );
}
protected WeatherInfo( Parcel in ) {
this.temperature = in.readString();
this.phenomena = in.readString();
this.windDirection = in.readString();
this.windForce = in.readString();
}
public static final Creator< WeatherInfo > CREATOR = new Creator< WeatherInfo >() {
@Override
public WeatherInfo createFromParcel( Parcel source ) {
return new WeatherInfo( source );
}
@Override
public WeatherInfo[] newArray( int size ) {
return new WeatherInfo[size];
}
};
}

View File

@@ -1,137 +0,0 @@
package com.mogo.module.extensions.weather;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.ThreadPoolService;
import androidx.annotation.NonNull;
/**
* @author congtaowang
* @since 2020-01-05
* <p>
* 描述
*/
public class WeatherModel {
private static final String TAG = "WeatherModel";
private Context mContext;
private Uri mWeatherUri;
private Handler mHandler;
private ContentResolver mContentResolver;
private ContentObserver mContentObserver;
private WeatherCallback mCallback;
public WeatherModel( Context context ) {
this.mContext = context;
}
public void init( WeatherCallback callback ) {
mCallback = callback;
mWeatherUri = Uri.parse( WeatherConstants.WEATHER_URI );
mContentResolver = mContext.getContentResolver();
mHandler = new Handler( Looper.getMainLooper() ) {
@Override
public void handleMessage( @NonNull Message msg ) {
if ( msg.what == WeatherConstants.MSG_WEATHER_LOADED ) {
if ( mCallback != null ) {
mCallback.onWeatherLoaded( ( ( WeatherInfo ) msg.obj ) );
}
}
}
};
mContentObserver = new ContentObserver( mHandler ) {
@Override
public void onChange( boolean selfChange, Uri uri ) {
super.onChange( selfChange, uri );
try {
queryWeatherInformation();
} catch ( Exception e ) {
Logger.e( TAG, e, "error. " );
}
}
};
try {
mContentResolver.registerContentObserver( mWeatherUri, false, mContentObserver );
} catch ( Exception e ) {
Logger.e( TAG, e, "error when query weather info." );
}
}
public void queryWeatherInformation() {
if ( mCallback == null ) {
Logger.e( TAG, "WeatherModel#init should invoked " );
return;
}
startNewThreadToQuery();
}
private void startNewThreadToQuery() {
ThreadPoolService.execute(new Runnable() {
@Override
public void run() {
if ( mContentResolver == null ) {
return;
}
Cursor cursor = null;
try {
cursor = mContentResolver.query( mWeatherUri, null, null, null, null, null );
} catch ( Exception e ) {
return;
}
if ( cursor == null ) {
return;
}
WeatherInfo weatherInfo = new WeatherInfo();
if ( cursor.moveToFirst() ) {
int index = cursor.getColumnIndex( WeatherConstants.TEMPERATURE );
if ( index != -1 ) {
weatherInfo.setTemperature( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.PHENOMENA );
if ( index != -1 ) {
weatherInfo.setPhenomena( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.WIND_DIRECTION );
if ( index != -1 ) {
weatherInfo.setWindDirection( cursor.getString( index ) );
}
index = cursor.getColumnIndex( WeatherConstants.WIND_FORCE );
if ( index != -1 ) {
weatherInfo.setWindForce( cursor.getString( index ) );
}
Message msg = Message.obtain();
msg.obj = weatherInfo;
msg.what = WeatherConstants.MSG_WEATHER_LOADED;
mHandler.sendMessage( msg );
}
cursor.close();
}
} );
}
public void destroy() {
if ( mContentResolver != null && mContentObserver != null ) {
mContentResolver.unregisterContentObserver( mContentObserver );
}
mContext = null;
mWeatherUri = null;
mHandler = null;
mContentResolver = null;
mContentObserver = null;
mCallback = null;
}
}

View File

@@ -1,47 +0,0 @@
package com.mogo.module.extensions.weather;
import com.google.gson.annotations.SerializedName;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 天气数据描述
*/
public class WebWeatherData {
@SerializedName( "observe" )
public ObserveDataType observe;
/**
* 实时数据
*/
public static class ObserveDataType {
@SerializedName( "101010200" )
public ObserveData data;
}
/**
* 实时数据对象
*/
public static class ObserveData {
@SerializedName( "1001002" )
public Data data;
}
/**
* what the fuck.
*/
public static class Data {
@SerializedName( "000" )
public String time;
@SerializedName( "001" )
public String phenomena;
@SerializedName( "002" )
public String temperature;
@SerializedName( "003" )
public String windForce;
@SerializedName( "004" )
public String windDirection;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

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