Merge branch 'dev_robotaxi-d-app-module_290_220715_2.9.0' into 'master'

Dev robotaxi d app module 290 220715 2.9.0

See merge request zhjt/AndroidApp/MoGoEagleEye!131
This commit is contained in:
pangfan
2022-08-16 06:34:44 +00:00
559 changed files with 14289 additions and 3545 deletions

View File

@@ -29,15 +29,13 @@ android {
}
buildTypes {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

View File

@@ -28,7 +28,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
private static final int LINE_START_STATION_ITEM = 0;
private static final int LINE_END_STATION_ITEM = 1;
private static final int LINE_MIDDLE_STATION_ITEM = 2;
private String preArrivingStation = "";
// private String preArrivingStation = "";
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
this.mContext = context;
@@ -58,15 +58,15 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
BusPassengerStation station = mStations.get(position);
if (holder instanceof StartStationViewHolder){
StartStationViewHolder viewHolder = (StartStationViewHolder)holder;
if (!preArrivingStation.equals(station.getName())){
// if (!preArrivingStation.equals(station.getName())){
viewHolder.startStationName.setText(station.getName());
}
// }
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){//到站
viewHolder.curStationBg.setVisibility(View.VISIBLE);
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.startStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.startStationName.setSelected(true);
preArrivingStation = station.getName();
// preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
@@ -75,9 +75,9 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
}
}else if (holder instanceof EndStationViewHolder){
EndStationViewHolder viewHolder = (EndStationViewHolder)holder;
if (!preArrivingStation.equals(station.getName())){
// if (!preArrivingStation.equals(station.getName())){
viewHolder.endStationName.setText(station.getName());
}
// }
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())){//到站
@@ -85,7 +85,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.endStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.endStationName.setSelected(true);
preArrivingStation = station.getName();
// preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.stationCircle.setVisibility(View.VISIBLE);
@@ -94,9 +94,9 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
}
}else {
MiddleStationViewHolder viewHolder = (MiddleStationViewHolder)holder;
if (!preArrivingStation.equals(station.getName())){
// if (!preArrivingStation.equals(station.getName())){
viewHolder.middleStationName.setText(station.getName());
}
// }
BusPassengerStation preStation = mStations.get(position -1);
if ((preStation.getDrivingStatus() == STATION_STATUS_STOPPED && preStation.isLeaving())
|| (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving())) {//到站
@@ -104,7 +104,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_current_station_txt_color));
viewHolder.stationCircle.setVisibility(View.GONE);
viewHolder.middleStationName.setSelected(true);
preArrivingStation = station.getName();
// preArrivingStation = station.getName();
}else {
viewHolder.curStationBg.setVisibility(View.GONE);
viewHolder.middleStationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));

View File

@@ -12,6 +12,8 @@ public class BusPassengerStation {
private String cityCode;
private double lon; //高精坐标
private double lat; //高精坐标
private double gcjLon; //高德坐标
private double gcjLat; //高德坐标
private int businessType; //站点类型9:taxi10:bus
private int status;
private int siteId;
@@ -72,6 +74,13 @@ public class BusPassengerStation {
return cityCode;
}
public double getGcjLon() {
return gcjLon;
}
public double getGcjLat() {
return gcjLat;
}
public int getBusinessType() {
return businessType;

View File

@@ -11,7 +11,8 @@ import mogo.telematics.pad.MessagePad;
* Created on 2022/3/31
*/
public interface IBusPassengerAutopilotPlanningCallback {
void routeResult(List<LatLng> models);
void routeResult(List<LatLng> models,int haveArrivedIndex);
void routePlanningToNextStationChanged(long meters, long timeInSecond);
void setLineMarker(List<LatLng> models);
void updateTotalDistance();
}

View File

@@ -41,5 +41,8 @@ class BusPassengerConst {
//bus平均速度
const val BUS_AVERAGE_SPEED = 25
// 订单总里程
const val BUS_SP_KEY_ORDER_SUM_DIS = "BUS_SP_KEY_ORDER_SUM_DIS"
}
}

View File

@@ -22,6 +22,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListen
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;
@@ -52,6 +53,7 @@ import java.util.concurrent.ConcurrentHashMap;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STATUS_STOPPED;
@@ -82,6 +84,10 @@ public class BusPassengerModel {
private double mLongitude, mLatitude;
List<BusPassengerStation> mStations = new ArrayList<>();
private int mNextStationIndex = 0;// 要到达站的index
private List<LatLng> mTwoStationsRouts = new ArrayList<>();
private BusPassengerModel() {
}
@@ -145,12 +151,22 @@ public class BusPassengerModel {
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
if (result.getSites() != null){
List<BusPassengerStation> stations = result.getSites();
mStations.clear();
mStations.addAll(stations);
for (int i = 0; i< stations.size(); i++){
BusPassengerStation station = stations.get(i);
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
if(mNextStationIndex != i+1){
mTwoStationsRouts.clear();
startRemainRouteInfo();
}
mNextStationIndex = i+1;
return;
}else if (station.getDrivingStatus() == STATION_STATUS_STOPPED && !station.isLeaving()){
if (i == 0){
startOrStopRouteAndWipe(false);
}
startOrStopCalculateRouteInfo(false);
mRouteLineInfoCallback.updateStationsInfo(stations,i,true);
return;
@@ -284,6 +300,8 @@ public class BusPassengerModel {
}
};
private volatile int mPreAutoStatus = -1;
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
@Override
@@ -301,19 +319,25 @@ public class BusPassengerModel {
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "state = %s", state );
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
// TODO: 2022/3/31
//2022.7.20 自动驾驶更换成带档位的
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
// TODO: 2022/3/31
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
if(state != mPreAutoStatus){
mTwoStationsRouts.clear();
}
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
// TODO: 2022/3/31
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
if(state != mPreAutoStatus){
mTwoStationsRouts.clear();
}
// if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
}else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING){
if(state != mPreAutoStatus){
mTwoStationsRouts.clear();
}
}
mPreAutoStatus = state;
}
@Override
@@ -337,6 +361,10 @@ public class BusPassengerModel {
}
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
};
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
@@ -352,7 +380,6 @@ public class BusPassengerModel {
List<MessagePad.Location> routePoints = routeList.getWayPointsList();
if (null != routePoints && routePoints.size() > 0){
updateRoutePoints(routePoints);
startRemainRouteInfo();
setRouteLineMarker();
startToRouteAndWipe();
}
@@ -364,26 +391,64 @@ public class BusPassengerModel {
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
.coordinateConverterWgsToGcjListCommon(mContext,routePoints);
mRoutePoints.addAll(latLngModels);
calculateTwoStationsRoute();
}
private void calculateTwoStationsRoute(){
//找出前往站对应的轨迹点,拿出两站点的集合
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "mRoutePoints.size() = " + mRoutePoints.size());
if (mRoutePoints.size() > 0) {
if (mStations.size() > 2){ //两个站点以上要计算两个站点间的估计路线
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){
mTwoStationsRouts.clear();
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
//当前站在轨迹中对应的点
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
,stationCur.getGcjLon(),stationCur.getGcjLat());
//要前往的站在轨迹中对应的点
int nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndex(mRoutePoints
,stationNext.getGcjLon(),stationNext.getGcjLat());
mTwoStationsRouts.addAll(mRoutePoints.subList(currentRouteIndex,nextRouteIndex));
}
}else { //只有两个站点的时候整个路线就是两个站点之间的轨迹
mTwoStationsRouts.clear();
mTwoStationsRouts.addAll(mRoutePoints);
}
if (mTwoStationsRouts.size() > 0){
float sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(mTwoStationsRouts);
SharedPrefsMgr.getInstance(mContext).putInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,(int) sumLength);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.updateTotalDistance();
}
}
}
}
public void dynamicCalculateRouteInfo() {
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mRoutePoints,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){
calculateTwoStationsRoute();
}
double lastTime = lastSumLength / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 ; //秒
if (mTwoStationsRouts.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mTwoStationsRouts,mLongitude,mLatitude);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routePlanningToNextStationChanged((long)lastSumLength,(long) lastTime);
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);
}
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);
}
}
}
public void startRemainRouteInfo() {
@@ -409,10 +474,12 @@ public class BusPassengerModel {
public void loopRouteAndWipe() {
if (mRoutePoints != null && mRoutePoints.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mRoutePoints,mLongitude,mLatitude);
int haveArrivedIndex = CoordinateCalculateRouteUtil
.getArrivedPointIndex(mRoutePoints,mLongitude,mLatitude);
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "thread = "+ Thread.currentThread().getName()+" haveArrivedIndex== " + haveArrivedIndex);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResult(lastPoints);
mAutopilotPlanningCallback.routeResult(mRoutePoints,haveArrivedIndex);
}
}
}
@@ -431,11 +498,11 @@ public class BusPassengerModel {
* @param isStart
*/
public void startOrStopCalculateRouteInfo(boolean isStart) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopOrderLoop() " + isStart);
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "startOrStopCalculateRouteInfo() " + isStart);
if (isStart) {
BusPassengerModelLoopManager.getInstance().startCalculateRouteInfoLoop();
} else {
mRoutePoints.clear();
mTwoStationsRouts.clear();
BusPassengerModelLoopManager.getInstance().stopCalculateRouteInfLoop();
}
}

View File

@@ -6,8 +6,12 @@ import com.mogo.och.bus.passenger.model.BusPassengerModel;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
@@ -24,8 +28,6 @@ public class BusPassengerModelLoopManager {
private static final String TAG = BusPassengerModelLoopManager.class.getSimpleName();
private Disposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
private static final class SingletonHolder {
private static final BusPassengerModelLoopManager INSTANCE = new BusPassengerModelLoopManager();
}
@@ -35,27 +37,44 @@ public class BusPassengerModelLoopManager {
}
private Disposable mHeartbeatDisposable; //心跳轮询
private Disposable mRouteWipeDisposable; //轨迹擦除
private CompositeDisposable mRouteWipeDisposable;
private CompositeDisposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
public void startOrStopRouteAndWipe() {
if (mRouteWipeDisposable != null && !mRouteWipeDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startOrStopRouteWipe()");
mRouteWipeDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_1S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
if (mRouteWipeDisposable != null) return;
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
})
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
.delay(LOOP_LINE_1S, TimeUnit.MILLISECONDS, true) // 设置delayError为true表示出现错误的时候也需要延迟5s进行通知达到无论是请求正常还是请求失败都是5s后重新订阅即重新请求。
.subscribeOn(Schedulers.io())
.repeat() // repeat保证请求成功后能够重新订阅。
.retry() // retry保证请求失败后能重新订阅
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().loopRouteAndWipe());
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
}
});
mRouteWipeDisposable.add(disposable);
}
public void stopOrStopRouteAndWipe() {
if (mRouteWipeDisposable != null) {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "stopOrStopRouteWipe()");
mRouteWipeDisposable.dispose();
mRouteWipeDisposable = null;
}
if (mRouteWipeDisposable != null) {
mRouteWipeDisposable.dispose();
mRouteWipeDisposable = null;
}
}
public void startQueryDriverLineLoop() {
@@ -80,16 +99,33 @@ public class BusPassengerModelLoopManager {
}
public void startCalculateRouteInfoLoop() {
if (mCalculateRouteDisposable != null && !mCalculateRouteDisposable.isDisposed()) {
return;
}
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startCalculateRouteInfoLoop()");
mCalculateRouteDisposable = Observable.interval(LOOP_DELAY,
LOOP_LINE_2S, TimeUnit.MILLISECONDS)
.map((aLong -> aLong + 1))
if (mCalculateRouteDisposable != null) return;
if (mCalculateRouteDisposable == null){
mCalculateRouteDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopCalculateRouteInfo()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
})
.doOnError(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
}
})
.delay(LOOP_LINE_2S, TimeUnit.MILLISECONDS, true) // 设置delayError为true表示出现错误的时候也需要延迟5s进行通知达到无论是请求正常还是请求失败都是5s后重新订阅即重新请求。
.subscribeOn(Schedulers.io())
.repeat() // repeat保证请求成功后能够重新订阅。
.retry() // retry保证请求失败后能重新订阅
.observeOn(AndroidSchedulers.mainThread())
.subscribe(aLong -> BusPassengerModel.getInstance().dynamicCalculateRouteInfo());
.subscribe(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
}
});
mCalculateRouteDisposable.add(disposable);
}
public void stopCalculateRouteInfLoop() {
@@ -99,4 +135,26 @@ public class BusPassengerModelLoopManager {
mCalculateRouteDisposable = null;
}
}
private Observable<Integer> startLoopRouteAndWipe(){
return Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
if (emitter.isDisposed()) return;
BusPassengerModel.getInstance().loopRouteAndWipe();
emitter.onComplete();
}
});
}
private Observable<Integer> startLoopCalculateRouteInfo(){
return Observable.create(new ObservableOnSubscribe<Integer>() {
@Override
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
if (emitter.isDisposed()) return;
BusPassengerModel.getInstance().dynamicCalculateRouteInfo();
emitter.onComplete();
}
});
}
}

View File

@@ -82,7 +82,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
@Override
public void onAutopilotArriveEnd() {
// mView.showOverviewFragment();
}
@Override
@@ -136,8 +136,10 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
}
@Override
public void routeResult(List<LatLng> models) {
runOnUIThread(() -> mView.routeResult(models));
public void routeResult(List<LatLng> models, int haveArrivedIndex) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "routeResult:" + models.size()
+ " haveArrivedIndex = "+haveArrivedIndex);
runOnUIThread(() ->mView.routeResult(models,haveArrivedIndex));
}
@Override
@@ -149,4 +151,9 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
public void setLineMarker(List<LatLng> models) {
runOnUIThread(() -> mView.setLineMarker(models));
}
@Override
public void updateTotalDistance() {
runOnUIThread(() -> mView.setProgressBarMax());
}
}

View File

@@ -3,17 +3,24 @@ package com.mogo.och.bus.passenger.ui;
import android.os.Bundle;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.widget.ContentLoadingProgressBar;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.common.module.utils.NumberFormatUtil;
/**
@@ -29,7 +36,7 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
private TextView mCurrentArriveTip;
private ImageView mAutopilotIv;
private FrameLayout flContainer;
private ContentLoadingProgressBar mProgressBar;
/**
* 改变自动驾驶状态
@@ -59,7 +66,17 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mCurrentArriveTip = findViewById(R.id.bus_p_cur_station_tip);
mAutopilotIv = findViewById(R.id.bus_p_autopilot_iv);
mProgressBar = findViewById(R.id.bus_progress_bar);
showRouteFragment();
// mCurrentArriveStation.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View v) {
// showOverviewFragment();
// return false;
// }
// });
}
@Override
@@ -90,19 +107,30 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
if (currentIndex == 0){
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title_init));
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip_init));
removeProgressBar();
return;
}
if (isArrived){
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_station_title));
mCurrentArriveTip.setText(getResources().getString(R.string.bus_p_cur_station_arrived_tip));
removeProgressBar();
}else {
mCurrentArriveStationTitle.setText(getResources().getString(R.string.bus_p_cur_next_station_title));
mProgressBar.setVisibility(View.VISIBLE);
}
}
}
private void removeProgressBar() {
mProgressBar.setProgress(0);
mProgressBar.setMax(0);
mProgressBar.setVisibility(View.GONE);
}
public void updateRoutePlanningToNextStation(long meters, long timeInSecond){
//更新进度条
updateProgressBar(meters);
String dis = "0";
String disUnit = "公里";
if (meters > 0){
@@ -119,6 +147,19 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
mCurrentArriveTip.setText(Html.fromHtml(strHtml2));
}
private void updateProgressBar(long meters) {
int haveDriven = new Long(meters).intValue();
int progressInt = SharedPrefsMgr.getInstance(getContext())
.getInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,0) - haveDriven;
mProgressBar.setProgress(progressInt);
}
public void setProgressBarMax(){
int max = SharedPrefsMgr.getInstance(getContext())
.getInt(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,0);
mProgressBar.setMax(max);
}
public void onAutopilotStatusChanged(int status) {
getActivity().runOnUiThread(() -> {
// 3. 其他过程直接更新
@@ -139,4 +180,14 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
}
}
public void showOverviewFragment() {
CallerHmiManager.INSTANCE.showSmallFragment();
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerHmiManager.INSTANCE.hideSmallFragment();
}
},5000L);
}
}

View File

@@ -1,7 +1,6 @@
package com.mogo.och.bus.passenger.ui;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -16,6 +15,7 @@ import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptor;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.CustomMapStyleOptions;
@@ -63,10 +63,15 @@ public class BusPassengerMapDirectionView
private CameraUpdate mCameraUpdate;
private Context mContext;
private List<Integer> colorList = new ArrayList<>();
List<BitmapDescriptor> textureList = new ArrayList<>();
List<Integer> texIndexList = new ArrayList<>();
private int mHaveArrivedIndex = 0;
private List<Marker> mLineMarkers = new ArrayList<>();
private IBusPassengerMapViewCallback mIBusPassengerMapViewCallback;
private BitmapDescriptor mArrivedRes;
private BitmapDescriptor mUnArrivedRes;
public BusPassengerMapDirectionView(Context context) {
this(context, null);
@@ -129,6 +134,9 @@ public class BusPassengerMapDirectionView
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);
// 加载自定义样式
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
.setEnable(true)
@@ -178,12 +186,12 @@ public class BusPassengerMapDirectionView
if (location == null) {
return;
}
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onCarLocationChanged2 :" + location.getLatitude() + ":" + location.getLongitude());
// CallerLogger.INSTANCE.d(M_BUS_P + TAG, "onCarLocationChanged2 :" + location.getLatitude() + ":" + location.getLongitude());
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
//更新车辆位置
if (mCarMarker != null) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "location.getBearing() = " + location.getBearing());
// CallerLogger.INSTANCE.d(M_BUS_P + TAG, "location.getBearing() = " + location.getBearing());
mCarMarker.setRotateAngle(360 - location.getBearing());
mCarMarker.setPosition(currentLatLng);
mCarMarker.setToTop();
@@ -224,10 +232,13 @@ public class BusPassengerMapDirectionView
//设置线段纹理
PolylineOptions polylineOptions = new PolylineOptions();
polylineOptions.addAll(mCoordinatesLatLng);
polylineOptions.colorValues(colorList);
polylineOptions.useGradient(true);
polylineOptions.width(10); //线段宽度
polylineOptions.width(14); //线段宽度
polylineOptions.setUseTexture(true);
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
polylineOptions.setCustomTextureList(textureList);
polylineOptions.setCustomTextureIndex(texIndexList);
// polylineOptions.colorValues(colorList);
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
@@ -240,8 +251,15 @@ public class BusPassengerMapDirectionView
* 添加画线颜色值
*/
private void addRouteColorList() {
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
colorList.add(Color.argb(255, 70, 147, 253));//路线颜色
textureList.clear();
texIndexList.clear();
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mHaveArrivedIndex){
textureList.add(mArrivedRes);
}else {
textureList.add(mUnArrivedRes);
}
texIndexList.add(i);
}
}
@@ -280,7 +298,10 @@ public class BusPassengerMapDirectionView
}
public void clearCoordinatesLatLng(){
textureList.clear();
texIndexList.clear();
mCoordinatesLatLng.clear();
mLinePointsLatLng.clear();
}
public void onCreateView(Bundle savedInstanceState) {
@@ -314,6 +335,12 @@ public class BusPassengerMapDirectionView
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs,int haveArrivedIndex) {
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
mHaveArrivedIndex = haveArrivedIndex;
}
public void clearLineMarkers(){
for (int i =0; i< mLineMarkers.size();i++){
mLineMarkers.get(i).setVisible(false);

View File

@@ -17,10 +17,12 @@ import com.amap.api.maps.model.LatLng;
import com.elegant.utils.UiThreadHandler;
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;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.adapter.BusPassengerLineStationsAdapter;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassengerMapViewCallback;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
@@ -139,10 +141,9 @@ public class BusPassengerRouteFragment extends
}
}
public void routeResult(List<LatLng> latLngList) {
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "routeResult:" + latLngList.size());
public void routeResult(List<LatLng> latLngList,int haveArrivedIndex) {
if (latLngList.size() > 0) {
drawablePolyline(latLngList);
drawablePolyline(latLngList,haveArrivedIndex);
} else {
clearPolyline();
}
@@ -169,9 +170,9 @@ public class BusPassengerRouteFragment extends
*
* @param coordinates
*/
private void drawablePolyline(List<LatLng> coordinates) {
private void drawablePolyline(List<LatLng> coordinates,int haveArrivedIndex) {
if (mMapDirectionView != null) {
mMapDirectionView.setCoordinatesLatLng(coordinates);
mMapDirectionView.setCoordinatesLatLng(coordinates,haveArrivedIndex);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
@@ -245,8 +246,10 @@ public class BusPassengerRouteFragment extends
}
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
clearPolyline();
SharedPrefsMgr.getInstance(getContext())
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
clearPolyline();
}
if (stations.size() > 0){

View File

@@ -16,7 +16,7 @@ public class BusPassengerMapAssetStyleUtil {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style.data
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);
@@ -39,7 +39,7 @@ public class BusPassengerMapAssetStyleUtil {
byte[] buffer1 = null;
InputStream is1 = null;
try {
is1 = context.getResources().getAssets().open(fileName); //eg. small_map_style_extra.data
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style_extra.data
int lenght1 = is1.available();
buffer1 = new byte[lenght1];
is1.read(buffer1);

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:startColor="#D8E4FF"
android:endColor="#D8E4FF"
android:type="linear"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -4,8 +4,8 @@
<shape android:shape="rectangle">
<gradient
android:angle="90"
android:endColor="#F2F7FF"
android:startColor="#E6ECF9"
android:endColor="#F2F6FF"
android:startColor="#E1E7F5"
android:type="linear" />
</shape>
</item>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_10" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/progress_item_round"
android:scaleWidth="100%" />
</item>
</layer-list>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="@dimen/dp_60"
android:bottomRightRadius="@dimen/dp_30"
android:topRightRadius="@dimen/dp_30"/>
<gradient
android:angle="0"
android:endColor="#009EFF"
android:startColor="#4D006AFF"
android:type="linear" />
</shape>

View File

@@ -8,7 +8,7 @@
android:id="@+id/steering_wheel"
android:layout_width="@dimen/dp_490"
android:layout_height="@dimen/dp_490"
android:layout_marginLeft="@dimen/dp_22"
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_88"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -28,69 +28,100 @@
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/iv_bg"
android:layout_width="@dimen/bus_p_curent_station_panel_width"
android:layout_height="@dimen/bus_p_curent_station_panel_height"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bus_p_curent_station_panel_margin_left"
android:layout_marginBottom="@dimen/bus_p_curent_station_panel_margin"
app:bgColor="@android:color/transparent"
app:blurRadius="@dimen/dp_30"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:bgColor="@color/bus_p_panel_cur_station_panel_color"
app:blurRadius="@dimen/dp_12"
app:shadowRadius="@dimen/dp_20"
app:shadowColor="@color/bus_p_panel_edge_shadow"
app:shadowRadius="@dimen/dp_30"
app:xOffset="0px"
app:yOffset="0px">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/bus_p_curent_station_panel_width"
android:layout_height="@dimen/bus_p_curent_station_panel_height"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/bus_p_panel_cur_station_panel">
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_40"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_title"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="@dimen/bus_p_curent_station_txt_width"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:elevation="@dimen/dp_10"
android:ellipsize="end"
android:maxLines="1"
android:text="-- --"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
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"
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"
android:layout_marginRight="@dimen/dp_10"
android:src="@drawable/station_arrow">
</androidx.appcompat.widget.AppCompatImageView>
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_arrived_tip"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name" />
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/bus_progress_bar"
android:layout_width="0dp"
android:layout_height="@dimen/dp_10"
android:progress="0"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_15"
app:layout_constraintRight_toRightOf="parent"
android:progressDrawable="@drawable/bus_progress_bar_bg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.och.common.module.wigets.OCHBorderShadowLayout>
<TextView
android:id="@+id/bus_p_cur_station_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_27"
android:layout_marginTop="@dimen/dp_50"
android:elevation="@dimen/dp_10"
android:text="@string/bus_p_cur_station_title"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size"
app:layout_constraintLeft_toLeftOf="@+id/iv_bg"
app:layout_constraintTop_toTopOf="@+id/iv_bg" />
<TextView
android:id="@+id/bus_p_cur_station_name"
android:layout_width="@dimen/bus_p_curent_station_txt_width"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/bus_p_panel_cur_station_txt_color"
android:textSize="@dimen/bus_p_curent_station_txt_size1"
android:textStyle="bold"
android:text="-- --"
android:maxLines="1"
android:ellipsize="end"
android:elevation="@dimen/dp_10"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_title"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_title" />
<TextView
android:id="@+id/bus_p_cur_station_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/bus_p_cur_station_arrived_tip"
android:elevation="@dimen/dp_10"
android:textStyle="bold"
android:textColor="@color/bus_p_panel_cur_station_tips_color"
android:textSize="@dimen/bus_p_curent_station_tip_size1"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_cur_station_name"
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_station_name" />
<FrameLayout
android:id="@+id/bus_p_route_panel"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -98,6 +129,6 @@
android:layout_marginBottom="@dimen/dp_48"
android:src="@drawable/bus_p_mogo_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel"/>
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -7,7 +7,7 @@
<com.mogo.och.common.module.wigets.OCHBorderShadowLayout
android:id="@+id/edge_view"
android:layout_width="716px"
android:layout_width="725px"
android:layout_height="match_parent"
app:shadowColor="@color/bus_p_route_view_left_edge_shadow"
app:xOffset="0px"

View File

@@ -47,10 +47,10 @@
<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">638px</dimen>
<dimen name="bus_p_curent_station_panel_height">316px</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">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>

View File

@@ -51,7 +51,7 @@
<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">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>

View File

@@ -61,12 +61,14 @@ dependencies {
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogo_core_data
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation rootProject.ext.dependencies.mogo_core_function_hmi
}else {
implementation project(":core:mogo-core-utils")
implementation project(":foudations:mogo-commons")
implementation project(':modules:mogo-module-common')
implementation project(':core:mogo-core-data')
implementation project(':core:mogo-core-function-call')
implementation project(':core:function-impl:mogo-core-function-hmi')
}
}

View File

@@ -22,6 +22,11 @@ public class BusRoutesResult {
public String txtFileMd5 = ""; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel = ""; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url默认“”
public String csvFileMd5DPQP = ""; //轨迹文件md5默认“”
public String txtFileUrlDPQP = ""; //打点文件下载的cos url默认“”
public String txtFileMd5DPQP = ""; //轨迹文件md5默认“”
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public int getLineId() {
return lineId;
@@ -54,6 +59,11 @@ public class BusRoutesResult {
", txtFileMd5='" + txtFileMd5 + '\'' +
", contrailSaveTime=" + contrailSaveTime +
", carModel='" + carModel + '\'' +
", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' +
", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' +
", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' +
", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' +
", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP +
'}';
}
}

View File

@@ -28,6 +28,8 @@ public class BusStationBean {
private double lon; //高精坐标
private double lat; //高精坐标
private int businessType; //站点类型9:taxi10:bus
private double gcjLon; //高德
private double gcjLat; //高德
private int status;
private int siteId;
private int seq;
@@ -35,6 +37,14 @@ public class BusStationBean {
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
private boolean leaving;
public double getGcjLon() {
return gcjLon;
}
public double getGcjLat() {
return gcjLat;
}
public void setName(String name) {
this.name = name;
}

View File

@@ -9,5 +9,5 @@ import java.util.List;
* @date: 2021/10/22
*/
public interface IRefreshBusStationsCallback {
void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
void refreshBusStations(String lineName,List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived);
}

View File

@@ -71,6 +71,9 @@ class BusConst {
*/
const val TYPE_MARKER_BUS_ORDER = "TYPE_MARKER_BUS_ORDER"
const val TIMER_START_AUTOPILOT_INTERVAL = 10 * 1000L
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
//围栏到站 暂定10米
const val ARRIVE_AT_END_STATION_DISTANCE = 10
}
}

View File

@@ -5,7 +5,6 @@ import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.LinearInterpolator;
@@ -15,6 +14,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
@@ -31,6 +31,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -46,9 +47,9 @@ import com.mogo.och.bus.bean.BusRoutesResult;
import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.model.BusOrderModel;
import com.mogo.och.bus.util.BDRouteDataTestUtils;
import com.mogo.och.bus.view.BusArcView;
import com.mogo.och.bus.view.SlidePanelView;
import mogo.telematics.pad.MessagePad;
import record_cache.RecordPanelOuterClass;
/**
@@ -68,12 +69,14 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private TextView ctvAutopilotStatusTv;
protected TextView tvOperationStatus;
protected RelativeLayout mSettingBtn;
protected ImageView mBadcaseBtn;
protected RelativeLayout mBadcaseBtn;
protected RelativeLayout mAICollectBtn;
public boolean isOperationStatus;//false-收车true-出车
private FrameLayout flStationPanelContainer;
private Group groupTestPanel;
private FrameLayout flSpeed;
private BusArcView mouduleArc;
// private BusArcView mouduleArc;
private TrafficDataView mTrafficDataView;
private ImageView mUpgradeTipIv;
// private BusTrafficLightView mTrafficLightView;
@@ -119,7 +122,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
mouduleArc = (BusArcView) findViewById(R.id.bus_arc);
mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
@@ -147,8 +150,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
if (DebugConfig.isDebug()) {
mouduleArc.setLongClickable(true);
mouduleArc.setOnLongClickListener(v -> {
mTrafficDataView.setLongClickable(true);
mTrafficDataView.setOnLongClickListener(v -> {
CallerLogger.INSTANCE.d(M_BUS + TAG, "长按显示状态工具栏");
Intent intent = new Intent();
intent.putExtra("oper", 52);
@@ -203,7 +206,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
});
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_iv);
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
// CallerHmiManager.INSTANCE.registerBadCaseCallback(
// () -> { // onShow()
// return mBadcaseBtn; },
@@ -211,14 +214,16 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
// return null; });
if (mBadcaseBtn != null) {
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn, null, null);
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
if (!HmiBuildConfig.isShowBadCaseView) {
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
}
}
//设置升级小红点提示 默认隐藏
mUpgradeTipIv = findViewById(R.id.module_och_bus_upgrade_red_tip);
CallerHmiManager.INSTANCE.registerUpgradeTipsCallback(() -> mUpgradeTipIv);
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl);
if (mAICollectBtn != null){
CallerDevaToolsManager.INSTANCE.initAiCollect(mAICollectBtn);
}
}
private void updateSwitchMapIcon(){
@@ -246,9 +251,13 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
@Override
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel);
}
// if (!HmiBuildConfig.isShowBadCaseView && recordPanel != null && recordPanel.getType() == 1 && recordPanel.getStat() == 100) {
// CallerDevaToolsManager.INSTANCE.onReceiveBadCaseRecord(recordPanel);
// }
}
@Override
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
}
@@ -479,9 +488,9 @@ 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为负值
mouduleArc.setArcColor(Color.parseColor(speed > 60 ? "#DB3137" : "#3E77F6"));
mouduleArc.setValues(speed);
flSpeed.setBackgroundResource(speed > 60 ? R.drawable.bus_yi_biao_pan_bg_speeding : R.drawable.bus_yi_biao_pan_bg_nor);
if (mTrafficDataView != null){
mTrafficDataView.updateSpeedWithValue(speed);
}
}
@Override
@@ -521,6 +530,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
private TextView lineIdTV;
private TextView trajMd5TV;
private TextView stopMd5TV;
private TextView trajMd5DPQPTV;
private TextView stopMd5DPQPTV;
public void showHideTestBar() {
if (busTestBar == null) {
@@ -528,6 +539,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id);
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5);
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5);
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp);
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp);
}
if (busTestBar.getVisibility() == View.VISIBLE) {
@@ -537,6 +550,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
busTestBar.setVisibility(View.VISIBLE);
}
}
@@ -547,6 +562,8 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
}
}
/**

View File

@@ -26,6 +26,7 @@ import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.presenter.BusPresenter;
import com.mogo.och.bus.ui.BusSwitchLineActivity;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import java.util.List;
@@ -42,11 +43,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
private static final String TAG = "BusFragment";
private TextView mCurrentStationName;
private TextView mStartStationFlag;
private TextView mNextStationName;
private TextView mEndStationFlag;
// private TextView mDebugArrive;
private TextView mCurrentTag;
private TextView mNextTag;
private TextView mSwitchLine; //切换路线
private TextView mLineName;
private int mCurrentStation = 0;
private View mBus;
@@ -64,11 +65,11 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
super.initViews();
mBus = findViewById(R.id.module_och_bus_tag);
mCurrentStationName = findViewById(R.id.module_och_bus_current_station);
mStartStationFlag = findViewById(R.id.module_och_bus_start_station_tag);
mCurrentTag = findViewById(R.id.module_och_bus_current_station_anchor);
mNextStationName = findViewById(R.id.module_och_bus_order_end_station);
mEndStationFlag = findViewById(R.id.module_och_bus_end_station_tag);
mNextTag = findViewById(R.id.module_och_bus_next_station_anchor);
mSwitchLine = findViewById(R.id.switch_line_btn);
// mDebugArrive = findViewById(R.id.module_och_bus_arrive_station);
mLineName = findViewById(R.id.module_och_bus_line_name);
if (DebugConfig.isDebug()) {
mBus.setOnClickListener(view -> {
@@ -76,10 +77,6 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
mPresenter.queryBusRoutes();
});
// mBus.setOnLongClickListener(view -> {
// getActivity().finish();
// return true;
// });
//debug下调用测试面板
mCurrentStationName.setOnLongClickListener(v -> {
debugTestBar();
@@ -132,7 +129,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
* @param nextStation 下个站点
* @param isArrived 是否都站
*/
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
public void refreshBusStations(String lineName,List<BusStationBean> stationList
, int currentStation, int nextStation, boolean isArrived) {
mCurrentStation = currentStation;
if (getActivity() == null) {
return;
@@ -144,25 +142,25 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
}
// 渲染小巴路线数据
renderCurrentStationStatus(stationList, currentStation, nextStation, isArrived);
renderCurrentStationStatus(lineName,stationList, currentStation, nextStation, isArrived);
});
}
/**
* 重新刷新站点信息 isArrived 是否到站
*/
private void renderCurrentStationStatus(List<BusStationBean> stationList, int currentStation
private void renderCurrentStationStatus(String lineName,List<BusStationBean> stationList, int currentStation
, int nextStation, boolean isArrived) {
CallerLogger.INSTANCE.d(M_BUS + "MapMaker ", "currentStation=" + currentStation + ",nextStation=" + nextStation + "isArrived=" + isArrived);
String currentStationName = null;
String nextStationName = null;
int startStationFlagVisibility = View.INVISIBLE;
int endStationFlagVisibility = View.INVISIBLE;
boolean isArriveEndStation = false;
boolean isArriveAtStation = false;
boolean isArriveAtStartStation = false;
mLineName.setText(lineName);
// 获取当前站点的名称
currentStationName = stationList.get(currentStation).getName();
@@ -171,9 +169,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
// 是否到达起点
if (currentStation == 0) {
startStationFlagVisibility = View.VISIBLE;
isArriveAtStartStation = true;
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
mCurrentTag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
@@ -181,6 +178,8 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
, endStation.getLon(),R.raw.end_marker);
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
isArriveAtStation = true;
mCurrentTag.setText(getResources().getString(R.string.bus_arrive_to_current_tag));
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_next_tag));
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
@@ -189,9 +188,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
isArriveEndStation = true;
nextStationName = "--";
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
startStationFlagVisibility = View.VISIBLE;
endStationFlagVisibility = View.INVISIBLE;
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(),R.raw.star_marker);
@@ -211,8 +208,16 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
}
// 是否到达终点
if (nextStation == stationList.size() - 1) {
endStationFlagVisibility = View.VISIBLE;
if ( nextStation == stationList.size() - 1 || nextStation == -1) {
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
}else {
mNextTag.setText(getResources().getString(R.string.bus_arrive_to_next_tag));
}
if (currentStation == 0 && isArrived){
showOrHideSwitchLineBtn(true);
}else {
showOrHideSwitchLineBtn(false);
}
// 重置滑动按钮文字
@@ -226,12 +231,17 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
mCurrentStationName.setText(currentStationName);
mNextStationName.setText(nextStationName);
mStartStationFlag.setVisibility(startStationFlagVisibility);
mEndStationFlag.setVisibility(endStationFlagVisibility);
updateBusTestBarInfo();
}
private void showOrHideSwitchLineBtn(boolean isShow) {
if (isShow){
mSwitchLine.setVisibility(View.VISIBLE);
}else {
mSwitchLine.setVisibility(View.GONE);
}
}
public void hideOchBus() {
// tvNotice.setVisibility(View.GONE);
}
@@ -328,27 +338,43 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
Runnable setMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
}else {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
Runnable removeMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
}
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}
@@ -374,5 +400,4 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
startActivity(intent);
}
}
}

View File

@@ -11,11 +11,13 @@ import android.location.Location;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.amap.api.maps.model.LatLng;
import com.elegant.network.utils.GsonUtil;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
@@ -24,8 +26,10 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -79,7 +83,6 @@ import mogo.telematics.pad.MessagePad;
public class BusOrderModel {
private final String TAG = BusOrderModel.class.getSimpleName();
private int currentLineId = -1;
private int currentStationIndex = 0; //因为服务端和前台对于当前站不一致所以设置两个current index 一个用于前台展示, 一个用于服务端接口请求
private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引
/**
* 运营状态、后端更具运营状态来判断车辆是否派单
@@ -111,6 +114,8 @@ public class BusOrderModel {
private boolean hadQueryLeaveAwayPassager = false;
private volatile boolean isArrivedStation = false;
private final Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
@@ -246,12 +251,12 @@ public class BusOrderModel {
* 上报订单全路径规划数据
*/
public void updateOrderRoute() {
if (!isGoingToNextStation || currentStationIndex >= stationList.size() || currentStationIndex-1 < 0 || points.size() == 0){
if (!isGoingToNextStation || backgroundCurrentStationIndex+1 >= stationList.size() || points.size() == 0){
return;
}
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
BusServiceManager.getInstance().updateOrderRoute(mContext, currentLineId, currentStation.getSiteId()
, nextStation.getSiteId(), points, new IBusServiceCallback<BaseData>() {
@@ -376,9 +381,42 @@ public class BusOrderModel {
if (mControllerStatusCallback != null) {
mControllerStatusCallback.onCarLocationChanged(location);
}
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
if (isGoingToNextStation && !isArrivedStation){
judgeStartStation(location);
}
}
};
//根据围栏判断,是否到达起点
private void judgeStartStation(Location location) {
if (backgroundCurrentStationIndex +1 > stationList.size() - 1 ){
return;
}
BusStationBean upcomingStation = stationList.get( backgroundCurrentStationIndex +1);
double startLon = upcomingStation.getGcjLon();
double startLat = upcomingStation.getGcjLat();
double distance = CoordinateUtils.calculateLineDistance(
startLon, startLat,
location.getLongitude(), location.getLatitude() );
Logger.i(TAG, "judgeStartStation() distance = " + distance);
if ( distance > BusConst.ARRIVE_AT_END_STATION_DISTANCE ) {
distance = CoordinateUtils.calculateLineDistance(startLon, startLat,
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(),
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat());
}
if ( distance <= BusConst.ARRIVE_AT_END_STATION_DISTANCE ) {
onArriveAt(null); //无自动驾驶到站信息传null
return;
}
}
/**
* 查询小巴路线
*/
@@ -443,14 +481,14 @@ public class BusOrderModel {
if ( o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty() ) {
return;
}
isArrivedStation = false;
if (!isOneWayOver){
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
//需要更改当前站和下一站的状态 然后渲染
RenderLeaveStationSuccess(o.getResult(),isRestart);
leaveStationSuccess(o.getResult(),isRestart);
}else {
CallerLogger.INSTANCE.d( M_BUS + TAG, "单程真的结束了====" );
isGoingToNextStation = false;
currentStationIndex = 0;
backgroundCurrentStationIndex = 0;
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
queryBusRoutes();
@@ -480,7 +518,7 @@ public class BusOrderModel {
paramIndexes = {0},
clientPkFileName = "sn"
)
private void RenderLeaveStationSuccess(BusRoutesResult result, boolean isRestart) {
private void leaveStationSuccess(BusRoutesResult result, boolean isRestart) {
renderBusStationsStatus(result);
if (slidePannelHideCallback != null) {
slidePannelHideCallback.hideSlidePanel();
@@ -500,8 +538,12 @@ public class BusOrderModel {
* @param isRestart
*/
private void startAutopilot(boolean isRestart) {
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
triggerStartServiceEvent(isRestart, false);
isArrivedStation = false;
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex + 1);
// if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
// == CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
@@ -523,14 +565,15 @@ public class BusOrderModel {
busRoutesResult.getLineId(),
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
busRoutesResult.contrailSaveTime, busRoutesResult.carModel);
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
busRoutesResult.contrailSaveTimeDPQP);
}
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+" startLatLon="+currentStation.getName()+"endLatLon="+nextStation.getName());
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
triggerStartServiceEvent(isRestart, false);
if (mControllerStatusCallback != null) {
mControllerStatusCallback.startOpenAutopilot();
}
@@ -540,9 +583,18 @@ public class BusOrderModel {
* 到站后重置站点状态
*/
private void arriveSiteStation(boolean isRestart) {
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+currentStationIndex);
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) { //到站短时间内调用多次
CallerLogger.INSTANCE.e( M_BUS + TAG, "数组越界" );
return;
}
int arrivedStationIndex = 0;
if (!isRestart){
arrivedStationIndex = backgroundCurrentStationIndex + 1;
}
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex);
BusServiceManager.getInstance().arriveSiteStation(mContext
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
, stationList.get(arrivedStationIndex).getSeq(), stationList.get(arrivedStationIndex).getSiteId()
, new IBusServiceCallback<BaseData>() {
@Override
public void onSuccess(BaseData o) {
@@ -567,9 +619,9 @@ public class BusOrderModel {
private void renderArriveBusStation() {
List<BusStationBean> site = busRoutesResult.getSites();
if (site != null && site.size() > 0){
backgroundCurrentStationIndex = currentStationIndex;
backgroundCurrentStationIndex ++;
if (refreshBusStationsCallback != null){
refreshBusStationsCallback.refreshBusStations(stationList, currentStationIndex
refreshBusStationsCallback.refreshBusStations(busRoutesResult.getName(),stationList, backgroundCurrentStationIndex
, getNextStopStation(),true);
}
}
@@ -582,7 +634,7 @@ public class BusOrderModel {
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
, stationList.get(currentStationIndex).getSeq(), stationList.get(currentStationIndex).getSiteId()
, stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
, new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
@Override
public void onSuccess(QueryLeaveAwayPassengersResponse o) {
@@ -608,6 +660,7 @@ public class BusOrderModel {
@Override
public void onSuccess(BaseData o) {
mIsWorking = !mIsWorking;
closeBeautificationMode();
carOperationStatusCallback.changeOperationStatus(isWorking());
startOrStopOrderLoop(mIsWorking);
BusTrajectoryManager.getInstance().stopTrajReqLoop();
@@ -623,6 +676,17 @@ public class BusOrderModel {
});
}
/**
* 关闭美化模式
*/
private void closeBeautificationMode() {
if (FunctionBuildConfig.isDemoMode) {//收车结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为false收车");
}
}
/**
* 出车
*/
@@ -634,7 +698,7 @@ public class BusOrderModel {
startOrStopOrderLoop(mIsWorking);
if ( stationList != null && stationList.size() > 0 ) {
AIAssist.getInstance( mContext ).speakTTSVoice( "车辆已整备完毕,请前往"
+ stationList.get( currentStationIndex ).getName() + "站点" );
+ stationList.get( backgroundCurrentStationIndex ).getName() + "站点" );
}
carOperationStatusCallback.changeOperationStatus(isWorking());
queryBusRoutes();
@@ -693,7 +757,7 @@ public class BusOrderModel {
/**
* 渲染站点信息
* 服务端返回的OchBusRoutesResult逻辑 离开站为当前站, 到达下一站后才会将下一站置为当前站,
* 车机端展示离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理current index不能直接渲染
* 车机端展示 离开站为当前站点,前往站为下一站, 下一站到站后在置为当前站
* @param result
*/
private void renderBusStationsStatus(BusRoutesResult result) {
@@ -705,42 +769,47 @@ public class BusOrderModel {
stationList.addAll( site );
for ( int i = 0; i < stationList.size(); i++ ) {
BusStationBean s = stationList.get( i );
CallerLogger.INSTANCE.d( M_BUS + "renderBusStationsStatus--",
"Index="+ i+" ,name = "+s.getName()+" ,"+s.isLeaving()+","+s.getDrivingStatus());
// 是否正在开往下一站
if ( s.isLeaving()) {
isGoingToNextStation = true;
}
// 当前站点信息
if (s.getDrivingStatus() == STATION_STATUS_STOPPED ) {
currentStationIndex = i;
backgroundCurrentStationIndex = i;
break;
}
}
backgroundCurrentStationIndex = currentStationIndex;
BusStationBean currentStation = stationList.get(currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "渲染站点信息服务端currentStationIndex="+currentStationIndex
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG,
"渲染站点信息服务端currentStationIndex="+backgroundCurrentStationIndex
+" isLeaving()="+currentStation.isLeaving());
//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态
// ,订单开始站下在始发站的状态流转有问题
if (currentStationIndex == 0 && !currentStation.isLeaving()){
if (backgroundCurrentStationIndex == 0 && !currentStation.isLeaving()){
arriveSiteStation(true);
}
// 美化是否开始
if (FunctionBuildConfig.isDemoMode && ((currentStationIndex > 0
&& currentStationIndex < stationList.size()-1)
|| (stationList.get(0).isLeaving() || stationList.get(stationList.size() -1).isLeaving()))){//行驶过程中设置美化
if (FunctionBuildConfig.isDemoMode && (backgroundCurrentStationIndex >= 0
&& backgroundCurrentStationIndex <= stationList.size()-1)
&& stationList.get(backgroundCurrentStationIndex).isLeaving()){//行驶过程中设置美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true;
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(true);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为true每次滑动出发");
}
if (refreshBusStationsCallback != null){
if (currentStation.isLeaving()){//如果服务端的当前站是leaving状态展示当前站需要+1
currentStationIndex ++;
refreshBusStationsCallback.refreshBusStations(stationList
, currentStationIndex, getNextStopStation(),false);
}else{
refreshBusStationsCallback.refreshBusStations(stationList
, currentStationIndex, getNextStopStation(),true);
}
refreshBusStationsCallback.refreshBusStations(result.getName(),stationList
, backgroundCurrentStationIndex, getNextStopStation(),!currentStation.isLeaving());
}
if ( currentStation.isLeaving() && slidePannelHideCallback != null) {
slidePannelHideCallback.hideSlidePanel();
}
@@ -755,10 +824,10 @@ public class BusOrderModel {
* @return -1 当前已是最后一个站点
*/
private int getNextStopStation() {
if ( currentStationIndex >= stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex >= stationList.size() - 1 ) {
return -1;
}
int nextStationIndex = currentStationIndex + 1;
int nextStationIndex = backgroundCurrentStationIndex + 1;
for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) {
if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) {
break;
@@ -789,12 +858,13 @@ public class BusOrderModel {
* @param awayPassengersResponse
*/
private void playLeavePassengersMsg( QueryLeaveAwayPassengersResponse awayPassengersResponse ) {
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="+currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "播报下车乘客信息currentStationIndex="
+ String.valueOf(backgroundCurrentStationIndex + 1));
if ( currentStationIndex > stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
return;
}
String station = stationList.get( currentStationIndex ).getName();
String station = stationList.get( backgroundCurrentStationIndex+1 ).getName();
StringBuilder builder = new StringBuilder( "已到达" );
builder.append( station );
if ( !station.endsWith( "" ) ) {
@@ -841,9 +911,8 @@ public class BusOrderModel {
* 行程结束
*/
private void travelOver() {
// CallerLogger.INSTANCE.d( M_BUS + TAG, "行程结束");
if ( currentStationIndex >= stationList.size() ) {
if ( backgroundCurrentStationIndex >= stationList.size() ) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "travel over index out of station list" );
return;
}
@@ -862,18 +931,22 @@ public class BusOrderModel {
* @param data
*/
public void onArriveAt( MessagePad.ArrivalNotification data){
if ( currentStationIndex > stationList.size() - 1 ) {
if ( backgroundCurrentStationIndex +1 > stationList.size() - 1 ) {
CallerLogger.INSTANCE.e( M_BUS + TAG, "到站异常,取消后续操作结束" );
return;
}
if (FunctionBuildConfig.isDemoMode && currentStationIndex == stationList.size() - 1) {//到达最后一站结束美化
if (isArrivedStation) return;
isArrivedStation = true;
if (FunctionBuildConfig.isDemoMode && backgroundCurrentStationIndex <= stationList.size() - 1) {//到达一站结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;
CallerAutoPilotManager.INSTANCE.setIPCDemoMode(false);
CallerLogger.INSTANCE.d(M_BUS + TAG, "美化模式-ignore置为false到最后一站");
}
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + currentStationIndex);
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex);
isGoingToNextStation = false;
// 到达站点后,更新站点状态
// currentStationIndex = getNextStopStation();
queryStationLeaveAwayPassengers();
UiThreadHandler.postDelayed(new Runnable() {// 先查询下车乘客,再上报到站,便于后台筛查下车订单
@Override
@@ -916,11 +989,11 @@ public class BusOrderModel {
}
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
if (stationList == null || currentStationIndex >= stationList.size() || currentStationIndex == 0) {
if (stationList == null || backgroundCurrentStationIndex >= stationList.size()-1) {
return;
}
BusStationBean currentStation = stationList.get( currentStationIndex -1);
BusStationBean nextStation = stationList.get( currentStationIndex);
BusStationBean currentStation = stationList.get( backgroundCurrentStationIndex);
BusStationBean nextStation = stationList.get( backgroundCurrentStationIndex +1);
BusAnalyticsManager.getInstance().triggerStartAutopilotEvent(isRestart, send,
currentStation.getName(), nextStation.getName(), currentLineId);
}
@@ -930,6 +1003,6 @@ public class BusOrderModel {
}
public int getCurrentStationIndex() {
return currentStationIndex;
return backgroundCurrentStationIndex;
}
}

View File

@@ -64,6 +64,10 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
BusLineModel.getInstance().commitSwitchLineId(lineId);
}
public void removeListener(){
BusLineModel.getInstance().setBusLinesCallback(null);
}
public void queryBusRoutes(){
BusOrderModel.getInstance().queryBusRoutes();
}
@@ -71,6 +75,5 @@ public class BusLinePresenter extends Presenter<BusSwitchLineView> implements IB
@Override
public void onDestroy(@NonNull LifecycleOwner owner) {
super.onDestroy(owner);
BusLineModel.getInstance().setBusLinesCallback(null);
}
}

View File

@@ -32,6 +32,7 @@ import java.util.List;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
/**
* 网约车小巴
@@ -47,6 +48,7 @@ public class BusPresenter extends Presenter<BusFragment>
private int currentAutopilotStatus = -1;
private List<BusStationBean> mStationList = new ArrayList<>();
private int mCurrentStation = 0;
private boolean isRestartAutopilot = false;
public BusPresenter(BusFragment view) {
super(view);
@@ -84,14 +86,6 @@ public class BusPresenter extends Presenter<BusFragment>
BusOrderModel.getInstance().setControllerStatusCallback(null);
}
// public void setIsAnimateRunning(boolean isAnimateRunning){
// this.isAnimateRunning = isAnimateRunning;
// }
// public boolean getIsAnimateRunning(){
// return isAnimateRunning;
// }
public void queryBusRoutes() {
BusOrderModel.getInstance().queryBusRoutes();
}
@@ -103,12 +97,14 @@ public class BusPresenter extends Presenter<BusFragment>
public void autoDriveToNextStation(boolean isRestart) {
currentAutopilotStatus = -1;
BusOrderModel.getInstance().autoDriveToNextStation(isRestart);
isRestartAutopilot = false;
}
public void restartAutopilot() {
if (BusOrderModel.getInstance().isGoingToNextStation()){
currentAutopilotStatus = -1;
BusOrderModel.getInstance().restartAutopilot();
isRestartAutopilot = true;
}
}
@@ -124,14 +120,15 @@ public class BusPresenter extends Presenter<BusFragment>
}
@Override
public void refreshBusStations(List<BusStationBean> stationList, int currentStation, int nextStation, boolean isArrived) {
public void refreshBusStations(String lineName,List<BusStationBean> stationList
, int currentStation, int nextStation, boolean isArrived) {
mStationList.clear();
mStationList.addAll(stationList);
mCurrentStation = currentStation;
// functionDemoModeChange();
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel =", " mCurrentStation =" + mCurrentStation);
if (mView != null) {
runOnUIThread(() -> mView.refreshBusStations(
runOnUIThread(() -> mView.refreshBusStations(lineName,
stationList, currentStation, nextStation, isArrived));
}
}
@@ -168,7 +165,7 @@ public class BusPresenter extends Presenter<BusFragment>
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
if (autopilotStatusInfo == null) return;
int state = autopilotStatusInfo.getState();
CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus);
// CallerLogger.INSTANCE.d(M_BUS + TAG, "onStateChange: " + state + "currentAutopilotStatus = " + currentAutopilotStatus);
switch (state) {
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
@@ -203,7 +200,7 @@ public class BusPresenter extends Presenter<BusFragment>
// 改变UI自动驾驶状态
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
BusOrderModel.getInstance().triggerStartServiceEvent(
BusOrderModel.getInstance().isGoingToNextStation(), true);
isRestartAutopilot, true);
}
break;
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
@@ -283,4 +280,9 @@ public class BusPresenter extends Presenter<BusFragment>
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @Nullable String reason) {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
}

View File

@@ -79,7 +79,7 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
mLinesListView = findViewById(R.id.switch_line_rv);
mLinesListView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new SwitchLineAdapter(this,mData);
mAdapter = new SwitchLineAdapter(getApplicationContext(),mData);
mLinesListView.setAdapter(mAdapter);
//设置item 点击事件
mAdapter.setOnLineItemClickListener(new LineItemClickListener() {
@@ -158,6 +158,10 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
public void onChangeLineIdSuccess(){
ToastUtils.showLong(getResources().getString(R.string.bus_change_line_commit_tip_s));
mPresenter.queryBusRoutes();
if (mAdapter != null){
mAdapter.setOnLineItemClickListener(null);
}
mPresenter.removeListener();
finish();
}
@@ -198,9 +202,6 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
@Override
protected void onDestroy() {
super.onDestroy();
if (mAdapter != null){
mAdapter.setOnLineItemClickListener(null);
}
}
/**
@@ -255,6 +256,9 @@ public class BusSwitchLineActivity extends MvpActivity<BusSwitchLineView, BusLin
}
}else {
if (line.choose == 1){//1:绑定 2:未绑定 默认绑定
if (mItemClickListener != null) {
mItemClickListener.onItemClick(position);
}
holder.selectIv.setImageResource(R.drawable.bus_selected_btn);
}else {
holder.selectIv.setImageResource(R.drawable.bus_unselect_btn);

View File

@@ -5,7 +5,9 @@ import android.text.TextUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.app.AppConfigInfo;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.call.analytics.AnalyticsManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.och.bus.constant.BusConst;
@@ -35,7 +37,9 @@ public class BusAnalyticsManager {
private Runnable startAutopilotRunnable = () -> {
// 15s内未开启上报失败埋点
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT, false);
mStartAutopilotParams.put(BusConst.EVENT_PARAM_START_RESULT
, CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() ==
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
AnalyticsManager.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
};

View File

@@ -40,9 +40,9 @@ public class BusTrajectoryManager {
private Disposable mSendReqDisposable = null;
public BusTrajectoryManager() {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(
-1, "", "", "", "",
0, "");
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
"", "", "", "", 0, "",
"", "", "", "", 0);
}
/**
@@ -106,7 +106,10 @@ public class BusTrajectoryManager {
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(routesResult.getLineId(),
routesResult.csvFileUrl, routesResult.csvFileMd5,
routesResult.txtFileUrl, routesResult.txtFileMd5,
routesResult.contrailSaveTime, routesResult.carModel);
routesResult.contrailSaveTime, routesResult.carModel,
routesResult.csvFileUrlDPQP, routesResult.csvFileMd5DPQP,
routesResult.txtFileUrlDPQP, routesResult.txtFileMd5DPQP,
routesResult.contrailSaveTimeDPQP);
} else {
mAutoPilotLine.setLineId(routesResult.getLineId());
mAutoPilotLine.setTrajUrl(routesResult.csvFileUrl);
@@ -115,6 +118,11 @@ public class BusTrajectoryManager {
mAutoPilotLine.setStopMd5(routesResult.txtFileMd5);
mAutoPilotLine.setTimestamp(routesResult.contrailSaveTime);
mAutoPilotLine.setVehicleModel(routesResult.carModel);
mAutoPilotLine.setTrajUrl_dpqp(routesResult.csvFileUrlDPQP);
mAutoPilotLine.setTrajMd5_dpqp(routesResult.csvFileMd5DPQP);
mAutoPilotLine.setStopUrl_dpqp(routesResult.txtFileUrlDPQP);
mAutoPilotLine.setStopMd5_dpqp(routesResult.txtFileMd5DPQP);
mAutoPilotLine.setTimestamp_dpqp(routesResult.contrailSaveTimeDPQP);
}
}
}
@@ -128,6 +136,11 @@ public class BusTrajectoryManager {
mAutoPilotLine.setStopMd5("");
mAutoPilotLine.setTimestamp(0);
mAutoPilotLine.setVehicleModel("");
mAutoPilotLine.setTrajUrl_dpqp("");
mAutoPilotLine.setTrajMd5_dpqp("");
mAutoPilotLine.setStopUrl_dpqp("");
mAutoPilotLine.setStopMd5_dpqp("");
mAutoPilotLine.setTimestamp_dpqp(0);
}
private void startTrajReqLoop() {

View File

@@ -112,6 +112,7 @@ public class SlidePanelView extends View {
}
private void init() {
bgRectF = new RectF(0, 0, 0, 0);
bgPaint.setColor(Color.parseColor("#CC0F1325"));
bgPaint.setStyle(Paint.Style.FILL);
@@ -160,7 +161,12 @@ public class SlidePanelView extends View {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
bgRectF = new RectF(0, 0, w, h);
if (bgRectF != null){
bgRectF.left = 0;
bgRectF.top = 0;
bgRectF.right = w;
bgRectF.bottom = h;
}
if (matrixAnim != null) {
matrixAnim.cancel();
@@ -233,10 +239,10 @@ public class SlidePanelView extends View {
}
private void startBlockBackAnim() {
ObjectAnimator animator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration(1000 * blockOffset / getWidth());
animator.start();
ObjectAnimator blockBackanimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
blockBackanimator.setInterpolator(new DecelerateInterpolator());
blockBackanimator.setDuration(1000 * blockOffset / getWidth());
blockBackanimator.start();
lastX = 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_selected="true" />
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" />
<item android:drawable="@drawable/icon_ai_normal" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_selected="true" />
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" />
<item android:drawable="@drawable/icon_bad_case_normal" />
</selector>

View File

@@ -1,46 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#293159" android:startColor="#293159" />
</shape>
<item android:state_pressed="true" android:drawable="@drawable/press_start_status">
</item>
<!-- <item android:state_pressed="false">-->
<!-- <shape android:shape="rectangle">-->
<!-- <corners android:bottomLeftRadius="20px" android:bottomRightRadius="45px" android:topLeftRadius="45px" android:topRightRadius="20px" />-->
<!-- <gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />-->
<!-- </shape>-->
<!-- </item>-->
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#2B6EFF" android:startColor="#2B6EFF" />
</shape>
<item android:state_selected="true" android:drawable="@drawable/start_success">
</item>
<item android:state_selected="false">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:state_selected="false" android:drawable="@drawable/start_failure">
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#293159" android:startColor="#293159" />
</shape>
<item android:state_focused="true" android:drawable="@drawable/press_start_status">
</item>
<item android:state_focused="false">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:state_focused="false" android:drawable="@drawable/start_failure">
</item>
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="30px" android:bottomRightRadius="70px" android:topLeftRadius="70px" android:topRightRadius="30px" />
<gradient android:angle="315" android:endColor="#3B4577" android:startColor="#3B4577" />
</shape>
<item android:drawable="@drawable/start_failure">
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#000B4B" android:startColor="#001C83" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient android:angle="180" android:endColor="#0027FF" android:startColor="#4267FF" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_selected="true" />
<item android:drawable="@drawable/bus_operation_status_select_bg" android:state_focused="true" />
<item android:drawable="@drawable/bus_operation_status_bg" />
</selector>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- <corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />-->
<gradient
android:startColor="#029DFF"
android:endColor="#0056FF"
android:angle="225"
/>
<size
android:width="120px"
android:height="120px"
/>
</shape>

View File

@@ -3,10 +3,9 @@
<item>
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="27px"
android:bottomRightRadius="27px"/>
<solid android:color="#2A67EF"></solid>
<corners android:bottomLeftRadius="40px"
android:bottomRightRadius="40px"/>
<gradient android:angle="180" android:endColor="#004DFF" android:startColor="#20AAFF" />
</shape>
</item>
</selector>

View File

@@ -5,67 +5,60 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_72">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/bus_ext_speed_width"
android:layout_height="@dimen/bus_ext_speed_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginTop="@dimen/module_mogo_och_margin_left"
android:background="@drawable/bus_yi_biao_pan_bg_nor"
android:elevation="@dimen/bus_dp_10"
android:padding="@dimen/bus_dp_20"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_616"
android:layout_height="@dimen/dp_320"
android:layout_marginLeft="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_40"
android:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.och.bus.view.BusArcView
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
android:id="@+id/bus_arc"
android:layout_width="@dimen/bus_ext_arcView_width"
android:layout_height="@dimen/bus_ext_arcView_height"
android:layout_gravity="center" />
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<RelativeLayout
android:id="@+id/module_mogo_och_autopilot_status"
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
android:layout_marginTop="@dimen/bus_ext_arcView_top"
android:background="@drawable/bus_autopilot_status_bg"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_13"
android:gravity="center"
tools:visibility="visible" >
<ImageView
android:id="@+id/bus_autopilot_btn_iv"
android:layout_width="56px"
android:layout_height="56px"
android:layout_width="73px"
android:layout_height="73px"
android:layout_centerVertical="true"
android:src="@drawable/bus_ic_autopilot" />
<TextView
android:id="@+id/bus_autopolot_btn_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自动驾驶"
android:layout_centerVertical="true"
android:layout_marginLeft="28px"
android:layout_toRightOf="@+id/bus_autopilot_btn_iv"
android:text="自动驾驶"
android:textColor="@color/bus_autopilot_text_color_normal"
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
android:layout_centerVertical="true"
android:textStyle="bold"/>
android:textStyle="bold" />
</RelativeLayout>
<FrameLayout
android:id="@+id/module_mogo_och_station_panel_container"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_m_t"
android:background="@drawable/bus_panel_bkg"
android:elevation="@dimen/bus_dp_10"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_13"
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
tools:visibility="visible" />
@@ -127,41 +120,56 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
<ImageView
android:id="@+id/module_och_bus_upgrade_red_tip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_gravity="right"
android:visibility="gone"
android:elevation="8px"
android:background="@drawable/bus_setting_tip_red_cir_bg" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:background="@drawable/bus_setting_btn_bg" />
</RelativeLayout>
<ImageView
android:id="@+id/module_mogo_och_badcase_iv"
<RelativeLayout
android:id="@+id/module_mogo_och_badcase_rl"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:src="@drawable/bus_badcase_btn_bg"
android:background="@drawable/bus_operation_status_bg_selector"
android:elevation="@dimen/dp_10"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout"/>
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:src="@drawable/bad_case_selector"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/module_mogo_och_ai_collet_rl"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="@dimen/module_mogo_och_margin_left"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:elevation="@dimen/dp_10"
android:background="@drawable/bus_operation_status_bg_selector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_badcase_rl">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:src="@drawable/ai_collect_selector" />
</RelativeLayout>
<com.mogo.och.bus.view.SlidePanelView
android:id="@+id/module_mogo_och_slide_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:visibility="gone"
android:visibility="invisible"
app:BLOCK_START_X="@dimen/module_mogo_och_slide_panel_block_start_x"
app:BLOCK_START_Y="@dimen/module_mogo_och_slide_panel_block_start_y"
app:NORMAL_TEXT_MARGIN_LEFT="@dimen/module_mogo_och_slide_panel_normal_text_margin_left"
@@ -232,13 +240,4 @@
,btnAutopilotRunning,btnAutopilotRoute"
tools:visibility="visible" />
<!-- <com.mogo.och.bus.ui.BusTrafficLightView-->
<!-- android:id="@+id/bus_traffic_light_view"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintRight_toRightOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:layout_marginRight="@dimen/bus_traffic_light_layout_margin_right"-->
<!-- android:layout_marginTop="@dimen/bus_traffic_light_layout_margin_top"-->
<!-- android:visibility="gone"/>-->
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -22,4 +22,16 @@
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_traj_md5_dpqp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
<TextView
android:id="@+id/bus_test_bar_current_stop_md5_dpqp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"/>
</LinearLayout>

View File

@@ -2,188 +2,175 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/module_och_bus_order_status_stationInfo"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/module_mogo_och_autopilot_order_bg_height"
android:background="@drawable/bus_panel_bkg">
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp_28"
android:background="@drawable/bus_line_panel_bg"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<!-- <TextView-->
<!-- android:id="@+id/module_och_bus_arrive_to_end_title"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginTop="@dimen/dp_32"-->
<!-- android:layout_marginLeft="@dimen/dp_27"-->
<!-- android:text="@string/bus_arrive_to_end_title"-->
<!-- android:textColor="#FFF"-->
<!-- android:textSize="@dimen/dp_27"-->
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- android:textStyle="bold" />-->
<!-- <View-->
<!-- android:id="@+id/module_och_bus_arrive_to_end_deviler_line"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/dp_1"-->
<!-- android:layout_marginTop="@dimen/dp_23"-->
<!-- app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_arrive_to_end_title"-->
<!-- app:layout_constraintTop_toBottomOf="@+id/module_och_bus_arrive_to_end_title"-->
<!-- android:background="#707DBE">-->
<!-- </View>-->
<TextView
android:id="@+id/module_och_bus_line_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_68"
android:layout_marginRight="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_64"
android:ellipsize="end"
android:maxLines="1"
android:text="--"
android:textColor="#FFF"
android:textSize="38px"
android:textStyle="bold"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_tag"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_bus_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/dp_109"
android:layout_height="@dimen/dp_42"
android:layout_gravity="right"
android:layout_marginTop="@dimen/module_mogo_och_autopilot_order_tag_m_t"
android:layout_marginRight="@dimen/module_mogo_och_autopilot_order_tag_m_r"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_60"
android:background="@drawable/bus_panel_anchor_bkg"
android:paddingLeft="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingTop="2px"
android:paddingRight="@dimen/module_mogo_och_autopilot_order_tag_p_r"
android:paddingBottom="2px"
android:gravity="center"
android:text="小巴车"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_autopilot_order_tag_height"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_line_name"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/module_och_bus_line_name" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/module_och_bus_order_status_stationInfo"
<View
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_4"
android:layout_marginTop="@dimen/dp_24"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:background="@drawable/bus_line_dividing_line1_selector"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_tag" />
<View
android:id="@+id/line2"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_4"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:background="@drawable/bus_line_dividing_line2_selector"
app:layout_constraintLeft_toLeftOf="@+id/line1"
app:layout_constraintRight_toRightOf="@+id/line1"
app:layout_constraintTop_toBottomOf="@+id/line1" />
<TextView
android:id="@+id/module_och_bus_current_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft"
android:paddingTop="8px"
android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight"
android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_tag"
app:layout_constraintLeft_toLeftOf="parent">
android:layout_marginLeft="14px"
android:layout_marginTop="@dimen/dp_24"
android:text="当前站点:"
android:textColor="#CAD6FF"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/line2" />
<TextView
android:id="@+id/module_och_bus_current_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14px"
android:text="当前站点:"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_och_bus_current_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_60"
android:ellipsize="end"
android:maxLines="2"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor" />
<TextView
android:id="@+id/module_och_bus_current_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6px"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_start_station_tag"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
tools:text="后路站" />
<TextView
android:id="@+id/module_och_bus_next_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_34"
android:text="下一站:"
android:textColor="#CAD6FF"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
<TextView
android:id="@+id/module_och_bus_start_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="始"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station"
tools:visibility="visible" />
<TextView
android:id="@+id/module_och_bus_order_end_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_goneMarginTop="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_60"
android:layout_marginBottom="@dimen/dp_30"
android:ellipsize="end"
android:maxLines="2"
app:layout_goneMarginBottom="@dimen/dp_40"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@+id/switch_line_btn"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
tools:text="后路站1" />
<TextView
android:id="@+id/module_och_bus_next_station_anchor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/module_och_bus_order_distance_anchor_marginTop"
android:text="下一站:"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_och_bus_order_start_station_anchor_textSize"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14px"
android:src="@drawable/bus_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_line_name"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
<TextView
android:id="@+id/module_och_bus_order_end_station"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="--"
android:textColor="#FFF"
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
android:textStyle="bold"
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_end_station_tag"
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
tools:text="后路站1" />
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/bus_dot_line"
app:layout_constraintBottom_toTopOf="@+id/blueDot"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<TextView
android:id="@+id/module_och_bus_end_station_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="终"
android:textColor="#8E9DD4"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:textStyle="bold"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station"
tools:visibility="visible" />
<ImageView
android:id="@+id/blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bus_icon_arriving_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
<ImageView
android:id="@+id/greenDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14px"
android:src="@drawable/bus_icon_arrived_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
<ImageView
android:id="@+id/dotLine"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/bus_dot_line"
app:layout_constraintBottom_toTopOf="@+id/blueDot"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintRight_toRightOf="@+id/greenDot"
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
<ImageView
android:id="@+id/blueDot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bus_icon_arriving_station"
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/switch_line_btn"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="@dimen/bus_switch_line_btn"
android:text="@string/bus_switch_line_btn"
android:layout_width="@dimen/bus_switch_line_btn_width_1"
android:layout_height="@dimen/bus_switch_line_btn_height_1"
android:layout_marginLeft="@dimen/dp_28"
android:background="@drawable/bus_switch_line_btn"
android:gravity="center"
android:text="@string/bus_switch_line_btn"
android:textColor="@android:color/white"
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
android:background="@drawable/bus_switch_line_btn"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
app:layout_constraintLeft_toLeftOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -13,8 +13,8 @@
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">40px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
@@ -44,20 +44,20 @@
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">34px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">34px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_height">28px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">64px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
<dimen name="module_mogo_och_margin_left">40px</dimen>
@@ -77,8 +77,8 @@
<dimen name="module_mogo_och_slide_panel_textSize">70px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">180px</dimen>
<dimen name="module_mogo_och_operation_status_bg_width">112px</dimen>
<dimen name="module_mogo_och_operation_status_bg_height">112px</dimen>
@@ -86,11 +86,11 @@
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
<dimen name="module_mogo_och_autopilot_order_m_t">30px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">466px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">446px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">36px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">40px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
@@ -104,9 +104,9 @@
<dimen name="bus_ext_arcView_stroke_with">20px</dimen>
<dimen name="bus_ext_arcView_top">40px</dimen>
<dimen name="bus_ext_arcView_width">320px</dimen>
<dimen name="bus_ext_speed_height">460px</dimen>
<dimen name="bus_ext_speed_height">320px</dimen>
<dimen name="bus_ext_speed_padding">70px</dimen>
<dimen name="bus_ext_speed_width">460px</dimen>
<dimen name="bus_ext_speed_width">616px</dimen>
<dimen name="bus_ext_speed_width_big_radius">130px</dimen>
<dimen name="bus_ext_speed_width_sm_radius">30px</dimen>
<dimen name="bus_switch_map">279px</dimen>
@@ -120,7 +120,8 @@
<dimen name="bus_switch_line_title">46px</dimen>
<dimen name="bus_switch_line_btn_width">700px</dimen>
<dimen name="bus_switch_line_btn_height">120px</dimen>
<dimen name="bus_switch_line_btn">86px</dimen>
<dimen name="bus_switch_line_btn_width_1">560px</dimen>
<dimen name="bus_switch_line_btn_height_1">116px</dimen>
<dimen name="bus_switch_line_btn_margin_b">20px</dimen>

View File

@@ -13,8 +13,8 @@
<dimen name="module_mogo_och_bus_current_station_name_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_current_station_notice_text_size">20px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">32px</dimen>
<dimen name="module_mogo_och_bus_station_name_text_size">40px</dimen>
<dimen name="module_mogo_och_bus_station_notice_text_size">42px</dimen>
<dimen name="module_mogo_och_bus_station_name_margin_left">15px</dimen>
@@ -44,11 +44,11 @@
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">32px</dimen>
<dimen name="module_och_bus_order_start_station_anchor_textSize">34px</dimen>
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">44.5px</dimen>
<dimen name="module_och_bus_order_distance_anchor_marginTop">34px</dimen>
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
@@ -57,7 +57,7 @@
<dimen name="module_mogo_och_autopilot_order_tag_height">25.6px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_t">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_m_r">20px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">16px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_r">64px</dimen>
<dimen name="module_mogo_och_autopilot_order_tag_p_l">16px</dimen>
<dimen name="module_mogo_och_margin_left">40px</dimen>
@@ -77,8 +77,8 @@
<dimen name="module_mogo_och_slide_panel_textSize">70px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">460px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">140px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_status_bg_height">180px</dimen>
<dimen name="module_mogo_och_operation_status_bg_width">112px</dimen>
<dimen name="module_mogo_och_operation_status_bg_height">112px</dimen>
@@ -86,11 +86,11 @@
<dimen name="module_mogo_och_operation_status_padding">92px</dimen>
<dimen name="module_mogo_och_autopilot_order_m_t">30px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">466px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">446px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_width">616px</dimen>
<dimen name="module_mogo_och_autopilot_order_bg_height">754px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">36px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_size">40px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
<dimen name="module_mogo_och_autopilot_status_text_m_l">350px</dimen>
@@ -119,7 +119,8 @@
<dimen name="bus_switch_line_title">46px</dimen>
<dimen name="bus_switch_line_btn_width">700px</dimen>
<dimen name="bus_switch_line_btn_height">120px</dimen>
<dimen name="bus_switch_line_btn">86px</dimen>
<dimen name="bus_switch_line_btn_width_1">560px</dimen>
<dimen name="bus_switch_line_btn_height_1">116px</dimen>
<dimen name="bus_switch_line_btn_margin_b">50px</dimen>
<dimen name="bus_traffic_light_layout_width">225px</dimen>

View File

@@ -135,7 +135,8 @@
<dimen name="bus_switch_line_title">30px</dimen>
<dimen name="bus_switch_line_btn_width">450px</dimen>
<dimen name="bus_switch_line_btn_height">72px</dimen>
<dimen name="bus_switch_line_btn">52px</dimen>
<dimen name="bus_switch_line_btn_width_1">280px</dimen>
<dimen name="bus_switch_line_btn_height_1">58px</dimen>
<dimen name="bus_switch_line_btn_margin_b">20px</dimen>
<dimen name="bus_traffic_light_layout_width">225px</dimen>

View File

@@ -19,9 +19,9 @@
<string name="bus_change_line_commit_tip_s">更换路线成功</string>
<string name="bus_change_line_commit_tip_f">更换路线失败</string>
<!-- <string name="bus_arrive_to_end_title">去往下车地点</string>-->
<string name="bus_arrive_to_end_start"></string>
<!-- <string name="bus_arrive_to_end_start1">上车</string>-->
<string name="bus_arrive_to_end_end"></string>
<!-- <string name="bus_arrive_to_end_end1">下车</string>-->
<string name="bus_arrive_to_end_start">起点:</string>
<string name="bus_arrive_to_end_end">终点:</string>
<string name="bus_arrive_to_current_tag">当前站点:</string>
<string name="bus_arrive_to_next_tag">下一站:</string>
<string name="bus_auto_disable_tip">自动驾驶状态为0不可用</string>
</resources>

View File

@@ -0,0 +1,261 @@
package com.mogo.och.common.module.utils;
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
* @author: wangmingjun
* @date: 2022/7/20
*/
public class AnimatorDrawableUtil {
private static final int MSG_START = 0xf1;
private static final int MSG_STOP = 0xf2;
private static final int STATE_STOP = 0xf3;
private static final int STATE_RUNNING = 0xf4;
//运行状态
private int mState = STATE_RUNNING;
//显示图片的View
private ImageView mImageView = null;
//图片资源的ID列表
private List<Integer> mResourceIdList = null;
//定时任务器
private Timer mTimer = null;
//定时任务
private AnimTimerTask mTimeTask = null;
//记录播放位置
private int mFrameIndex = 0;
//播放形式
private boolean isLooping = false;
public AnimatorDrawableUtil() {
mTimer = new Timer();
}
/**
* 设置动画播放资源
*/
public void setAnimation(ImageView imageview, List<Integer> resourceIdList) {
mImageView = imageview;
if(mResourceIdList==null){
mResourceIdList = new ArrayList<Integer>();
}else{
mResourceIdList.clear();
}
mResourceIdList.addAll(resourceIdList);
}
/**
* 设置动画播放资源
*/
public void setAnimation(Context context, int resourceId, ImageView imageview) {
this.mImageView = imageview;
if(mResourceIdList==null){
mResourceIdList = new ArrayList<Integer>();
}else{
mResourceIdList.clear();
}
loadFromXml(context, resourceId, new OnParseListener() {
@Override
public void onParse(List<Integer> res) {
mResourceIdList.addAll(res);
}
});
}
/**
* 解析xml
*
* @param context
* @param resourceId 资源id
*/
private void loadFromXml(final Context context, final int resourceId,
final OnParseListener onParseListener) {
if (context == null) {
return;
}
final List<Integer> res = new ArrayList<Integer>();
XmlResourceParser parser = context.getResources().getXml(resourceId);
try {
int eventType = parser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_DOCUMENT) {
} else if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("item")) {
for (int i = 0; i < parser.getAttributeCount(); i++) {
if (parser.getAttributeName(i).equals("drawable")) {
int resId = Integer.parseInt(parser.getAttributeValue(i).substring(1));
res.add(resId);
}
}
}
} else if (eventType == XmlPullParser.END_TAG) {
} else if (eventType == XmlPullParser.TEXT) {
}
eventType = parser.next();
}
} catch (IOException e) {
// TODO: handle exception
e.printStackTrace();
} catch (XmlPullParserException e2) {
// TODO: handle exception
e2.printStackTrace();
} finally {
parser.close();
}
if (onParseListener != null) {
onParseListener.onParse(res);
}
}
private AnimationLisenter lisenter;
/**
* 开始播放动画
*
* @param loop 是否循环播放
* @param duration 动画播放时间间隔
*/
public void start(boolean loop, int duration, AnimationLisenter lisenter) {
this.lisenter = lisenter;
stop();
if (mResourceIdList == null || mResourceIdList.size() == 0) {
return;
}
if (mTimer == null) {
mTimer = new Timer();
}
isLooping = loop;
mFrameIndex = 0;
mState = STATE_RUNNING;
mTimeTask = new AnimTimerTask();
mTimer.schedule(mTimeTask, 0, duration);
if (lisenter != null){
lisenter.startAnimation();
}
}
/**
* 停止动画播放
*/
public void stop() {
if (mTimer != null) {
mTimer.purge();
mTimer.cancel();
mTimer = null;
}
if (mTimeTask != null) {
mFrameIndex = 0;
mState = STATE_STOP;
mTimeTask.cancel();
mTimeTask = null;
}
//移除Handler消息
if (AnimHandler != null) {
AnimHandler.removeMessages(MSG_START);
AnimHandler.removeMessages(MSG_STOP);
AnimHandler.removeCallbacksAndMessages(null);
}
}
/**
* 定时器任务
*/
class AnimTimerTask extends TimerTask {
@Override
public void run() {
if (mFrameIndex < 0 || mState == STATE_STOP) {
return;
}
if (mFrameIndex < mResourceIdList.size()) {
Message msg = AnimHandler.obtainMessage(MSG_START, 0, 0, null);
msg.sendToTarget();
} else {
mFrameIndex = 0;
if (!isLooping) {
Message msg = AnimHandler.obtainMessage(MSG_STOP, 0, 0, null);
msg.sendToTarget();
}
}
}
}
/**
* Handler
*/
private Handler AnimHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_START: {
if (mFrameIndex >= 0 && mFrameIndex < mResourceIdList.size() && mState == STATE_RUNNING) {
//这里不能使用image.setImageResource 因为源码中也是创建了bitmap 所以这里我们自己创建
Bitmap bitmap=readBitMap(mImageView.getContext(),mResourceIdList.get(mFrameIndex));
mImageView.setImageBitmap(bitmap);
mFrameIndex++;
}
}
break;
case MSG_STOP: {
if (mTimeTask != null) {
mFrameIndex = 0;
mTimer.purge();
mTimeTask.cancel();
mState = STATE_STOP;
mTimeTask = null;
if (lisenter !=null){
lisenter.endAnimation();
}
if (isLooping) {
mImageView.setImageResource(0);
}
}
}
break;
default:
break;
}
}
};
public static Bitmap readBitMap(Context context, int resId) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
InputStream is = context.getResources().openRawResource(resId);
return BitmapFactory.decodeStream(is, null, opt);
}
public interface OnParseListener {
void onParse(List<Integer> res);
}
public interface AnimationLisenter {
void startAnimation();
void endAnimation();
}
}

View File

@@ -167,4 +167,34 @@ public class CoordinateCalculateRouteUtil {
}
return latePoints;
}
/**
* 简单粗暴 直接比较 todo 需要优化
* @param mRoutePoints
* @param realLon
* @param realLat
* @return 返回已经到达点的index
*/
public static int getArrivedPointIndex(List<LatLng> mRoutePoints,double realLon,double realLat) {
int currentIndex = 0; //记录疑似点
if (mRoutePoints.size() > 0){
//基础点
LatLng baseLatLng = mRoutePoints.get(0);
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,realLat
,baseLatLng.longitude,baseLatLng.latitude);// lon,lat, prelon, prelat
for (int i= 1; i < mRoutePoints.size(); i++){
LatLng latLng = mRoutePoints.get(i);
float diff = CoordinateUtils.calculateLineDistance(realLon,realLat
,latLng.longitude,latLng.latitude);
if (baseDiffDis > diff){
// Logger.d(M_TAXI + "calculateRouteSumLength", "点:"+i+"-------先记录点----- ");
baseDiffDis = diff;
currentIndex = i;
}
}
return currentIndex;
}
return currentIndex;
}
}

View File

@@ -9,7 +9,7 @@ import java.math.RoundingMode;
*/
public class NumberFormatUtil {
/**
* 有小数位, 没有小数保留整数
* 有小数1位, 没有小数保留整数
* @param d
* @return
*/

View File

@@ -0,0 +1,152 @@
package com.mogo.och.common.module.utils;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* @author: wangmingjun
* @date: 2022/7/19
*/
public class OCHThreadPoolManager<T> {
/**
* 根据cpu的数量动态的配置核心线程数和最大线程数
*/
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
/**
* 核心线程数 = CPU核心数 + 1
*/
private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
/**
* 线程池最大线程数 = CPU核心数 * 2 + 1
*/
private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1;
/**
* 非核心线程闲置时超时1s
*/
private static final int KEEP_ALIVE = 1;
/**
* 线程池的对象
*/
private ThreadPoolExecutor executor;
/**
* 要确保该类只有一个实例对象,避免产生过多对象消费资源,所以采用单例模式
*/
private OCHThreadPoolManager() {
}
private volatile static OCHThreadPoolManager INSTANCE;
public static OCHThreadPoolManager getsInstance() {
if (INSTANCE == null) {
synchronized (OCHThreadPoolManager.class) {
if (INSTANCE == null) {
INSTANCE = new OCHThreadPoolManager();
}
}
}
return INSTANCE;
}
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public void execute(Runnable r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
try {
executor.execute(r);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 开启一个有返回结果的线程
*
* @param r
* @return
*/
public Future<T> submit(Callable<T> r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
// 把一个任务丢到了线程池中
return executor.submit(r);
}
/**
* 开启一个无返回结果的线程
*
* @param r
*/
public Future submit(Runnable r) {
if (executor == null) {
/**
* corePoolSize:核心线程数
* maximumPoolSize线程池所容纳最大线程数(workQueue队列满了之后才开启)
* keepAliveTime非核心线程闲置时间超时时长
* unitkeepAliveTime的单位
* workQueue等待队列存储还未执行的任务
* threadFactory线程创建的工厂
* handler异常处理机制
*
*/
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
}
return executor.submit(r);
}
/**
* 把任务移除等待队列
*
* @param r
*/
public void cancel(Runnable r) {
if (r != null) {
executor.getQueue().remove(r);
}
}
}

View File

@@ -149,8 +149,10 @@ public abstract class BaseSurfaceView extends SurfaceView implements SurfaceHold
getHolder().unlockCanvasAndPost(canvas);
onFrameDrawFinish();
}
handler.postDelayed(this, frameDuration);
if (handler != null){
handler.postDelayed(this, frameDuration);
}
}
}

View File

@@ -29,15 +29,13 @@ android {
}
buildTypes {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

View File

@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.taxi.passenger">
/
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
<application>
<activity
android:name=".ui.video.VideoActivity"
android:launchMode="singleTask"
android:process=":video"
android:theme="@style/ActivityTranslucentVideo"
android:exported="false" />
<service android:name=".mulprocess.EmptyService"
android:process=":video" />
<provider
android:name=".mulprocess.BinderProvider"
android:authorities="com.mogo.och.taxi.passenger.leftmenu"
android:exported="false" />
</application>
</manifest>

View File

@@ -0,0 +1,12 @@
// ICallback.aidl
package com.mogo.och.taxi.passenger.mulprocess;
// Declare any non-default types here with import statements
interface ICallback {
void onResult(long meters, long timeInSecond,float speed);
void postEvent(int type);
}

View File

@@ -0,0 +1,19 @@
// ILeftMenuService.aidl
package com.mogo.och.taxi.passenger.mulprocess;
import com.mogo.och.taxi.passenger.mulprocess.ICallback;
// Declare any non-default types here with import statements
interface ILeftMenuService {
/**
* 向主进程传选中的item
*/
void transmissionIndex(int index);
void registerCallback(in ICallback cb);
void unRegisterCallback(in ICallback cb);
}

Binary file not shown.

View File

View File

@@ -57,6 +57,11 @@ public class TaxiPassengerOrderQueryRespBean extends BaseData {
public String txtFileMd5 = ""; //轨迹文件md5默认“”
public long contrailSaveTime; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String carModel = ""; //[optional] 车型号如红旗H9默认“”暂不加入校验逻辑、用于人工排查问题
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url默认“”
public String csvFileMd5DPQP = ""; //轨迹文件md5默认“”
public String txtFileUrlDPQP = ""; //打点文件下载的cos url默认“”
public String txtFileMd5DPQP = ""; //轨迹文件md5默认“”
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
// !!!接口中暂无此字段仅用于本地实现逻辑使用起始站目的站距离km
public double travelDistance;

View File

@@ -12,5 +12,5 @@ import mogo.telematics.pad.MessagePad;
*/
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
void setLineMarker(List<LatLng> models);
void routeResultByServer(List<LatLng> models);
void routeResultByServer(List<LatLng> models,int haveArrivedIndex);
}

View File

@@ -0,0 +1,4 @@
package com.mogo.och.taxi.passenger.event;
public class FinishActivity {
}

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