Merge branch 'dev_robotaxi-d_231031_6.2.0' into dev_robotaxi-d_231016_6.2.0_local
3
.gitignore
vendored
@@ -7,4 +7,5 @@
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
.cxx
|
||||
.gitlab-ci.yml
|
||||
@@ -1,27 +0,0 @@
|
||||
stages:
|
||||
- analyze
|
||||
|
||||
inspect java and kotlin codes:
|
||||
tags:
|
||||
- apk
|
||||
- android
|
||||
stage: analyze
|
||||
script:
|
||||
- echo "$CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA $CI_COMMIT_BRANCH $CI_COMMIT_DESCRIPTION $CI_COMMIT_TIMESTAMP"
|
||||
- echo "${CI_JOB_STAGE}_reports_${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}"
|
||||
- ./gradlew runCodeInspect
|
||||
before_script:
|
||||
- source change_java_version
|
||||
artifacts:
|
||||
name: "${CI_JOB_STAGE}_reports_${CI_PROJECT_NAME}_$CI_COMMIT_REF_SLUG"
|
||||
when: always
|
||||
expire_in: 1 days
|
||||
paths:
|
||||
- "build/reports/*"
|
||||
only:
|
||||
- $CI_COMMIT_BRANCH
|
||||
- pushes
|
||||
- schedules
|
||||
except:
|
||||
- master
|
||||
allow_failure: true
|
||||
@@ -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,7 +1,6 @@
|
||||
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.util.NetworkUtils;
|
||||
@@ -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){
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.magic.mogo.och.charter.callback
|
||||
|
||||
import com.magic.mogo.och.charter.manager.BeautifyManager
|
||||
|
||||
interface IBeautifyModeCallback {
|
||||
fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.magic.mogo.och.charter.manager
|
||||
|
||||
import com.magic.mogo.och.charter.callback.IBeautifyModeCallback
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object BeautifyManager {
|
||||
|
||||
private val TAG = BeautifyManager::class.java.simpleName
|
||||
|
||||
enum class ChangeTypeEnum{
|
||||
BEAUTIFY_TYPE,// 美化模式变化
|
||||
ORDER_STATU_CHANGE,// 订单状态发生变化
|
||||
ARRIVED_DEST,// 到站
|
||||
STOPSITE_SUCCESS// 靠边停车成功
|
||||
}
|
||||
|
||||
private val orderStatusChangeListeners = ConcurrentHashMap<String, IBeautifyModeCallback>()
|
||||
|
||||
@Volatile
|
||||
@JvmField
|
||||
var isBeautifyMode = false
|
||||
|
||||
init {
|
||||
isBeautifyMode = FunctionBuildConfig.isDemoMode
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(3, ::checkDemoMode))
|
||||
}
|
||||
|
||||
private fun checkDemoMode() {
|
||||
if(isBeautifyMode!=FunctionBuildConfig.isDemoMode){
|
||||
isBeautifyMode = FunctionBuildConfig.isDemoMode
|
||||
notifyViewChange(ChangeTypeEnum.BEAUTIFY_TYPE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,8 +36,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 +54,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 +61,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 +89,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 +135,6 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
mView?.onAutopilotStatusChanged(state)
|
||||
when(state){
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> { //
|
||||
//
|
||||
@@ -193,21 +182,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
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.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.magic.mogo.och.charter.R
|
||||
import com.magic.mogo.och.charter.constant.CharterConst
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ResourceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
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
|
||||
|
||||
var isAnimateRunning = false
|
||||
|
||||
private var autopilotLoadingAnimator: ObjectAnimator? = null
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.charter_autopilot_status, this, true)
|
||||
onClick {
|
||||
if (!isAnimateRunning) {
|
||||
viewModel?.restartAutopilot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun startAutopilotAnimation() {
|
||||
isAnimateRunning = true
|
||||
bus_autopolot_btn_tv!!.text = resources.getString(R.string.charter_loading_autopilot_tv)
|
||||
bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
isClickable = true
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_loading_autopilot_icon)
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator =
|
||||
ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f)
|
||||
autopilotLoadingAnimator?.interpolator = LinearInterpolator()
|
||||
autopilotLoadingAnimator?.repeatCount = -1 //无限循环
|
||||
autopilotLoadingAnimator?.duration = 1000 //设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator!!.start() //动画开始
|
||||
startingAutoApilotCountDown()
|
||||
}
|
||||
|
||||
override fun stopAnimAndUpdateBtnStatus() {
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.getState())
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusChanged(autopilotStatus: Int) {
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus
|
||||
) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return
|
||||
}
|
||||
if (isAnimateRunning) {
|
||||
stopAnimAndUpdateBtnStatus()
|
||||
} else {
|
||||
setAutopilotBtnStatus(autopilotStatus)
|
||||
}
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed({
|
||||
//未启动成功做处理
|
||||
if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.getState())
|
||||
}
|
||||
}, CharterConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
fun updateAutopilotStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus
|
||||
) { //2 running
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_right_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_success_tv)
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
isClickable = false
|
||||
} else {
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_wrong_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_failure_tv)
|
||||
isClickable = false
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
}
|
||||
UiThreadHandler.postDelayed({ setAutopilotBtnStatus(autopilotStatus) }, 1000)
|
||||
}
|
||||
|
||||
fun setAutopilotBtnStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus
|
||||
) { //0不可用
|
||||
bus_autopolot_btn_tv!!.setTextColor(resources.getColor(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)
|
||||
// ctvAutopilotStatus!!.isSelected = false
|
||||
isClickable = true
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
}else{
|
||||
bus_autopolot_btn_tv!!.setTextColor(resources.getColor(R.color.charter_autopilot_text_color_normal))
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.charter_ic_autopilot)
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_runnig_tv)
|
||||
isClickable = true
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
|
||||
background =
|
||||
ResourceUtils.getDrawable(R.drawable.charter_autopilot_0_1_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
|
||||
background =
|
||||
ResourceUtils.getDrawable(R.drawable.charter_autopilot_2_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING == autopilotStatus){
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
resources.getString(R.string.charter_loading_autopilot_pingxing_tv)
|
||||
isClickable = false
|
||||
background = ResourceUtils.getDrawable(R.drawable.charter_pingxingjiashi)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
protected open fun stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
bus_autopilot_btn_iv!!.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
isAnimateRunning = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(AutopilotStatusViewModel::class.java)
|
||||
}
|
||||
viewModel?.setAutopilotStatusCallback(this)
|
||||
setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.getState())
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.magic.mogo.och.charter.view.autopilot
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.magic.mogo.och.charter.callback.IDriverM1ControllerStatusCallback
|
||||
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.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
|
||||
class AutopilotStatusViewModel: ViewModel(), IDriverM1ControllerStatusCallback,
|
||||
IMoGoAutopilotStatusListener {
|
||||
|
||||
private val TAG = AutopilotStatusViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:IAutopilotStatusCallback?=null
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fun restartAutopilot() {
|
||||
// todo 启动自驾必须有订单路线
|
||||
if (DriverM1Model.get().isHaveOrder()) {
|
||||
DriverM1Model.get().restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
interface IAutopilotStatusCallback{
|
||||
fun startAutopilotAnimation()
|
||||
fun stopAnimAndUpdateBtnStatus()
|
||||
fun onAutopilotStatusChanged(state: Int)
|
||||
}
|
||||
|
||||
override fun startOpenAutopilot() {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
this.viewCallback?.startAutopilotAnimation()
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onStartAdasFailure() {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
this.viewCallback?.stopAnimAndUpdateBtnStatus()
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun updateSpeed(gnssInfo: MogoLocation) {
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
ThreadUtils.runOnUiThread( {
|
||||
this.viewCallback?.onAutopilotStatusChanged(state)
|
||||
},ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.charter.passenger.callback
|
||||
|
||||
import com.mogo.och.charter.passenger.utils.BeautifyManager
|
||||
|
||||
interface IBeautifyModeCallback {
|
||||
fun dispatchStatus(typeEnum: BeautifyManager.ChangeTypeEnum)
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.mogo.och.charter.passenger.callback.*
|
||||
import com.mogo.och.charter.passenger.constant.CharterPassengerConst
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.charter.passenger.net.BusPassengerServiceManager
|
||||
import com.mogo.och.charter.passenger.utils.BeautifyManager
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.charter.passenger.utils.VoiceFocusManager
|
||||
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg
|
||||
@@ -736,6 +737,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 +966,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 ?: "",
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.mogo.och.charter.passenger.receive.DriverMessage
|
||||
import com.mogo.och.charter.passenger.ui.MainFragment
|
||||
import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteName
|
||||
import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteNamewithCheck
|
||||
import com.mogo.och.charter.passenger.utils.BeautifyManager
|
||||
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.stopsidemanager.StopSideManager
|
||||
@@ -208,6 +209,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 {
|
||||
|
||||
@@ -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,25 @@ 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.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
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.callback.IBeautifyModeCallback
|
||||
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.charter.passenger.utils.BeautifyManager
|
||||
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 +46,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 +88,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 +102,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 +119,60 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun setAutoPilotStatusInfo(state: Int) {
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
actv_auto_status.text = "安全接管中"
|
||||
if (FunctionBuildConfig.isDemoMode) {// 美化模式
|
||||
val gnssSpeed = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed
|
||||
actv_auto_status.text = "自动驾驶中"
|
||||
when (CharterPassengerModel.getCurrentOrderStatus()) {
|
||||
OrderStatusEnum.Nothing -> {// 初始状态
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.NoOrderUnuse -> {//无订单车闲置
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.OrderNoLine -> {//有订单无线路
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false
|
||||
}
|
||||
OrderStatusEnum.OrdersWithLine -> {//有订单有线路 是否到站
|
||||
//是否强制绘制引导线
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = gnssSpeed>0.3
|
||||
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 +182,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 +204,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.och.charter.passenger.utils
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.charter.passenger.callback.IBeautifyModeCallback
|
||||
import com.mogo.och.charter.passenger.ui.statusbar.StatusBarView
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
object BeautifyManager {
|
||||
|
||||
private val TAG = BeautifyManager::class.java.simpleName
|
||||
|
||||
enum class ChangeTypeEnum{
|
||||
BEAUTIFY_TYPE,// 美化模式变化
|
||||
ORDER_STATU_CHANGE,// 订单状态发生变化
|
||||
ARRIVED_DEST,// 到站
|
||||
STOPSITE_SUCCESS// 靠边停车成功
|
||||
}
|
||||
|
||||
private val orderStatusChangeListeners = ConcurrentHashMap<String, IBeautifyModeCallback>()
|
||||
|
||||
@Volatile
|
||||
@JvmField
|
||||
var isBeautifyMode = false
|
||||
|
||||
init {
|
||||
isBeautifyMode = FunctionBuildConfig.isDemoMode
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(3, ::checkDemoMode))
|
||||
}
|
||||
|
||||
private fun checkDemoMode() {
|
||||
if(isBeautifyMode!=FunctionBuildConfig.isDemoMode){
|
||||
isBeautifyMode = FunctionBuildConfig.isDemoMode
|
||||
notifyViewChange(ChangeTypeEnum.BEAUTIFY_TYPE)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
@@ -44,7 +44,7 @@ object DebugDataDispatch {
|
||||
const val trajectoryStation = "trajectoryStation"
|
||||
const val showDebugView = "showDebugView"
|
||||
|
||||
// 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"
|
||||
@@ -53,10 +53,14 @@ object DebugDataDispatch {
|
||||
|
||||
|
||||
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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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,207 @@
|
||||
package com.mogo.och.common.module.wigets
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
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.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.och.common.module.R
|
||||
import com.mogo.och.common.module.utils.FrameAnimatorContainer
|
||||
import com.mogo.tts.base.zhi.AsrTextBean
|
||||
import com.mogo.tts.base.zhi.CallbackWidget
|
||||
import com.mogo.tts.base.zhi.AvatarManager
|
||||
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 normalAnim: FrameAnimatorContainer?=null
|
||||
private var listeningAnim: FrameAnimatorContainer?=null
|
||||
private var understandingAnim: FrameAnimatorContainer?=null
|
||||
private var speakingAnim: FrameAnimatorContainer?=null
|
||||
|
||||
@Volatile
|
||||
private var currentAni:FrameAnimatorContainer?=null
|
||||
|
||||
init {
|
||||
normalAnim = FrameAnimatorContainer(R.array.xiaozhi_normal, 20,this)
|
||||
normalAnim?.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "常态动画暂停")
|
||||
currentAni?.reStart()
|
||||
}
|
||||
})
|
||||
|
||||
listeningAnim = FrameAnimatorContainer(R.array.xiaozhi_normal, 20,this)
|
||||
listeningAnim?.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "侦听动画暂停")
|
||||
currentAni?.reStart()
|
||||
}
|
||||
})
|
||||
|
||||
understandingAnim = FrameAnimatorContainer(R.array.xiaozhi_normal, 20,this)
|
||||
understandingAnim?.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "理解中动画暂停")
|
||||
currentAni?.reStart()
|
||||
}
|
||||
})
|
||||
|
||||
speakingAnim = FrameAnimatorContainer(R.array.xiaozhi_normal, 20,this)
|
||||
speakingAnim?.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
|
||||
override fun AnimationStopped() {
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "说话动画暂停")
|
||||
currentAni?.reStart()
|
||||
}
|
||||
})
|
||||
|
||||
currentAni = normalAnim
|
||||
|
||||
onClick {
|
||||
AvatarManager.wakeupXiaoZhi()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onWindowFocusChanged(hasWindowFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasWindowFocus)
|
||||
CallerLogger.d(SceneConstant.M_OCHCOMMON + TAG, "焦点与否:${hasWindowFocus}")
|
||||
AvatarManager.enableXiaoZhi(!hasWindowFocus)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
AvatarManager.addDistanceListener(TAG,this)
|
||||
normalAnim?.reStart()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
AvatarManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
override fun start(reason: String?) {
|
||||
CallerLogger.d(TAG,"-----start $reason")
|
||||
val msg = VoiceMsg(
|
||||
isWakeUp = true,
|
||||
isWakeUpEnd = false,
|
||||
msg = "",
|
||||
isLastMsg = true,
|
||||
isResp = true
|
||||
)
|
||||
pushMsgBox(msg)
|
||||
}
|
||||
|
||||
override fun onStatusChange(status: ZhiRecordWinUi.RecordStatus?) {
|
||||
CallerLogger.d(TAG,"-----onStatusChange $status")
|
||||
|
||||
|
||||
when (status) {
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SILENCE -> {}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_LISTENING -> {
|
||||
// 正在听取
|
||||
currentAni?.stop()
|
||||
currentAni = listeningAnim
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTANDING -> {
|
||||
// 正在理解
|
||||
currentAni?.stop()
|
||||
currentAni = understandingAnim
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_UNDERSTAND_END -> {
|
||||
|
||||
}
|
||||
ZhiRecordWinUi.RecordStatus.STATUS_SPEAKING -> {
|
||||
// 正在说话
|
||||
currentAni?.stop()
|
||||
currentAni = speakingAnim
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun close(trigger: Boolean) {
|
||||
CallerLogger.d(TAG,"-----close $trigger")
|
||||
currentAni?.stop()
|
||||
currentAni = normalAnim
|
||||
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))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 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: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 19 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: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |