Merge branch 'release_robotaxi-d_231031_6.2.0.2' into 6.2.0_merge_master
# Conflicts: # OCH/sweeper/driver/src/main/java/com/mogo/och/sweeper/cloud/fragment/BaseSweeperCloudTabFragment.java # OCH/sweeper/driver/src/main/java/com/mogo/och/sweeper/cloud/model/SweeperCloudTaskModel.java # OCH/sweeper/driver/src/main/java/com/mogo/och/sweeper/operate/model/SweeperOperateTaskModel.java # OCH/sweeper/sweeper/build.gradle # OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/SweeperProvider.java # OCH/sweeper/sweeper/src/main/java/com/mogo/och/sweeper/view/BusArcView.java # app/script/functions/och.gradle # app/src/main/java/com/mogo/launcher/startup/ConfigStartUp.kt # core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/SOPSettingView.kt # core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_sop_setting.xml # core/function-impl/mogo-core-function-hmi/src/main/res/values/strings.xml # core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/FunctionBuildConfig.kt
3
.gitignore
vendored
@@ -7,4 +7,5 @@
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
.cxx
|
||||
.gitlab-ci.yml
|
||||
@@ -7,7 +7,6 @@ import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -81,7 +80,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.plugins.RxJavaPlugins;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -98,6 +96,7 @@ public class OrderModel {
|
||||
private int backgroundCurrentStationIndex = 0;//A->B 此处值是A站点索引
|
||||
|
||||
private static volatile OrderModel sInstance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Context mContext;
|
||||
private final List<BusStationBean> stationList = new ArrayList<>();
|
||||
private BusRoutesResult busRoutesResult = null;
|
||||
@@ -125,20 +124,20 @@ public class OrderModel {
|
||||
|
||||
private LoginService loginService;
|
||||
|
||||
private final Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (msg.what == MSG_QUERY_BUS_STATION) {
|
||||
queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
private final Handler handler = new Handler(msg -> {
|
||||
if (msg.what == MSG_QUERY_BUS_STATION) {
|
||||
queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
private OrderModel() {
|
||||
}
|
||||
|
||||
public static OrderModel getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (OrderModel.class) {
|
||||
synchronized (obj) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new OrderModel();
|
||||
}
|
||||
@@ -147,10 +146,6 @@ public class OrderModel {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private OrderModel() {
|
||||
|
||||
}
|
||||
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
|
||||
@@ -171,7 +166,7 @@ public class OrderModel {
|
||||
|
||||
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听核销乘客
|
||||
OCHSocketMessageManager.msgWriteOffPassengerType,
|
||||
mWriteOffPassengeOnMessageListener);
|
||||
mWriteOffPassengerOnMessageListener);
|
||||
|
||||
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
|
||||
|
||||
@@ -180,38 +175,35 @@ public class OrderModel {
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
// The exception could not be delivered to the consumer because it has already canceled/disposed
|
||||
// the flow or the excTeption has nowhere to go to begin with
|
||||
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable e) {
|
||||
if (e instanceof UndeliverableException) {
|
||||
e = e.getCause();
|
||||
CallerLogger.d(M_BUS + TAG, "UndeliverableException");
|
||||
}
|
||||
if ((e instanceof IOException)) {//
|
||||
// fine, irrelevant network problem or API that throws on cancellation
|
||||
CallerLogger.d(M_BUS + TAG, "IOException");
|
||||
return;
|
||||
}
|
||||
if (e instanceof InterruptedException) {
|
||||
// fine, some blocking code was interrupted by a dispose call
|
||||
CallerLogger.d(M_BUS + TAG, "InterruptedException");
|
||||
return;
|
||||
}
|
||||
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
|
||||
// that's likely a bug in the application
|
||||
CallerLogger.d(M_BUS + TAG, "NullPointerException or IllegalArgumentException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
if (e instanceof IllegalStateException) {
|
||||
// that's a bug in RxJava or in a custom operator
|
||||
CallerLogger.d(M_BUS + TAG, "IllegalStateException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "Undeliverable exception");
|
||||
// the flow or the exception has nowhere to go to begin with
|
||||
RxJavaPlugins.setErrorHandler(e -> {
|
||||
if (e instanceof UndeliverableException) {
|
||||
e = e.getCause();
|
||||
CallerLogger.d(M_BUS + TAG, "UndeliverableException");
|
||||
}
|
||||
if ((e instanceof IOException)) {
|
||||
// fine, irrelevant network problem or API that throws on cancellation
|
||||
CallerLogger.d(M_BUS + TAG, "IOException");
|
||||
return;
|
||||
}
|
||||
if (e instanceof InterruptedException) {
|
||||
// fine, some blocking code was interrupted by a dispose call
|
||||
CallerLogger.d(M_BUS + TAG, "InterruptedException");
|
||||
return;
|
||||
}
|
||||
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
|
||||
// that's likely a bug in the application
|
||||
CallerLogger.d(M_BUS + TAG, "NullPointerException or IllegalArgumentException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
if (e instanceof IllegalStateException) {
|
||||
// that's a bug in RxJava or in a custom operator
|
||||
CallerLogger.d(M_BUS + TAG, "IllegalStateException");
|
||||
Thread.currentThread().getUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "Undeliverable exception");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -234,7 +226,7 @@ public class OrderModel {
|
||||
}
|
||||
};
|
||||
|
||||
private final IMogoOnMessageListener<WriteOffPassenger> mWriteOffPassengeOnMessageListener =
|
||||
private final IMogoOnMessageListener<WriteOffPassenger> mWriteOffPassengerOnMessageListener =
|
||||
new IMogoOnMessageListener<WriteOffPassenger>() {
|
||||
@Override
|
||||
public Class<WriteOffPassenger> target() {
|
||||
@@ -272,11 +264,8 @@ public class OrderModel {
|
||||
this.mControllerStatusCallback = callback;
|
||||
}
|
||||
|
||||
private final ITrajectoryListener trajectoryListener = new ITrajectoryListener() {
|
||||
@Override
|
||||
public void trajectoryCallback(@NonNull List<MogoLocation> routeArrivied, @NonNull List<MogoLocation> routeArriving, @NonNull MogoLocation location) {
|
||||
private final ITrajectoryListener trajectoryListener = (routeArrivied, routeArriving, location) -> {
|
||||
|
||||
}
|
||||
};
|
||||
private final IMoGoPlanningRottingListener moGoAutopilotPlanningListener = new IMoGoPlanningRottingListener() {
|
||||
|
||||
@@ -361,11 +350,6 @@ public class OrderModel {
|
||||
TrajectoryAndDistanceManager.INSTANCE.removeListener(TAG);
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
|
||||
// VR mode变更回调
|
||||
@Override
|
||||
@@ -444,8 +428,6 @@ public class OrderModel {
|
||||
CallerLogger.d(M_BUS + TAG, "judgeArrivedStation() = 刚过站且在15m内");
|
||||
onArriveAt(null); //无自动驾驶到站信息传null
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -621,10 +603,7 @@ public class OrderModel {
|
||||
leaveTTSTips(nextStation,nextStationKr);
|
||||
|
||||
if (busRoutesResult != null) {
|
||||
boolean isLastStop = false;
|
||||
if (leaveIndex + 1 == stationList.size() - 1) {
|
||||
isLastStop = true;
|
||||
}
|
||||
boolean isLastStop = leaveIndex + 1 == stationList.size() - 1;
|
||||
//给bus外屏发送
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.LEAVE_STATION
|
||||
, busRoutesResult.getName()
|
||||
@@ -768,10 +747,7 @@ public class OrderModel {
|
||||
private void arriveStationSuccess(int arrivedStationIndex, String departureStopName,
|
||||
String arriveStation, String arriveStationKr) {
|
||||
if (busRoutesResult != null) {
|
||||
boolean isLastStop = false;
|
||||
if (arrivedStationIndex == busRoutesResult.getSites().size() - 1) {
|
||||
isLastStop = true;
|
||||
}
|
||||
boolean isLastStop = arrivedStationIndex == busRoutesResult.getSites().size() - 1;
|
||||
//给bus外屏发送
|
||||
BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.ARRIVE_STATION
|
||||
, busRoutesResult.getName()
|
||||
@@ -845,12 +821,7 @@ public class OrderModel {
|
||||
//车站10s后播报
|
||||
private void leaveTTSTips(String nextStation,String nextStationKr) {
|
||||
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr);
|
||||
}
|
||||
},DELAY_10S);
|
||||
UiThreadHandler.postDelayed(() -> VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr),DELAY_10S);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -981,16 +952,12 @@ public class OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
Runnable tip3Runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !stationList.get(0).isLeaving()){
|
||||
tipStartTask("3");
|
||||
}else {
|
||||
removeTipRunnables();
|
||||
}
|
||||
Runnable tip3Runnable = () -> {
|
||||
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !stationList.get(0).isLeaving()){
|
||||
tipStartTask("3");
|
||||
}else {
|
||||
removeTipRunnables();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1005,16 +972,11 @@ public class OrderModel {
|
||||
VoiceNotice.showNotice(tips);
|
||||
}
|
||||
|
||||
Runnable tip1Runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (backgroundCurrentStationIndex == 0 && stationList != null &&
|
||||
stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED
|
||||
&& !stationList.get(0).isLeaving()){
|
||||
tipStartTask("1");
|
||||
}else {
|
||||
removeTipRunnables();
|
||||
}
|
||||
Runnable tip1Runnable = () -> {
|
||||
if (backgroundCurrentStationIndex == 0 && stationList.get(0).getDrivingStatus() == STATION_STATUS_STOPPED && !stationList.get(0).isLeaving()){
|
||||
tipStartTask("1");
|
||||
}else {
|
||||
removeTipRunnables();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1205,7 +1167,7 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
public void triggerStartServiceEvent(boolean isRestart, boolean send) {
|
||||
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() - 1) {
|
||||
if (backgroundCurrentStationIndex >= stationList.size() - 1) {
|
||||
return;
|
||||
}
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
@@ -1215,7 +1177,7 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
public void triggerUnableStartAPReasonEvent() {
|
||||
if (stationList == null || backgroundCurrentStationIndex >= stationList.size() - 1) {
|
||||
if (backgroundCurrentStationIndex >= stationList.size() - 1) {
|
||||
return;
|
||||
}
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
@@ -1253,8 +1215,8 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
private AutopilotControlParameters initAutopilotControlParameters(int leaveIndex) {
|
||||
BusStationBean currentStation = null;
|
||||
BusStationBean nextStation = null;
|
||||
BusStationBean currentStation;
|
||||
BusStationBean nextStation;
|
||||
|
||||
if (leaveIndex < 0) {
|
||||
if (backgroundCurrentStationIndex + 1 > stationList.size() - 1 || !isGoingToNextStation) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BusRoutesResult {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public void setSite(List<BusStationBean> site) {
|
||||
public void setSites(List<BusStationBean> sites) {
|
||||
this.sites = sites;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import androidx.constraintlayout.widget.Group;
|
||||
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.IMoGoAutopilotRecordListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
|
||||
@@ -60,7 +59,7 @@ import record_cache.RecordPanelOuterClass;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener, IMoGoAutopilotRecordListener {
|
||||
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
|
||||
|
||||
private static final String TAG = "BaseBusTabFragment";
|
||||
|
||||
@@ -206,7 +205,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
|
||||
if (mBadcaseBtn != null) {
|
||||
CallerDevaToolsManager.INSTANCE.initBadCase(mBadcaseBtn);
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
//消息盒子
|
||||
@@ -299,18 +297,6 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordResult(@Nullable RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRecordConfig(@NonNull MessagePad.RecordDataConfig config) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBagManagerResult(@NonNull BagManagerOuterClass.BagManager bagManager) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试到站
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.mogo.och.bus.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
@@ -24,9 +23,13 @@ public class BusLineModel {
|
||||
private static volatile BusLineModel sInstance;
|
||||
private Context mContext;
|
||||
private IBusLinesCallback mBusLinesCallback;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
private BusLineModel() {
|
||||
}
|
||||
public static BusLineModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( BusLineModel.class ) {
|
||||
synchronized ( obj ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new BusLineModel();
|
||||
}
|
||||
@@ -34,9 +37,7 @@ public class BusLineModel {
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
private BusLineModel() {
|
||||
|
||||
}
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
@@ -79,7 +80,7 @@ public class BusLineModel {
|
||||
|
||||
/**
|
||||
* 通过线路id 查询线路排班表
|
||||
* @param lineId
|
||||
* @param lineId 线路id
|
||||
* @param position 位置
|
||||
*/
|
||||
public void queryBusLineTasksById(int lineId, int position,boolean autoRefresh){
|
||||
@@ -120,7 +121,7 @@ public class BusLineModel {
|
||||
OrderServiceManager.switchLine(mContext,taskId, new OchCommonServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
SharedPrefs.getInstance(mContext).putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
SharedPrefsMgr.getInstance(mContext).putInt(BusSwitchLineActivity.LASTCOMMITLINEID,lineId);
|
||||
if (mBusLinesCallback != null){
|
||||
mBusLinesCallback.onChangeLineIdSuccess();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.commons.mvp.MvpActivity
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.presenter.BusLinePresenter
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse
|
||||
@@ -118,7 +118,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
showNoData(true)
|
||||
return
|
||||
}
|
||||
var lastCommitLineid = SharedPrefs.getInstance(this).getInt(LASTCOMMITLINEID, -1)
|
||||
val lastCommitLineid = SharedPrefsMgr.getInstance(this).getInt(LASTCOMMITLINEID, -1)
|
||||
if (data.data != null && data.data.size > 0) {
|
||||
showNoData(false)
|
||||
mData.clear()
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -28,19 +27,19 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
|
||||
private static TimeInterpolator sDefaultInterpolator;
|
||||
|
||||
private ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mPendingRemovals = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mPendingAdditions = new ArrayList<>();
|
||||
private final ArrayList<MoveInfo> mPendingMoves = new ArrayList<>();
|
||||
private final ArrayList<ChangeInfo> mPendingChanges = new ArrayList<>();
|
||||
|
||||
ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<RecyclerView.ViewHolder>> mAdditionsList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<MoveInfo>> mMovesList = new ArrayList<>();
|
||||
private final ArrayList<ArrayList<ChangeInfo>> mChangesList = new ArrayList<>();
|
||||
|
||||
ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mAddAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mMoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mRemoveAnimations = new ArrayList<>();
|
||||
private final ArrayList<RecyclerView.ViewHolder> mChangeAnimations = new ArrayList<>();
|
||||
|
||||
private static class MoveInfo {
|
||||
public RecyclerView.ViewHolder holder;
|
||||
@@ -102,20 +101,16 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
mPendingRemovals.clear();
|
||||
// Next, move stuff
|
||||
if (movesPending) {
|
||||
final ArrayList<MoveInfo> moves = new ArrayList<>();
|
||||
moves.addAll(mPendingMoves);
|
||||
final ArrayList<MoveInfo> moves = new ArrayList<>(mPendingMoves);
|
||||
mMovesList.add(moves);
|
||||
mPendingMoves.clear();
|
||||
Runnable mover = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (MoveInfo moveInfo : moves) {
|
||||
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
|
||||
moveInfo.toX, moveInfo.toY);
|
||||
}
|
||||
moves.clear();
|
||||
mMovesList.remove(moves);
|
||||
Runnable mover = () -> {
|
||||
for (MoveInfo moveInfo : moves) {
|
||||
animateMoveImpl(moveInfo.holder, moveInfo.fromX, moveInfo.fromY,
|
||||
moveInfo.toX, moveInfo.toY);
|
||||
}
|
||||
moves.clear();
|
||||
mMovesList.remove(moves);
|
||||
};
|
||||
if (removalsPending) {
|
||||
View view = moves.get(0).holder.itemView;
|
||||
@@ -126,19 +121,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
}
|
||||
// Next, change stuff, to run in parallel with move animations
|
||||
if (changesPending) {
|
||||
final ArrayList<ChangeInfo> changes = new ArrayList<>();
|
||||
changes.addAll(mPendingChanges);
|
||||
final ArrayList<ChangeInfo> changes = new ArrayList<>(mPendingChanges);
|
||||
mChangesList.add(changes);
|
||||
mPendingChanges.clear();
|
||||
Runnable changer = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (ChangeInfo change : changes) {
|
||||
animateChangeImpl(change);
|
||||
}
|
||||
changes.clear();
|
||||
mChangesList.remove(changes);
|
||||
Runnable changer = () -> {
|
||||
for (ChangeInfo change : changes) {
|
||||
animateChangeImpl(change);
|
||||
}
|
||||
changes.clear();
|
||||
mChangesList.remove(changes);
|
||||
};
|
||||
if (removalsPending) {
|
||||
RecyclerView.ViewHolder holder = changes.get(0).oldHolder;
|
||||
@@ -149,19 +140,15 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
}
|
||||
// Next, add stuff
|
||||
if (additionsPending) {
|
||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>();
|
||||
additions.addAll(mPendingAdditions);
|
||||
final ArrayList<RecyclerView.ViewHolder> additions = new ArrayList<>(mPendingAdditions);
|
||||
mAdditionsList.add(additions);
|
||||
mPendingAdditions.clear();
|
||||
Runnable adder = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (RecyclerView.ViewHolder holder : additions) {
|
||||
animateAddImpl(holder);
|
||||
}
|
||||
additions.clear();
|
||||
mAdditionsList.remove(additions);
|
||||
Runnable adder = () -> {
|
||||
for (RecyclerView.ViewHolder holder : additions) {
|
||||
animateAddImpl(holder);
|
||||
}
|
||||
additions.clear();
|
||||
mAdditionsList.remove(additions);
|
||||
};
|
||||
if (removalsPending || movesPending || changesPending) {
|
||||
long removeDuration = removalsPending ? getRemoveDuration() : 0;
|
||||
@@ -341,8 +328,8 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
final ViewPropertyAnimator oldViewAnim = view.animate().setDuration(
|
||||
getChangeDuration());
|
||||
mChangeAnimations.add(changeInfo.oldHolder);
|
||||
oldViewAnim.translationX(changeInfo.toX - changeInfo.fromX);
|
||||
oldViewAnim.translationY(changeInfo.toY - changeInfo.fromY);
|
||||
oldViewAnim.translationX((float) (changeInfo.toX - changeInfo.fromX));
|
||||
oldViewAnim.translationY((float) (changeInfo.toY - changeInfo.fromY));
|
||||
oldViewAnim.alpha(0).setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animator) {
|
||||
@@ -480,25 +467,25 @@ public class OpenItemAnimator extends DefaultItemAnimator {
|
||||
}
|
||||
|
||||
// animations should be ended by the cancel above.
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mRemoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mRemoveAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mAddAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mAddAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mChangeAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mChangeAnimations list");
|
||||
}
|
||||
|
||||
//noinspection PointlessBooleanExpression,ConstantConditions
|
||||
//noinspection Pointless BooleanExpression,ConstantConditions
|
||||
if (mMoveAnimations.remove(item) && DEBUG) {
|
||||
throw new IllegalStateException("after animation is cancelled, item should not be in "
|
||||
+ "mMoveAnimations list");
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager;
|
||||
import com.zhidao.socket.utils.LoginStatusUtil;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -72,30 +73,36 @@ public class BusTrajectoryManager {
|
||||
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
|
||||
// 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹开始下载");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹开始下载", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹开始下载");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
|
||||
// 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载成功");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载成功", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载成功");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
|
||||
// 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地无对应轨迹");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地无对应轨迹", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
|
||||
// 4. 轨迹管理_轨迹下载失败,本地有对应轨迹,认为成功
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地有对应轨迹,认为成功", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
|
||||
// 5. 轨迹管理_轨迹下载超时
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() 轨迹下载超时");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载超时", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
// ToastUtils.showShort("轨迹下载超时");
|
||||
} else if ("ISSM_FUNC_AUTO_PILOT_READY".equals(guardianInfo.getCode())) {
|
||||
// 收到ssm的自动驾驶变为ready,再次下发轨迹下载.解决:域控重启,或者102域控启动太早,107节点初始化未完成导致的轨迹未进行下载。
|
||||
CallerLogger.d(M_BUS + TAG, "onAutopilotGuardian() ssm ready,再次发起下载");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 再次发起下载", true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
syncTrajectoryInfo();
|
||||
}
|
||||
}
|
||||
@@ -186,7 +193,7 @@ public class BusTrajectoryManager {
|
||||
CallerLogger.e(M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
OchChainLogManager.writeChainLog("轨迹监控","sendTrajectoryReq() 下发轨迹 轨迹id"+mAutoPilotLine.getLineId(), true, OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY);
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.d(M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
|
||||
@@ -24,13 +24,13 @@ import com.mogo.och.bus.R;
|
||||
public class BusArcView extends View {
|
||||
|
||||
//中心的文字描述
|
||||
private String mDes = "KM/H";
|
||||
private final String mDes = "KM/H";
|
||||
//根据数据显示的圆弧Paint
|
||||
private Paint mArcPaint;
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
//圆弧的画笔的宽度
|
||||
private float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
|
||||
private final float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
|
||||
//文字描述的paint
|
||||
private Paint mTextPaint;
|
||||
|
||||
@@ -39,9 +39,9 @@ public class BusArcView extends View {
|
||||
//当前数据
|
||||
private int currentValue;
|
||||
//最大数据
|
||||
private int maxValue = 240;
|
||||
private final int maxValue = 240;
|
||||
//圆弧背景的开始和结束间的夹角大小
|
||||
private float mAngle = 270;
|
||||
private final float mAngle = 270;
|
||||
//上次绘制圆弧夹角
|
||||
private float lastAngle = 0;
|
||||
|
||||
@@ -75,13 +75,13 @@ public class BusArcView extends View {
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
//绘制中心的数值
|
||||
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
|
||||
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
|
||||
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
|
||||
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
|
||||
//绘制中心文字描述
|
||||
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_des_text_size));
|
||||
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
|
||||
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
|
||||
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
|
||||
}
|
||||
|
||||
private void drawArc(Canvas canvas) {
|
||||
@@ -135,13 +135,10 @@ public class BusArcView extends View {
|
||||
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
|
||||
progressAnimator.setDuration(time);
|
||||
progressAnimator.setTarget(mIncludedAngle);
|
||||
progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
mIncludedAngle = (float) animation.getAnimatedValue();
|
||||
//重新绘制,不然不会出现效果
|
||||
postInvalidate();
|
||||
}
|
||||
progressAnimator.addUpdateListener(animation -> {
|
||||
mIncludedAngle = (float) animation.getAnimatedValue();
|
||||
//重新绘制,不然不会出现效果
|
||||
postInvalidate();
|
||||
});
|
||||
//开始执行动画
|
||||
progressAnimator.start();
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.view.animation.DecelerateInterpolator;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
|
||||
import com.mogo.och.bus.R;
|
||||
|
||||
import me.jessyan.autosize.AutoSizeConfig;
|
||||
@@ -93,7 +92,7 @@ public class SlidePanelView extends View {
|
||||
private ObjectAnimator matrixAnim;
|
||||
|
||||
private String blockText = STRING_SLIDE_TO_RIGHT;
|
||||
private Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
private final Paint.FontMetrics blockTextMetrics = new Paint.FontMetrics();
|
||||
|
||||
private static final int GRADIENT_OFFSET = 200;
|
||||
|
||||
@@ -250,7 +249,7 @@ public class SlidePanelView extends View {
|
||||
private void startBlockBackAnim() {
|
||||
ObjectAnimator blockBackanimator = ObjectAnimator.ofInt(this, "blockOffset", blockOffset, 0);
|
||||
blockBackanimator.setInterpolator(new DecelerateInterpolator());
|
||||
blockBackanimator.setDuration(1000 * blockOffset / getWidth());
|
||||
blockBackanimator.setDuration(1000L * blockOffset / getWidth());
|
||||
blockBackanimator.start();
|
||||
lastX = 0;
|
||||
}
|
||||
@@ -259,15 +258,15 @@ public class SlidePanelView extends View {
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
// 画背景
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2, (float) getHeight() / 2, bgPaint);
|
||||
canvas.drawRoundRect(bgRectF, (float) getHeight() / 2.0f, (float) getHeight() / 2.0f, bgPaint);
|
||||
// 画文字
|
||||
gradientMatrix.setTranslate(matrixTranslate, 0);
|
||||
textGradient.setLocalMatrix(gradientMatrix);
|
||||
canvas.save();
|
||||
canvas.drawText(blockText, blockWidth + BLOCK_START_X + textMarginLeft, textOffset, textPaint);
|
||||
canvas.drawText(blockText, (float) (blockWidth + BLOCK_START_X + textMarginLeft), textOffset, textPaint);
|
||||
canvas.restore();
|
||||
// 画滑块
|
||||
canvas.drawBitmap(bmBlock, BLOCK_START_X + blockOffset, BLOCK_START_Y, blockPaint);
|
||||
canvas.drawBitmap(bmBlock, (float) (BLOCK_START_X + blockOffset), (float) BLOCK_START_Y, blockPaint);
|
||||
}
|
||||
|
||||
public interface OnSlidePanelMoveToEndListener {
|
||||
|
||||
@@ -68,8 +68,9 @@ dependencies {
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
implementation project(':core:mogo-core-res')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
androidTestImplementation rootProject.ext.dependencies.androidxjunit
|
||||
testImplementation rootProject.ext.dependencies.junit
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -47,7 +47,7 @@ public class MogoOCHBusPassenger implements IMogoOCH {
|
||||
this.mContainerId = containerId;
|
||||
showFragment();
|
||||
|
||||
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode) && activity != null) {
|
||||
MultiDisplayUtils.INSTANCE.startActWithSecond(activity, VideoPlayerActivity.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -517,14 +517,10 @@ object BusPassengerModel {
|
||||
}
|
||||
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// ToastUtils.showShort("到达目的地");
|
||||
// ToastUtils.showShort("到达目的地")
|
||||
// }
|
||||
mADASStatusCallback?.onAutopilotArriveEnd()
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
|
||||
override fun onSystemStatus(statusInf: SsmInfo.SsmStatusInf) {}
|
||||
}
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
|
||||
object : IMoGoPlanningRottingListener {
|
||||
|
||||
@@ -58,6 +58,11 @@ public abstract class BusPassengerBaseFragment<V extends IView, P extends Presen
|
||||
videoSwitch.setOnClickListener(v -> openOrCloseLiveVideo());
|
||||
|
||||
CallerTelematicListenerManager.INSTANCE.addListener(TAG, new IReceivedMsgListener() {
|
||||
@Override
|
||||
public void onDemoMode(boolean isDemoMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedServerSn(@Nullable String sn) {
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ public class BusPassengerMapAssetStyleUtil {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
int count = 0;
|
||||
while ((count = is1.read(buffer1)) > 0) {
|
||||
is1.read(buffer1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.junit.Test;
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
//@Test
|
||||
public void addition_isCorrect() {
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ dependencies {
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation rootProject.ext.dependencies.androidxjunit
|
||||
testImplementation rootProject.ext.dependencies.junit
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.magic.mogo.och.charter">
|
||||
<manifest package="com.magic.mogo.och.charter">
|
||||
|
||||
</manifest>
|
||||
@@ -12,6 +12,7 @@ import androidx.constraintlayout.widget.Group
|
||||
import com.magic.mogo.och.charter.R
|
||||
import com.magic.mogo.och.charter.constant.CharterConst
|
||||
import com.magic.mogo.och.charter.view.SlidePanelView
|
||||
import com.magic.mogo.och.charter.view.autopilot.AutopilotStatusView
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
@@ -54,16 +55,13 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
|
||||
private val TAG = "BaseBusTabFragment"
|
||||
|
||||
private var ctvAutopilotStatus: RelativeLayout? = null
|
||||
private var ctvAutopilotStatusIv: ImageView? = null
|
||||
private var ctvAutopilotStatusTv: TextView? = null
|
||||
private var ctvAutopilotStatus: AutopilotStatusView? = null
|
||||
protected var mSettingBtn: RelativeLayout? = null
|
||||
protected var mBadcaseBtn: RelativeLayout? = null
|
||||
protected var mAICollectBtn: RelativeLayout? = null
|
||||
private var flStationPanelContainer: FrameLayout? = null
|
||||
private var mapBizView: MapBizView? = null
|
||||
private var groupTestPanel: Group? = null
|
||||
private var mTrafficDataView: TrafficDataView? = null
|
||||
protected var slidePanelView: SlidePanelView? = null
|
||||
//远景和中景的切换
|
||||
private var mSwitchMapModeImage: ImageView? = null
|
||||
@@ -87,16 +85,13 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
override fun initViews() {
|
||||
mapBizView = findViewById(R.id.mapBizView)
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel)
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status)
|
||||
ctvAutopilotStatusIv = findViewById(R.id.bus_autopilot_btn_iv)
|
||||
ctvAutopilotStatusTv = findViewById(R.id.bus_autopolot_btn_tv)
|
||||
ctvAutopilotStatus = findViewById(R.id.autopilot_status)
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container)
|
||||
|
||||
slidePanelView = findViewById(R.id.charter_slide_panel)
|
||||
slidePanelView?.setText(resources.getString(R.string.charter_back_car))
|
||||
slidePanelView?.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
|
||||
|
||||
mTrafficDataView = findViewById<View>(R.id.bus_arc) as TrafficDataView?
|
||||
LayoutInflater.from(context).inflate(getStationPanelViewId(), flStationPanelContainer)
|
||||
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout)
|
||||
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon)
|
||||
@@ -122,12 +117,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
}
|
||||
})
|
||||
initListener()
|
||||
setAutopilotBtnStatus(getState())
|
||||
ctvAutopilotStatus!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
restartAutopilot()
|
||||
}
|
||||
})
|
||||
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
findViewById<View>(R.id.btnAutopilotDisable)!!.setOnClickListener { view: View? ->
|
||||
@@ -194,6 +183,11 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
}
|
||||
})
|
||||
smallMapView = findViewById(R.id.smallMapView)
|
||||
|
||||
ctvAutopilotStatus?.setOnLongClickListener {
|
||||
debugTestBar()
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
@@ -308,90 +302,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
fun onAutopilotStatusChanged(autopilotStatus: Int) {
|
||||
requireActivity().runOnUiThread {
|
||||
changeAutopilotBtnView(
|
||||
autopilotStatus,
|
||||
isAnimateRunning
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAutopilotBtnStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus
|
||||
) { //0不可用
|
||||
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_disable))
|
||||
ctvAutopilotStatusTv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
ctvAutopilotStatusIv!!.setImageResource(R.drawable.charter_disable_autopilot_icon)
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
ctvAutopilotStatus!!.isClickable = true
|
||||
ctvAutopilotStatus!!.background = getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
}else{
|
||||
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
ctvAutopilotStatusIv!!.setImageResource(R.drawable.charter_ic_autopilot)
|
||||
ctvAutopilotStatusTv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
ctvAutopilotStatus!!.isClickable = true
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
|
||||
ctvAutopilotStatus!!.background = getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
|
||||
ctvAutopilotStatus!!.background = getDrawable(R.drawable.charter_autopilot_2_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
== autopilotStatus){
|
||||
ctvAutopilotStatusTv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_pingxing_tv)
|
||||
ctvAutopilotStatus!!.isClickable = false
|
||||
ctvAutopilotStatus!!.background = getDrawable(R.drawable.charter_pingxingjiashi)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open fun updateAutopilotStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus
|
||||
) { //2 running
|
||||
ctvAutopilotStatusIv!!.setImageResource(R.drawable.charter_right_autopilot_icon)
|
||||
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
ctvAutopilotStatusTv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_success_tv)
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
ctvAutopilotStatus!!.isClickable = false
|
||||
} else {
|
||||
ctvAutopilotStatusIv!!.setImageResource(R.drawable.charter_wrong_autopilot_icon)
|
||||
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
ctvAutopilotStatusTv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_failure_tv)
|
||||
ctvAutopilotStatus!!.isClickable = false
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
}
|
||||
UiThreadHandler.postDelayed({ setAutopilotBtnStatus(autopilotStatus) }, 1000)
|
||||
}
|
||||
|
||||
private fun changeAutopilotBtnView(autopilotStatus: Int, isAnimateRunning: Boolean) {
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus
|
||||
) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return
|
||||
}
|
||||
if (isAnimateRunning) {
|
||||
stopAnimAndUpdateBtnStatus()
|
||||
} else {
|
||||
setAutopilotBtnStatus(autopilotStatus)
|
||||
}
|
||||
}
|
||||
|
||||
open fun stopAnimAndUpdateBtnStatus() {
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -408,74 +318,13 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
*/
|
||||
abstract fun getStationPanelViewId(): Int
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
abstract fun restartAutopilot()
|
||||
|
||||
/**
|
||||
* 模拟自动驾驶返回状态
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
private fun debugAutoPilotStatus(status: Int){
|
||||
setAutopilotBtnStatus(status)
|
||||
}
|
||||
/**
|
||||
* 开启自动驾驶中间动画
|
||||
*/
|
||||
@SuppressLint("ObjectAnimatorBinding")
|
||||
open fun startAutopilotAnimation() {
|
||||
isAnimateRunning = true
|
||||
ctvAutopilotStatusTv!!.text = resources.getString(R.string.charter_loading_autopilot_tv)
|
||||
ctvAutopilotStatusTv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
ctvAutopilotStatus!!.isClickable = true
|
||||
ctvAutopilotStatusIv!!.setImageResource(R.drawable.charter_loading_autopilot_icon)
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator =
|
||||
ObjectAnimator.ofFloat(ctvAutopilotStatusIv, "rotation", 0f, 360f)
|
||||
autopilotLoadingAnimator?.interpolator = LinearInterpolator()
|
||||
autopilotLoadingAnimator?.repeatCount = -1 //无限循环
|
||||
autopilotLoadingAnimator?.duration = 1000 //设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator!!.start() //动画开始
|
||||
startingAutoApilotCountDown()
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功做处理
|
||||
if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
}, CharterConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
protected open fun stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
ctvAutopilotStatusIv!!.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
isAnimateRunning = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 迈速表实时更新
|
||||
*
|
||||
* @param newSpeed
|
||||
*/
|
||||
open fun updateSpeedView(newSpeed: Float) {
|
||||
val speed = (abs(newSpeed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
|
||||
if (mTrafficDataView != null) {
|
||||
mTrafficDataView!!.updateSpeedWithValue(speed)
|
||||
}
|
||||
ctvAutopilotStatus?.setAutopilotBtnStatus(status)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.magic.mogo.och.charter.callback
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
*
|
||||
@@ -14,6 +12,4 @@ interface IDriverM1ControllerStatusCallback {
|
||||
//启动自驾失败
|
||||
fun onStartAdasFailure()
|
||||
|
||||
//速度更新
|
||||
fun updateSpeed(gnssInfo: MogoLocation)
|
||||
}
|
||||
@@ -168,13 +168,6 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
|
||||
return R.layout.charter_fragment_driver_m1
|
||||
}
|
||||
|
||||
override fun restartAutopilot() {
|
||||
//启动自驾
|
||||
if (!isAnimateRunning) {
|
||||
mPresenter?.restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return TAG
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -63,11 +64,13 @@ object CharterTrajectoryManager {
|
||||
// 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹开始下载")
|
||||
// ToastUtils.showShort("轨迹开始下载");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹开始下载", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
stopTrajReqLoop()
|
||||
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS" == guardianInfo.code) {
|
||||
// 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹下载成功")
|
||||
// ToastUtils.showShort("轨迹下载成功");
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载成功", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
stopTrajReqLoop()
|
||||
} else if ("ISYS_INIT_TRAJECTORY_FAILURE" == guardianInfo.code) {
|
||||
// 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
@@ -75,6 +78,7 @@ object CharterTrajectoryManager {
|
||||
SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地无对应轨迹"
|
||||
)
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地无对应轨迹", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_WARNING" == guardianInfo.code) {
|
||||
// 4. 轨迹管理_轨迹下载失败,本地有对应轨迹,认为成功
|
||||
@@ -82,14 +86,17 @@ object CharterTrajectoryManager {
|
||||
SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地有对应轨迹,认为成功"
|
||||
)
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载失败,本地有对应轨迹,认为成功", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT" == guardianInfo.code) {
|
||||
// 5. 轨迹管理_轨迹下载超时
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() 轨迹下载超时")
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 轨迹下载超时", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
// ToastUtils.showShort("轨迹下载超时");
|
||||
} else if ("EMAP_ATTITUDE_INIT_FAILED" == guardianInfo.getCode()) {
|
||||
// 收到ssm的自动驾驶变为ready,再次下发轨迹下载.解决:域控重启,或者102域控启动太早,107节点初始化未完成导致的轨迹未进行下载。
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "onAutopilotGuardian() ssm ready,再次发起下载")
|
||||
OchChainLogManager.writeChainLog("轨迹监控","onAutopilotGuardian() 当前位置距离轨迹距离大于15m", eventID = OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
get().getBusOrderResult()?.lineId?.let {
|
||||
syncTrajectoryInfo(it,
|
||||
get().getBusOrderResult()?.lineName!!)
|
||||
@@ -219,6 +226,13 @@ object CharterTrajectoryManager {
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
mAutoPilotLine?.let {
|
||||
OchChainLogManager.writeChainLog("轨迹监控", "sendTrajectoryReq() 下发轨迹 轨迹id" + it.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
}
|
||||
|
||||
sendTrajectoryDownloadReq(mAutoPilotLine!!)
|
||||
d(
|
||||
SceneConstant.M_CHARTER_D + TAG,
|
||||
|
||||
@@ -363,8 +363,6 @@ class DriverM1Model {
|
||||
mLongitude = gnssInfo.longitude
|
||||
mLatitude = gnssInfo.latitude
|
||||
|
||||
mControllerStatusCallback?.updateSpeed(gnssInfo)
|
||||
|
||||
//是否到站的围栏判断 自动驾驶还未触发到站
|
||||
if (!isArrivedStation) {
|
||||
judgeArrivedStation(gnssInfo)
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.mogo.och.common.module.biz.callback.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.OPERATION_ROAD_SIDE_TYPE
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.OCHPlanningActionsCallback
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideStatus
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideManager
|
||||
@@ -36,8 +37,7 @@ import mogo_msg.MogoReportMsg
|
||||
*/
|
||||
class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
Presenter<DriverM1Fragment?>(view),ILoginCallback, DriverM1OrderCallback, ChangeDestCallback,
|
||||
IMoGoAutopilotStatusListener, OCHPlanningActionsCallback,
|
||||
IDriverM1ControllerStatusCallback {
|
||||
IMoGoAutopilotStatusListener, OCHPlanningActionsCallback{
|
||||
|
||||
companion object{
|
||||
private const val TAG = "DriverM1Presenter"
|
||||
@@ -55,7 +55,6 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
StopSideManager.addListener(TAG,this)
|
||||
DriverM1Model.get().setDriverM1OrderCallback(this)
|
||||
DriverM1Model.get().setChangeDestCallback(this)
|
||||
DriverM1Model.get().setControllerStatusCallback(this)
|
||||
}
|
||||
|
||||
private fun releaseListener() {
|
||||
@@ -63,7 +62,6 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
DriverM1Model.get().setDriverM1OrderCallback(null)
|
||||
DriverM1Model.get().setChangeDestCallback(null)
|
||||
DriverM1Model.get().setControllerStatusCallback(null)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
@@ -92,13 +90,6 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
DriverM1Model.get().logout()
|
||||
}
|
||||
|
||||
fun restartAutopilot() {
|
||||
// todo 启动自驾必须有订单路线
|
||||
if (DriverM1Model.get().isHaveOrder()) {
|
||||
DriverM1Model.get().restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
fun driverEndLease() {
|
||||
DriverM1Model.get().driverEndLease()
|
||||
}
|
||||
@@ -145,7 +136,6 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
mView?.onAutopilotStatusChanged(state)
|
||||
when(state){
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> { //
|
||||
//
|
||||
@@ -182,6 +172,12 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
OPERATION_ROAD_SIDE_TYPE
|
||||
)
|
||||
}
|
||||
StopSideStatus.EndingSuccess -> {
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.STOPSITE_SUCCESS)
|
||||
}
|
||||
StopSideStatus.NOTHING -> {
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.STOPSITE_SUCCESS_RUN)
|
||||
}
|
||||
StopSideStatus.EndingFaile,
|
||||
StopSideStatus.NOSTART-> {
|
||||
DriverM1Model.get().pushOperationalToMsgBox(
|
||||
@@ -193,21 +189,4 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun startOpenAutopilot() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.startAutopilotAnimation()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStartAdasFailure() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.stopAnimAndUpdateBtnStatus()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateSpeed(gnssInfo: MogoLocation) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateSpeedView(gnssInfo.gnssSpeed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ class SlidePanelView @JvmOverloads constructor(
|
||||
val size = AutoSizeUtils.dp2px(context, 120f)
|
||||
val opts = BitmapFactory.Options()
|
||||
opts.inDensity = AutoSizeConfig.getInstance().initDensity.toInt()
|
||||
bmBlock = BitmapFactory.decodeResource(resources, R.drawable.charter_base_slide_block, opts) as Bitmap
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock!!, size, size, true) as Bitmap
|
||||
blockWidth = bmBlock!!.width
|
||||
bmBlock = BitmapFactory.decodeResource(resources, R.drawable.charter_base_slide_block, opts)
|
||||
bmBlock = Bitmap.createScaledBitmap(bmBlock!!, size, size, true)
|
||||
blockWidth = bmBlock!!.getWidth()
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
@@ -210,6 +210,7 @@ class SlidePanelView @JvmOverloads constructor(
|
||||
)
|
||||
canvas.restore()
|
||||
// 画滑块
|
||||
|
||||
canvas.drawBitmap(
|
||||
bmBlock!!,
|
||||
(BLOCK_START_X + blockOffset).toFloat(),
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.magic.mogo.och.charter.view.autopilot
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.magic.mogo.och.charter.R
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils
|
||||
import kotlinx.android.synthetic.main.charter_autopilot_status.view.bus_autopilot_btn_iv
|
||||
import kotlinx.android.synthetic.main.charter_autopilot_status.view.bus_autopolot_btn_tv
|
||||
|
||||
/**
|
||||
* 剩余时间和结束订单入口
|
||||
*/
|
||||
class AutopilotStatusView : RelativeLayout,AutopilotStatusViewModel.IAutopilotStatusCallback {
|
||||
|
||||
private val TAG = "AutopilotStatusView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
var viewModel:AutopilotStatusViewModel?=null
|
||||
|
||||
private lateinit var autopilotLoadingAnimator: ObjectAnimator
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_autopilot_status, this, true)
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f)
|
||||
autopilotLoadingAnimator.interpolator = LinearInterpolator()
|
||||
autopilotLoadingAnimator.repeatCount = -1 //无限循环
|
||||
autopilotLoadingAnimator.duration = 1000 //设置持续时间
|
||||
onClick {
|
||||
viewModel?.restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
override fun startAutopilotSuccess(){
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_right_autopilot_icon)
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_success_tv)
|
||||
isClickable = false
|
||||
}
|
||||
|
||||
override fun startAutopilotFail(){
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_wrong_autopilot_icon)
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_failure_tv)
|
||||
isClickable = false
|
||||
}
|
||||
|
||||
fun setAutopilotBtnStatus(autopilotStatus: Int) {
|
||||
viewModel?.setUIMode(autopilotStatus)
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始动画展示
|
||||
*/
|
||||
override fun startAutopilotAnimation() {
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_tv)
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
isClickable = true
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_loading_autopilot_icon)
|
||||
autopilotLoadingAnimator.start() //动画开始
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束动画展示
|
||||
*/
|
||||
override fun stopAutopilotAnimation() {
|
||||
autopilotLoadingAnimator.end()
|
||||
bus_autopilot_btn_iv.clearAnimation()
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶不可用
|
||||
*/
|
||||
override fun autopilotDisable(){
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_disable))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_disable_autopilot_icon)
|
||||
isClickable = true
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 底盘准备好了可以启动自动驾驶
|
||||
*/
|
||||
override fun canStartAutopilot(){
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot)
|
||||
isClickable = true
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶中
|
||||
*/
|
||||
override fun inAutopilot(){
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot)
|
||||
isClickable = true
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_2_status_bg)
|
||||
}
|
||||
|
||||
/**
|
||||
* 平行驾驶中
|
||||
*/
|
||||
override fun inRemoteDriver(){
|
||||
bus_autopolot_btn_tv.setTextColor(ContextCompat.getColor(context,R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv.text = resources.getString(R.string.charter_loading_autopilot_pingxing_tv)
|
||||
bus_autopilot_btn_iv.setImageResource(R.drawable.charter_ic_autopilot)
|
||||
isClickable = false
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_pingxingjiashi)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(AutopilotStatusViewModel::class.java)
|
||||
}
|
||||
viewModel?.setAutopilotStatusCallback(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.magic.mogo.och.charter.view.autopilot
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse.Result.Companion.ARRIVED
|
||||
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse.Result.Companion.ARRIVING
|
||||
import com.magic.mogo.och.charter.callback.IDriverM1ControllerStatusCallback
|
||||
import com.magic.mogo.och.charter.constant.CharterConst
|
||||
import com.magic.mogo.och.charter.model.DriverM1Model
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.IBeautifyModeCallback
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideManager
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideStatus
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback,
|
||||
IMoGoAutopilotStatusListener, IBeautifyModeCallback {
|
||||
|
||||
private val TAG = AutopilotStatusViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:IAutopilotStatusCallback?=null
|
||||
|
||||
private var isAnimateRunning = AtomicBoolean(false)
|
||||
|
||||
|
||||
init {
|
||||
DriverM1Model.get().setControllerStatusCallback(this)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
fun setAutopilotStatusCallback(viewCallback:IAutopilotStatusCallback){
|
||||
this.viewCallback = viewCallback
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
BeautifyManager.setStatusChangeListener(TAG,this)
|
||||
this.setUIMode(CallerAutoPilotStatusListenerManager.getState())
|
||||
}
|
||||
|
||||
fun restartAutopilot() {
|
||||
// todo 启动自驾必须有订单路线
|
||||
if(isAnimateRunning.get()){
|
||||
ToastUtils.showShort("启动自驾中")
|
||||
}else {
|
||||
if (DriverM1Model.get().isHaveOrder()) {
|
||||
DriverM1Model.get().restartAutopilot()
|
||||
CallerLogger.d(M_BUS_P + TAG, "启动自驾")
|
||||
}
|
||||
// startOpenAutopilot() // TODO: 需要注释
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动自驾
|
||||
*/
|
||||
override fun startOpenAutopilot() {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
isAnimateRunning.set(true)
|
||||
this.viewCallback?.startAutopilotAnimation()
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
//20s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed({
|
||||
//20s 超时来判断自驾状态
|
||||
assertStartAutopiloState(CallerAutoPilotStatusListenerManager.getState());
|
||||
}, CharterConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自驾不符合条件启动(底盘返回的)
|
||||
*/
|
||||
override fun onStartAdasFailure() {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
// 底盘自驾判断无法启动自驾
|
||||
assertStartAutopiloState(CallerAutoPilotStatusListenerManager.getState())
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 自驾状态回调
|
||||
*/
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (isAnimateRunning.get() && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return
|
||||
}
|
||||
ThreadUtils.runOnUiThread( {
|
||||
// 自驾状态变更回调(可能成功可能失败)
|
||||
assertStartAutopiloState(state)
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
private fun assertStartAutopiloState(state: Int){
|
||||
if(isAnimateRunning.get()){
|
||||
isAnimateRunning.set(false)
|
||||
if(state==IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
viewCallback?.startAutopilotSuccess()
|
||||
}else{
|
||||
viewCallback?.startAutopilotFail()
|
||||
}
|
||||
this.viewCallback?.stopAutopilotAnimation()
|
||||
RxUtils.createSubscribe(1_000) {
|
||||
setUIMode(state)
|
||||
}
|
||||
}else{
|
||||
setUIMode(state)
|
||||
}
|
||||
}
|
||||
|
||||
fun setUIMode(state:Int){
|
||||
CallerLogger.d(M_BUS_P + TAG, "新的状态:${state}")
|
||||
if (FunctionBuildConfig.isDemoMode) {// 美化模式
|
||||
viewCallback?.inAutopilot()
|
||||
val busOrderResult = DriverM1Model.get().getBusOrderResult()
|
||||
if(busOrderResult==null){//无订单车闲置|车辆不闲置
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
OchChainLogManager.writeChainLog("车辆状态${state}","美化模式-无订单车闲置|车辆不闲置")
|
||||
}else{
|
||||
if(busOrderResult.lineId==0||busOrderResult.siteId==0){//有订单无线路
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
CallerLogger.d(M_BUS_P + TAG, "美化模式-有订单-无线路")
|
||||
OchChainLogManager.writeChainLog("车辆状态${state}","美化模式-有订单-无线路")
|
||||
}else{
|
||||
if (busOrderResult.arriveStatus==ARRIVED) {
|
||||
// 到站不绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
OchChainLogManager.writeChainLog("车辆状态${state}","美化模式-有订单-到站")
|
||||
return
|
||||
}
|
||||
if (StopSideManager.stopSiteStatus== StopSideStatus.EndingSuccess) {
|
||||
// 靠边停车成功不绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
OchChainLogManager.writeChainLog("车辆状态${state}","美化模式-有订单-靠边停车")
|
||||
return
|
||||
}
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
OchChainLogManager.writeChainLog("车辆状态${state}","美化模式-有订单-强制有引导线")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
// 自动驾驶未就绪
|
||||
viewCallback?.autopilotDisable()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
|
||||
// 自动驾驶状态就绪可启动自驾
|
||||
viewCallback?.canStartAutopilot()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// 自动驾驶中
|
||||
viewCallback?.inAutopilot()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
// 平行驾驶中
|
||||
viewCallback?.inRemoteDriver()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum) {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
// 自驾状态变更回调(可能成功可能失败)
|
||||
setUIMode(CallerAutoPilotStatusListenerManager.getState())
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
interface IAutopilotStatusCallback{
|
||||
/**
|
||||
* 开始动画
|
||||
*/
|
||||
fun startAutopilotAnimation()
|
||||
|
||||
/**
|
||||
* 结束动画
|
||||
*/
|
||||
fun stopAutopilotAnimation()
|
||||
// 进入自动驾驶
|
||||
fun inAutopilot()
|
||||
// 自动驾驶不可用
|
||||
fun autopilotDisable()
|
||||
// 自动驾驶不可用
|
||||
fun canStartAutopilot()
|
||||
// 进入平行驾驶
|
||||
fun inRemoteDriver()
|
||||
// 启动自驾成功
|
||||
fun startAutopilotSuccess()
|
||||
// 启动自驾失败
|
||||
fun startAutopilotFail()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.magic.mogo.och.charter.view.carstatus
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
|
||||
|
||||
class CarStatusView : TrafficDataView, CarStatusViewModel.ICarStatusCallback {
|
||||
|
||||
private val TAG = "CarStatusView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
var viewModel:CarStatusViewModel?=null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(CarStatusViewModel::class.java)
|
||||
}
|
||||
viewModel?.setAutopilotStatusCallback(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
override fun updateSpeedWithCurrentValue(speed: Int) {
|
||||
updateSpeedWithValue(speed)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.magic.mogo.och.charter.view.carstatus
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.magic.mogo.och.charter.model.DriverM1Model
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import kotlin.math.abs
|
||||
|
||||
class CarStatusViewModel: ViewModel(), IMoGoAutopilotStatusListener,
|
||||
IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
private val TAG = CarStatusViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:ICarStatusCallback?=null
|
||||
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(DriverM1Model.TAG)
|
||||
}
|
||||
|
||||
fun setAutopilotStatusCallback(viewCallback:ICarStatusCallback){
|
||||
this.viewCallback = viewCallback
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(DriverM1Model.TAG, 10, this)
|
||||
}
|
||||
|
||||
interface ICarStatusCallback{
|
||||
fun updateSpeedWithCurrentValue(speed:Int)
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
mogoLocation?.let {
|
||||
val speed = (abs(it.gnssSpeed) * 3.6f).toInt() // 倒车时工控机反馈定位信息中speed为负值
|
||||
ThreadUtils.runOnUiThread( {
|
||||
viewCallback?.updateSpeedWithCurrentValue(speed)
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/charter_press_start_status">
|
||||
</item>
|
||||
<item android:drawable="@drawable/charter_start_failure">
|
||||
</item>
|
||||
<item android:state_pressed="true" android:drawable="@drawable/charter_press_start_status"/>
|
||||
<item android:drawable="@drawable/charter_start_failure"/>
|
||||
</selector>
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_616"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/charter_autopilot_0_1_status_bg"
|
||||
tools:parentTag="RelativeLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_autopilot_btn_iv"
|
||||
android:layout_width="73dp"
|
||||
android:layout_height="73dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/charter_ic_autopilot" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_autopolot_btn_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="28dp"
|
||||
android:layout_toRightOf="@+id/bus_autopilot_btn_iv"
|
||||
android:text="自动驾驶"
|
||||
android:textColor="@color/charter_autopilot_text_color_normal"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textStyle="bold" />
|
||||
</merge>
|
||||
@@ -29,7 +29,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
<!--车速档位加速度-->
|
||||
<FrameLayout
|
||||
<com.magic.mogo.och.charter.view.carstatus.CarStatusView
|
||||
android:id="@+id/fl_speed"
|
||||
android:layout_width="@dimen/dp_616"
|
||||
android:layout_height="@dimen/dp_320"
|
||||
@@ -37,14 +37,8 @@
|
||||
android:layout_marginTop="@dimen/dp_40"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView
|
||||
android:id="@+id/bus_arc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!--V2X预警红色边框-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.V2XWarningView
|
||||
@@ -160,38 +154,17 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<!--自驾状态和启动开关-->
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_autopilot_status"
|
||||
|
||||
<com.magic.mogo.och.charter.view.autopilot.AutopilotStatusView
|
||||
android:id="@+id/autopilot_status"
|
||||
android:layout_width="@dimen/dp_616"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_marginLeft="@dimen/dp_13"
|
||||
android:background="@drawable/charter_autopilot_0_1_status_bg"
|
||||
android:gravity="center"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/fl_speed"
|
||||
tools:visibility="visible">
|
||||
tools:visibility="visible"
|
||||
android:layout_marginLeft="@dimen/dp_13"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_autopilot_btn_iv"
|
||||
android:layout_width="73dp"
|
||||
android:layout_height="73dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/charter_ic_autopilot" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_autopolot_btn_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="28dp"
|
||||
android:layout_toRightOf="@+id/bus_autopilot_btn_iv"
|
||||
android:text="自动驾驶"
|
||||
android:textColor="@color/charter_autopilot_text_color_normal"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
<!--订单状态-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
@@ -199,7 +172,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_13"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
|
||||
app:layout_constraintTop_toBottomOf="@id/autopilot_status"
|
||||
app:layout_goneMarginTop="@dimen/dp_530" />
|
||||
|
||||
<!--订单信息-->
|
||||
|
||||
@@ -62,7 +62,9 @@ dependencies {
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
implementation project(':core:mogo-core-res')
|
||||
testImplementation 'junit:junit:4.12'
|
||||
|
||||
androidTestImplementation rootProject.ext.dependencies.androidxjunit
|
||||
testImplementation rootProject.ext.dependencies.junit
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.charter.passenger">
|
||||
<manifest package="com.mogo.och.charter.passenger">
|
||||
|
||||
</manifest>
|
||||
@@ -44,8 +44,8 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
|
||||
val supportFragmentManager: FragmentManager? = mActivity?.supportFragmentManager
|
||||
|
||||
if (mPassengerFragment == null) {
|
||||
d(SceneConstant.M_TAXI_P + com.mogo.och.charter.passenger.MogoOCHBusPassenger.Companion.TAG, "准备add fragment======")
|
||||
var fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(MainFragment.TAG)
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
|
||||
val fragmentByTag: Fragment? = supportFragmentManager?.findFragmentByTag(MainFragment.TAG)
|
||||
mPassengerFragment = if (fragmentByTag is MainFragment){
|
||||
fragmentByTag
|
||||
}else{
|
||||
@@ -58,7 +58,7 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
|
||||
}
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_TAXI_P + com.mogo.och.charter.passenger.MogoOCHBusPassenger.Companion.TAG, "准备show fragment")
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备show fragment")
|
||||
supportFragmentManager?.beginTransaction()?.show(mPassengerFragment!!)
|
||||
?.commitAllowingStateLoss()
|
||||
}
|
||||
@@ -71,6 +71,6 @@ class MogoOCHBusPassenger : IMoGoFunctionProvider {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = com.mogo.och.charter.passenger.MogoOCHBusPassenger::class.java.simpleName
|
||||
private val TAG = MogoOCHBusPassenger::class.java.simpleName
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
@@ -42,6 +43,7 @@ import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.CharterSendTripInfoManager
|
||||
import com.mogo.och.common.module.manager.CharterSendTripInfoManager.LEAVE_STATION
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
import com.mogo.och.common.module.manager.orderlogmanager.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
@@ -311,7 +313,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, intent ->
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
d(M_BUS_P + TAG, "onIntentReceived = %s", intentStr)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
@@ -385,7 +387,7 @@ object CharterPassengerModel {
|
||||
this.orderInfo?.orderNo?.let {
|
||||
if (it != orderData.orderNo) {
|
||||
// orderNo 变后清理
|
||||
SharedPrefs.getInstance(mContext).remove("${it}$min5Speak")
|
||||
SharedPrefsMgr.getInstance(mContext).remove("${it}$min5Speak")
|
||||
}
|
||||
}
|
||||
if (order.lineId == null || order.lineId == 0L || order.siteId == null || order.siteId == 0L) {
|
||||
@@ -561,7 +563,7 @@ object CharterPassengerModel {
|
||||
.subscribe { millisUntilFinished ->
|
||||
if (millisUntilFinished <= 900L) {
|
||||
orderInfo?.let {
|
||||
val isPlayed = SharedPrefs.getInstance(mContext)
|
||||
val isPlayed = SharedPrefsMgr.getInstance(mContext)
|
||||
.getBoolean("${it.orderNo}$min5Speak", false)
|
||||
if (!isPlayed) {
|
||||
//发送 通知
|
||||
@@ -572,7 +574,7 @@ object CharterPassengerModel {
|
||||
)
|
||||
VoiceManager.surplus15min(VoiceFocusManager.getVoiceCmdCallBack())
|
||||
d(M_BUS_P + TAG, "倒计时15分钟${it.orderNo}")
|
||||
SharedPrefs.getInstance(mContext)
|
||||
SharedPrefsMgr.getInstance(mContext)
|
||||
.putBoolean("${it.orderNo}$min5Speak", true)
|
||||
}
|
||||
}
|
||||
@@ -736,6 +738,7 @@ object CharterPassengerModel {
|
||||
d(M_BUS_P + TAG, "${this.orderInfo?.orderNo}新的状态:$orderStatus")
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"新的状态:$orderStatus")
|
||||
this.orderStatus = orderStatus
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.ORDER_STATU_CHANGE)
|
||||
for (callback in orderStatusChangeListeners.values) {
|
||||
callback.onStatusChange(this.orderStatus)
|
||||
}
|
||||
@@ -964,6 +967,7 @@ object CharterPassengerModel {
|
||||
|
||||
if (order != null && lineId != null && siteId != null) {
|
||||
OchChainLogManager.writeChainLog(this.orderInfo.toString(),"到站成功:${order.siteName}")
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.ARRIVED_DEST)
|
||||
VoiceManager.arrivedStation(
|
||||
order.siteName!!,
|
||||
order.siteNameKr ?: "",
|
||||
|
||||
@@ -11,14 +11,13 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.function.view.SiteMarkerBean
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.bean.response.LineInfoResponse
|
||||
import com.mogo.och.charter.passenger.bean.response.OrderInfoResponse
|
||||
@@ -34,6 +33,7 @@ import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteName
|
||||
import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteNamewithCheck
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideManager
|
||||
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.OCHPlanningActionsCallback
|
||||
@@ -149,14 +149,14 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
}
|
||||
|
||||
private fun clearShowNoviceGuidanceSharedPrefs() {
|
||||
SharedPrefs.getInstance(context).remove(KEY4SHOWNOVICEGUIDANCE)
|
||||
SharedPrefsMgr.getInstance(context).remove(KEY4SHOWNOVICEGUIDANCE)
|
||||
}
|
||||
|
||||
private fun showNoviceGuidance() {
|
||||
CallerLogger.d(M_BUS_P + TAG, "showNoviceGuidance")
|
||||
val currentOrderInfo = CharterPassengerModel.getCurrentOrderInfo()
|
||||
currentOrderInfo?.orderNo?.let { order ->
|
||||
val stringSet = SharedPrefs.getInstance(context).getStringSet(KEY4SHOWNOVICEGUIDANCE)
|
||||
val stringSet = SharedPrefsMgr.getInstance(context).getStringSet(KEY4SHOWNOVICEGUIDANCE)
|
||||
|
||||
if (stringSet == null) {
|
||||
|
||||
@@ -208,6 +208,7 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
}
|
||||
|
||||
StopSideStatus.EndingSuccess -> {
|
||||
BeautifyManager.notifyViewChange(BeautifyManager.ChangeTypeEnum.STOPSITE_SUCCESS)
|
||||
ToastCharterUtils.showToastShort("靠边停车成功")
|
||||
VoiceNotice.showNotice(
|
||||
context.getString(R.string.charter_p_stop_site_success),
|
||||
|
||||
@@ -42,9 +42,9 @@ import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_softcontrol
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_video
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.omvOverMap
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxBubble
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxButton
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxList
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxBubble
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxButton
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxList
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -104,20 +104,20 @@ class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogo
|
||||
|
||||
override fun initViews() {
|
||||
omvOverMap.hideResetView()
|
||||
viewBusPM1MsgBoxButton.setClickListener(object : MMsgBoxButtonView.ClickListener {
|
||||
override fun showMsgBoxList(show: Boolean) {
|
||||
if (show) {
|
||||
viewBusPM1MsgBoxList.visibility = View.VISIBLE
|
||||
viewBusPM1MsgBoxBubble.visibility = View.GONE
|
||||
viewBusPM1MsgBoxBubble.isShowData(false)
|
||||
} else {
|
||||
viewBusPM1MsgBoxList.visibility = View.GONE
|
||||
viewBusPM1MsgBoxBubble.visibility = View.VISIBLE
|
||||
viewBusPM1MsgBoxBubble.isShowData(true)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
// viewBusPM1MsgBoxButton.setClickListener(object : MMsgBoxButtonView.ClickListener {
|
||||
// override fun showMsgBoxList(show: Boolean) {
|
||||
// if (show) {
|
||||
// viewBusPM1MsgBoxList.visibility = View.VISIBLE
|
||||
// viewBusPM1MsgBoxBubble.visibility = View.GONE
|
||||
// viewBusPM1MsgBoxBubble.isShowData(false)
|
||||
// } else {
|
||||
// viewBusPM1MsgBoxList.visibility = View.GONE
|
||||
// viewBusPM1MsgBoxBubble.visibility = View.VISIBLE
|
||||
// viewBusPM1MsgBoxBubble.isShowData(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// })
|
||||
|
||||
bb_boorombar.setCheckChangeListener(object : BottomBar.ApplyClickLintener {
|
||||
override fun onApplyClick(selectItem: BottomBar.SelectView): Boolean {
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.commons.mvp.MvpDialogFragment
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.model.CharterPassengerModel
|
||||
@@ -160,7 +161,7 @@ class NoviceGuidanceFragment :
|
||||
val currentOrderInfo = CharterPassengerModel.getCurrentOrderInfo()
|
||||
currentOrderInfo?.orderNo?.let { order ->
|
||||
val orderNoSet = mutableSetOf(order)
|
||||
SharedPrefs.getInstance(requireContext())
|
||||
SharedPrefsMgr.getInstance(requireContext())
|
||||
.putStringSet(BusPassengerPresenter.KEY4SHOWNOVICEGUIDANCE, orderNoSet)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.och.charter.passenger.ui.statusbar
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.util.AttributeSet
|
||||
@@ -14,22 +13,24 @@ import chassis.ChassisStatesOuterClass
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.bean.response.OrderInfoResponse
|
||||
import com.mogo.och.charter.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.charter.passenger.model.OrderStatusEnum
|
||||
import com.mogo.och.charter.passenger.ui.debugview.DebugEvent
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.IBeautifyModeCallback
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideManager
|
||||
import com.mogo.och.common.module.manager.stopsidemanager.StopSideStatus
|
||||
import kotlinx.android.synthetic.main.charter_p_statusview_datetime.view.aciv_connect_driver_status
|
||||
import kotlinx.android.synthetic.main.charter_p_statusview_datetime.view.actv_auto_status
|
||||
import kotlinx.android.synthetic.main.charter_p_statusview_datetime.view.bizz_view
|
||||
@@ -44,7 +45,8 @@ class StatusBarView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener, IViewControlListener, IMoGoBatteryManagementSystemListener, IMoGoAutopilotStatusListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoBatteryManagementSystemListener, IMoGoAutopilotStatusListener,
|
||||
IBeautifyModeCallback {
|
||||
|
||||
companion object {
|
||||
const val TAG = "StatusBarView"
|
||||
@@ -85,17 +87,12 @@ class StatusBarView @JvmOverloads constructor(
|
||||
params.height = AutoSizeUtils.dp2px(context,47f)
|
||||
layoutParams = params
|
||||
}
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
CallerHmiViewControlListenerManager.setListenerHz(TAG,5)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
|
||||
//电池电量监听
|
||||
CallerBatteryManagementSystemListenerManager.addListener(TAG,this)
|
||||
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
|
||||
|
||||
updateStatusBarRightView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(this.context))
|
||||
BeautifyManager.setStatusChangeListener(TAG,this)
|
||||
|
||||
bizz_view.setOnClickListener { continuousClick(bizz) }
|
||||
|
||||
@@ -104,8 +101,7 @@ class StatusBarView @JvmOverloads constructor(
|
||||
progress.progress = 50
|
||||
tv_power_cos.text = "50%"
|
||||
|
||||
val state = CallerAutoPilotStatusListenerManager.getState()
|
||||
setAutoPilotStatusInfo(state)
|
||||
setAutoPilotStatusInfo(CallerAutoPilotStatusListenerManager.getState())
|
||||
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(3, ::showConnectStatusWithDriver))
|
||||
}
|
||||
@@ -122,27 +118,58 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun setAutoPilotStatusInfo(state: Int) {
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
if (FunctionBuildConfig.isDemoMode) {// 美化模式
|
||||
actv_auto_status.text = "自动驾驶中"
|
||||
when (CharterPassengerModel.getCurrentOrderStatus()) {
|
||||
OrderStatusEnum.Nothing -> {// 初始状态
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.NoOrderUnuse -> {//无订单车闲置
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.OrderNoLine -> {//有订单无线路
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.OrdersWithLine -> {//有订单有线路 是否到站
|
||||
//是否强制绘制引导线
|
||||
CharterPassengerModel.getCurrentOrderInfo()?.let {
|
||||
if(it.arriveStatus == OrderInfoResponse.ARRIVED){
|
||||
// 到站不绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
return
|
||||
}
|
||||
if (StopSideManager.stopSiteStatus== StopSideStatus.EndingSuccess) {
|
||||
// 靠边停车成功不绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
return
|
||||
}
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
}
|
||||
}
|
||||
OrderStatusEnum.NoOrderUse -> {// 无订单车不闲置
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
}else{
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
actv_auto_status.text = "自动驾驶中"
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
actv_auto_status.text = "远程代驾中"
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
actv_auto_status.text = "自动驾驶中"
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
actv_auto_status.text = "远程代驾中"
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,21 +179,16 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
CallerDevaToolsManager.hideStatusBar()
|
||||
//定时任务
|
||||
BizLoopManager.removeLoopFunction(TAG)
|
||||
//电池电量监听
|
||||
CallerBatteryManagementSystemListenerManager.removeListener(TAG)
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
BeautifyManager.setStatusChangeListener(TAG,null)
|
||||
}
|
||||
|
||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
@@ -179,5 +201,11 @@ class StatusBarView @JvmOverloads constructor(
|
||||
tv_power_cos.text = "${bmsSoc.roundToInt()}%"
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum) {
|
||||
UiThreadHandler.post( {
|
||||
setAutoPilotStatusInfo(CallerAutoPilotStatusListenerManager.getState())
|
||||
},UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ public class BusPassengerMapAssetStyleUtil {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
int count = 0;
|
||||
while ((count = is1.read(buffer1)) > 0) {
|
||||
is1.read(buffer1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
|
||||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 182 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 178 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 65 KiB |
@@ -50,9 +50,10 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:src="@drawable/charter_p_arrow_lock"
|
||||
android:layout_marginTop="-15dp"
|
||||
android:layout_marginStart="-15dp"
|
||||
app:layout_constraintStart_toEndOf="@+id/cl_lock_status"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginEnd="-15dp"
|
||||
android:scaleX="-1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/cl_lock_status"
|
||||
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
|
||||
android:layout_width="@dimen/dp_637"
|
||||
android:layout_height="@dimen/dp_241"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<com.mogo.eagle.core.function.view.MapBizView
|
||||
android:id="@+id/mapBizView"
|
||||
android:layout_width="0dp"
|
||||
app:layout_constraintWidth_percent="0.662"
|
||||
app:layout_constraintWidth_percent="0.6045"
|
||||
app:styleMode="MAP_STYLE_DAY_VR"
|
||||
app:isWeatherEnable="false"
|
||||
app:locationIcon3DRes="@raw/m1"
|
||||
@@ -32,15 +32,25 @@
|
||||
app:resetDrawableMarginBottom="54dp"
|
||||
app:resetDrawableMarginRight="34dp"
|
||||
app:startPointDrawable="@null"
|
||||
app:rightPadding="140"
|
||||
app:topPadding="100" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_enter_video"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_149"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:src="@drawable/charter_p_video"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_map_2_default"
|
||||
android:layout_width="@dimen/dp_148"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
android:layout_marginBottom="-15dp"
|
||||
android:layout_marginTop="@dimen/dp_m_27"
|
||||
android:src="@drawable/charter_p_overmap_reset"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintTop_toBottomOf="@+id/aciv_enter_video"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--pnc行为决策-->
|
||||
@@ -52,45 +62,24 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/mapBizView"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<!--消息盒子选择入口-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
|
||||
android:id="@+id/viewBusPM1MsgBoxButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_enter_video"
|
||||
android:layout_width="@dimen/dp_147"
|
||||
android:layout_height="@dimen/dp_149"
|
||||
android:layout_marginTop="-20dp"
|
||||
android:src="@drawable/charter_p_video"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
|
||||
<!--消息盒子打开视图-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxListView
|
||||
android:id="@+id/viewBusPM1MsgBoxList"
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="520dp"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:layout_marginEnd="@dimen/dp_34"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBusPM1MsgBoxButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
<com.mogo.och.common.module.wigets.ZhiView
|
||||
android:id="@+id/zv_msg_pop_bottom"
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_240"
|
||||
android:layout_marginBottom="-20dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<!--消息盒子气泡视图-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxBubbleView
|
||||
android:id="@+id/viewBusPM1MsgBoxBubble"
|
||||
android:layout_width="450dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-30dp"
|
||||
android:layout_marginEnd="@dimen/dp_34"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:layout_marginBottom="-40dp"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintEnd_toEndOf="@+id/viewBusPM1MsgBoxButton"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewBusPM1MsgBoxButton" />
|
||||
app:layout_constraintEnd_toEndOf="@+id/zv_msg_pop_bottom"
|
||||
app:layout_constraintBottom_toTopOf="@+id/zv_msg_pop_bottom" />
|
||||
|
||||
<!--速度、剩余时间、剩余距离和到达时间-->
|
||||
<com.mogo.och.charter.passenger.ui.itinerary.ItineraryView
|
||||
@@ -169,9 +158,8 @@
|
||||
<com.mogo.och.charter.passenger.ui.lockview.LockAndUnlockView
|
||||
android:layout_width="@dimen/dp_138"
|
||||
android:layout_height="@dimen/dp_138"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_map_2_default"
|
||||
android:layout_marginBottom="-30dp"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
app:layout_constraintBottom_toTopOf="@+id/bb_boorombar"
|
||||
android:layout_marginBottom="@dimen/dp_m_2"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</com.mogo.och.charter.passenger.ui.lockview.LockViewConstrainLayout>
|
||||
@@ -49,6 +49,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.material
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation project(path: ':OCH:mogo-och-common-module')
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.och.common.module.debug
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Environment
|
||||
import android.os.SystemClock
|
||||
import chassis.Chassis
|
||||
import chassis.Chassis.DoorNumber
|
||||
import chassis.VehicleStateOuterClass
|
||||
@@ -10,10 +11,12 @@ import com.google.gson.reflect.TypeToken
|
||||
import com.mogo.eagle.core.data.enums.DataSourceType
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotStatisticsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisDoorStateListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisGnssListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
@@ -24,6 +27,7 @@ import com.mogo.och.common.module.debug.location.MogoLocationExit
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.view.DebugFloatWindow
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.io.BufferedReader
|
||||
@@ -43,20 +47,30 @@ object DebugDataDispatch {
|
||||
const val carLightSwitch = "lightSwitch"
|
||||
const val trajectoryStation = "trajectoryStation"
|
||||
const val showDebugView = "showDebugView"
|
||||
const val stateAutopilot = "stateAutopilot"
|
||||
const val stateAutopilotFail = "stateAutopilotFail"
|
||||
const val stopSite = "stopSite"
|
||||
|
||||
// aadb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "globalPath" --es path "sy73.json"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "carDoor" --ei doorPostion 1 --ei doorStatus 1
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "trunAroud" --es code "IMAP_TRA_LOADED"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "lightSwitch" --ei lightPostion 0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stateAutopilot" --ei autopilotMode 0 --ei autopilotState 0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stateAutopilotFail"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "trajectoryStation" --ef startLon 116.74053643938474 --ef startLat 40.200487993233246 --ef endLon 116.73876977409685 --ef endLat 40.20179054129441 --el lineID 8
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stopSite" --ei state 6 --ei action 1
|
||||
|
||||
|
||||
val ROOT_PATH =
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator + "MLog" + File.separator + "APPLog" + File.separator //程序外部存储跟目录
|
||||
Environment.getExternalStorageDirectory().absolutePath + File.separator + "MLog" + File.separator + "APP_mock" + File.separator //程序外部存储跟目录
|
||||
|
||||
|
||||
fun disPathc(type: String?, frequency: Int, sourceFilePath: String?, intent: Intent) {
|
||||
val file = File(ROOT_PATH);
|
||||
if(file.exists()){
|
||||
|
||||
}
|
||||
when (type) {
|
||||
globalPathMock -> {
|
||||
sourceFilePath?.let {
|
||||
@@ -118,6 +132,35 @@ object DebugDataDispatch {
|
||||
val debugFloatWindow = DebugFloatWindow(ActivityUtils.getTopActivity())
|
||||
debugFloatWindow.showFloatWindow()
|
||||
}
|
||||
stateAutopilot -> {
|
||||
val autopilotState = intent.getIntExtra("autopilotState", 0)
|
||||
val autopilotMode = intent.getIntExtra("autopilotMode", 0)
|
||||
CallerAutoPilotStatusListenerManager.updateAutoPilotStatus(autopilotState,autopilotMode)
|
||||
}
|
||||
stateAutopilotFail -> {
|
||||
val newBuilder = MogoReportMsg.MogoReportMessage.newBuilder()
|
||||
newBuilder.code = "100"
|
||||
newBuilder.msg = "adb 模拟指令"
|
||||
newBuilder.timestampBuilder.sec = 0
|
||||
newBuilder.timestampBuilder.nsec = 0
|
||||
newBuilder.src = "2"
|
||||
newBuilder.level = ""
|
||||
var autopilotStatistics =
|
||||
AutopilotStatistics(1, SystemClock.elapsedRealtime(), null, newBuilder.build())
|
||||
CallerAutopilotStatisticsListenerManager.invokeAutopilotStatistics(autopilotStatistics)
|
||||
}
|
||||
stopSite -> {
|
||||
val state = intent.getIntExtra("state", 0)
|
||||
val action = intent.getIntExtra("action", 0)
|
||||
val pncAction = MessagePad.PlanningActionMsg.newBuilder()
|
||||
val planningaction = MessagePad.ParkScenarioPlanningAction.newBuilder()
|
||||
val drivingAction = MessagePad.ParkScenarioDrivingAction.newBuilder()
|
||||
drivingAction.drivingState = MessagePad.ParkScenarioDrivingState.forNumber(state)
|
||||
drivingAction.drivingAction = MessagePad.DrivingAction.forNumber(action)
|
||||
planningaction.actionMsg = drivingAction.build()
|
||||
pncAction.parkScenarioAction = planningaction.build()
|
||||
CallerPlanningActionsListenerManager.invokePNCActions(pncAction.build())
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,17 @@ public class CollectionUtils {
|
||||
OkHttpClient okHttpClient = OkHttpFactory.Companion.getOkHttpClient();
|
||||
List<Interceptor> interceptors = okHttpClient.interceptors();
|
||||
Field pro = getDeclaredField(interceptors, "list");
|
||||
pro.setAccessible(true);
|
||||
List<Interceptor> modifyerList = null;
|
||||
try {
|
||||
modifyerList = (List<Interceptor>) pro.get(interceptors);
|
||||
modifyerList.add(new SimpleInterceptor());
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
if(pro != null){
|
||||
pro.setAccessible(true);
|
||||
List<Interceptor> modifierList;
|
||||
try {
|
||||
modifierList = (List<Interceptor>) pro.get(interceptors);
|
||||
if(modifierList != null){
|
||||
modifierList.add(new SimpleInterceptor());
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -32,7 +36,10 @@ public class CollectionUtils {
|
||||
* @since:2019年2月26日 下午4:06:16
|
||||
*/
|
||||
public static Field getDeclaredField(Object object, String fieldName){
|
||||
Field field = null ;
|
||||
if(fieldName == null){
|
||||
return null;
|
||||
}
|
||||
Field field;
|
||||
Class<?> clazz = object.getClass() ;
|
||||
for(; clazz != Object.class ; clazz = clazz.getSuperclass()) {
|
||||
try {
|
||||
|
||||
@@ -4,9 +4,8 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean
|
||||
@@ -100,8 +99,8 @@ object OchCommonLoginModel {
|
||||
// 获取验证码成功
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.module_och_taxi_login_login_success))
|
||||
LoginStatusManager.setLoginStatus(TaxiLoginStatusEnum.Login)
|
||||
mContext?.let {
|
||||
SharedPrefs.getInstance(it).putString("och_account", phone)
|
||||
mContext?.let { c ->
|
||||
SharedPrefsMgr.getInstance(c).putString("och_account", phone)
|
||||
}
|
||||
iTaxiLoginCallback?.loginSuccess()
|
||||
} else {
|
||||
|
||||
@@ -3,16 +3,14 @@ package com.mogo.och.common.module.biz.model
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.SharedPrefs
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.och.common.module.bean.dpmsg.BusCacheKey
|
||||
import com.mogo.och.common.module.bean.dpmsg.LoginCacheStatus
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.callback.ILoginViewCallback
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.data.manager.cache.CacheDataManager
|
||||
|
||||
@@ -29,10 +27,10 @@ object OchCommonLoginStatusDefaultModel : OchCommonLoginStatusModel() {
|
||||
override fun loginSuccess(data: DriverStatusQueryRespBean?) {
|
||||
CallerLogger.d(SceneConstant.M_TAXI + TAG, "loginSuccess:${LoginStatusManager.isLogin()}")
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
SharedPrefs.getInstance(mContext).putString("och_account", data?.data?.phone)
|
||||
SharedPrefsMgr.getInstance(mContext).putString("och_account", data?.data?.phone)
|
||||
loginViewCallback?.hideLoginDialogFragment()
|
||||
} else {
|
||||
SharedPrefs.getInstance(mContext).putString("och_account", "")
|
||||
SharedPrefsMgr.getInstance(mContext).putString("och_account", "")
|
||||
loginViewCallback?.showLoginDialogFragment()
|
||||
}
|
||||
loginCallback?.loginSuccess(data)
|
||||
@@ -42,8 +40,7 @@ object OchCommonLoginStatusDefaultModel : OchCommonLoginStatusModel() {
|
||||
}
|
||||
|
||||
private fun updateLoginLocalStatus(loginStatus: Int = 0) {
|
||||
var loginCacheStatus = LoginCacheStatus(loginStatus,DateTimeUtil.getCurrentTimeStamp())
|
||||
|
||||
val loginCacheStatus = LoginCacheStatus(loginStatus,DateTimeUtil.getCurrentTimeStamp())
|
||||
CacheDataManager.instance.putCacheData(mContext, BusCacheKey.BUS_LOGIN_STATUS_CACHE,
|
||||
GsonUtils.toJson(loginCacheStatus))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.och.common.module.manager.beautifymode
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object BeautifyManager : IViewControlListener, IReceivedMsgListener {
|
||||
|
||||
private val TAG = BeautifyManager::class.java.simpleName
|
||||
|
||||
enum class ChangeTypeEnum{
|
||||
BEAUTIFY_TYPE,// 美化模式变化
|
||||
ORDER_STATU_CHANGE,// 订单状态发生变化
|
||||
ARRIVED_DEST,// 到站
|
||||
STOPSITE_SUCCESS,// 靠边停车成功
|
||||
STOPSITE_SUCCESS_RUN// 靠边停车成功后恢复为正在驾驶
|
||||
}
|
||||
|
||||
private val orderStatusChangeListeners = ConcurrentHashMap<String, IBeautifyModeCallback>()
|
||||
|
||||
init {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
} else if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
CallerTelematicListenerManager.addListener(TAG,this)
|
||||
}
|
||||
}
|
||||
|
||||
fun setStatusChangeListener(tag: String, orderStatusChangeListener: IBeautifyModeCallback?) {
|
||||
if (tag.isBlank()) return
|
||||
if (orderStatusChangeListener == null) {
|
||||
orderStatusChangeListeners.remove(tag)
|
||||
return
|
||||
}
|
||||
orderStatusChangeListeners[tag] = orderStatusChangeListener
|
||||
}
|
||||
|
||||
|
||||
fun notifyViewChange(typeEnum: ChangeTypeEnum){
|
||||
CallerLogger.d(TAG,"美化模式变化原因:${typeEnum}")
|
||||
orderStatusChangeListeners.forEach {
|
||||
it.value.dispatchStatus(typeEnum)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
|
||||
}
|
||||
|
||||
override fun onDemoMode(isDemoMode: Boolean) {
|
||||
notifyViewChange(ChangeTypeEnum.BEAUTIFY_TYPE)
|
||||
}
|
||||
|
||||
override fun updateFuncMode(tag: String, boolean: Boolean) {
|
||||
if (tag == IViewControlListener.FUNC_MODE_DEMO) {
|
||||
notifyViewChange(ChangeTypeEnum.BEAUTIFY_TYPE)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.och.common.module.manager.beautifymode
|
||||
|
||||
|
||||
interface IBeautifyModeCallback {
|
||||
fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum)
|
||||
}
|
||||
@@ -670,18 +670,24 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
|
||||
return if (redCatche.isNullOrEmpty()) {
|
||||
distanceWithStartStation()
|
||||
} else {
|
||||
distanceWithTrajectory(redCatche)
|
||||
val currentPoint =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
distanceWithTrajectory(redCatche,currentPoint)
|
||||
}
|
||||
|
||||
} else {
|
||||
return if (this.lineId == 0L || this.lineId == null) {
|
||||
distanceWithTrajectory(mRoutePoints!!)
|
||||
val currentPoint =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
distanceWithTrajectory(mRoutePoints!!,currentPoint)
|
||||
} else {
|
||||
if (lineId != this.lineId) {
|
||||
// 判断距离起始站的距离
|
||||
distanceWithStartStation()
|
||||
} else {
|
||||
distanceWithTrajectory(mRoutePoints!!)
|
||||
val currentPoint =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
distanceWithTrajectory(mRoutePoints!!,currentPoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -715,9 +721,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
|
||||
/**
|
||||
* 距离轨迹的距离
|
||||
*/
|
||||
private fun distanceWithTrajectory(redCatche: MutableList<MogoLocation>): String {
|
||||
val currentPoint =
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
|
||||
fun distanceWithTrajectory(redCatche: MutableList<MogoLocation>,currentPoint:MogoLocation): String {
|
||||
// 判断距离轨迹的距离
|
||||
val carLocationInfo: Triple<Int, Boolean?, Float> =
|
||||
CoordinateCalculateRouteUtil.getNearestPointInfo(
|
||||
@@ -725,8 +729,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
|
||||
redCatche.size - 1,
|
||||
redCatche,
|
||||
currentPoint,
|
||||
2,
|
||||
useHeading = false
|
||||
2
|
||||
)
|
||||
if (carLocationInfo.third <= OchCommonConst.AUTOMATIC_PLANNING_MAX_DISTANCE) {
|
||||
return ""// 可以启动自驾
|
||||
|
||||
@@ -73,7 +73,11 @@ object BizLoopManager {
|
||||
override fun onSubscribe(d: Disposable) {}
|
||||
override fun onError(e: Throwable) {}
|
||||
override fun onComplete() {
|
||||
loopInfo.function.invoke()
|
||||
try {
|
||||
loopInfo.function.invoke()
|
||||
}catch (e:Throwable){
|
||||
CallerLogger.e(TAG,"$tag:--$e")
|
||||
}
|
||||
CallerLogger.d(TAG, "${aLong}正在执行方法${tag}_${Thread.currentThread().name}")
|
||||
}
|
||||
override fun onNext(t: String) {}
|
||||
|
||||
@@ -16,6 +16,7 @@ object OchChainLogManager {
|
||||
private val TAG = OchChainLogManager::class.java.simpleName
|
||||
|
||||
const val EVENT_KEY_INFE_WITH_CHANGE = "event_key_och_common_info_and_changeinfo"
|
||||
const val EVENT_KEY_INFE_WITH_TRAJECTORY = "event_key_och_trajectory_info"
|
||||
|
||||
/**
|
||||
* @param Info 订单详细信息
|
||||
@@ -27,19 +28,24 @@ object OchChainLogManager {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_OCH_COMMON_DISTANCE,
|
||||
paramIndexes = [0,1]
|
||||
)
|
||||
fun writeChainLog(Info: String, changeInfo: String,upload:Boolean = true) {
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, Info)
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, changeInfo)
|
||||
if(upload) {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
params["env"] = DebugConfig.getNetMode()
|
||||
params["plate_number"] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params["time"] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
params["info"] = Info
|
||||
params["changeInfo"] = changeInfo
|
||||
MogoAnalyticUtils.track(EVENT_KEY_INFE_WITH_CHANGE, params)
|
||||
@JvmStatic
|
||||
fun writeChainLog(Info: String, changeInfo: String,upload:Boolean = true,eventID:String=EVENT_KEY_INFE_WITH_CHANGE) {
|
||||
try {
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, Info)
|
||||
d(SceneConstant.M_OCHCOMMON + TAG, changeInfo)
|
||||
if(upload) {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
params["env"] = DebugConfig.getNetMode()
|
||||
params["plate_number"] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params["time"] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
params["info"] = Info
|
||||
params["changeInfo"] = changeInfo
|
||||
MogoAnalyticUtils.track(eventID, params)
|
||||
}
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,12 @@ object StopSideManager : IMoGoAutopilotPlanningActionsListener {
|
||||
// 只响应第一次
|
||||
}else{
|
||||
stopSiteStatus = StopSideStatus.NOTHING
|
||||
CallerLogger.d(SceneConstant.M_BUS+ TAG,"进入正常驾驶")
|
||||
M_LISTENERS.forEach {
|
||||
val tag = it.key
|
||||
val listener = it.value
|
||||
CallerLogger.d(SceneConstant.M_BUS+ TAG,"进入正常驾驶")
|
||||
listener.onStartAutopilotFailure(StopSideStatus.NOTHING,false,"进入正常行驶中")
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
import com.mogo.och.common.module.utils.PermissionUtil;
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
|
||||
private ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private volatile ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private AtomicInteger errorCount = new AtomicInteger(0);
|
||||
private boolean isPlay;
|
||||
|
||||
@@ -61,26 +61,31 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
|
||||
public void initAMapNavi(NaviLatLng startLatLng, NaviLatLng endLatLng) {
|
||||
try {
|
||||
CallerLogger.i( TAG, "initAMapNavi()");
|
||||
mAMapNavi = AMapNavi.getInstance(AbsMogoApplication.getApp());
|
||||
mAMapNavi.addAMapNaviListener(this);
|
||||
mAMapNavi.setUseInnerVoice(true, true);
|
||||
sList.add(startLatLng);
|
||||
eList.add(endLatLng);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
try {
|
||||
CallerLogger.i(TAG, "initAMapNavi()");
|
||||
mAMapNavi = AMapNavi.getInstance(AbsMogoApplication.getApp());
|
||||
mAMapNavi.addAMapNaviListener(this);
|
||||
mAMapNavi.setUseInnerVoice(true, true);
|
||||
sList.add(startLatLng);
|
||||
eList.add(endLatLng);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setVoiceIsMute(boolean isPlay) {
|
||||
if (mAMapNavi == null) return;
|
||||
this.isPlay = isPlay;
|
||||
if (isPlay) {
|
||||
mAMapNavi.startSpeak();
|
||||
} else {
|
||||
mAMapNavi.stopSpeak();
|
||||
}
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
if (mAMapNavi == null) return;
|
||||
CallerLogger.i(TAG, "setVoiceIsMute()--"+isPlay);
|
||||
this.isPlay = isPlay;
|
||||
if (isPlay) {
|
||||
mAMapNavi.startSpeak();
|
||||
} else {
|
||||
mAMapNavi.stopSpeak();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AMapNavi getmAMapNavi() {
|
||||
@@ -88,16 +93,18 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
|
||||
public void destroyAmaNavi() {
|
||||
if (mAMapNavi != null) {
|
||||
CallerLogger.i( TAG, "destroyAmaNavi()");
|
||||
isPlay = false;
|
||||
sList.clear();
|
||||
eList.clear();
|
||||
mAMapNavi.stopNavi();
|
||||
mAMapNavi.destroy();
|
||||
mAMapNavi = null;
|
||||
mNaviChangedCallback = null;
|
||||
}
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
CallerLogger.i(TAG, "destroyAmaNavi()");
|
||||
if (mAMapNavi != null) {
|
||||
isPlay = false;
|
||||
sList.clear();
|
||||
eList.clear();
|
||||
mAMapNavi.stopNavi();
|
||||
mAMapNavi.destroy();
|
||||
mAMapNavi = null;
|
||||
mNaviChangedCallback = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTaxiNaviChangedCallback(ICommonNaviChangedCallback callback) {
|
||||
@@ -124,26 +131,28 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
* 说明: 以上参数都是boolean类型,其中multipleroute参数表示是否多条路线,如果为true则此策略会算出多条路线。
|
||||
* 注意: 不走高速与高速优先不能同时为true 高速优先与避免收费不能同时为true
|
||||
*/
|
||||
int strategy = 0;
|
||||
try {
|
||||
//再次强调,最后一个参数为true时代表多路径,否则代表单路径
|
||||
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
int strategy = 0;
|
||||
try {
|
||||
//再次强调,最后一个参数为true时代表多路径,否则代表单路径
|
||||
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateRouteSuccess(int[] ints) {
|
||||
//多路径算路成功回调
|
||||
mAMapNavi.startNavi(NaviType.GPS);
|
||||
ThreadUtils.getSinglePool().execute(() -> mAMapNavi.startNavi(NaviType.GPS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(NaviInfo naviinfo) {
|
||||
//导航过程中的信息更新,请看NaviInfo的具体说明
|
||||
CallerLogger.i( TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
CallerLogger.i(TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
if (null != mNaviChangedCallback) {
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance(), naviinfo.getPathRetainTime());// 米、秒
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ object CoordinateCalculateRouteUtil {
|
||||
}
|
||||
distanceMap.clear()
|
||||
Logger.d(SceneConstant.M_OCHCOMMON + "calculateRouteSumLength",
|
||||
"计算时间:${startTime-System.currentTimeMillis()}")
|
||||
"计算时间:${System.currentTimeMillis()-startTime}")
|
||||
return getNearestPointInfo(preIndex,endIndex,mRoutePoints,location,type,size+2)
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ object CoordinateCalculateRouteUtil {
|
||||
}
|
||||
distanceMap.clear()
|
||||
Logger.d(SceneConstant.M_OCHCOMMON + "calculateRouteSumLength",
|
||||
"计算时间:${startTime-System.currentTimeMillis()}")
|
||||
"计算时间:${System.currentTimeMillis()-startTime}")
|
||||
return Triple(currentIndex,preIndexDistance?.isNext,preIndexDistance!!.distance)
|
||||
}else{
|
||||
currentIndex = preIndex+1
|
||||
@@ -770,7 +770,7 @@ object CoordinateCalculateRouteUtil {
|
||||
}
|
||||
distanceMap.clear()
|
||||
Logger.d(SceneConstant.M_OCHCOMMON + "calculateRouteSumLength",
|
||||
"计算时间:${startTime-System.currentTimeMillis()}")
|
||||
"计算时间:${System.currentTimeMillis()-startTime}")
|
||||
return Triple(currentIndex,preIndexNextDistance?.isNext,preIndexNextDistance!!.distance)
|
||||
}
|
||||
}
|
||||
@@ -832,7 +832,7 @@ object CoordinateCalculateRouteUtil {
|
||||
}
|
||||
distanceMap.clear()
|
||||
Logger.d(SceneConstant.M_OCHCOMMON + "calculateRouteSumLength",
|
||||
"计算时间:${startTime-System.currentTimeMillis()}")
|
||||
"计算时间:${System.currentTimeMillis()-startTime}")
|
||||
return Triple(currentIndex,key.isNext,key.distance)
|
||||
}
|
||||
key.distance.let {
|
||||
@@ -850,7 +850,7 @@ object CoordinateCalculateRouteUtil {
|
||||
}
|
||||
distanceMap.clear()
|
||||
Logger.d(SceneConstant.M_OCHCOMMON + "calculateRouteSumLength",
|
||||
"计算时间:${startTime-System.currentTimeMillis()}")
|
||||
"计算时间:${System.currentTimeMillis()-startTime}")
|
||||
return Triple(currentIndex,isNext,tempDistance)
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,15 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import java.lang.RuntimeException
|
||||
import java.lang.ref.SoftReference
|
||||
|
||||
class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFirstFrame:Boolean = true,width:Int = -1,height:Int = -1){
|
||||
class FrameAnimatorContainer (resId: Int,
|
||||
fps: Int,
|
||||
imageView: ImageView,
|
||||
sequence: Boolean = true,// 播放顺序 true 正序 false 倒序
|
||||
isOnce: Boolean = false,// 一次性的 true 值播放一次 false 重复播放
|
||||
initFirstFrame:Boolean = true,
|
||||
width:Int = -1,
|
||||
height:Int = -1){
|
||||
private val TAG = "FrameAnimatorContainer"
|
||||
private lateinit var mFrames: IntArray // 帧数组
|
||||
private var mIndex = 0 // 当前帧
|
||||
private var mShouldRun = false // 开始/停止播放用
|
||||
@@ -21,9 +29,13 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
private var mOnAnimationStoppedListener: OnAnimationStoppedListener? = null//播放停止监听
|
||||
private var mBitmap: Bitmap? = null
|
||||
private var mBitmapOptions: BitmapFactory.Options? = null //Bitmap管理类,可有效减少Bitmap的OOM问题
|
||||
var isOnce:Boolean = false
|
||||
var sequence:Boolean = true
|
||||
|
||||
init {
|
||||
createAnimation(imageView, getData(resId), fps,initFirstFrame,width,height)
|
||||
this.isOnce = isOnce
|
||||
this.sequence = sequence
|
||||
}
|
||||
|
||||
private fun createAnimation(
|
||||
@@ -74,13 +86,22 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
private val next: Int
|
||||
get() {
|
||||
mIndex++
|
||||
if (mIndex >= mFrames.size) mIndex = 0
|
||||
if (mIndex >= mFrames.size){
|
||||
mIndex = 0
|
||||
if(isOnce){// 一次性动画 播放完毕后直接结束
|
||||
stop()
|
||||
}
|
||||
}
|
||||
if(!sequence){// 倒叙
|
||||
return mFrames[mFrames.size-1-mIndex]
|
||||
}
|
||||
return mFrames[mIndex]
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun reStart(){
|
||||
mIndex = 0
|
||||
mIndex = -1
|
||||
mIsRunning = false
|
||||
start()
|
||||
}
|
||||
|
||||
@@ -91,6 +112,7 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
fun start() {
|
||||
mShouldRun = true
|
||||
if (mIsRunning) return
|
||||
mHandler?.removeCallbacksAndMessages(null)
|
||||
val runnable: Runnable = object : Runnable {
|
||||
override fun run() {
|
||||
val imageView = mSoftReferenceImageView!!.get()
|
||||
@@ -103,9 +125,16 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
}
|
||||
mIsRunning = true
|
||||
//新开线程去读下一帧
|
||||
mHandler!!.postDelayed(this, mDelayMillis.toLong())
|
||||
if (imageView.isShown) {
|
||||
val imageRes: Int = next
|
||||
if (!mShouldRun || imageView == null) {
|
||||
mIsRunning = false
|
||||
if (mOnAnimationStoppedListener != null) {
|
||||
mOnAnimationStoppedListener!!.AnimationStopped()
|
||||
}
|
||||
return
|
||||
}
|
||||
mHandler?.postDelayed(this, mDelayMillis.toLong())
|
||||
if (mBitmap != null) { // so Build.VERSION.SDK_INT >= 11
|
||||
var bitmap: Bitmap? = null
|
||||
try {
|
||||
@@ -158,7 +187,7 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
* @param resId
|
||||
* @return
|
||||
*/
|
||||
private fun getData(resId: Int): IntArray {
|
||||
fun getData(resId: Int): IntArray {
|
||||
val array = AbsMogoApplication.getApp().resources.obtainTypedArray(resId)
|
||||
val len = array.length()
|
||||
val intArray = IntArray(array.length())
|
||||
@@ -169,6 +198,10 @@ class FrameAnimatorContainer (resId: Int, fps: Int, imageView: ImageView,initFir
|
||||
return intArray
|
||||
}
|
||||
|
||||
fun setData(mFrames: IntArray){
|
||||
this.mFrames = mFrames
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止播放监听
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ public class NumberFormatUtil {
|
||||
* @return
|
||||
*/
|
||||
public static String formatLong(double d) {
|
||||
BigDecimal bg = new BigDecimal(d).setScale(1, RoundingMode.HALF_UP);
|
||||
BigDecimal bg = BigDecimal.valueOf(d).setScale(1, RoundingMode.HALF_UP);
|
||||
double num = bg.doubleValue();
|
||||
if (Math.ceil(num) - num == 0) {
|
||||
return String.valueOf((long) num);
|
||||
|
||||
@@ -7,11 +7,6 @@ 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> {
|
||||
|
||||
/**
|
||||
@@ -42,10 +37,11 @@ public class OCHThreadPoolManager<T> {
|
||||
}
|
||||
|
||||
private volatile static OCHThreadPoolManager INSTANCE;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
public static OCHThreadPoolManager getsInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (OCHThreadPoolManager.class) {
|
||||
synchronized (obj) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new OCHThreadPoolManager();
|
||||
}
|
||||
@@ -57,12 +53,10 @@ public class OCHThreadPoolManager<T> {
|
||||
|
||||
/**
|
||||
* 开启一个无返回结果的线程
|
||||
*
|
||||
* @param r
|
||||
*/
|
||||
public void execute(Runnable r) {
|
||||
if (executor == null) {
|
||||
/**
|
||||
/*
|
||||
* corePoolSize:核心线程数
|
||||
* maximumPoolSize:线程池所容纳最大线程数(workQueue队列满了之后才开启)
|
||||
* keepAliveTime:非核心线程闲置时间超时时长
|
||||
@@ -73,7 +67,7 @@ public class OCHThreadPoolManager<T> {
|
||||
*
|
||||
*/
|
||||
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
|
||||
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
|
||||
}
|
||||
// 把一个任务丢到了线程池中
|
||||
@@ -87,13 +81,10 @@ public class OCHThreadPoolManager<T> {
|
||||
|
||||
/**
|
||||
* 开启一个有返回结果的线程
|
||||
*
|
||||
* @param r
|
||||
* @return
|
||||
*/
|
||||
public Future<T> submit(Callable<T> r) {
|
||||
if (executor == null) {
|
||||
/**
|
||||
/*
|
||||
* corePoolSize:核心线程数
|
||||
* maximumPoolSize:线程池所容纳最大线程数(workQueue队列满了之后才开启)
|
||||
* keepAliveTime:非核心线程闲置时间超时时长
|
||||
@@ -104,7 +95,7 @@ public class OCHThreadPoolManager<T> {
|
||||
*
|
||||
*/
|
||||
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20),
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(20),
|
||||
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
|
||||
}
|
||||
// 把一个任务丢到了线程池中
|
||||
@@ -113,12 +104,10 @@ public class OCHThreadPoolManager<T> {
|
||||
|
||||
/**
|
||||
* 开启一个无返回结果的线程
|
||||
*
|
||||
* @param r
|
||||
*/
|
||||
public Future submit(Runnable r) {
|
||||
if (executor == null) {
|
||||
/**
|
||||
/*
|
||||
* corePoolSize:核心线程数
|
||||
* maximumPoolSize:线程池所容纳最大线程数(workQueue队列满了之后才开启)
|
||||
* keepAliveTime:非核心线程闲置时间超时时长
|
||||
@@ -129,7 +118,7 @@ public class OCHThreadPoolManager<T> {
|
||||
*
|
||||
*/
|
||||
executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(200),
|
||||
KEEP_ALIVE, TimeUnit.SECONDS, new ArrayBlockingQueue<>(200),
|
||||
Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
|
||||
}
|
||||
return executor.submit(r);
|
||||
@@ -138,8 +127,6 @@ public class OCHThreadPoolManager<T> {
|
||||
|
||||
/**
|
||||
* 把任务移除等待队列
|
||||
*
|
||||
* @param r
|
||||
*/
|
||||
public void cancel(Runnable r) {
|
||||
if (r != null) {
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package com.mogo.och.common.module.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.media.*;
|
||||
import android.content.*;
|
||||
import android.os.*;
|
||||
import android.app.*;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/23
|
||||
*
|
||||
*/
|
||||
public class SoundPoolHelper {
|
||||
private SoundPool mSoundPool;
|
||||
private AudioManager mAudioManager;
|
||||
@@ -22,20 +17,16 @@ public class SoundPoolHelper {
|
||||
private int resId;
|
||||
private Context mContext;
|
||||
|
||||
private volatile static SoundPoolHelper INSTANCE;
|
||||
private SoundPoolHelper(){}
|
||||
|
||||
public static SoundPoolHelper getSoundPoolHelper(){
|
||||
if (INSTANCE == null){
|
||||
synchronized (SoundPoolHelper.class){
|
||||
if (INSTANCE == null){
|
||||
INSTANCE = new SoundPoolHelper();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
|
||||
public SoundPoolHelper(){}
|
||||
private static final class Holder{
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static final SoundPoolHelper INSTANCE = new SoundPoolHelper();
|
||||
}
|
||||
|
||||
//播放资源文件
|
||||
public void playSoundWithRedId(Context context,int resId){
|
||||
@@ -64,30 +55,19 @@ public class SoundPoolHelper {
|
||||
|
||||
if (mSoundPool == null){
|
||||
// For Android SDK >= 21
|
||||
if (Build.VERSION.SDK_INT >= 21 ) {
|
||||
AudioAttributes audioAttrib = new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_GAME)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build();
|
||||
|
||||
AudioAttributes audioAttrib = new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_GAME)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build();
|
||||
SoundPool.Builder builder= new SoundPool.Builder();
|
||||
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
|
||||
|
||||
SoundPool.Builder builder= new SoundPool.Builder();
|
||||
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
|
||||
|
||||
this.mSoundPool = builder.build();
|
||||
} else {// for Android SDK < 21
|
||||
// SoundPool(int maxStreams, int streamType, int srcQuality)
|
||||
this.mSoundPool = new SoundPool(MAX_STREAMS, AudioManager.STREAM_MUSIC, 0);
|
||||
}
|
||||
this.mSoundPool = builder.build();
|
||||
}
|
||||
|
||||
// When Sound Pool load complete.
|
||||
this.mSoundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
|
||||
@Override
|
||||
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
|
||||
playSound();
|
||||
}
|
||||
});
|
||||
this.mSoundPool.setOnLoadCompleteListener((soundPool, sampleId, status) -> playSound());
|
||||
|
||||
//load res
|
||||
this.mSoundId =this.mSoundPool.load(this.mContext,this.resId,1);
|
||||
@@ -105,14 +85,12 @@ public class SoundPoolHelper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//play the sound res
|
||||
private void playSound(){
|
||||
float leftVolumn = volume;
|
||||
float rightVolumn = volume;
|
||||
float leftVolume = volume;
|
||||
float rightVolume = volume;
|
||||
// Play sound of gunfire. Returns the ID of the new stream.
|
||||
int streamId = this.mSoundPool.play(this.mSoundId,leftVolumn, rightVolumn, 1, 0, 1f);
|
||||
int streamId = this.mSoundPool.play(this.mSoundId,leftVolume, rightVolume, 1, 0, 1f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView
|
||||
/**
|
||||
* 是否使用自定义 gap
|
||||
*/
|
||||
private boolean mUseCustomGap;
|
||||
private final boolean mUseCustomGap;
|
||||
|
||||
public MarqueeTextView(Context context) {
|
||||
this(context, null);
|
||||
@@ -60,7 +60,6 @@ public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (hasWindowFocus){}
|
||||
super.onWindowFocusChanged(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class OCHGradientTextView extends AppCompatTextView {
|
||||
private Paint mPaint;
|
||||
private int mViewWidth = 0;//文字的宽度
|
||||
private int mViewHeight = 0;//文字的高度
|
||||
private Rect mTextBound = new Rect();
|
||||
private final Rect mTextBound = new Rect();
|
||||
private int[] mColorList;//存放颜色的数组
|
||||
private boolean isVertrial;//默认是横向
|
||||
|
||||
@@ -60,7 +60,7 @@ public class OCHGradientTextView extends AppCompatTextView {
|
||||
mPaint.setShadowLayer(mRadius, mdx, mdy, mColor);
|
||||
|
||||
//画出文字
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2 - mTextBound.width() / 2, getMeasuredHeight() / 2 + mTextBound.height() / 2, mPaint);
|
||||
canvas.drawText(mTipText, getMeasuredWidth() / 2.0f - mTextBound.width() / 2.0f, getMeasuredHeight() / 2.0f + mTextBound.height() / 2.0f, mPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,18 +22,18 @@ import com.mogo.och.common.module.R;
|
||||
public class OCHShapeBlurView extends OCHStockBlurView {
|
||||
Paint mPaint;
|
||||
RectF mRectF;
|
||||
private float mRadius;
|
||||
private int mTopColor; // default #aaffffff
|
||||
private int mBottomColor; // default #aaffffff
|
||||
private final float mRadius;
|
||||
private final int mTopColor; // default #aaffffff
|
||||
private final int mBottomColor; // default #aaffffff
|
||||
|
||||
public OCHShapeBlurView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHRShapeBlurView);
|
||||
mRadius = a.getDimension(R.styleable.OCHRShapeBlurView_och_realtime_radius,
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.OCHShapeBlurView);
|
||||
mRadius = a.getDimension(R.styleable.OCHShapeBlurView_och_realtime_radius,
|
||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, context.getResources().getDisplayMetrics()));
|
||||
mTopColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_start_color, 0xAAFFFFFF);
|
||||
mBottomColor = a.getColor(R.styleable.OCHRShapeBlurView_och_realtime_end_color, 0xAAFFFFFF);
|
||||
mTopColor = a.getColor(R.styleable.OCHShapeBlurView_och_realtime_start_color, 0xAAFFFFFF);
|
||||
mBottomColor = a.getColor(R.styleable.OCHShapeBlurView_och_realtime_end_color, 0xAAFFFFFF);
|
||||
a.recycle();
|
||||
mPaint = new Paint();
|
||||
mRectF = new RectF();
|
||||
@@ -60,7 +60,7 @@ public class OCHShapeBlurView extends OCHStockBlurView {
|
||||
mPaint.reset();
|
||||
mPaint.setAntiAlias(true);
|
||||
/* 设置渐变色 这个正方形的颜色是改变的 */
|
||||
Shader mShader = new LinearGradient(getWidth()/2, 0, getWidth()/2, getHeight(),
|
||||
Shader mShader = new LinearGradient(getWidth()/2.0f, 0, getWidth()/2.0f, getHeight(),
|
||||
new int[] {mTopColor,mBottomColor}, null, Shader.TileMode.CLAMP); // 一个材质,打造出一个线性梯度沿著一条线。
|
||||
mPaint.setShader(mShader);//0xBFE0E8FF,0xBF6AA2D7
|
||||
canvas.drawRoundRect(mRectF, mRadius,mRadius,mPaint);
|
||||
|
||||
@@ -24,13 +24,13 @@ public class OCHStockBlurView extends View {
|
||||
private float mDownsampleFactor; // default 4
|
||||
private int mOverlayColor; // default #aaffffff
|
||||
private float mBlurRadius; // default 10dp (0 < r <= 25)
|
||||
private boolean onece;
|
||||
private final boolean onece;
|
||||
|
||||
private boolean mDirty;
|
||||
private Bitmap mBitmapToBlur, mBlurredBitmap;
|
||||
private Canvas mBlurringCanvas;
|
||||
private boolean mIsRendering;
|
||||
private Paint mPaint;
|
||||
private final Paint mPaint;
|
||||
private final Rect mRectSrc = new Rect(), mRectDst = new Rect();
|
||||
// mDecorView should be the root view of the activity (even if you are on a different window like a dialog)
|
||||
private View mDecorView;
|
||||
@@ -149,9 +149,11 @@ public class OCHStockBlurView extends View {
|
||||
} finally {
|
||||
if (!r) {
|
||||
release();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
@@ -216,7 +218,9 @@ public class OCHStockBlurView extends View {
|
||||
}
|
||||
}
|
||||
if(onece) {
|
||||
mDecorView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
if(mDecorView!=null) {
|
||||
mDecorView.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.app.ActivityCompat
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.VoiceMsg
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.main.MainPresenter
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.permissions.PermissionsDialogUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import com.mogo.och.common.module.utils.PermissionUtil
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.tts.base.zhi.AsrTextBean
|
||||
import com.mogo.tts.base.zhi.AvatarManager
|
||||
import com.mogo.tts.base.zhi.CallbackWidget
|
||||
import com.mogo.tts.base.zhi.ZhiRecordWinUi
|
||||
|
||||
class ZhiView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr),
|
||||
ZhiRecordWinUi {
|
||||
companion object {
|
||||
const val TAG = "ZhiView"
|
||||
}
|
||||
|
||||
private var currentAnim = FrameAnimatorContainer(R.array.xiaozhi_normal, 12,this)
|
||||
|
||||
@Volatile
|
||||
private var status = ZhiRecordWinUi.RecordStatus.STATUS_SILENCE
|
||||
private var animalState = AnimalState.Normal
|
||||
init {
|
||||
val xiaozhiNormal = currentAnim.getData(R.array.xiaozhi_normal)
|
||||
val xiaozhiThink = currentAnim.getData(R.array.xiaozhi_think)
|
||||
val xiaozhiThinkNormal = currentAnim.getData(R.array.xiaozhi_think_normal)
|
||||
currentAnim.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
when (status) {
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SILENCE -> {
|
||||
if(animalState==AnimalState.SPEAK){
|
||||
currentAnim.setData(xiaozhiThinkNormal)
|
||||
currentAnim.isOnce = true
|
||||
currentAnim.sequence = false
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.NORMAL_SPEAK
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status speak to normal")
|
||||
}else{
|
||||
currentAnim.setData(xiaozhiNormal)
|
||||
currentAnim.isOnce = false
|
||||
currentAnim.sequence = true
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.Normal
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status normal")
|
||||
}
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_LISTENING -> {
|
||||
if(animalState==AnimalState.Normal){
|
||||
currentAnim.setData(xiaozhiThinkNormal)
|
||||
currentAnim.isOnce = true
|
||||
currentAnim.sequence = true
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.NORMAL_SPEAK
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status normal to speak")
|
||||
}else{
|
||||
currentAnim.setData(xiaozhiThink)
|
||||
currentAnim.isOnce = false
|
||||
currentAnim.sequence = true
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.SPEAK
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status speak")
|
||||
}
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTANDING -> {}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTAND_END -> {}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SPEAKING -> {
|
||||
if(animalState==AnimalState.SPEAK){
|
||||
currentAnim.setData(xiaozhiThinkNormal)
|
||||
currentAnim.isOnce = true
|
||||
currentAnim.sequence = false
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.NORMAL_SPEAK
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status speak to normal")
|
||||
}else{
|
||||
currentAnim.setData(xiaozhiNormal)
|
||||
currentAnim.isOnce = false
|
||||
currentAnim.sequence = true
|
||||
currentAnim.reStart()
|
||||
animalState = AnimalState.Normal
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "动画$status normal")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setOnClickListener {
|
||||
if (ClickUtils.isClickTooFrequent(this,3000)) {
|
||||
ToastCharterUtils.showToastShort("请稍后唤醒")
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (PermissionUtil.checkPermission(context,Manifest.permission.RECORD_AUDIO)) {
|
||||
AvatarManager.wakeupXiaoZhi()
|
||||
}else{
|
||||
//申请悬浮窗权限
|
||||
val shouldShowRequestPermissionRationale = ActivityUtils.getTopActivity()
|
||||
.shouldShowRequestPermissionRationale(Manifest.permission.RECORD_AUDIO)
|
||||
if(shouldShowRequestPermissionRationale){// 可以弹窗系统权限框
|
||||
ActivityCompat.requestPermissions(ActivityUtils.getTopActivity(),
|
||||
arrayOf(
|
||||
Manifest.permission.RECORD_AUDIO,
|
||||
), MainPresenter.MOGO_PERMISSION_REQUEST_CODE
|
||||
)
|
||||
}else{// 不会弹系统弹窗
|
||||
PermissionsDialogUtils.openAppDetails(ActivityUtils.getTopActivity(), "录音机", 100)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasWindowFocus)
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "焦点与否:${hasWindowFocus}")
|
||||
AvatarManager.enableXiaoZhi(!hasWindowFocus)
|
||||
if(hasWindowFocus){
|
||||
currentAnim.reStart()
|
||||
}else{
|
||||
currentAnim.stop()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
AvatarManager.addDistanceListener(TAG,this)
|
||||
currentAnim.reStart()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
AvatarManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun start(reason: String?) {
|
||||
CallerLogger.d(TAG,"-----start $reason")
|
||||
}
|
||||
|
||||
override fun onStatusChange(status: ZhiRecordWinUi.RecordStatus?) {
|
||||
CallerLogger.d(TAG,"-----onStatusChange $status")
|
||||
this.status = status?:ZhiRecordWinUi.RecordStatus.STATUS_SILENCE
|
||||
when (status) {
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SILENCE -> {
|
||||
currentAnim.stop()
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_LISTENING -> {// 监听中
|
||||
currentAnim.stop()
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTANDING -> {
|
||||
// 正在理解
|
||||
CallerLogger.d(TAG,"正在理解")
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTAND_END -> {
|
||||
CallerLogger.d(TAG,"理解结束")
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SPEAKING -> {
|
||||
// 正在说话
|
||||
currentAnim.stop()
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun close(trigger: Boolean) {
|
||||
CallerLogger.d(TAG,"-----close $trigger")
|
||||
onStatusChange(ZhiRecordWinUi.RecordStatus.STATUS_SILENCE)
|
||||
val msg = VoiceMsg(
|
||||
isWakeUp = false,
|
||||
isWakeUpEnd = true,
|
||||
msg = null,
|
||||
isLastMsg = true,
|
||||
isResp = true
|
||||
)
|
||||
pushMsgBox(msg)
|
||||
}
|
||||
|
||||
|
||||
override fun onVolumeChange(volume: Int) {
|
||||
CallerLogger.d(TAG,"-----onVolumeChange $volume")
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户输入的
|
||||
*/
|
||||
override fun showInputText(asrTextBean: AsrTextBean?) {
|
||||
CallerLogger.d(TAG,"-----showInputText $asrTextBean")
|
||||
asrTextBean.let {
|
||||
val msg = VoiceMsg(
|
||||
isWakeUp = false,
|
||||
isWakeUpEnd = false,
|
||||
msg = it?.text,
|
||||
isLastMsg = it?.isLast == true,
|
||||
isResp = false
|
||||
)
|
||||
pushMsgBox(msg)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 特定View
|
||||
*/
|
||||
override fun showOutPutWidget(callbackWidget: CallbackWidget?) {
|
||||
// todo 咱不支持定制显示 包括天气
|
||||
CallerLogger.d(TAG,"-----showOutPutWidget $callbackWidget")
|
||||
}
|
||||
|
||||
/**
|
||||
* 小智说的
|
||||
*/
|
||||
override fun showOutputText(outPutText: String?) {
|
||||
CallerLogger.d(TAG,"-----showOutputText $outPutText")
|
||||
outPutText?.let {
|
||||
val msg = VoiceMsg(
|
||||
isWakeUp = false,
|
||||
isWakeUpEnd = false,
|
||||
msg = it,
|
||||
isLastMsg = false,
|
||||
isResp = true
|
||||
)
|
||||
pushMsgBox(msg)
|
||||
}
|
||||
}
|
||||
|
||||
private fun pushMsgBox(msg:VoiceMsg){
|
||||
CallerMsgBoxManager.saveMsgBox(MsgBoxBean(MsgBoxType.VOICE, msg))
|
||||
}
|
||||
|
||||
enum class AnimalState {
|
||||
Normal,
|
||||
NORMAL_SPEAK,
|
||||
SPEAK_NORMAL,
|
||||
SPEAK,
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*/
|
||||
public class FrameSurfaceView extends BaseSurfaceView {
|
||||
public static final int INVALID_INDEX = Integer.MAX_VALUE;
|
||||
private int bufferSize = 3;
|
||||
private final int bufferSize = 3;
|
||||
public static final String DECODE_THREAD_NAME = "DecodingThread";
|
||||
public static final int INFINITE = -1;
|
||||
//-1 means repeat infinitely
|
||||
@@ -45,12 +45,12 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
* decoded bitmaps stores in this queue
|
||||
* consumer is drawing thread, producer is decoding thread.
|
||||
*/
|
||||
private LinkedBlockingQueue decodedBitmaps = new LinkedBlockingQueue(bufferSize);
|
||||
private final LinkedBlockingQueue decodedBitmaps = new LinkedBlockingQueue(bufferSize);
|
||||
/**
|
||||
* bitmaps already drawn by canvas stores in this queue
|
||||
* consumer is decoding thread, producer is drawing thread.
|
||||
*/
|
||||
private LinkedBlockingQueue drawnBitmaps = new LinkedBlockingQueue(bufferSize);
|
||||
private final LinkedBlockingQueue drawnBitmaps = new LinkedBlockingQueue(bufferSize);
|
||||
/**
|
||||
* the thread for decoding bitmaps
|
||||
*/
|
||||
@@ -64,9 +64,9 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
*/
|
||||
private Handler handler;
|
||||
private BitmapFactory.Options options;
|
||||
private Paint paint = new Paint();
|
||||
private final Paint paint = new Paint();
|
||||
private Rect srcRect;
|
||||
private Rect dstRect = new Rect();
|
||||
private final Rect dstRect = new Rect();
|
||||
private int defaultWidth;
|
||||
private int defaultHeight;
|
||||
|
||||
@@ -138,7 +138,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
return;
|
||||
}
|
||||
this.bitmapIds = bitmapIds;
|
||||
//by default, take the first bitmap's dimension into consideration
|
||||
//by default, take the first bitMap's dimension into consideration
|
||||
getBitmapDimension(bitmapIds.get(bitmapIdIndex));
|
||||
preloadFrames();
|
||||
decodeRunnable = new DecodeRunnable(bitmapIdIndex, bitmapIds, options);
|
||||
@@ -203,8 +203,6 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
|
||||
/**
|
||||
* draw a single frame which is a bitmap
|
||||
*
|
||||
* @param canvas
|
||||
*/
|
||||
private void drawOneFrame(Canvas canvas) {
|
||||
LinkedBitmap linkedBitmap = getDecodedBitmap();
|
||||
@@ -214,12 +212,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
putDrawnBitmap(linkedBitmap);
|
||||
frameIndex.incrementAndGet();
|
||||
if(isFinish()&&frameFinishCallback!=null){
|
||||
runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
frameFinishCallback.onFinishCallback();
|
||||
}
|
||||
});
|
||||
runOnUIThread(() -> frameFinishCallback.onFinishCallback());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,8 +264,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
}
|
||||
if (decodeRunnable != null) {
|
||||
decodeRunnable.setIndex(0);
|
||||
handler.post(decodeRunnable);
|
||||
}
|
||||
handler.post(decodeRunnable);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,8 +283,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
* decode bitmap by BitmapFactory.decodeStream(), it is about twice faster than BitmapFactory.decodeResource()
|
||||
*
|
||||
* @param resId the bitmap resource
|
||||
* @param options
|
||||
* @return
|
||||
* @param options options
|
||||
* @return Bitmap
|
||||
*/
|
||||
private Bitmap decodeBitmap(int resId, BitmapFactory.Options options) {
|
||||
options.inScaled = false;
|
||||
@@ -322,8 +315,7 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
* @param linkedBitmap
|
||||
*/
|
||||
private void decodeAndPutBitmap(int resId, BitmapFactory.Options options, LinkedBitmap linkedBitmap) {
|
||||
Bitmap bitmap = decodeBitmap(resId, options);
|
||||
linkedBitmap.bitmap = bitmap;
|
||||
linkedBitmap.bitmap = decodeBitmap(resId, options);
|
||||
try {
|
||||
decodedBitmaps.put(linkedBitmap);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -377,8 +369,8 @@ public class FrameSurfaceView extends BaseSurfaceView {
|
||||
private class DecodeRunnable implements Runnable {
|
||||
|
||||
private int index;
|
||||
private List<Integer> bitmapIds;
|
||||
private BitmapFactory.Options options;
|
||||
private final List<Integer> bitmapIds;
|
||||
private final BitmapFactory.Options options;
|
||||
|
||||
public DecodeRunnable(int index, List<Integer> bitmapIds, BitmapFactory.Options options) {
|
||||
this.index = index;
|
||||
|
||||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 21 KiB |