[Bus passenger v1.0.0] init
This commit is contained in:
@@ -11,6 +11,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerBaseFragment;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
@@ -30,6 +31,7 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
|
||||
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
private BusPassengerBaseFragment mBusPassengerFragment;
|
||||
|
||||
@Override
|
||||
public void createCoverage(FragmentActivity activity, int containerId) {
|
||||
@@ -69,11 +71,11 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (descriptor == StatusDescriptor.VR_MODE){
|
||||
if (descriptor == StatusDescriptor.VR_MODE) {
|
||||
if (isTrue){
|
||||
|
||||
showFragment();
|
||||
}else {
|
||||
|
||||
hideFragment();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,4 +88,21 @@ public class MogoOCHBusPassenger implements IMogoOCH, IMogoStatusChangedListener
|
||||
MogoMapUIController.getInstance()
|
||||
.openVrMode( false );
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
if (mBusPassengerFragment == null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备add fragment======");
|
||||
mBusPassengerFragment = new BusPassengerBaseFragment();
|
||||
mActivity.getSupportFragmentManager().beginTransaction().add(mContainerId, mBusPassengerFragment).commitAllowingStateLoss();
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "准备show fragment");
|
||||
mActivity.getSupportFragmentManager().beginTransaction().show(mBusPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
if (mBusPassengerFragment != null){
|
||||
mActivity.getSupportFragmentManager().beginTransaction().hide(mBusPassengerFragment).commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IBusPassengerADASStatusCallback {
|
||||
// 自动驾驶触发的已到达目的地:暂未用到
|
||||
void onAutopilotArriveEnd();
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable();
|
||||
|
||||
// 自动驾驶不可用状态
|
||||
void onAutopilotDisable();
|
||||
|
||||
// 自动驾驶运行中
|
||||
void onAutopilotRunning();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public interface IBusPassengerAutopilotPlanningCallback {
|
||||
void routeResult(List<MessagePad.Location> models);
|
||||
void routeResultByServer(List<LatLng> models);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IBusPassengerControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
package com.mogo.och.bus.passenger.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
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.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BusPassengerModel {
|
||||
private static final String TAG = BusPassengerModel.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
|
||||
}
|
||||
|
||||
public static BusPassengerModel getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
private IBusPassengerADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private IBusPassengerAutopilotPlanningCallback mAutopilotPlanningCallback; //Model->Presenter:自动驾驶线路规划
|
||||
private Map<String, IBusPassengerControllerStatusCallback> mControllerStatusCallbackMap = new ConcurrentHashMap<>();
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
|
||||
private BusPassengerModel() {
|
||||
}
|
||||
|
||||
public void init( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
initListeners();
|
||||
// TODO: 2022/3/31
|
||||
}
|
||||
|
||||
public void release() {
|
||||
releaseListeners();
|
||||
}
|
||||
|
||||
public void setMoGoAutopilotPlanningListener(IBusPassengerAutopilotPlanningCallback
|
||||
moGoAutopilotPlanningCallback) {
|
||||
this.mAutopilotPlanningCallback = moGoAutopilotPlanningCallback;
|
||||
}
|
||||
|
||||
public void setADASStatusCallback(IBusPassengerADASStatusCallback callback) {
|
||||
this.mADASStatusCallback = callback;
|
||||
}
|
||||
|
||||
public void setControllerStatusCallback(String tag, IBusPassengerControllerStatusCallback callback) {
|
||||
if (tag == null || "".equals(tag)) return;
|
||||
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag);
|
||||
return;
|
||||
}
|
||||
|
||||
mControllerStatusCallbackMap.put(tag,callback);
|
||||
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.registerLifecycleListener(10010, mSocketLifeCycleLisnter);
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getIntentManagerApi()
|
||||
.registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.registerStatusChangedListener( TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
|
||||
// 达到起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG, mCarLocationChangedListener2);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getStatusManagerApi()
|
||||
.unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "onIntentReceived = %s", intentStr );
|
||||
if ( ConnectivityManager.CONNECTIVITY_ACTION.equals( intentStr ) ) {
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// TODO: 2022/3/31
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IMogoStatusChangedListener mMogoStatusChangedListener = new IMogoStatusChangedListener() {
|
||||
// VR mode变更回调
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (StatusDescriptor.VR_MODE == descriptor) {
|
||||
if (mControllerStatusCallbackMap.size() > 0) {
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
callback.onVRModeChanged(isTrue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IMogoLifecycleListener mSocketLifeCycleLisnter = new IMogoLifecycleListener() {
|
||||
@Override
|
||||
public void onConnectFailure() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectFailure"); }
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectSuccess"); }
|
||||
|
||||
@Override
|
||||
public void onConnectLost() { CallerLogger.INSTANCE.e(M_BUS_P + TAG,"socket onConnectLost"); }
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
// TODO: 2022/3/31
|
||||
mLongitude = location.getLongitude();
|
||||
mLatitude = location.getLatitude();
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
callback.onCarLocationChanged(location);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
private boolean arriveAtEnd = false; //乘客app专用字段
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autopilotStatusInfo) {
|
||||
if (autopilotStatusInfo == null) return;
|
||||
int state = autopilotStatusInfo.getState();
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "state = %s", state );
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotRunning();
|
||||
// TODO: 2022/3/31
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
// TODO: 2022/3/31
|
||||
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotEnable();
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
// TODO: 2022/3/31
|
||||
|
||||
if (mADASStatusCallback != null) mADASStatusCallback.onAutopilotDisable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
arriveAtEnd = true;
|
||||
}
|
||||
|
||||
// TODO: 2022/3/31
|
||||
if (DebugConfig.isDebug()) {
|
||||
// TipToast.shortTip("到达目的地");
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private final IMoGoAutopilotPlanningListener moGoAutopilotPlanningListener = new IMoGoAutopilotPlanningListener(){
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
|
||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||
// TODO: 2022/3/31
|
||||
mAutopilotPlanningCallback.routeResult(routeList.getWayPointsList());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(ArrayList<ADASTrajectoryInfo> trajectoryInfos) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
interface BusPassengerServiceApi {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public interface BusPassengerServiceCallback<T> {
|
||||
|
||||
void onSuccess(T data);
|
||||
|
||||
void onFail(int code, String msg);
|
||||
|
||||
default void onError() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.mogo.och.bus.passenger.network;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BusPassengerServiceManager {
|
||||
private static final String TAG = BusPassengerServiceManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerServiceManager INSTANCE = new BusPassengerServiceManager();
|
||||
}
|
||||
|
||||
public static BusPassengerServiceManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private BusPassengerServiceApi mBusPassengerServiceApi;
|
||||
|
||||
private BusPassengerServiceManager() {
|
||||
if (mBusPassengerServiceApi == null){
|
||||
mBusPassengerServiceApi = MoGoRetrofitFactory.getInstance(
|
||||
BusPassengerConst.getBaseUrl()).create(BusPassengerServiceApi.class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
private String getDriverAppSn(){
|
||||
return CallerTelematicManager.INSTANCE.getServerToken();
|
||||
// return "X2020210525EFA93B5946FA38D4";
|
||||
}
|
||||
|
||||
private <T extends BaseData> SubscribeImpl getSubscribeImpl(
|
||||
Context context, BusPassengerServiceCallback<T> callback, String apiName) {
|
||||
return new SubscribeImpl<T>(RequestOptions.create(context)) {
|
||||
@Override
|
||||
public void onSuccess(T o) {
|
||||
super.onSuccess(o);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,apiName +
|
||||
": onSuccess() " + o.msg);
|
||||
if (callback != null) {
|
||||
callback.onSuccess(o);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,apiName +
|
||||
": onError() " + e.getMessage());
|
||||
if (callback != null) {
|
||||
callback.onError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
CallerLogger.INSTANCE.e(M_BUS_P + TAG,String.format(apiName +
|
||||
": onError() code = %d; message = %s;", code, message));
|
||||
if (callback != null) {
|
||||
callback.onFail(code, message);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.mogo.och.bus.passenger.presenter;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback;
|
||||
import com.mogo.och.bus.passenger.model.BusPassengerModel;
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerBaseFragment;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS_P;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BaseBusPassengerPresenter extends Presenter<BusPassengerBaseFragment> implements
|
||||
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback {
|
||||
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
|
||||
|
||||
public BaseBusPassengerPresenter(BusPassengerBaseFragment view) {
|
||||
super(view);
|
||||
BusPassengerModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "Bus乘客端Presenter onCreate()" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
releaseListeners();
|
||||
BusPassengerModel.getInstance().release();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
BusPassengerModel.getInstance().setADASStatusCallback(this);
|
||||
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
BusPassengerModel.getInstance().setADASStatusCallback(null);
|
||||
BusPassengerModel.getInstance().setControllerStatusCallback(TAG, null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.och.bus.passenger.ui;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.och.bus.passenger.R;
|
||||
import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端基础Fragment
|
||||
*/
|
||||
public class BusPassengerBaseFragment extends MvpFragment<BusPassengerBaseFragment, BaseBusPassengerPresenter> {
|
||||
private static final String TAG = BusPassengerBaseFragment.class.getSimpleName();
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
@Override
|
||||
protected BaseBusPassengerPresenter createPresenter() {
|
||||
return new BaseBusPassengerPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.bus_p_base_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user