Merge branch 'release_robotaxi-d-app-module_2130_221116_2.13.0.1' into 'master'

Release robotaxi d app module 2130 221116 2.13.0.1

See merge request zhjt/AndroidApp/MoGoEagleEye!502
This commit is contained in:
pangfan
2023-01-05 09:28:56 +00:00
2043 changed files with 18752 additions and 44324 deletions

View File

@@ -6,15 +6,14 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.elegant.utils.UiThreadHandler;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.MogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -64,8 +63,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
@Override
public void init(Context context) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus"
, StatusDescriptor.VR_MODE, this);
MogoStatusManager.getInstance().registerStatusChangedListener("OchBus",StatusDescriptor.VR_MODE, this);
}
@Override
@@ -106,4 +104,5 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
mActivity.getSupportFragmentManager().beginTransaction().hide(mPassengerFragment).commitAllowingStateLoss();
}
}
}

View File

@@ -13,6 +13,5 @@ import mogo.telematics.pad.MessagePad;
public interface IBusPassengerAutopilotPlanningCallback {
void routeResult(List<LatLng> models,int haveArrivedIndex);
void routePlanningToNextStationChanged(long meters, long timeInSecond);
void setLineMarker(List<LatLng> models);
void updateTotalDistance();
}

View File

@@ -1,6 +1,6 @@
package com.mogo.och.bus.passenger.callback;
import android.location.Location;
import com.mogo.eagle.core.data.map.MogoLocation;
/**
* Created on 2022/3/31
@@ -11,5 +11,5 @@ public interface IBusPassengerControllerStatusCallback {
// 是否vr map模式
void onVRModeChanged(boolean isVRMode);
// 自车定位
void onCarLocationChanged(Location location);
void onCarLocationChanged(MogoLocation location);
}

View File

@@ -39,7 +39,7 @@ class BusPassengerConst {
// 未到站(未到站)
const val STATION_STATUS_ARRIVING = 3
//bus平均速度
//bus平均速度 bus的平均里程25km/h
const val BUS_AVERAGE_SPEED = 25
// 订单总里程

View File

@@ -2,7 +2,6 @@ package com.mogo.och.bus.passenger.model;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.net.ConnectivityManager;
import android.os.Handler;
import android.os.Message;
@@ -11,23 +10,30 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.amap.api.maps.model.LatLng;
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult;
@@ -41,11 +47,8 @@ import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -67,7 +70,7 @@ import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STAT
public class BusPassengerModel {
private static final String TAG = BusPassengerModel.class.getSimpleName();
private List<LatLng> mRoutePoints = new ArrayList<>();
private List<MogoLocation> mRoutePoints = new ArrayList<>();
private static final class SingletonHolder {
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
@@ -85,13 +88,15 @@ public class BusPassengerModel {
private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态
private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新
private double mLongitude, mLatitude;
private MogoLocation mLocation = null;
private BusPassengerRoutesResult routesResult = null;
List<BusPassengerStation> mStations = new ArrayList<>();
private int mNextStationIndex = 0;// 要到达站的index
private List<LatLng> mTwoStationsRouts = new ArrayList<>();
private List<MogoLocation> mTwoStationsRouts = new ArrayList<>();
private int mPreRouteIndex = 0;
private int mWipePreIndex = 0;
private static final int MSG_QUERY_BUS_P_STATION = 1001;
private final Handler handler = new Handler(new Handler.Callback() {
@@ -131,21 +136,31 @@ public class BusPassengerModel {
private void queryDriverOperationStatus() {
BusPassengerServiceManager.queryDriverOperationStatus(mContext
, new OchCommonServiceCallback<BusPassengerOperationStatusResponse>() {
@Override
public void onSuccess(BusPassengerOperationStatusResponse data) {
if (data == null || data.data == null) return;
if(mDriverStatusCallback != null){
mDriverStatusCallback.changeOperationStatus(data.data.driverStatus == 1);
mDriverStatusCallback.updatePlateNumber(data.data.plateNumber);
}
}
@Override
public void onSuccess(BusPassengerOperationStatusResponse data) {
if (data == null || data.data == null) return;
if (mDriverStatusCallback != null) {
mDriverStatusCallback.changeOperationStatus(data.data.driverStatus == 1);
mDriverStatusCallback.updatePlateNumber(data.data.plateNumber);
}
}
@Override
public void onFail(int code, String msg) {
//延迟3s再次查询
queryDriverOperationDelay();
}
});
@Override
public void onError() {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
queryDriverOperationDelay();
}
@Override
public void onFail(int code, String msg) {
//延迟3s再次查询
queryDriverOperationDelay();
}
});
}
public void queryDriverSiteByCoordinate(){
@@ -157,6 +172,7 @@ public class BusPassengerModel {
|| data.getResult() == null
|| data.getResult().getSites() == null) {
routesResult = null;
mNextStationIndex = 0;
startOrStopCalculateRouteInfo(false);
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.showNoTaskView();
@@ -170,14 +186,20 @@ public class BusPassengerModel {
updatePassengerRouteInfo(data.getResult());
}
@Override
public void onError() {
}
@Override
public void onFail(int code, String msg) {
//code = 1003; message = bus车辆已收车或未出车;bus driver shadow,not exists
if (code == 1003){
routesResult = null;
startOrStopCalculateRouteInfo(false);
queryDriverOperationDelay();
return;
}
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg );
}
});
}
@@ -204,6 +226,7 @@ public class BusPassengerModel {
if (i == 0){
startOrStopRouteAndWipe(false);
}
mPreRouteIndex = 0;
startOrStopCalculateRouteInfo(false);
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
return;
@@ -242,46 +265,33 @@ public class BusPassengerModel {
}
private void initListeners() {
MogoAiCloudSocketManager.getInstance(mContext)
.registerLifecycleListener(10010, mSocketLifeCycleLisnter);
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
MogoApisHandler.getInstance()
.getApis()
.getIntentManagerApi()
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
// 达到起始站围栏监听
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.registerCarLocationChangedListener( TAG, mCarLocationChangedListener2);
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
// 定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, mMapLocationListener,false);
//2021.11.1 自动驾驶路线规划接口
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
}
private void releaseListeners() {
MogoApisHandler.getInstance()
.getApis()
.getStatusManagerApi()
.unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
// 注销到达起始站围栏监听
MogoApisHandler.getInstance()
.getApis()
.getRegisterCenterApi()
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
// 注销定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
MogoAiCloudSocketManager.getInstance(mContext)
.unregisterLifecycleListener(10010);
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
}
//监听网络变化,避免启动机器时无网导致无法更新订单信息
@@ -297,40 +307,22 @@ public class BusPassengerModel {
}
};
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
// VR mode变更回调
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (StatusDescriptor.VR_MODE == descriptor) {
if (mControllerStatusCallbackMap.size() > 0) {
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
callback.onVRModeChanged(isTrue);
}
// VR mode变更回调
private final IMogoStatusChangedListener mMogoStatusChangedListener = (descriptor, isTrue) -> {
if (StatusDescriptor.VR_MODE == descriptor) {
if (mControllerStatusCallbackMap.size() > 0) {
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
callback.onVRModeChanged(isTrue);
}
}
}
};
private final IMogoLifecycleListener mSocketLifeCycleLisnter = new IMogoLifecycleListener() {
private final IMoGoMapLocationListener mMapLocationListener = new IMoGoMapLocationListener() {
@Override
public void onConnectFailure() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectFailure"); }
@Override
public void onConnectSuccess() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectSuccess"); }
@Override
public void onConnectLost() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectLost"); }
};
// 自车定位
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
@Override
public void onCarLocationChanged2( Location location ) {
//位置变化时通过围栏判断是否到达x点
// TODO: 2022/3/31
mLongitude = location.getLongitude();
mLatitude = location.getLatitude();
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
if (null == location) return;
mLocation = location;
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
callback.onCarLocationChanged(location);
}
@@ -417,7 +409,6 @@ public class BusPassengerModel {
List<MessagePad.Location> routePoints = routeList.getWayPointsList();
if (null != routePoints && routePoints.size() > 0){
updateRoutePoints(routePoints);
setRouteLineMarker();
startToRouteAndWipe();
}
}
@@ -425,8 +416,8 @@ public class BusPassengerModel {
public void updateRoutePoints(List<MessagePad.Location> routePoints){
mRoutePoints.clear();
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjListCommon(mContext,routePoints);
List<MogoLocation> latLngModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjLocations(mContext,routePoints);
mRoutePoints.addAll(latLngModels);
calculateTwoStationsRoute();
}
@@ -441,13 +432,17 @@ public class BusPassengerModel {
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
//当前站在轨迹中对应的点
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(0
,mRoutePoints
,stationCur.getGcjLon(),stationCur.getGcjLat());
//要前往的站在轨迹中对应的点
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(currentRouteIndex
,mRoutePoints
,stationNext.getGcjLon(),stationNext.getGcjLat());
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==currentRouteIndex = " + currentRouteIndex
+ " nextRouteIndex = " + nextRouteIndex);
if (currentRouteIndex < nextRouteIndex){ //如果找到的next在起点的轨迹前面直接舍弃这个轨迹不显示
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex));
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex + 1));
}
}
}else { //只有两个站点的时候整个路线就是两个站点之间的轨迹
@@ -470,22 +465,37 @@ public class BusPassengerModel {
if (mTwoStationsRouts.size() == 0){
calculateTwoStationsRoute();
}
if (mTwoStationsRouts.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mTwoStationsRouts,mLongitude,mLatitude);
float lastSumLength = 0;
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
lastSumLength = CoordinateUtils.calculateLineDistance(
lastPoints.get(0).longitude, lastPoints.get(0).latitude,
mLongitude, mLatitude);
}else {
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
if (mTwoStationsRouts.size() > 0 && mLocation != null){
Map<Integer,List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
.getRemainPointListByCompareNew(mPreRouteIndex,mTwoStationsRouts,mLocation);
for (int index: lastPointsMap.keySet()) {
mPreRouteIndex = index;
break;
}
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "lastSumLength = " + lastSumLength);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastPoints.size() = " + lastPoints.size());
float lastSumLength = 0;
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex >= 0){
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
lastSumLength = CoordinateUtils.calculateLineDistance(
stationNext.getGcjLon(), stationNext.getGcjLat(),
mLocation.getLongitude(), mLocation.getLatitude());
}else {
lastSumLength = CoordinateUtils.calculateLineDistance(
lastPoints.get(0).getLongitude(), lastPoints.get(0).getLatitude(),
mLocation.getLongitude(), mLocation.getLatitude());
}
}else {
lastSumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(lastPoints);
}
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==lastSumLength = " + lastSumLength);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
}
}
}
}
@@ -507,31 +517,29 @@ public class BusPassengerModel {
if (isStart){
BusPassengerModelLoopManager.getInstance().startOrStopRouteAndWipe();
}else {
mWipePreIndex = 0;
BusPassengerModelLoopManager.getInstance().stopOrStopRouteAndWipe();
}
}
public void loopRouteAndWipe() {
if (mRoutePoints != null && mRoutePoints.size() > 0){
if (mRoutePoints != null && mRoutePoints.size() > 0 && mLocation != null){
int haveArrivedIndex = CoordinateCalculateRouteUtil
.getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude);
.getArrivedPointIndexNew(mWipePreIndex,
mRoutePoints,
mLocation);
mWipePreIndex = haveArrivedIndex;
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = "+ Thread.currentThread().getName()+" haveArrivedIndex== " + haveArrivedIndex);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex);
List<LatLng> routePoints = CoordinateCalculateRouteUtil
.coordinateConverterLocationToLatLng(mContext,mRoutePoints);
mAutopilotPlanningCallback.routeResult(routePoints,haveArrivedIndex);
}
}
}
/**
* 设置小地图路径的起终点marker
*/
public void setRouteLineMarker(){
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.setLineMarker(mRoutePoints);
}
}
/**
* 开始轮询计算剩余里程和时间
* @param isStart

View File

@@ -9,6 +9,7 @@ import androidx.lifecycle.LifecycleOwner;
import com.amap.api.maps.model.LatLng;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -109,7 +110,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
}
@Override
public void onCarLocationChanged(Location location) {
public void onCarLocationChanged(MogoLocation location) {
if (location != null){
runOnUIThread(() -> mView.onCarLocationChanged(location));
}
@@ -157,11 +158,6 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
runOnUIThread(() -> mView.updateRoutePlanningToNextStation(meters, timeInSecond));
}
@Override
public void setLineMarker(List<LatLng> models) {
runOnUIThread(() -> mView.setLineMarker(models));
}
@Override
public void updateTotalDistance() {
runOnUIThread(() -> mView.setProgressBarMax());

View File

@@ -51,14 +51,9 @@ public class BusPassengerMapDirectionView
private TextureMapView mAMapNaviView;
private AMap mAMap;
private Marker mCarMarker;
private Marker mStartMarker;
private Marker mEndMarker;
private int mCurrentIndex = -1;
private int zoomLevel = 13;
private List<LatLng> mCoordinatesLatLng = new ArrayList<>(); //站点坐标数据
private List<LatLng> mLinePointsLatLng = new ArrayList<>(); //轨迹坐标数据
private List<LatLng> mCoordinatesLatLng = new ArrayList<>(); //轨迹坐标数据
private List<LatLng> mLineStationLatLng = new ArrayList<>();//站点坐标数据
private Polyline mPolyline;
private CameraUpdate mCameraUpdate;
private Context mContext;
@@ -129,10 +124,6 @@ public class BusPassengerMapDirectionView
mCarMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_car))
.anchor(0.5f, 0.5f));
mStartMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_way_point)));
mEndMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_end_point)));
mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived);
mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive);
@@ -197,24 +188,23 @@ public class BusPassengerMapDirectionView
mCarMarker.setToTop();
}
if (mLinePointsLatLng.size() > 0){
//圈定地图显示范围
//存放经纬度
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
for (int i = 0; i < mLinePointsLatLng.size(); i++) {
boundsBuilder.include(mLinePointsLatLng.get(i));
}
boundsBuilder.include(currentLatLng);
//第二个参数为四周留空宽度
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
//圈定地图显示范围
LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
if (mCoordinatesLatLng.size() > 0){
//存放经纬度
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
boundsBuilder.include(mCoordinatesLatLng.get(i));
}
//第二个参数为四周留空宽度
}else if (mLineStationLatLng.size() > 0){
for (int i = 0; i< mLineStationLatLng.size();i++){
boundsBuilder.include(mLineStationLatLng.get(i));
}
}
// else {
// //设置希望展示的地图缩放级别
// CameraPosition cameraPosition = new CameraPosition.Builder()
// .target(mCarMarker.getPosition()).tilt(0).bearing(location.getBearing()).zoom(zoomLevel).build();
// mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
// }
boundsBuilder.include(currentLatLng);
mAMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(),100,100,100,100));
}
@@ -227,9 +217,9 @@ public class BusPassengerMapDirectionView
if (mAMap != null) {
addRouteColorList();
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mLinePointsLatLng.size() = " +mLinePointsLatLng.size());
if (mLinePointsLatLng.size() >= 2 && mCoordinatesLatLng.size() > 2) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mLinePointsLatLng.size() = " +mLineStationLatLng.size()
+" mCoordinatesLatLng.size()= " + mCoordinatesLatLng.size());
if (mLineStationLatLng.size() >= 2 && mCoordinatesLatLng.size() > 2) {
//设置线段纹理
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.addAll(mCoordinatesLatLng);
@@ -269,40 +259,18 @@ public class BusPassengerMapDirectionView
if (mPolyline != null) {
mPolyline.remove();
}
if (mStartMarker != null) {
mStartMarker.setVisible(false);
}
if (mEndMarker != null) {
mEndMarker.setVisible(false);
}
}
@Override
public void setLineMarker() {
if (mStartMarker != null) {
mStartMarker.setVisible(false);
}
if (mEndMarker != null) {
mEndMarker.setVisible(false);
}
if (mCoordinatesLatLng.size() > 2) {
// 设置开始结束Marker位置
LatLng startLatLng = mCoordinatesLatLng.get(0);
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
mStartMarker.setPosition(startLatLng);
mEndMarker.setPosition(endLatLng);
mStartMarker.setVisible(true);
mEndMarker.setVisible(true);
}
}
public void clearCoordinatesLatLng(){
textureList.clear();
texIndexList.clear();
mCoordinatesLatLng.clear();
mLinePointsLatLng.clear();
mLineStationLatLng.clear();
CallerLogger.INSTANCE.d(M_BUS_P + TAG, " mCoordinatesLatLng.clear " );
}
@@ -322,19 +290,12 @@ public class BusPassengerMapDirectionView
if (mAMapNaviView != null) {
mAMapNaviView.onPause();
}
mCurrentIndex = -1;
}
public void onDestroy() {
if (mAMapNaviView != null) {
mAMapNaviView.onDestroy();
}
mCurrentIndex = -1;
}
public void setCoordinatesLatLng(List<LatLng> latLngs) {
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs,int haveArrivedIndex) {
@@ -346,40 +307,28 @@ public class BusPassengerMapDirectionView
public void clearLineMarkers(){
for (int i =0; i< mLineMarkers.size();i++){
mLineMarkers.get(i).setVisible(false);
mLineMarkers.get(i).remove();
}
mLineMarkers.clear();
}
public void setLineMarkersAndDraw(List<LatLng> lineineLatLngs){
public void setLinePointMarkerAndDraw(List<LatLng> mLineStationsList, int currentIndex) {
clearLineMarkers();
for (int i = 0; i < lineineLatLngs.size(); i++) {
Marker mWayPointMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_way_point)));
mLineMarkers.add(mWayPointMarker);
}
if (mCoordinatesLatLng.size() == 0) {
for (int i = 0; i < mLineMarkers.size(); i++) {
mLineMarkers.get(i).setPosition(lineineLatLngs.get(i));
mLineMarkers.get(i).setVisible(true);
}
mCurrentIndex = -1;
}
}
mLineStationLatLng.clear();
mLineStationLatLng.addAll(mLineStationsList);
public void setLinePointMarkerAndDraw(List<LatLng> routeLineLatLngs, int currentIndex) {
mLinePointsLatLng.clear();
mLinePointsLatLng.addAll(routeLineLatLngs);
if (mLinePointsLatLng.size() > 0 && mCurrentIndex != currentIndex) {
if (mAMap != null && mLineMarkers.size() > 0) {
mCurrentIndex = currentIndex;
for (int i = 0; i < mLineMarkers.size(); i++) {
if (i != currentIndex && i + 1 != currentIndex) {
mLineMarkers.get(i).setPosition(mLinePointsLatLng.get(i));
mLineMarkers.get(i).setVisible(true);
} else {
mLineMarkers.get(i).setVisible(false);
}
if (mLineStationsList.size() > 0){
for (int i = 0; i < mLineStationsList.size(); i++) {
if (currentIndex == i){
Marker mEndMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_end_point)));
mEndMarker.setPosition(mLineStationsList.get(i));
mLineMarkers.add(i,mEndMarker);
}else {
Marker mStartMarker = mAMap.addMarker(new MarkerOptions()
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_way_point)));
mStartMarker.setPosition(mLineStationsList.get(i));
mLineMarkers.add(i,mStartMarker);
}
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.och.bus.passenger.ui;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
@@ -15,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.amap.api.maps.model.LatLng;
import com.elegant.utils.UiThreadHandler;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
@@ -26,7 +26,6 @@ import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.common.module.wigets.MarqueeTextView;
import java.util.ArrayList;
@@ -46,7 +45,6 @@ public class BusPassengerRouteFragment extends
private BusPassengerTrafficLightView mTrafficLightView;
private List<BusPassengerStation> mStationsList = new ArrayList<>();
private List<LatLng> mLinePointsList = new ArrayList<>();
private TextView mSpeedTv;
private ConstraintLayout mNoLineInfoView;
@@ -104,12 +102,6 @@ public class BusPassengerRouteFragment extends
@Override
public boolean onLongClick(View v) {
BPRouteDataTestUtils.converToRouteData();
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
updateWayPointList(mStationsList,1);
}
},1000);
return false;
}
});
@@ -156,22 +148,6 @@ public class BusPassengerRouteFragment extends
}
}
public void setLineMarker(List<LatLng> latLngList){
if (latLngList.size() > 0) {
if (mMapDirectionView != null) {
mMapDirectionView.setCoordinatesLatLng(latLngList);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.setLineMarker();
}
});
}
} else {
clearMapView();
}
}
/**
* 绘制
*
@@ -213,18 +189,6 @@ public class BusPassengerRouteFragment extends
}
}
public void setLineMarkers(List<LatLng> list) {
if (mMapDirectionView != null) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.setLineMarkersAndDraw(list);
}
});
}
}
public void changeOperationStatus(boolean status) {
if (status) {
mNoLineInfoView.setVisibility(View.GONE);
@@ -298,19 +262,19 @@ public class BusPassengerRouteFragment extends
}
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
mLinePointsList.clear();
List<LatLng> mLineStationsList = new ArrayList<>();
for (int i = 0; i< stations.size(); i++) {//站点集合
LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
,stations.get(i).getLon(),stations.get(i).getLat());// lat,lon
mLinePointsList.add(latLng);
// LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
// ,stations.get(i).getLon(),stations.get(i).getLat());// lat,lon
LatLng latLng = new LatLng(stations.get(i).getGcjLat(),stations.get(i).getGcjLon());// lat,lon
mLineStationsList.add(latLng);
}
setLineMarkers(mLinePointsList);
if (mMapDirectionView != null) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mMapDirectionView.setLinePointMarkerAndDraw(mLinePointsList,currentStationIndex);
mMapDirectionView.setLinePointMarkerAndDraw(mLineStationsList,currentStationIndex);
}
});
}
@@ -337,7 +301,7 @@ public class BusPassengerRouteFragment extends
lastBearing = bearing;
}
public void onCarLocationChanged(Location location) {
public void onCarLocationChanged(MogoLocation location) {
updateSpeedView(location.getSpeed());
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 795 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 996 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -38,8 +38,8 @@
app:layout_constraintLeft_toLeftOf="parent"
app:shadowColor="@color/bus_p_panel_edge_shadow"
app:shadowRadius="@dimen/dp_30"
app:xOffset="0px"
app:yOffset="0px">
app:xOffset="0dp"
app:yOffset="0dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/bus_p_curent_station_panel_width"
@@ -76,8 +76,8 @@
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_27"
app:layout_constraintTop_toTopOf="@+id/bus_p_cur_station_name"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_cur_station_name"
app:layout_constraintRight_toLeftOf="@+id/bus_p_cur_station_name"
@@ -123,8 +123,8 @@
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_75"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_48"
android:src="@drawable/bus_p_mogo_nor"

View File

@@ -8,8 +8,8 @@
<ImageView
android:id="@+id/no_order_data_iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_386"
android:layout_height="@dimen/dp_350"
android:src="@drawable/bus_p_no_order_data"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
@@ -20,7 +20,7 @@
android:layout_height="wrap_content"
android:textColor="@color/bus_p_no_data_color"
android:textSize="@dimen/bus_p_no_data_size"
android:layout_marginTop="50px"
android:layout_marginTop="50dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_order_data_iv"

View File

@@ -7,11 +7,11 @@
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/edge_view"
android:layout_width="725px"
android:layout_width="725dp"
android:layout_height="match_parent"
app:shadowColor="@color/bus_p_route_view_left_edge_shadow"
app:xOffset="0px"
app:yOffset="0px"
app:xOffset="0dp"
app:yOffset="0dp"
app:bgColor="@android:color/transparent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -107,7 +107,7 @@
<com.mogo.och.common.module.wigets.MarqueeTextView
android:id="@+id/bus_p_line_name_tv"
android:layout_width="0px"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
@@ -124,7 +124,7 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_driver_num_plate_tv"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_driver_num_plate_tv"
app:layout_goneMarginLeft="0px" />
app:layout_goneMarginLeft="0dp" />
<TextView
android:id="@+id/line_operation_time_tv"
@@ -169,8 +169,8 @@
<ImageView
android:id="@+id/bus_p_arrow_nor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_108"
android:layout_height="@dimen/dp_107"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_370"
android:src="@drawable/bus_p_arrow_nor"

View File

@@ -25,8 +25,8 @@
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_arrow_bg"/>
<ImageView
android:layout_width="62px"
android:layout_height="62px"
android:layout_width="62dp"
android:layout_height="62dp"
android:src="@drawable/bus_p_point_gray"
app:layout_constraintTop_toTopOf="@+id/bus_p_circle"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_circle"
@@ -35,18 +35,18 @@
<ImageView
android:id="@+id/bus_p_circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="62dp"
android:layout_height="62dp"
android:src="@drawable/bus_p_point_blue"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_station"/>
<ImageView
android:id="@+id/bus_p_cur_arrow_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_12"
android:layout_height="@dimen/dp_61"
android:scaleType="fitXY"
android:layout_marginLeft="8px"
android:layout_marginLeft="8dp"
android:src="@drawable/bus_p_line_blue"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_circle"
app:layout_constraintRight_toRightOf="@+id/bus_p_circle"

View File

@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bus_p_route_info_panel_width">700px</dimen>
<dimen name="bus_p_route_info_margin_right">40px</dimen>
<dimen name="bus_p_route_info_margin_left">40px</dimen>
<dimen name="bus_p_route_info_margin_bottom">40px</dimen>
<dimen name="bus_p_route_info_margin_top">110px</dimen>
<dimen name="bus_p_route_line_info_height">224px</dimen>
<dimen name="bus_p_route_line_map_view_height">510px</dimen>
<dimen name="bus_p_route_line_dividing_view_height">3px</dimen>
<dimen name="bus_p_route_traffic_light_view_width">158px</dimen>
<dimen name="bus_p_route_traffic_light_view_height">90px</dimen>
<dimen name="bus_p_route_traffic_light_view_corner">45px</dimen>
<dimen name="bus_p_traffic_light_bg_width">158px</dimen>
<dimen name="bus_p_traffic_light_bg_height">90px</dimen>
<dimen name="bus_p_traffic_light_time_size">45px</dimen>
<dimen name="bus_p_traffic_light_time_view_width">90px</dimen>
<dimen name="bus_p_traffic_light_icon_size">90px</dimen>
<dimen name="bus_p_traffic_light_bg_stroke_width">3px</dimen>
<dimen name="bus_p_route_dividing_line2_margin_top">224px</dimen>
<dimen name="bus_p_driver_number_plate_margin_top">50px</dimen>
<dimen name="bus_p_driver_number_plate_margin_bottom">50px</dimen>
<dimen name="bus_p_driver_number_plate_size">44px</dimen>
<dimen name="bus_p_line_operation_time_margin_top">130px</dimen>
<dimen name="bus_p_line_operation_time_size">38px</dimen>
<dimen name="bus_p_no_data_size">36px</dimen>
<dimen name="bus_p_speed_txt_size">110px</dimen>
<dimen name="bus_p_speed_unit_txt_size">42px</dimen>
<dimen name="bus_p_station_circle_borner_size">4px</dimen>
<dimen name="bus_p_station_circle_radius_size">10px</dimen>
<dimen name="bus_p_station_circle_width_height">20px</dimen>
<dimen name="bus_p_station_tag_width_height">60px</dimen>
<dimen name="bus_p_station_tag_radius_size">30px</dimen>
<dimen name="bus_p_cur_station_circle_width">20px</dimen>
<dimen name="bus_p_cur_station_circle_height">50px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">50px</dimen>
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">80px</dimen>
<dimen name="bus_p_station_item_middle_height">100px</dimen>
<dimen name="bus_p_station_tag_line_height">80px</dimen>
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_curent_station_panel_width">685px</dimen>
<dimen name="bus_p_curent_station_panel_height">309px</dimen>
<dimen name="bus_p_curent_station_panel_margin">50px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">10px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
<dimen name="bus_p_station_txt_width">550px</dimen>
</resources>

View File

@@ -1,61 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="bus_p_route_info_panel_width">700px</dimen>
<dimen name="bus_p_auto_icon_margin_top">40px</dimen>
<dimen name="bus_p_route_info_margin_right">40px</dimen>
<dimen name="bus_p_route_info_margin_left">40px</dimen>
<dimen name="bus_p_route_info_margin_bottom">40px</dimen>
<dimen name="bus_p_route_info_margin_top">110px</dimen>
<dimen name="bus_p_route_line_info_height">224px</dimen>
<dimen name="bus_p_route_line_map_view_height">510px</dimen>
<dimen name="bus_p_route_line_dividing_view_height">3px</dimen>
<dimen name="bus_p_route_info_panel_width">700dp</dimen>
<dimen name="bus_p_auto_icon_margin_top">40dp</dimen>
<dimen name="bus_p_route_info_margin_right">40dp</dimen>
<dimen name="bus_p_route_info_margin_left">40dp</dimen>
<dimen name="bus_p_route_info_margin_bottom">40dp</dimen>
<dimen name="bus_p_route_info_margin_top">110dp</dimen>
<dimen name="bus_p_route_line_info_height">224dp</dimen>
<dimen name="bus_p_route_line_map_view_height">510dp</dimen>
<dimen name="bus_p_route_line_dividing_view_height">3dp</dimen>
<dimen name="bus_p_route_traffic_light_view_width">158px</dimen>
<dimen name="bus_p_route_traffic_light_view_height">90px</dimen>
<dimen name="bus_p_route_traffic_light_view_corner">45px</dimen>
<dimen name="bus_p_traffic_light_bg_width">158px</dimen>
<dimen name="bus_p_traffic_light_bg_height">90px</dimen>
<dimen name="bus_p_traffic_light_time_size">45px</dimen>
<dimen name="bus_p_traffic_light_time_view_width">90px</dimen>
<dimen name="bus_p_traffic_light_icon_size">90px</dimen>
<dimen name="bus_p_traffic_light_bg_stroke_width">3px</dimen>
<dimen name="bus_p_route_traffic_light_view_width">158dp</dimen>
<dimen name="bus_p_route_traffic_light_view_height">90dp</dimen>
<dimen name="bus_p_route_traffic_light_view_corner">45dp</dimen>
<dimen name="bus_p_traffic_light_bg_width">158dp</dimen>
<dimen name="bus_p_traffic_light_bg_height">90dp</dimen>
<dimen name="bus_p_traffic_light_time_size">45dp</dimen>
<dimen name="bus_p_traffic_light_time_view_width">90dp</dimen>
<dimen name="bus_p_traffic_light_icon_size">90dp</dimen>
<dimen name="bus_p_traffic_light_bg_stroke_width">3dp</dimen>
<dimen name="bus_p_route_dividing_line2_margin_top">224px</dimen>
<dimen name="bus_p_driver_number_plate_margin_top">50px</dimen>
<dimen name="bus_p_driver_number_plate_margin_bottom">50px</dimen>
<dimen name="bus_p_driver_number_plate_size">44px</dimen>
<dimen name="bus_p_line_operation_time_margin_top">130px</dimen>
<dimen name="bus_p_line_operation_time_size">38px</dimen>
<dimen name="bus_p_route_dividing_line2_margin_top">224dp</dimen>
<dimen name="bus_p_driver_number_plate_margin_top">50dp</dimen>
<dimen name="bus_p_driver_number_plate_margin_bottom">50dp</dimen>
<dimen name="bus_p_driver_number_plate_size">44dp</dimen>
<dimen name="bus_p_line_operation_time_margin_top">130dp</dimen>
<dimen name="bus_p_line_operation_time_size">38dp</dimen>
<dimen name="bus_p_no_data_size">36px</dimen>
<dimen name="bus_p_no_data_size">36dp</dimen>
<dimen name="bus_p_speed_txt_size">110px</dimen>
<dimen name="bus_p_speed_unit_txt_size">42px</dimen>
<dimen name="bus_p_speed_txt_size">110dp</dimen>
<dimen name="bus_p_speed_unit_txt_size">42dp</dimen>
<dimen name="bus_p_station_circle_borner_size">4px</dimen>
<dimen name="bus_p_station_circle_radius_size">10px</dimen>
<dimen name="bus_p_station_circle_width_height">20px</dimen>
<dimen name="bus_p_station_tag_width_height">60px</dimen>
<dimen name="bus_p_station_tag_radius_size">30px</dimen>
<dimen name="bus_p_cur_station_circle_width">20px</dimen>
<dimen name="bus_p_cur_station_circle_height">50px</dimen>
<dimen name="bus_p_mid_station_circle_cor">6px</dimen>
<dimen name="bus_p_station_txt_size">50px</dimen>
<dimen name="bus_p_station_tag_txt_size">36px</dimen>
<dimen name="bus_p_station_item_height">80px</dimen>
<dimen name="bus_p_station_item_middle_height">100px</dimen>
<dimen name="bus_p_station_tag_line_height">80px</dimen>
<dimen name="bus_p_station_tag_line_height1">60px</dimen>
<dimen name="bus_p_station_tag_line_width">6px</dimen>
<dimen name="bus_p_station_circle_borner_size">4dp</dimen>
<dimen name="bus_p_station_circle_radius_size">10dp</dimen>
<dimen name="bus_p_station_circle_width_height">20dp</dimen>
<dimen name="bus_p_station_tag_width_height">60dp</dimen>
<dimen name="bus_p_station_tag_radius_size">30dp</dimen>
<dimen name="bus_p_cur_station_circle_width">20dp</dimen>
<dimen name="bus_p_cur_station_circle_height">50dp</dimen>
<dimen name="bus_p_mid_station_circle_cor">6dp</dimen>
<dimen name="bus_p_station_txt_size">50dp</dimen>
<dimen name="bus_p_station_tag_txt_size">36dp</dimen>
<dimen name="bus_p_station_item_height">80dp</dimen>
<dimen name="bus_p_station_item_middle_height">100dp</dimen>
<dimen name="bus_p_station_tag_line_height">80dp</dimen>
<dimen name="bus_p_station_tag_line_height1">60dp</dimen>
<dimen name="bus_p_station_tag_line_width">6dp</dimen>
<dimen name="bus_p_curent_station_panel_width">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</dimen>
<dimen name="bus_p_curent_station_panel_margin">38px</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">10px</dimen>
<dimen name="bus_p_curent_station_txt_size">44px</dimen>
<dimen name="bus_p_curent_station_txt_size1">55px</dimen>
<dimen name="bus_p_curent_station_tip_size1">40px</dimen>
<dimen name="bus_p_curent_station_panel_width">685dp</dimen>
<dimen name="bus_p_curent_station_panel_height">309dp</dimen>
<dimen name="bus_p_curent_station_panel_margin">50dp</dimen>
<dimen name="bus_p_curent_station_panel_margin_left">10dp</dimen>
<dimen name="bus_p_curent_station_txt_size">44dp</dimen>
<dimen name="bus_p_curent_station_txt_size1">55dp</dimen>
<dimen name="bus_p_curent_station_tip_size1">40dp</dimen>
<dimen name="bus_p_curent_station_txt_width">584px</dimen>
<dimen name="bus_p_station_txt_width">550px</dimen>
<dimen name="bus_p_curent_station_txt_width">584dp</dimen>
<dimen name="bus_p_station_txt_width">550dp</dimen>
</resources>

View File

@@ -10,13 +10,13 @@ import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.MogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.fragment.BusFragment;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,15 +38,15 @@ public class BusProvider implements IMogoOCH {
/**
* 进入鹰眼模式,设置手势缩放地图失效
*/
private void stepIntoVrMode(){
CallerLogger.INSTANCE.d( M_BUS + TAG, "进入vr模式" );
private void stepIntoVrMode() {
CallerLogger.INSTANCE.d(M_BUS + TAG, "进入vr模式");
MogoMapUIController.getInstance()
.stepInVrMode(false);
}
@Override
public void init(Context context) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus"
MogoStatusManager.getInstance().registerStatusChangedListener("OchBus"
, StatusDescriptor.VR_MODE, statusChangedListener);
}
@@ -55,12 +55,14 @@ public class BusProvider implements IMogoOCH {
if (busFragment == null) {
CallerLogger.INSTANCE.d(TAG, "准备add fragment======");
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(BusFragment.TAG);
if(fragmentByTag instanceof BusFragment){
busFragment = (BusFragment)fragmentByTag;
}else {
if (fragmentByTag instanceof BusFragment) {
busFragment = (BusFragment) fragmentByTag;
} else {
busFragment = new BusFragment();
}
supportFragmentManager.beginTransaction().add(containerId, busFragment,BusFragment.TAG).commitAllowingStateLoss();
if(!busFragment.isAdded()) {
supportFragmentManager.beginTransaction().add(containerId, busFragment, BusFragment.TAG).commitAllowingStateLoss();
}
return;
}
CallerLogger.INSTANCE.d(TAG, "准备show fragment");
@@ -83,7 +85,7 @@ public class BusProvider implements IMogoOCH {
} else {
hideFragment();
}
} else if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
} else if (MogoStatusManager.getInstance().isVrMode()) {
// topView进行展示时推出网约车界面但是不隐藏整个fragment
if (busFragment != null && isTrue) {
busFragment.hideOchBus();
@@ -115,7 +117,9 @@ public class BusProvider implements IMogoOCH {
@Override
public void onDestroy() {
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
MogoStatusManager.getInstance().unregisterStatusChangedListener("OchBus"
, StatusDescriptor.VR_MODE, statusChangedListener);
if (activity == null) return;
activity.finish();
}

View File

@@ -1,10 +1,12 @@
package com.mogo.och.bus.bean;
import java.io.Serializable;
/**
* @author: wangmingjun
* @date: 2022/9/23
*/
public class WriteOffPassenger {
public class WriteOffPassenger implements Serializable {
public String phone;
public String orderNo;
public int passengerSize;

View File

@@ -1,6 +1,6 @@
package com.mogo.och.bus.callback;
import android.location.Location;
import com.mogo.eagle.core.data.map.MogoLocation;
/**
* Created on 2021/9/10
@@ -11,7 +11,7 @@ public interface IBusControllerStatusCallback {
// 是否vr map模式
void onVRModeChanged(boolean isVRMode);
// 自车定位
void onCarLocationChanged(Location location);
void onCarLocationChanged(MogoLocation location);
//开始开启自动驾驶
void startOpenAutopilot();
}

View File

@@ -63,6 +63,7 @@ class BusConst {
const val EVENT_PARAM_END_NAME = "end_name"
const val EVENT_PARAM_LINE_ID = "line_id"
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境true/false

View File

@@ -6,6 +6,7 @@ import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -43,8 +44,7 @@ import com.mogo.map.MogoMarkerManager;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.view.OnPreventFastClickListener;
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.constant.BusConst;
@@ -66,7 +66,7 @@ import record_cache.RecordPanelOuterClass;
*
* @author tongchenfei
*/
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener, IMoGoAutopilotRecordListener {
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener, IMoGoAutopilotRecordListener {
private static final String TAG = "BaseOchFragment";
@@ -157,19 +157,9 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
}
});
if (DebugConfig.isDebug()) {
mTrafficDataView.setLongClickable(true);
mTrafficDataView.setOnLongClickListener(v -> {
CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
MogoApisHandler.getInstance().getApis().getIntentManagerApi().invoke("com.mogo.mock", intent);
return true;
});
}
initListener();
setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener(){
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
@Override
public void onClickImpl(View v) {
@@ -220,7 +210,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
}
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
if (mAICollectBtn != null){
if (mAICollectBtn != null) {
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
}
@@ -235,7 +225,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
protected abstract void onArriveStation();
private void updateSwitchMapIcon(){
private void updateSwitchMapIcon() {
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
@@ -295,14 +285,15 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
/**
* 设置进站按钮状态
*
* @param isClickable
*/
public void setArrivedClikable(boolean isClickable){
public void setArrivedClikable(boolean isClickable) {
getActivity().runOnUiThread(() -> {
tvArrived.setEnabled(isClickable);
if (isClickable){
if (isClickable) {
tvArrived.setTextColor(getResources().getColor(R.color.bus_white));
}else {
} else {
tvArrived.setTextColor(getResources().getColor(R.color.bus_arrived_btn_un_clickable_color));
}
});
@@ -317,9 +308,10 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
}
public void playDI(){
public void playDI() {
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di);
}
/**
* 改变自动驾驶状态
*
@@ -347,13 +339,13 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
ctvAutopilotStatus.setClickable(true);
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) {//1可用
ctvAutopilotStatus.setSelected(false);
}else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus){
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
ctvAutopilotStatus.setSelected(true);
}
}
}
public void updateAutopilotStatus(int autopilotStatus){
public void updateAutopilotStatus(int autopilotStatus) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
== autopilotStatus) {//2 running
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
@@ -361,7 +353,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_success_tv));
ctvAutopilotStatus.setSelected(false);
ctvAutopilotStatus.setClickable(false);
}else {
} else {
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
ctvAutopilotStatusTv.setTextColor(getResources().getColor(R.color.bus_autopilot_text_color_normal));
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_failure_tv));
@@ -373,7 +365,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
public void run() {
setAutopilotBtnStatus(autopilotStatus);
}
},1000);
}, 1000);
}
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning) {
@@ -461,19 +453,20 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
}
private void startingAutoApilotCountDown(){
private void startingAutoApilotCountDown() {
//10s 若自动驾驶没有开启,则结束动画
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() { //未启动成功做处理
if (isAnimateRunning){// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
if (isAnimateRunning) {// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
stopAutopilotAnimation();
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState());
}
}
},TIMER_START_AUTOPILOT_INTERVAL);
}, TIMER_START_AUTOPILOT_INTERVAL);
}
/**
* 停止自动驾驶中间动画
*/
@@ -493,7 +486,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
*/
public void updateSpeedView(float newSpeed) {
int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
if (mTrafficDataView != null){
if (mTrafficDataView != null) {
mTrafficDataView.updateSpeedWithValue(speed);
}
}
@@ -528,7 +521,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
/**
* Bus调试信息线路、轨迹等信息
*
* <p>
* START
*/
private View busTestBar;

View File

@@ -120,8 +120,10 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
@Subscribe(threadMode = ThreadMode.MAIN)
public void changeOverview(EventLogout eventLogout){
CallerLogger.INSTANCE.d(M_BUS + TAG,"changeOverview Event消息去登出");
mPresenter.logout();
if (eventLogout.getMessgae() == EventLogout.LOGOUT_TYPE){
CallerLogger.INSTANCE.d(M_BUS + TAG,"changeOverview Event消息去登出");
mPresenter.logout();
}
}
@Override

View File

@@ -6,6 +6,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.SharedPrefs;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
import com.mogo.och.bus.bean.BusQueryLinesResponse;
import com.mogo.och.bus.bean.BusRoutesResponse;
@@ -56,6 +57,15 @@ public class BusLineModel {
}
}
@Override
public void onError() {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
}
@Override
public void onFail(int code, String failMsg) {
if (!NetworkUtils.isConnected(mContext)) {
@@ -86,6 +96,15 @@ public class BusLineModel {
}
}
@Override
public void onError() {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
}
@Override
public void onFail(int code, String failMsg) {
if (!NetworkUtils.isConnected(mContext)) {
@@ -107,6 +126,15 @@ public class BusLineModel {
}
}
@Override
public void onError() {
if (!NetworkUtils.isConnected(mContext)) {
ToastUtils.showShort(mContext.getString(R.string.network_error_tip));
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
}
@Override
public void onFail(int code, String failMsg) {
if (!NetworkUtils.isConnected(mContext)) {

View File

@@ -151,7 +151,7 @@ public interface IBusApiService {
Observable<BaseData> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
/**
* 任务正常跑完结束
* 查询核销乘客,目前不再使用,改为后台下发核销的乘客
* @param appId
* @param ticket
* @param data

View File

@@ -33,28 +33,28 @@ public class BusModelLoopManager {
}
private Disposable mHeartbeatDisposable; //心跳轮询
private Disposable mQueryPassengerDisposable; //查询核销乘客
// private Disposable mQueryPassengerDisposable; //查询核销乘客
public void startQueryPassengerWriteOffLoop() {
if (mQueryPassengerDisposable != null && !mQueryPassengerDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS + TAG, "startQueryPassengerWriteOffLoop()");
mQueryPassengerDisposable = Observable.interval(LOOP_DELAY_500,
LOOP_PASSENGER_5S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusOrderModel.getInstance().queryPassengerWriteOff());
}
// public void startQueryPassengerWriteOffLoop() {
// if (mQueryPassengerDisposable != null && !mQueryPassengerDisposable.isDisposed()) {
// return;
// }
// CallerLogger.INSTANCE.i(M_BUS + TAG, "startQueryPassengerWriteOffLoop()");
// mQueryPassengerDisposable = Observable.interval(LOOP_DELAY_500,
// LOOP_PASSENGER_5S, TimeUnit.MILLISECONDS)
// .map((aLong -> aLong + 1))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(aLong -> BusOrderModel.getInstance().queryPassengerWriteOff());
// }
public void stopQueryPassengerWriteOffLoop() {
if (mQueryPassengerDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS + TAG, "stopQueryPassengerWriteOffLoop()");
mQueryPassengerDisposable.dispose();
mQueryPassengerDisposable = null;
}
}
// public void stopQueryPassengerWriteOffLoop() {
// if (mQueryPassengerDisposable != null) {
// CallerLogger.INSTANCE.i(M_BUS + TAG, "stopQueryPassengerWriteOffLoop()");
// mQueryPassengerDisposable.dispose();
// mQueryPassengerDisposable = null;
// }
// }
public void startHeartbeatLoop() {
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {

View File

@@ -2,7 +2,6 @@ package com.mogo.och.bus.presenter;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import android.location.Location;
import android.os.Looper;
import androidx.annotation.NonNull;
@@ -14,11 +13,11 @@ import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.BusStationBean;
import com.mogo.och.bus.bean.WriteOffPassenger;
import com.mogo.och.bus.callback.IBusADASStatusCallback;
@@ -31,10 +30,9 @@ import com.mogo.och.bus.model.BusOrderModel;
import com.mogo.och.bus.util.BusTrajectoryManager;
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
import com.mogo.och.common.module.biz.callback.ILoginCallback;
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
import com.mogo.och.common.module.utils.SoundPoolHelper;
import com.mogo.och.common.module.voice.VoiceNotice;
import com.zhidao.socket.utils.LoginStatusUtil;
import org.jetbrains.annotations.NotNull;
@@ -71,7 +69,6 @@ public class BusPresenter extends Presenter<BusFragment>
@Override
public void onCreate(@NonNull LifecycleOwner owner) {
super.onCreate(owner);
BusOrderModel.getInstance().queryBusRoutes();
initModelListener();
}
@@ -236,7 +233,7 @@ public class BusPresenter extends Presenter<BusFragment>
}
@Override
public void onCarLocationChanged(Location location) {
public void onCarLocationChanged(MogoLocation location) {
if (null != location) {
runOnUIThread(() -> mView.updateSpeedView(location.getSpeed()));
}
@@ -285,8 +282,10 @@ public class BusPresenter extends Presenter<BusFragment>
}
@Override
public void loginSuccess(DriverStatusQueryRespBean data) {
if(LoginStatusUtil.isLogin()){
CallerLogger.INSTANCE.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());
if(LoginStatusManager.isLogin()){
BusOrderModel.getInstance().startOrStopOrderLoop(true);
BusOrderModel.getInstance().queryBusRoutes();
}else {
BusTrajectoryManager.getInstance().stopTrajReqLoop();
BusOrderModel.getInstance().startOrStopOrderLoop(false);
@@ -295,8 +294,6 @@ public class BusPresenter extends Presenter<BusFragment>
mView.hideSlidePanel();
BusOrderModel.getInstance().closeBeautificationMode();
}
BusOrderModel.getInstance().queryBusRoutes();
}
@Override

View File

@@ -10,7 +10,6 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.mvp.MvpActivity
import com.mogo.eagle.core.utilcode.util.SharedPrefs
@@ -18,7 +17,7 @@ import com.mogo.och.bus.presenter.BusLinePresenter
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
import com.mogo.och.bus.bean.BusQueryLinesResponse
import com.mogo.och.bus.ui.adapter.OpenItemAnimator
import com.mogo.module.common.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.R
import com.mogo.och.bus.bean.BusQueryLineTaskResponse
@@ -74,7 +73,11 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
mLinesListView.setLayoutManager(linearLayoutManager)
mLinesListView.setItemAnimator(OpenItemAnimator())
mAdapter = SwitchLineAdapter(applicationContext, mData)
mLinesListView.addItemDecoration(SpacesItemDecoration(4))
mLinesListView.addItemDecoration(
SpacesItemDecoration(
4
)
)
mLinesListView.setAdapter(mAdapter)
//设置item 点击事件
mAdapter.setOnLineItemClickListener(object :SwitchLineAdapter.LineItemClickListener{

View File

@@ -1,6 +1,8 @@
package com.mogo.och.bus.util;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
import android.annotation.SuppressLint;
import android.text.TextUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
@@ -36,22 +38,31 @@ public class BusAnalyticsManager {
private Runnable startAutopilotRunnable = () -> {
// 15s内未开启上报失败埋点
triggerStartAutopilotFailureEvent("15s后app等待超时");
triggerStartAutopilotFailureEvent("", "15s后app等待超时");
};
public void triggerStartAutopilotFailureEventByAdas(String failMsg){
public void triggerStartAutopilotFailureEventByAdas(String failCode, String failMsg){
removeWaitingCallback();
triggerStartAutopilotFailureEvent(failMsg);
triggerStartAutopilotFailureEvent(failCode, failMsg);
}
private void triggerStartAutopilotFailureEvent(String failMsg){
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
if (mStartAutopilotParams.isEmpty()) return;
CallerLogger.INSTANCE.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() !=
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, failMsg);
}
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG,
failMsg);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();//清空参数数据,防止误传
}
private void removeWaitingCallback() {
@@ -61,6 +72,15 @@ public class BusAnalyticsManager {
}
}
public void clearStartAutopilotFailureMSG(){
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_CODE, "");
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_FAILURE_MSG, "");
}
private void clearStartAutopilotParams(){
mStartAutopilotParams.clear();
}
/**
* 触发'开启自动驾驶'埋点流程
* 开启自动驾驶15s内成功则发送成功埋点否则发送失败埋点
@@ -86,10 +106,14 @@ public class BusAnalyticsManager {
mStartAutopilotParams.put(BusConst.EVENT_PARAM_LINE_ID, lineId);
if (send) {
if (mStartAutopilotParams.isEmpty()) return;
// 开启成功,上报埋点
clearStartAutopilotFailureMSG();
removeWaitingCallback();
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, true);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
clearStartAutopilotParams();//清空参数数据,防止误传
} else {
UiThreadHandler.postDelayed(startAutopilotRunnable, BusConst.LOOP_PERIOD_15S);
}

View File

@@ -21,8 +21,13 @@ import android.view.animation.DecelerateInterpolator;
import androidx.annotation.Nullable;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.och.bus.R;
import me.jessyan.autosize.AutoSizeConfig;
import me.jessyan.autosize.utils.AutoSizeUtils;
/**
* 滑块滑动面板
*
@@ -57,12 +62,12 @@ public class SlidePanelView extends View {
private final Paint textPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private static int textSize = 40;
private static int BLOCK_START_X = 15;
private static int BLOCK_START_Y = 15;
private static int NORMAL_TEXT_MARGIN_LEFT = 40;
private static int NORMAL_TEXT_MARGIN_RIGHT = 60;
private static int SHORT_TEXT_MARGIN_LEFT = 60;
private static int SHORT_TEXT_MARGIN_RIGHT = 70;
private static int BLOCK_START_X = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),15);
private static int BLOCK_START_Y = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),15);
private static int NORMAL_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),40);
private static int NORMAL_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);
private static int SHORT_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),60);;
private static int SHORT_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(),70);;
private int textMarginLeft = NORMAL_TEXT_MARGIN_LEFT;
private int textMarginRight = NORMAL_TEXT_MARGIN_RIGHT;
@@ -123,8 +128,11 @@ public class SlidePanelView extends View {
textGradient.setLocalMatrix(gradientMatrix);
textPaint.setShader(textGradient);
textPaint.getFontMetrics(blockTextMetrics);
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block);
int size = AutoSizeUtils.dp2px(getContext(), 120);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inDensity = (int) AutoSizeConfig.getInstance().getInitDensity();
bmBlock = BitmapFactory.decodeResource(getResources(), R.drawable.bus_base_slide_block,opts);
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true);
blockWidth = bmBlock.getWidth();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

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