Merge branch 'dev_robobus-d_230322_3.0.0' into dev_robobus_gradle_och_230317

# Conflicts:
#	app/build.gradle
#	app/productFlavors/fOchShuttlePassengerM2.gradle
#	app/productFlavors/flavorsFilterConfig.gradle
#	app/script/functions/och.gradle
#	app/script/vehicleFlavors/fOchShuttleM2.gradle
This commit is contained in:
yangyakun
2023-04-11 20:39:01 +08:00
316 changed files with 4064 additions and 23009 deletions

View File

@@ -1,7 +1,13 @@
# 网约车(Online Car Hailing)
1. mogo-och-busBus司机端Bus
2. mogo-och-bus-passengerBus乘客端BusPassenger
3. mogo-och-taxiTaxi司机端Taxi
4. mogo-och-taxi-passengerTaxi乘客端TaxiPassenger
5. mogo-och-noop空实现用于独立鹰眼打包
6. mogo-och-sweeper: 清扫车Sweeper
1. mogo-och-bus 公交车模式司机端
2. mogo-och-bus-passenger 公交车模式乘客端
3. mogo-och-charter 包车模式司机端
4. mogo-och-charter-passenger 包车模式乘客端
5. mogo-och-common-module 公用代码
6. mogo-och-data 数据
7. mogo-och-noop 空实现,用于独立鹰眼打包
8. mogo-och-shuttle 接驳模式司机端
9. mogo-och-shuttle-passenger 接驳模式乘客屏
10. mogo-och-sweeper: 清扫车
11. mogo-och-taxi 出租车模式司机端
12. mogo-och-taxi-passenger 出租车乘客端

View File

@@ -1,24 +0,0 @@
package com.mogo.och.bus.passenger.constant
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.common.module.biz.constant.OchCommonConst
/**
* Created on 2021/12/6
*/
class URLConst {
companion object {
@JvmStatic
fun getBaseUrl(): String {
return if(AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)){
OchCommonConst.getShuttleUrl()
}else{
OchCommonConst.getBaseUrl()
}
}
}
}

View File

@@ -27,14 +27,19 @@ 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.api.autopilot.IMoGoPlanningRottingListener;
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R;
@@ -50,9 +55,16 @@ import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.network.BusPassengerModelLoopManager;
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg;
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg;
import com.mogo.och.common.module.bean.dpmsg.DPMsgType;
import com.mogo.och.common.module.bean.dpmsg.LoginCacheStatus;
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager;
import com.mogo.och.common.module.biz.constant.OchCommonConst;
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.common.module.utils.DateTimeUtil;
import org.jetbrains.annotations.NotNull;
@@ -283,6 +295,9 @@ public class BusPassengerModel {
//2021.11.1 自动驾驶路线规划接口
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
//监听司机端消息
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
}
@@ -297,10 +312,31 @@ public class BusPassengerModel {
CallerAutoPilotStatusListenerManager.INSTANCE.removeListener(mGoAutopilotStatusListener);
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
}
private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() {
@Override
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
if (OchCommonConst.BUSINESS_STRING == type){
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedMsg = "+GsonUtils.toJson(baseMsg));
if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_COMMON.getType()){
AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class);
if (msg.isViewShow()){ //消息盒子显示内容
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),msg.getMsg(),
OCHSocketMessageManager.OPERATION_SYSTEM);
}
}
}
}
};
//监听网络变化,避免启动机器时无网导致无法更新订单信息
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
@Override
@@ -511,11 +547,7 @@ public class BusPassengerModel {
}
public int getAverageSpeed(){
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)){
return BusPassengerConst.SHUTTLE_AVERAGE_SPEED;
}else {
return BusPassengerConst.BUS_AVERAGE_SPEED;
}
return BusPassengerConst.BUS_AVERAGE_SPEED;
}
public void startRemainRouteInfo() {

View File

@@ -4,13 +4,10 @@ import android.content.Context
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.bus.passenger.constant.URLConst.Companion.getBaseUrl
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
import com.mogo.och.common.module.biz.network.interceptor.transformTry
@@ -22,17 +19,15 @@ object BusPassengerServiceManager {
private var driverSnCache = ""
private var mShuttleBusPassengerServiceApi =
MoGoRetrofitFactory.getInstance(getBaseUrl()).create(ShettlePassengerServiceApi::class.java)
private var mBusPassengerServiceApi =
MoGoRetrofitFactory.getInstance(getBaseUrl()).create(PassengerServiceApi::class.java)
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerServiceApi::class.java)
/**
* 获取Bus司机端的sn
* @return
*/
val driverAppSn: String
get(){
get() {
val serverToken = getServerToken()
if (serverToken != driverSnCache && serverToken.isNotEmpty()) {
driverSnCache = serverToken
@@ -49,25 +44,14 @@ object BusPassengerServiceManager {
fun queryDriverSiteByCoordinate(
context: Context, callback: OchCommonServiceCallback<BusPassengerRoutesResponse>?
) {
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
mShuttleBusPassengerServiceApi.queryDriverSiteByCoordinate(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
BusPassengerQueryLineRequest(
driverAppSn
)
).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
} else {
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
BusPassengerQueryLineRequest(
driverAppSn
)
).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
}
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
BusPassengerQueryLineRequest(
driverAppSn
)
).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
}
/**
@@ -80,22 +64,12 @@ object BusPassengerServiceManager {
context: Context,
callback: OchCommonServiceCallback<BusPassengerOperationStatusResponse>?
) {
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
mShuttleBusPassengerServiceApi.queryDriverOperationStatus(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
driverAppSn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
} else {
mBusPassengerServiceApi.queryDriverOperationStatus(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
driverAppSn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
}
mBusPassengerServiceApi.queryDriverOperationStatus(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
driverAppSn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
}
}

View File

@@ -1,40 +0,0 @@
package com.mogo.och.bus.passenger.network;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
/**
* Created on 2022/3/31
*
* Bus乘客端接口定义
*/
interface ShettlePassengerServiceApi {
/**
* 查询bus司机端绑定路线
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" )
Observable<BusPassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
/**
* 查询司机端的登陆状态
* @param sn
* @return
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
@GET("/och-shuttle-cabin/api/business/v1/passenger/loginStatus")
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
}

View File

@@ -161,4 +161,13 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.BusPassengerMsgBoxBubbleView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_100"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -9,5 +9,5 @@
<string name="bus_p_cur_next_station_title">下一站:</string>
<string name="bus_p_cur_station_title_init">始发站:</string>
<string name="bus_p_cur_station_arrived_tip">请携带好随身物品下车。</string>
<string name="bus_p_cur_station_arrived_tip_init">欢迎乘坐蘑菇车联自动驾驶车。</string>
<string name="bus_p_cur_station_arrived_tip_init">欢迎乘坐\'蘑菇车联\'自动驾驶车。</string>
</resources>

View File

@@ -8,6 +8,7 @@ package com.mogo.och.bus.bean;
public class BusStationBean {
private int siteId;
private String name;
private String nameKr;
private int seq;
private double gcjLon; //高德
private double gcjLat; //高德
@@ -21,6 +22,10 @@ public class BusStationBean {
private int status;
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
public String getNameKr() {
return nameKr;
}
public double getGcjLon() {
return gcjLon;
}

View File

@@ -1,12 +0,0 @@
package com.mogo.och.bus.constant
import com.mogo.commons.debug.DebugConfig
/**
* Created on 2021/12/6
*/
class URLConst {
companion object {
}
}

View File

@@ -581,11 +581,12 @@ public class OrderModel {
* 服务端返回的OchBusRoutesResult逻辑 离开站为当前站, 到达下一站后才会将下一站置为当前站,
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
*/
private void leaveStationSuccess(int leaveIndex, String leaveStation, String nextStation) {
private void leaveStationSuccess(int leaveIndex, String leaveStation,
String nextStation, String nextStationKr) {
onStartAutopilot(leaveIndex);
leaveTTSTips(nextStation);
leaveTTSTips(nextStation,nextStationKr);
if (busRoutesResult != null) {
boolean isLastStop = false;
@@ -657,6 +658,7 @@ public class OrderModel {
}
int arrivedStationIndex = backgroundCurrentStationIndex + 1;
String arriveStation = stationList.get(arrivedStationIndex).getName();
String arriveStationKr = stationList.get(arrivedStationIndex).getNameKr();
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
CallerLogger.INSTANCE.d(M_BUS + TAG, "arriveSiteStation-currentStationIndex = " + arrivedStationIndex);
@@ -672,7 +674,8 @@ public class OrderModel {
queryBusRoutes();
isArrivedStation = true;
isGoingToNextStation = false;
arriveStationSuccess(arrivedStationIndex, departureStopName, arriveStation);
arriveStationSuccess(arrivedStationIndex, departureStopName,
arriveStation,arriveStationKr);
}
//5s轮询核销乘客
// startOrStopQueryPassengerWriteOff(true);
@@ -701,7 +704,8 @@ public class OrderModel {
});
}
private void arriveStationSuccess(int arrivedStationIndex, String departureStopName, String arriveStation) {
private void arriveStationSuccess(int arrivedStationIndex, String departureStopName,
String arriveStation, String arriveStationKr) {
if (busRoutesResult != null) {
boolean isLastStop = false;
if (arrivedStationIndex == busRoutesResult.getSites().size() - 1) {
@@ -714,7 +718,7 @@ public class OrderModel {
, arriveStation
, isLastStop);
}
VoiceManager.INSTANCE.arrivedStation(arriveStation);
VoiceManager.INSTANCE.arrivedStationBus(arriveStation,arriveStationKr);
}
/**
@@ -723,11 +727,14 @@ public class OrderModel {
public void leaveStation() {
CallerLogger.INSTANCE.d(M_BUS + TAG, "leaveStation-backgroundCurrentStationIndex = " + backgroundCurrentStationIndex);
String nextStationName = "";
String nextStationNameKr = "";
if (backgroundCurrentStationIndex < stationList.size() - 1) {
nextStationName = stationList.get(backgroundCurrentStationIndex + 1).getName();
nextStationNameKr = stationList.get(backgroundCurrentStationIndex + 1).getNameKr();
}
final String currentStationName = stationList.get(backgroundCurrentStationIndex).getName();
String finalNextStationName = nextStationName;
String finalNextStationNameKr = nextStationNameKr;
OrderServiceManager.leaveStation(mContext,
stationList.get(backgroundCurrentStationIndex).getSeq(),
stationList.get(backgroundCurrentStationIndex).getSiteId(),
@@ -740,7 +747,8 @@ public class OrderModel {
//需要更改当前站和下一站的状态 然后渲染
//startOrStopQueryPassengerWriteOff(false);
queryBusRoutes();
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName, finalNextStationName);
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName,
finalNextStationName,finalNextStationNameKr);
}
@@ -765,12 +773,12 @@ public class OrderModel {
}
//车站10s后播报
private void leaveTTSTips(String nextStation) {
private void leaveTTSTips(String nextStation,String nextStationKr) {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
VoiceManager.INSTANCE.leaveStation(nextStation);
VoiceManager.INSTANCE.leaveStationBus(nextStation,nextStationKr);
}
},DELAY_10S);
}
@@ -1041,7 +1049,7 @@ public class OrderModel {
}
private void ttsEndTask() {
VoiceManager.INSTANCE.endOrder();
VoiceManager.INSTANCE.endOrderBus();
}
/**

View File

@@ -14,8 +14,10 @@ data class OrderInfoResponse(val data: OrderInfo?) : BaseData() {
val lineName: String?,//线路名称
var startSiteId: Int?,
var startSiteName: String?,
var startSiteNameKr: String?,
val siteId: Long?,//站点id
val siteName: String?,//站点名称
val siteNameKr: String?,//站点名称
val wgs84Lat: Double?,
val wgs84Lon: Double?,
var gcj02Lat: Double?,

View File

@@ -232,6 +232,7 @@ object CharterPassengerModel {
override fun onAutopilotSNRequest() {}
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
mADASStatusCallback?.onAutopilotArriveEnd()
CallerLogger.d(SceneConstant.M_BUS_P + TAG,"底盘给到站信息")
arriveDest()
}
@@ -403,6 +404,7 @@ object CharterPassengerModel {
)
// 小于15m到站
if (calculateLineDistance < CharterPassengerConst.ARRIVE_AT_START_STATION_DISTANCE) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG,"小于15米到站1")
arriveDest()
}
}
@@ -492,6 +494,7 @@ object CharterPassengerModel {
// 车辆空闲 订单结束已经还车
// 结束车态轮训
endCarStatusLoop()
this.carTypeChageListener?.setCarChangeListener(0)
setOrderStatus(OrderStatusEnum.NoOrderUnuse)
}
}
@@ -548,11 +551,7 @@ object CharterPassengerModel {
AbsMogoApplication.getApp()
.getString(R.string.m1_end_order_5min), 2
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VoiceManager.surplus5min(VoiceFocusManager.getVoiceCmdCallBack())
}else{
VoiceManager.surplus5min()
}
VoiceManager.surplus5min(VoiceFocusManager.getVoiceCmdCallBack())
CallerLogger.d(M_BUS_P+ TAG,"倒计时5分钟${it.orderNo}")
SharedPrefs.getInstance(mContext).putBoolean("${it.orderNo}$min5Speak",true)
}
@@ -711,6 +710,7 @@ object CharterPassengerModel {
+ " thread = " + Thread.currentThread().name
)
if (lastSumLength < CharterPassengerConst.ARRIVE_AT_START_STATION_DISTANCE) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG,"小于15米到站2")
arriveDest()
}
iDistanceTimeCallback?.setDistancecAndTime(lastSumLength.toLong(), lastTime.toLong())
@@ -858,12 +858,11 @@ object CharterPassengerModel {
mContext, lindId = it, object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
if (null != data && 0 == data.code) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VoiceManager.arrivedStation(orderInfo!!.siteName!!,
VoiceFocusManager.getVoiceCmdCallBack())
}else{
VoiceManager.arrivedStation(orderInfo!!.siteName!!,)
}
VoiceManager.arrivedStation(
orderInfo!!.siteName!!,
orderInfo!!.siteNameKr!!,
VoiceFocusManager.getVoiceCmdCallBack()
)
broadcastList["${it}$endKey"] = true
// 到站结束自驾
CallerAutoPilotControlManager.cancelAutoPilot()
@@ -883,13 +882,12 @@ object CharterPassengerModel {
}
}
fun leaveStation(){
orderInfo?.siteName?.let {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VoiceManager.leaveStation(it,VoiceFocusManager.getVoiceCmdCallBack())
}else{
VoiceManager.leaveStation(it)
fun leaveStation() {
orderInfo?.siteName?.let {cn->
orderInfo?.siteNameKr?.let {kr->
VoiceManager.leaveStation(cn,kr, VoiceFocusManager.getVoiceCmdCallBack())
}
}
}

View File

@@ -61,7 +61,7 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) :
}
CallerAutoPilotControlManager.sendRoboBusJinlvM1FrontDoorCmd(1)
disposeSubscribe(subscribeDoorStatus)
subscribeDoorStatus = createSubscribe {
subscribeDoorStatus = createSubscribe(6000) {
if (!OCHM1LightAirconditionDoorStatusManager.doorStatus.isOpen) {
ToastUtils.showShort("车门无法开启,请使用车内物理按钮")
}
@@ -80,7 +80,7 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) :
}
CallerAutoPilotControlManager.sendRoboBusJinlvM1FrontDoorCmd(2)
disposeSubscribe(subscribeDoorStatus)
subscribeDoorStatus = createSubscribe {
subscribeDoorStatus = createSubscribe(6000) {
if (OCHM1LightAirconditionDoorStatusManager.doorStatus.isOpen) {
ToastUtils.showShort("车门无法关闭,请使用车内物理按钮")
}

View File

@@ -10,44 +10,15 @@ import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
import com.mogo.och.common.module.voice.VoiceNotice
class BusPassengerFunctionPresenter(view: M1ContainFragment?) :
BusBasePassengerFunctionDevicePresenter<M1ContainFragment?>(view),
OCHPlanningStopSideStatusManager.OCHPlanningActionsCallback {
BusBasePassengerFunctionDevicePresenter<M1ContainFragment?>(view) {
companion object{
private const val TAG = "BusPassengerFunctionPresenter"
}
override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
OCHPlanningStopSideStatusManager.addListener(TAG,this)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
OCHPlanningStopSideStatusManager.removeListener(TAG)
}
override fun onStartAutopilotFailure(
actionStatus: OCHPlanningStopSideStatusManager.Status,
stopSideStatus: Boolean?,
errorInfo: String?
) {
UiThreadHandler.post {
when (actionStatus) {
OCHPlanningStopSideStatusManager.Status.NOSTART -> {
ToastUtils.showShort(errorInfo)
}
OCHPlanningStopSideStatusManager.Status.START -> {
VoiceNotice.showNotice(context.getString(R.string.m1_stop_site_zh), AIAssist.LEVEL1)
}
OCHPlanningStopSideStatusManager.Status.DOING -> {
// 正在靠边停车
}
OCHPlanningStopSideStatusManager.Status.EndingSuccess -> {
ToastUtils.showShort("靠边停车成功")
}
OCHPlanningStopSideStatusManager.Status.EndingFaile -> {
ToastUtils.showShort("靠边停车失败")
}
}
}
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.amap.api.maps.model.LatLng
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
@@ -20,23 +21,24 @@ import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.model.IOrderStatusChangeListener
import com.mogo.och.bus.passenger.model.OrderStatusEnum
import com.mogo.och.bus.passenger.ui.MainFragment
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg
import com.mogo.och.common.module.bean.dpmsg.ChangeDestMsg
import com.mogo.och.common.module.bean.dpmsg.DPCommonOperationMsg
import com.mogo.och.common.module.bean.dpmsg.DPMsgType
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.NumberFormatUtil
import com.mogo.och.common.module.utils.SoundPoolHelper
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg
import com.mogo.och.common.module.bean.dpmsg.DPCommonOperationMsg
import io.reactivex.disposables.Disposable
import java.util.*
class BusPassengerPresenter(view: MainFragment?) :
BusBasePassengerFunctionDevicePresenter<MainFragment?>(view),
IBusPassengerControllerStatusCallback, IDistanceTimeCallback, IOrderChangeCallback,
IOrderStatusChangeListener {
IOrderStatusChangeListener, OCHPlanningStopSideStatusManager.OCHPlanningActionsCallback {
private var subscribe: Disposable? = null
private var gnssSpeed = 0.0f
@@ -49,7 +51,8 @@ class BusPassengerPresenter(view: MainFragment?) :
CharterPassengerModel.setCarTypeChangeListener(this)
CharterPassengerModel.setStatusChangeListener(TAG,this)
CallerTelematicListenerManager.addListener(TAG, msgReceived)
setCarChangeListener(R.raw.aiqinghao)
OCHPlanningStopSideStatusManager.addListener(TAG,this)
setCarChangeListener(R.raw.m1)
//BusPassengerModel.setMoGoAutopilotPlanningListener(this)
}
@@ -60,6 +63,7 @@ class BusPassengerPresenter(view: MainFragment?) :
CharterPassengerModel.setiDistanceTimeCallback(null)
CharterPassengerModel.setCarTypeChangeListener(null)
CallerTelematicListenerManager.removeListener(TAG)
OCHPlanningStopSideStatusManager.removeListener(TAG)
}
private fun setSpeed(speed:Float){
UiThreadHandler.post {
@@ -210,7 +214,7 @@ class BusPassengerPresenter(view: MainFragment?) :
mView?.setCarModle(R.raw.pengyouhao)
}
else -> {
mView?.setCarModle(R.raw.aiqinghao)
mView?.setCarModle(R.raw.m1)
}
}
}
@@ -260,4 +264,30 @@ class BusPassengerPresenter(view: MainFragment?) :
mView?.drawEndStation(latLng)
}
override fun onStartAutopilotFailure(
actionStatus: OCHPlanningStopSideStatusManager.Status,
stopSideStatus: Boolean?,
errorInfo: String?
) {
UiThreadHandler.post {
when (actionStatus) {
OCHPlanningStopSideStatusManager.Status.NOSTART -> {
ToastUtils.showShort(errorInfo)
}
OCHPlanningStopSideStatusManager.Status.START -> {
VoiceNotice.showNotice(context.getString(R.string.m1_stop_site_zh), AIAssist.LEVEL1)
}
OCHPlanningStopSideStatusManager.Status.DOING -> {
// 正在靠边停车
}
OCHPlanningStopSideStatusManager.Status.EndingSuccess -> {
ToastUtils.showShort("靠边停车成功")
}
OCHPlanningStopSideStatusManager.Status.EndingFaile -> {
ToastUtils.showShort("靠边停车失败")
}
}
}
}
}

View File

@@ -52,7 +52,6 @@ class MainFragment :
}
override fun initViews() {
setCarModle(R.raw.m1)
cb_bp_video_player.onClick {
openSettingPage(M1ContainFragment.VIDEOTAB)
}

View File

@@ -25,17 +25,16 @@ import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.net.BusPassengerModelLoopManager
import com.mogo.och.bus.passenger.net.BusPassengerServiceManager
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionDevicePresenter
import com.mogo.och.bus.passenger.ui.M1ContainFragment
import com.mogo.och.bus.passenger.ui.adapter.OrderLineItemAdapter
import com.mogo.och.bus.passenger.ui.adapter.OrderSiteItemAdapter
import com.mogo.och.bus.passenger.utils.RxUtils
import com.mogo.och.bus.passenger.view.BottomDecoration
import com.mogo.och.common.module.bean.dpmsg.ChangeDestMsg
import com.mogo.och.common.module.bean.dpmsg.DPMsgType
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
import com.mogo.och.common.module.bean.dpmsg.ChangeDestMsg
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.m1.m1_order_lineside.view.*
import me.jessyan.autosize.utils.AutoSizeUtils

View File

@@ -7,7 +7,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.shuyu.gsyvideoplayer.GSYVideoManager
object VoiceFocusManager {
@RequiresApi(Build.VERSION_CODES.O)
fun getVoiceCmdCallBack():IMogoVoiceCmdCallBack{
UiThreadHandler.post {
GSYVideoManager.onPause()

View File

@@ -9,5 +9,6 @@ import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
interface DriverM1OrderCallback {
fun updateOrderUI(orderStatus: QueryCurrentOrderResponse.Result) // 到达站
fun updateOverCountDown(minutes: Long) //倒计时ms
fun clearCountDown() //清除倒计时
fun updateReturnCarStatus(returnSuccess: Boolean)
}

View File

@@ -186,7 +186,7 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}.start()
}
private fun clearCountDownTimer() {
fun clearCountDownTimer() {
if (countDownTimer != null){
countDownTimer?.cancel()
countDownTimer = null

View File

@@ -52,6 +52,7 @@ import com.mogo.och.common.module.manager.CharterSendTripInfoManager.END_TRIP
import com.mogo.och.common.module.manager.CharterSendTripInfoManager.START_TRIP
import com.mogo.och.common.module.manager.OCHAdasAbilityManager
import com.mogo.och.common.module.utils.*
import com.mogo.och.data.bean.*
import io.reactivex.exceptions.UndeliverableException
import io.reactivex.functions.Consumer
import io.reactivex.plugins.RxJavaPlugins
@@ -206,6 +207,8 @@ class DriverM1Model {
OCHSocketMessageManager.msgWriteOffPassengerType
)
stopLoopAbnormalFactors()
CallerTelematicListenerManager.removeListener(TAG)
}
/**
* 接收乘客屏发来确认信息
@@ -255,7 +258,7 @@ class DriverM1Model {
val list = obj.screenList
d(SceneConstant.M_CHARTER_D + TAG, "onMsgReceived = " + GsonUtils.toJson(list))
if (list != null && list.contains(1)){ // 司机端
pushOperationalToMsgBox(obj.pushTimeStamp, obj.context)
pushOperationalToMsgBox(DateTimeUtil.getCurrentTimeStamp(), obj.context)
}
if (list != null && list.contains(2)){ //发送乘客屏
sendMsgToClient(DPCommonOperationMsg(obj.context))
@@ -514,6 +517,7 @@ class DriverM1Model {
DriverM1LooperManager.starCountDownLoop()
}else{
DriverM1LooperManager.stopCountDownLoop()
mOrderCallback?.clearCountDown()
}
}

View File

@@ -105,6 +105,10 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
mView?.updateCountDown(minutes)
}
override fun clearCountDown() {
mView?.clearCountDownTimer()
}
override fun updateReturnCarStatus(returnSuccess: Boolean) {
mView?.updateReturnCarStatus(returnSuccess)
}

View File

@@ -57,6 +57,10 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.litezxing
api project(":OCH:mogo-och-data")
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons

View File

@@ -1,7 +0,0 @@
package com.mogo.och.common.module.bean
/**
* @author: wangmingjun
* @date: 2023/2/14
*/
data class AppConnectMsg(var isViewShow: Boolean,var isPlay: Boolean,var msg: String)

View File

@@ -1,7 +0,0 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
open class BaseDPMsg(var type: Int) // 0: 常规 1确认路线/站点 2开/关车门 3结束订单

View File

@@ -1,15 +0,0 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class ChangeDestMsg(
var lineId: Int, //线路id
var lineName: String = "", //线路名称
var startSiteId: Int= 0, //当前站点
var startSiteName: String = "",
var destSiteId: Int= 0, //目的地
var destSiteName: String = "",
var isConfirmed: Boolean = false //司机端是否同意
): BaseDPMsg(DPMsgType.TYPE_CHANGE_DEST.type)

View File

@@ -1,9 +0,0 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class DPCommonOperationMsg(
var msg: String
): BaseDPMsg(DPMsgType.TYPE_COMMON.type)

View File

@@ -8,5 +8,7 @@ enum class DPMsgType(val type: Int) {
TYPE_COMMON(0), //常规
TYPE_CHANGE_DEST(1),// 变更目的地确认
TYPE_OPEN_CLOSE_DOOR(2),//开关门
TYPE_ORDER_CLOSED(3) // 订单结束
TYPE_ORDER_CLOSED(3), // 订单结束
TYPE_TASK_DETAILS(4), //路线任务详情
TYPE_LOGIN_STATUS(5) //login status
}

View File

@@ -1,9 +0,0 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class DPOperateDoorMsg(
var open: Boolean = false // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_OPEN_CLOSE_DOOR.type)

View File

@@ -1,9 +0,0 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class DPOrderClosedMsg(
var closed: Boolean = true // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_ORDER_CLOSED.type)

View File

@@ -0,0 +1,46 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/3/27
*/
object BusCacheKey{
const val BUS_LINE_CACHE = "bus_line_cache"
const val BUS_LOGIN_STATUS_CACHE = "bus_login_status_cache"
}
open class BaseDPMsg(open var type: Int) // 0: 常规 1确认路线/站点 2开/关车门 3结束订单
data class LoginCacheStatus(
var loginStatus: Int,
var updateTime: Long
): BaseDPMsg(DPMsgType.TYPE_LOGIN_STATUS.type)
data class ChangeDestMsg(
var lineId: Int, //线路id
var lineName: String = "", //线路名称
var startSiteId: Int= 0, //当前站点
var startSiteName: String = "",
var destSiteId: Int= 0, //目的地
var destSiteName: String = "",
var isConfirmed: Boolean = false //司机端是否同意
): BaseDPMsg(DPMsgType.TYPE_CHANGE_DEST.type)
data class DPCommonOperationMsg(
var msg: String
): BaseDPMsg(DPMsgType.TYPE_COMMON.type)
data class DPOperateDoorMsg(
var open: Boolean = false // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_OPEN_CLOSE_DOOR.type)
data class DPOrderClosedMsg(
var closed: Boolean = true // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_ORDER_CLOSED.type)
data class AppConnectMsg(var isViewShow: Boolean, var isPlay: Boolean, var msg: String,
): BaseDPMsg(DPMsgType.TYPE_COMMON.type)
data class TaskDetailsMsg(
var msg: String?,
): BaseDPMsg(DPMsgType.TYPE_TASK_DETAILS.type)

View File

@@ -3,11 +3,18 @@ package com.mogo.och.common.module.biz.model
import android.annotation.SuppressLint
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.SharedPrefs
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.och.common.module.bean.dpmsg.BusCacheKey
import com.mogo.och.common.module.bean.dpmsg.LoginCacheStatus
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
import com.mogo.och.common.module.biz.callback.ILoginCallback
import com.mogo.och.common.module.biz.callback.ILoginViewCallback
import com.mogo.och.common.module.biz.constant.LoginStatusManager
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.data.manager.cache.CacheDataManager
@SuppressLint("StaticFieldLeak")
object OchCommonLoginStatusDefaultModel : OchCommonLoginStatusModel() {
@@ -29,6 +36,16 @@ object OchCommonLoginStatusDefaultModel : OchCommonLoginStatusModel() {
loginViewCallback?.showLoginDialogFragment()
}
loginCallback?.loginSuccess(data)
data?.data?.driverStatus?.let { updateLoginLocalStatus(it) }
}
private fun updateLoginLocalStatus(loginStatus: Int = 0) {
var loginCacheStatus = LoginCacheStatus(loginStatus,DateTimeUtil.getCurrentTimeStamp())
CacheDataManager.instance.putCacheData(mContext, BusCacheKey.BUS_LOGIN_STATUS_CACHE,
GsonUtils.toJson(loginCacheStatus))
}
override fun loginFail(isLogin: Boolean) {
@@ -39,6 +56,8 @@ object OchCommonLoginStatusDefaultModel : OchCommonLoginStatusModel() {
loginViewCallback?.showLoginDialogFragment()
}
loginCallback?.loginFail(isLogin)
updateLoginLocalStatus(0)
}
}

View File

@@ -5,6 +5,7 @@ import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/**
* @author: wangmingjun
@@ -101,4 +102,12 @@ public class DateTimeUtil {
public static long getCurrentTimeStamp(){
return System.currentTimeMillis();
}
public static long getTodayStartTime(){
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT+8"));
calendar.set(Calendar.HOUR_OF_DAY,0);
calendar.set(Calendar.MINUTE,0);
calendar.set(Calendar.SECOND,0);
return calendar.getTimeInMillis();
}
}

View File

@@ -0,0 +1,117 @@
package com.mogo.och.common.module.utils
import android.graphics.Bitmap
import android.graphics.Canvas
import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.common.BitMatrix
import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import java.util.*
/**
* isDeleteWhite 是否删除白边
*/
fun createQRCode(address: String, width: Int, height: Int,isDeleteWhite: Boolean): Bitmap? {
val hints = Hashtable<EncodeHintType, Any>()
hints[EncodeHintType.CHARACTER_SET] = "utf-8"
hints[EncodeHintType.ERROR_CORRECTION] = ErrorCorrectionLevel.H
hints[EncodeHintType.MARGIN] = if (isDeleteWhite) 1 else 0
var bitMatrix = QRCodeWriter().encode(
address,
BarcodeFormat.QR_CODE, width, height, hints
)
if (isDeleteWhite) {
//删除白边
bitMatrix = deleteWhite(bitMatrix)
}
val widthNew = bitMatrix.width
val heightNew = bitMatrix.height
val pixels = IntArray(widthNew * heightNew)
//下面这里按照二维码的算法,逐个生成二维码的图片,
//两个for循环是图片横列扫描的结果
for (y in 0 until heightNew) {
for (x in 0 until widthNew) {
if (bitMatrix.get(x, y)) {
pixels[y * widthNew + x] = -0x1000000
} else {
pixels[y * widthNew + x] = -0x1
}
}
}
//生成二维码图片的格式使用ARGB_8888
var bitmap = Bitmap.createBitmap(widthNew, heightNew, Bitmap.Config.ARGB_8888)
bitmap.setPixels(pixels, 0, widthNew, 0, 0, widthNew, heightNew)
return bitmap
}
/**
* 删除白色边框
*
* @param matrix matrix
* @return BitMatrix
*/
private fun deleteWhite(matrix: BitMatrix): BitMatrix? {
val rec = matrix.enclosingRectangle
val resWidth = rec[2] + 1
val resHeight = rec[3] + 1
val resMatrix = BitMatrix(resWidth, resHeight)
resMatrix.clear()
for (i in 0 until resWidth) {
for (j in 0 until resHeight) {
if (matrix[i + rec[0], j + rec[1]]) resMatrix[i] = j
}
}
return resMatrix
}
fun createQRCodeWithPicture(bmCenter: Bitmap,address: String, width: Int, height: Int,isDeleteWhite: Boolean): Bitmap?{
var qrCode = createQRCode(address,width,height,isDeleteWhite)
//8创建一个bitmap对象用于作为其图标
qrCode?.let {
val resultBitmap = addLogo(it,bmCenter)
if (resultBitmap != null){
return resultBitmap
}
}
return null
}
/**
* 用于向创建的二维码中添加一个logo
* @param bmQr
* @param bmCenter
* @return
*/
fun addLogo(bmQr: Bitmap, bmCenter:Bitmap) :Bitmap?{
if (bmQr == null) {
return null
}
if (bmCenter == null) {
return bmQr
}
//获取图片的宽高
val bmQrWidth = bmQr.width
val bmQrHeight = bmQr.height
val bmCenterWidth = bmCenter.width
val bmCenterHeight = bmCenter.height
var bitmap = Bitmap.createBitmap(bmQrWidth, bmQrHeight, Bitmap.Config.ARGB_8888)
try {
var canvas = Canvas(bitmap)
canvas.drawBitmap(bmQr, 0f, 0f, null)
canvas.drawBitmap(bmCenter, ((bmQrWidth-bmCenterWidth)/2-bmCenterWidth/2).toFloat(),
((bmQrHeight-bmCenterHeight)/2-bmCenterHeight/2).toFloat(), null)
canvas.save()
canvas.restore()
} catch (e: Exception) {
bitmap = null
e.stackTrace
}
return bitmap
}

View File

@@ -10,50 +10,66 @@ import java.util.ArrayList
object VoiceManager {
fun arrivedStation(siteName: String) {
arrivedStation(siteName,null)
fun arrivedStation(siteNameCN: String?) {
arrivedStation(siteNameCN,"")
}
fun arrivedStation(siteName: String,callBack: IMogoTTSCallback?=null) {
fun arrivedStation(siteNameCN: String?,siteNameKR: String?) {
arrivedStation(siteNameCN,siteNameKR,null)
}
fun arrivedStation(siteNameCN: String?, siteNameKR: String?,callBack: IMogoTTSCallback?=null) {
val contenxt = AbsMogoApplication.getApp()
val list: MutableList<LangTtsEntity> = ArrayList()
val chineseTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_zh, siteName),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_en, siteName),
LanguageType.CHINESE
)
val koreanTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_ko, siteName),
LanguageType.KOREAN
)
list.add(chineseTTS)
list.add(engTTS)
list.add(koreanTTS)
siteNameCN?.let {
val chineseTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_zh, it),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_en, it),
LanguageType.CHINESE
)
val koreanTTS = LangTtsEntity(
contenxt.getString(R.string.arrived_station_ko, siteNameKR?:it),
LanguageType.KOREAN
)
list.add(chineseTTS)
list.add(engTTS)
list.add(koreanTTS)
}
VoiceNotice.showNotice(list, AIAssist.LEVEL1,callBack)
}
fun leaveStation(siteName: String){
leaveStation(siteName,null)
fun leaveStation(siteNameCN: String?){
leaveStation(siteNameCN,"")
}
fun leaveStation(siteName: String,callBack: IMogoTTSCallback?=null) {
val contenxt = AbsMogoApplication.getApp()
fun leaveStation(siteNameCN: String?,siteNameKR: String?){
leaveStation(siteNameCN,siteNameKR,null)
}
fun leaveStation(siteNameCN: String?, siteNameKR: String?,callBack: IMogoTTSCallback?=null) {
val list: MutableList<LangTtsEntity> = ArrayList()
val chineseTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_zh, siteName),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_en, siteName),
LanguageType.CHINESE
)
val koreanTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_ko, siteName),
LanguageType.KOREAN
)
list.add(chineseTTS)
list.add(engTTS)
list.add(koreanTTS)
val contenxt = AbsMogoApplication.getApp()
siteNameCN?.let {
val chineseTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_zh, it),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_en, it),
LanguageType.CHINESE
)
list.add(chineseTTS)
list.add(engTTS)
val koreanTTS = LangTtsEntity(
contenxt.getString(R.string.leave_station_ko, siteNameKR ?: it),
LanguageType.KOREAN
)
list.add(koreanTTS)
}
VoiceNotice.showNotice(list, AIAssist.LEVEL1,callBack)
}
@@ -86,4 +102,65 @@ object VoiceManager {
list.add(koreanTTS)
VoiceNotice.showNotice(list, AIAssist.LEVEL0,callBack)
}
fun arrivedStationBus(siteNameCN: String?, siteNameKR: String?) {
val context = AbsMogoApplication.getApp()
val list: MutableList<LangTtsEntity> = ArrayList()
siteNameCN?.let {
val chineseTTS = LangTtsEntity(
context.getString(R.string.bus_arrived_station_tip, it),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
context.getString(R.string.bus_arrived_station_english_tip, it),
LanguageType.CHINESE
)
val koreanTTS = LangTtsEntity(
context.getString(R.string.bus_arrived_station_korean_tip, siteNameKR?:it),
LanguageType.KOREAN
)
list.add(chineseTTS)
list.add(engTTS)
list.add(koreanTTS)
}
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
}
fun leaveStationBus(siteNameCN: String?, siteNameKR: String?) {
val list: MutableList<LangTtsEntity> = ArrayList()
val context = AbsMogoApplication.getApp()
siteNameCN?.let {
val chineseTTS = LangTtsEntity(
context.getString(R.string.bus_leave_station_tip, it),
LanguageType.CHINESE
)
val engTTS = LangTtsEntity(
context.getString(R.string.bus_leave_station_english_tip, it),
LanguageType.CHINESE
)
list.add(chineseTTS)
list.add(engTTS)
val koreanTTS = LangTtsEntity(
context.getString(R.string.bus_leave_station_korean_tip, siteNameKR ?: it),
LanguageType.KOREAN
)
list.add(koreanTTS)
}
VoiceNotice.showNotice(list, AIAssist.LEVEL1,null)
}
fun endOrderBus() {
val context = AbsMogoApplication.getApp()
val list: MutableList<LangTtsEntity> = ArrayList()
val chineseTTS = LangTtsEntity(context.getString(R.string.bus_end_task_tip), LanguageType.CHINESE)
val engTTS = LangTtsEntity(context.getString(R.string.bus_end_task_english_tip), LanguageType.ENGLISH)
val koreanTTS = LangTtsEntity(context.getString(R.string.bus_end_task_korean_tip), LanguageType.KOREAN)
list.add(chineseTTS)
list.add(engTTS)
list.add(koreanTTS)
VoiceNotice.showNotice(list, AIAssist.LEVEL0,null)
}
}

View File

@@ -0,0 +1,76 @@
package com.mogo.och.common.module.wigets
import android.content.Context
import android.graphics.Bitmap
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.och.common.module.R
/**
* 带有title, tip,confirm,cancel的dialog
*/
class BindQRCodeDialog: BaseFloatDialog, LifecycleObserver {
private var qrBm : AppCompatImageView? = null
private var qrCancel: AppCompatTextView? = null
private var qrTitle: AppCompatTextView? = null
private var clickListener: ClickListener? = null
constructor(builder: Builder,context: Context) : super(context) {
qrTitle?.text = builder.titleStr
qrCancel?.text = builder.cancelStr
qrBm?.setImageBitmap(builder.qrBm)
}
init{
setContentView(R.layout.bind_driver_qr_view)
setCanceledOnTouchOutside(true)
qrTitle = findViewById(R.id.qr_title)
qrBm = findViewById(R.id.qr_bm)
qrCancel = findViewById(R.id.bind_qr_cancel)
qrCancel?.setOnClickListener {
clickListener?.cancel()
dismiss()
}
}
fun setClickListener(clickListener: ClickListener) {
this.clickListener = clickListener
}
interface ClickListener{
fun cancel()
}
class Builder{
var titleStr:String = ""
var cancelStr:String = ""
var qrBm: Bitmap? = null
fun title(title: String) : Builder{
this.titleStr = title
return this
}
fun cancelStr(cancel: String) : Builder{
this.cancelStr = cancel
return this
}
fun qrBm(bm: Bitmap) : Builder{
this.qrBm = bm
return this
}
fun build(context: Context): BindQRCodeDialog? {
return BindQRCodeDialog(this,context)
}
}
}

View File

@@ -49,13 +49,6 @@ class OCHCommitDialog: BaseFloatDialog, LifecycleObserver {
this.clickListener = clickListener
}
fun showUpgradeDialog(){
if(isShowing){
return
}
show()
}
interface ClickListener{
fun confirm()
fun cancel()

View File

@@ -0,0 +1,10 @@
package com.mogo.och.common.module.wigets.video
data class AdsDatas(val ads:MutableList<RotationItem>)
data class RotationItem(
var path: String,
var type: Int,
var cacheImgPath: String,
var title: String
)

View File

@@ -2,7 +2,6 @@ package com.mogo.och.common.module.wigets.video
import AdvancePagerAdapter
import AdvanceViewPager
import RotationItem
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet

View File

@@ -1,8 +1,10 @@
package com.mogo.och.common.module.wigets.video
import RotationItem
import com.google.gson.reflect.TypeToken
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.och.common.module.R
import kotlinx.android.synthetic.main.fragment_video_player.*
@@ -47,87 +49,12 @@ class VideoPlayerFragment :
}
private fun initResourceData() {
arrayListOf.clear()
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357256102/1.jpg",
0,
"",
"1"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
0,
"",
"2"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357557335/3.mp4",
1,
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
"3"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
0,
"",
"4"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v",
1,
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
"5"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676358660379/6.m4v",
1,
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
"6"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360154589/7.jpg",
0,
"",
"7"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360185500/8.jpg",
0,
"",
"8"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
0,
"",
"9"
)
)
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4",
1,
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
"10"
)
)
try {
arrayListOf.clear()
var datas: AdsDatas = GsonUtils.fromJson(FunctionBuildConfig.tempConfig,object : TypeToken<AdsDatas>() {}.type)
arrayListOf.addAll(datas.ads)
} catch (e: Exception) {
}
}
}

View File

@@ -24,6 +24,7 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.R
import com.mogo.och.common.module.wigets.video.ImageVideoRotationView
import com.mogo.och.common.module.wigets.video.RotationItem
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import com.shuyu.gsyvideoplayer.utils.Debuger
@@ -456,13 +457,6 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
}
}
data class RotationItem(
var path: String,
var type: Int,
var cacheImgPath: String,
var title: String
)
class AdvanceImageView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : RelativeLayout(context, attrs) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_32"/>
<solid android:color="@color/qr_bg_color"/>
</shape>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_890"
android:layout_height="@dimen/dp_780"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource"
android:background="@drawable/bind_driver_qr_bg">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/qr_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bind_driver_qr_title"
android:gravity="center"
android:textSize="@dimen/dp_56"
android:layout_marginTop="@dimen/dp_48"
android:textColor="@android:color/white"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/qr_bm"
android:layout_width="@dimen/dp_357"
android:layout_height="@dimen/dp_357"
android:padding="8dp"
android:background="@android:color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/qr_title"
app:layout_constraintBottom_toTopOf="@+id/line"/>
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="2px"
android:background="@color/qr_line_bg_color"
app:layout_constraintBottom_toTopOf="@+id/bind_qr_cancel"
app:layout_constraintLeft_toLeftOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/bind_qr_cancel"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_162"
android:gravity="center"
android:text="@string/qr_cancel"
android:textSize="@dimen/dp_52"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:textColor="@android:color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -22,6 +22,8 @@
android:id="@+id/common_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/dp_40"
android:paddingRight="@dimen/dp_40"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/common_title"

View File

@@ -11,4 +11,7 @@
<color name="taxi_4D000000">#4D000000</color>
<color name="och_dialog_bg_color">#3B4577</color>
<color name="qr_line_bg_color">#66B8BFE8</color>
<color name="qr_bg_color">#3B4577</color>
</resources>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="module_och_taxi_login_title">欢迎您登录</string>
<string name="module_och_taxi_login_btn">登录</string>
@@ -17,7 +17,7 @@
<string name="arrived_station_en">We are arriving at %1$s</string>
<string name="arrived_station_ko">%1$s 역에 도착했습니다</string>
<string name="arrived_station_zh">已到达%1$s</string>
<string name="arrived_station_zh">已到达%1$s</string>
<string name="leave_station_zh">车辆起步,请扶稳坐好,前方到站 %1$s</string>
<string name="leave_station_en">The next station is %1$s</string>
@@ -30,4 +30,19 @@
<string name="end_order_zh">感谢您体验\'蘑菇车联\'自动驾驶小巴车,本次旅程已结束,我们下次乘车再见</string>
<string name="end_order_en">Thank you for experiencing the self-driving minibus. See you next time</string>
<string name="end_order_ko">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
<string name="bus_arrived_station_tip">已到达%1$s带好随身物品下车请注意安全。</string>
<string name="bus_arrived_station_english_tip">We are arriving at %1$s get off with your belongings</string>
<string name="bus_arrived_station_korean_tip">%1$s 역에 도착했습니다 , 소지품 챙겨서 내리세요</string>
<string name="bus_leave_station_tip">车辆起步,请扶稳坐好,前方到站是%1$s请下车的乘客做好准备。</string>
<string name="bus_leave_station_english_tip">The next station is %1$s please get ready for your arrival</string>
<string name="bus_leave_station_korean_tip">전방에서 역에 도착하는 %1$s ,차에서 내리는 승객은 준비하세요</string>
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'自动驾驶小巴车,我们下次再见。</string>
<string name="bus_end_task_english_tip">Thank you for experiencing the self-driving minibus. See you next time</string>
<string name="bus_end_task_korean_tip">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
<string name="qr_cancel">取消</string>
<string name="bind_driver_qr_title">扫描二维码完成车辆绑定</string>
</resources>

View File

@@ -0,0 +1,46 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 23
targetSdkVersion 31
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.material
implementation rootProject.ext.dependencies.rxandroid
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
api rootProject.ext.dependencies.mogoutils
}else {
api project(":core:mogo-core-utils")
}
}

View File

@@ -0,0 +1,24 @@
package com.mogo.och.data
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mogo.och.data.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.data">
</manifest>

View File

@@ -1,4 +1,4 @@
package com.mogo.och.bus.bean;
package com.mogo.och.data.bean;
import java.util.List;
@@ -16,6 +16,8 @@ public class BusRoutesResult {
private int status;
private long taskTime; //线路时间班次
private int taskId;// 线路班次id
private String runningDur; //运营时间
private long writeVersion; //更新时间戳
//线路轨迹相关字段
public String csvFileUrl = ""; //轨迹文件下载的cos url默认
@@ -30,6 +32,14 @@ public class BusRoutesResult {
public String txtFileMd5DPQP = ""; //轨迹文件md5默认
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
public String getRunningDur() {
return runningDur;
}
public void setRunningDur(String runningDur) {
this.runningDur = runningDur;
}
public int getLineId() {
return lineId;
}
@@ -54,16 +64,40 @@ public class BusRoutesResult {
return taskTime;
}
public long getWriteVersion() {
return writeVersion;
}
public void setWriteVersion(long writeVersion) {
this.writeVersion = writeVersion;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BusRoutesResult that = (BusRoutesResult) o;
return lineId == that.lineId
&& lineType == that.lineType
&& status == that.status
&& sites.equals(that.sites)
&& name.equals(that.name)
&& writeVersion == that.writeVersion
&& runningDur.equals(that.runningDur);
}
@Override
public String toString() {
return "BusRoutesResult{" +
"sites=" + sites +
", lineId=" + lineId +
", name='" + name + '\'' +
", taskTime='" + taskTime + '\'' +
", lineType=" + lineType +
", description='" + description + '\'' +
", status=" + status +
", taskTime=" + taskTime +
", taskId=" + taskId +
", writeVersion=" + writeVersion +
", csvFileUrl='" + csvFileUrl + '\'' +
", csvFileMd5='" + csvFileMd5 + '\'' +
", txtFileUrl='" + txtFileUrl + '\'' +

View File

@@ -1,4 +1,6 @@
package com.mogo.och.bus.bean;
package com.mogo.och.data.bean;
import java.util.Objects;
/**
* 单个网约车小巴车站信息
@@ -8,6 +10,7 @@ package com.mogo.och.bus.bean;
public class BusStationBean {
private int siteId;
private String name;
private String nameKr;
private int seq;
private double gcjLon; //高德
private double gcjLat; //高德
@@ -16,6 +19,10 @@ public class BusStationBean {
private int drivingStatus;//行驶信息0初始值1已经过2当前站3未到站
private boolean leaving;
public String getNameKr() {
return nameKr;
}
public int getSiteId() {
return siteId;
}
@@ -88,6 +95,28 @@ public class BusStationBean {
this.leaving = leaving;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BusStationBean that = (BusStationBean) o;
return siteId == that.siteId
&& seq == that.seq
&& Double.compare(that.gcjLon, gcjLon) == 0
&& Double.compare(that.gcjLat, gcjLat) == 0
&& Double.compare(that.lon, lon) == 0
&& Double.compare(that.lat, lat) == 0
&& drivingStatus == that.drivingStatus
&& leaving == that.leaving
&& name.equals(that.name)
&& nameKr.equals(that.nameKr);
}
@Override
public int hashCode() {
return Objects.hash(siteId, name, nameKr, seq, gcjLon, gcjLat, lon, lat, drivingStatus, leaving);
}
@Override
public String toString() {
return "BusStationBean{" +
@@ -102,4 +131,6 @@ public class BusStationBean {
", leaving=" + leaving +
'}';
}
}

View File

@@ -0,0 +1,9 @@
package com.mogo.och.data.bean
/**
* @author: wangmingjun
* @date: 2023/3/31
*/
data class BusTransferData (
var loginStatus: Int,
var routesResult: BusRoutesResult?,
)

View File

@@ -0,0 +1,28 @@
package com.mogo.och.data.manager.cache
import android.content.Context
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
/**
* @author: wangmingjun
* @date: 2023/3/27
*/
class CacheDataManager private constructor(){
companion object{
val instance: CacheDataManager by lazy (mode = LazyThreadSafetyMode.SYNCHRONIZED) {
CacheDataManager()
}
}
fun putCacheData(context: Context, key:String, jsonStr: String){
SharedPrefsMgr.getInstance(context).putString(key,jsonStr)
}
fun getCacheData(context: Context, key: String) : String{
return SharedPrefsMgr.getInstance(context).getString(key)
}
fun clearCacheData(context: Context, key: String){
SharedPrefsMgr.getInstance(context).remove(key)
}
}

View File

@@ -0,0 +1,17 @@
package com.mogo.och.data
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -73,7 +73,7 @@ dependencies {
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(":OCH:mogo-och-common-module")
api project(":OCH:mogo-och-common-module")
compileOnly project(":libraries:mogo-map")
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'

View File

@@ -16,6 +16,7 @@ import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
import com.mogo.och.common.module.wigets.MarqueeTextView;
import com.mogo.och.data.bean.BusStationBean;
import java.util.List;
@@ -30,9 +31,9 @@ import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STAT
public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context mContext;
private List<BusPassengerStation> mStations;
private List<BusStationBean> mStations;
public BusPassengerLineStationsAdapter(Context context, List<BusPassengerStation> stations){
public BusPassengerLineStationsAdapter(Context context, List<BusStationBean> stations){
this.mContext = context;
this.mStations = stations;
}
@@ -47,7 +48,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
BusPassengerStation station = mStations.get(position);
BusStationBean station = mStations.get(position);
StationViewHolder viewHolder = (StationViewHolder)holder;
viewHolder.stationName.setText(station.getName());
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
@@ -75,7 +76,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
viewHolder.groupStationTagPanel.setVisibility(View.GONE);
}
viewHolder.curArrowBg.setVisibility(View.VISIBLE);
BusPassengerStation preStation = mStations.get(position -1);
BusStationBean preStation = mStations.get(position -1);
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));

View File

@@ -1,6 +1,7 @@
package com.mogo.och.bus.passenger.bean;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.och.data.bean.BusRoutesResult;
/**
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
@@ -8,13 +9,13 @@ import com.mogo.eagle.core.data.BaseData;
* @author tongchenfei
*/
public class BusPassengerRoutesResponse extends BaseData {
private BusPassengerRoutesResult data;
private BusRoutesResult data;
public BusPassengerRoutesResult getResult() {
public BusRoutesResult getResult() {
return data;
}
public void setResult(BusPassengerRoutesResult data) {
public void setResult(BusRoutesResult data) {
this.data = data;
}

View File

@@ -17,6 +17,7 @@ public class BusPassengerRoutesResult {
private int status;
private String runningDur; //运营时间
private long taskTime; //线路时间班次
private long writeVersion;//更新时间戳
public List<BusPassengerStation> getSites() {
return sites;
@@ -46,6 +47,10 @@ public class BusPassengerRoutesResult {
return runningDur;
}
public long getWriteVersion() {
return writeVersion;
}
@Override
public String toString() {
return "BusPassengerRoutesResult{" +
@@ -55,6 +60,7 @@ public class BusPassengerRoutesResult {
", lineType=" + lineType +
", description='" + description + '\'' +
", status=" + status +
", writeVersion="+ writeVersion+
", runningDur='" + runningDur + '\'' +
'}';
}

View File

@@ -1,6 +1,6 @@
package com.mogo.och.bus.passenger.callback;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.data.bean.BusStationBean;
import java.util.List;
@@ -10,7 +10,7 @@ import java.util.List;
*/
public interface IBusPassengerRouteLineInfoCallback {
void updateLineInfo(String lineName, String lineDurTime);
void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex, boolean isArrived);
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
void showNoTaskView();
void hideNoTaskView();
}

View File

@@ -20,6 +20,24 @@ import com.mogo.commons.module.intent.IMogoIntentListener;
import com.mogo.commons.module.intent.IntentManager;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager;
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg;
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg;
import com.mogo.och.common.module.bean.dpmsg.DPMsgType;
import com.mogo.och.common.module.bean.dpmsg.LoginCacheStatus;
import com.mogo.och.common.module.bean.dpmsg.TaskDetailsMsg;
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager;
import com.mogo.och.common.module.biz.constant.OchCommonConst;
import com.mogo.och.common.module.utils.DateTimeUtil;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -36,12 +54,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.och.bus.passenger.R;
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult;
import com.mogo.och.bus.passenger.bean.BusPassengerStation;
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
@@ -53,6 +65,9 @@ import com.mogo.och.bus.passenger.network.BusPassengerServiceManager;
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
import com.mogo.och.data.bean.BusRoutesResult;
import com.mogo.och.data.bean.BusStationBean;
import com.mogo.och.data.bean.BusTransferData;
import org.jetbrains.annotations.NotNull;
@@ -91,9 +106,9 @@ public class BusPassengerModel {
private MogoLocation mLocation = null;
private BusPassengerRoutesResult routesResult = null;
private BusRoutesResult routesResult = null;
List<BusPassengerStation> mStations = new ArrayList<>();
List<BusStationBean> mStations = new ArrayList<>();
private int mNextStationIndex = 0;// 要到达站的index
private List<MogoLocation> mTwoStationsRouts = new ArrayList<>();
private int mPreRouteIndex = 0;
@@ -117,11 +132,26 @@ public class BusPassengerModel {
public void init( Context context ) {
mContext = context.getApplicationContext();
initListeners();
// TODO: 2022/3/31
queryDriverOperationStatus();
queryDriverByLocalDriver();
startOrStopOrderLoop(true);
}
private void queryDriverByLocalDriver() {
//本地去请求司机端
TaskDetailsMsg msg = new TaskDetailsMsg("task");
sendMsgToServer(GsonUtils.toJson(msg));
}
private void queryLoginStatusByLocal() {
//本地去请求司机端
LoginCacheStatus msg = new LoginCacheStatus(0,
DPMsgType.TYPE_LOGIN_STATUS.getType());
sendMsgToServer(GsonUtils.toJson(msg));
}
public void setDriverStatusCallback(IBusPassegerDriverStatusCallback callback){
this.mDriverStatusCallback = callback;
}
@@ -134,6 +164,13 @@ public class BusPassengerModel {
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_P_STATION, QUERY_BUS_P_STATION_DELAY );
}
private void sendMsgToServer(String msg){
CallerTelematicManager.INSTANCE.sendMsgToServer(
OchCommonConst.BUSINESS_STRING,
msg.getBytes()
);
}
private void queryDriverOperationStatus() {
BusPassengerServiceManager.queryDriverOperationStatus(mContext
, new OchCommonServiceCallback<BusPassengerOperationStatusResponse>() {
@@ -154,7 +191,6 @@ public class BusPassengerModel {
} else {
ToastUtils.showShort(mContext.getString(R.string.request_error_tip));
}
queryDriverOperationDelay();
}
@Override
@@ -172,23 +208,31 @@ public class BusPassengerModel {
public void onSuccess(BusPassengerRoutesResponse data) {
if ( data == null || data.getResult() == null) {
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
if (routesResult != null) {
routesResult = null;
mNextStationIndex = 0;
startOrStopCalculateRouteInfo(false);
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.showNoTaskView();
}
}
clearLocalRouteResult();
return;
}
if (routesResult != null && data.getResult().equals(routesResult)){
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = not update");
return;
}
routesResult = data.getResult();
updatePassengerRouteInfo(data.getResult());
if (routesResult != null &&
routesResult.getWriteVersion() < data.getResult().getWriteVersion()){
routesResult = data.getResult();
}
if (routesResult == null){
routesResult = data.getResult();
}
updatePassengerRouteInfo(routesResult);
}
@Override
public void onError() {
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError ="
+ ", sn = " +BusPassengerServiceManager.INSTANCE.getDriverAppSn());
queryDriverByLocalDriver();
}
@Override
@@ -207,20 +251,40 @@ public class BusPassengerModel {
startOrStopCalculateRouteInfo(false);
return;
}
queryDriverByLocalDriver();
}
});
}
private void updatePassengerRouteInfo(BusPassengerRoutesResult result) {
private void clearLocalRouteResult() {
if (routesResult != null) {
routesResult = null;
}
mNextStationIndex = 0;
startOrStopCalculateRouteInfo(false);
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.showNoTaskView();
}
}
private void updatePassengerRouteInfo(BusRoutesResult result) {
if (result == null){
clearLocalRouteResult();
return;
}
CallerLogger.INSTANCE.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = update");
routesResult = result;
if (mRouteLineInfoCallback != null){
mRouteLineInfoCallback.updateLineInfo(result.getName(),result.getRunningDur());
mRouteLineInfoCallback.hideNoTaskView();
if (result.getSites() != null){
List<BusPassengerStation> stations = result.getSites();
List<BusStationBean> stations = result.getSites();
mStations.clear();
mStations.addAll(stations);
for (int i = 0; i< stations.size(); i++){
BusPassengerStation station = stations.get(i);
BusStationBean station = stations.get(i);
if (station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving() && i+1 < stations.size()){
mRouteLineInfoCallback.updateStationsInfo(stations,i+1,false);
if(mNextStationIndex != i+1){
@@ -283,6 +347,9 @@ public class BusPassengerModel {
//2021.11.1 自动驾驶路线规划接口
CallerPlanningRottingListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
//监听司机端消息
CallerTelematicListenerManager.INSTANCE.addListener(TAG,mReceivedMsgListener);
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
}
@@ -299,8 +366,48 @@ public class BusPassengerModel {
CallerPlanningRottingListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
AbnormalFactorsLoopManager.INSTANCE.stopLoopAbnormalFactors();
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
CallerTelematicListenerManager.INSTANCE.removeListener(TAG);
}
private final IReceivedMsgListener mReceivedMsgListener = new IReceivedMsgListener() {
@Override
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
if (OchCommonConst.BUSINESS_STRING == type) {
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg));
if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_COMMON.getType()) {
AppConnectMsg msg = GsonUtils.fromJson(new String(byteArray), AppConnectMsg.class);
if (msg != null && msg.isViewShow()) { //消息盒子显示内容
OCHSocketMessageManager.INSTANCE.pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(), msg.getMsg(),
OCHSocketMessageManager.OPERATION_SYSTEM);
}
} else if (baseMsg != null && baseMsg.getType() == DPMsgType.TYPE_TASK_DETAILS.getType()) {
TaskDetailsMsg msg = GsonUtils.fromJson(new String(byteArray), TaskDetailsMsg.class);
Logger.d(SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg));
if (msg == null || msg.getMsg().isEmpty()) {
clearLocalRouteResult();
return;
}
BusTransferData result = GsonUtils.fromJson(msg.getMsg(), BusTransferData.class);
if (msg != null && mDriverStatusCallback != null) {
mDriverStatusCallback.changeOperationStatus(result.getLoginStatus() == 1);
}
if (result != null) { //已司机端传来的为准
routesResult = result.getRoutesResult();
updatePassengerRouteInfo(routesResult);
}
}
}
}
};
//监听网络变化,避免启动机器时无网导致无法更新订单信息
private final IMogoIntentListener mNetWorkIntentListener = new IMogoIntentListener() {
@Override
@@ -437,8 +544,8 @@ public class BusPassengerModel {
if (mStations.size() > 1){ //两个站点及以上要计算两个站点间的轨迹路线
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex - 1 >=0){
mTwoStationsRouts.clear();
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
BusPassengerStation stationCur = mStations.get(mNextStationIndex - 1);
BusStationBean stationNext = mStations.get(mNextStationIndex);
BusStationBean stationCur = mStations.get(mNextStationIndex - 1);
//当前站在轨迹中对应的点
int currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(0
,mRoutePoints
@@ -471,6 +578,7 @@ public class BusPassengerModel {
public void dynamicCalculateRouteInfo() {
//计算当前位置和下一站的剩余点集合
//计算剩余点总里程和时间
CallerLogger.INSTANCE.d(M_BUS_P + TAG, "轨迹排查==mTwoStationsRouts.size() = " + mTwoStationsRouts.size());
if (mTwoStationsRouts.size() == 0){
calculateTwoStationsRoute();
}
@@ -487,7 +595,7 @@ public class BusPassengerModel {
float lastSumLength = 0;
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
if (mNextStationIndex <= mStations.size()-1 && mNextStationIndex >= 0){
BusPassengerStation stationNext = mStations.get(mNextStationIndex);
BusStationBean stationNext = mStations.get(mNextStationIndex);
lastSumLength = CoordinateUtils.calculateLineDistance(
stationNext.getGcjLon(), stationNext.getGcjLat(),
mLocation.getLongitude(), mLocation.getLatitude());

View File

@@ -4,13 +4,10 @@ import android.content.Context
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.bus.passenger.constant.URLConst.Companion.getBaseUrl
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl

View File

@@ -22,6 +22,7 @@ import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
import com.mogo.och.bus.passenger.model.BusPassengerModel;
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
import com.mogo.och.data.bean.BusStationBean;
import java.util.List;
@@ -131,7 +132,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
}
@Override
public void updateStationsInfo(List<BusPassengerStation> stations,int currentStationIndex,boolean isArrived) {
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
runOnUIThread(() -> mView.updateStationsInfo(stations,currentStationIndex, isArrived));
}

View File

@@ -28,6 +28,7 @@ import com.mogo.och.bus.passenger.presenter.BaseBusPassengerPresenter;
import com.mogo.och.bus.passenger.ui.layoutmanager.CenterLayoutManager;
import com.mogo.och.bus.passenger.utils.BPRouteDataTestUtils;
import com.mogo.och.common.module.wigets.MarqueeTextView;
import com.mogo.och.data.bean.BusStationBean;
import java.util.ArrayList;
import java.util.List;
@@ -42,7 +43,7 @@ public class BusPassengerRouteFragment extends
private final String TAG = "BusPassengerRouteFragment";
private final List<BusPassengerStation> mStationsList = new ArrayList<>();
private final List<BusStationBean> mStationsList = new ArrayList<>();
private TextView mSpeedTv;
private ConstraintLayout mNoLineInfoView;
@@ -236,7 +237,7 @@ public class BusPassengerRouteFragment extends
* @param currentStationIndex
* @param isArrived 是否到站并离开true 到达当前站 currentStationIndex 未离开, false 正在前往此站 currentStationIndex
*/
public void updateStationsInfo(List<BusPassengerStation> stations, int currentStationIndex,boolean isArrived) {
public void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived) {
updateArrivedStation(stations.get(currentStationIndex).getName(),currentStationIndex,isArrived);
mStationsList.clear();
mStationsList.addAll(stations);
@@ -257,7 +258,7 @@ public class BusPassengerRouteFragment extends
}
}
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
private void updateWayPointList(List<BusStationBean> stations,int currentStationIndex) {
List<LatLng> mLineStationsList = new ArrayList<>();
for (int i = 0; i< stations.size(); i++) {//站点集合
// LatLng latLng = CoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()

View File

@@ -161,4 +161,13 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel" />
<com.mogo.eagle.core.function.hmi.ui.msgbox.BusPassengerMsgBoxBubbleView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toLeftOf="@+id/bus_p_route_panel"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_100"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,7 @@
package com.mogo.och.bus.passenger.bean;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.och.data.bean.BusRoutesResult;
/**
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
@@ -8,13 +9,13 @@ import com.mogo.eagle.core.data.BaseData;
* @author tongchenfei
*/
public class PM2RoutesResponse extends BaseData {
private PM2RoutesResult data;
private BusRoutesResult data;
public PM2RoutesResult getResult() {
public BusRoutesResult getResult() {
return data;
}
public void setResult(PM2RoutesResult data) {
public void setResult(BusRoutesResult data) {
this.data = data;
}

View File

@@ -1,6 +1,6 @@
package com.mogo.och.bus.passenger.callback
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.data.bean.BusStationBean
/**
* @author: wangmingjun
@@ -13,6 +13,6 @@ interface DrivingInfoCallback {
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
fun changeOperationStatus(loginStatus : Boolean)
fun showNoTaskView(isTrue : Boolean)
fun updateLineStations(stations: MutableList<PM2Station>)
fun updateStationsInfo(stations: MutableList<PM2Station>, i: Int, isArrived: Boolean)
fun updateLineStations(stations: MutableList<BusStationBean>)
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean)
}

View File

@@ -1,9 +1,8 @@
package com.mogo.och.bus.passenger.model
import android.content.Context
import com.amap.api.maps.model.LatLng
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.bus.passenger.callback.ADASCallback
import com.mogo.och.data.bean.BusStationBean
/**
* @author: wangmingjun
@@ -29,7 +28,7 @@ class PM2ADASModel private constructor() {
this.mAdasCallback = adasCallback
}
fun updateHDMapStations(stations: MutableList<PM2Station>){
fun updateHDMapStations(stations: MutableList<BusStationBean>){
var stationsList = mutableListOf<MutableList<Double>>()
for (i in stations.indices){
var listLatLng = mutableListOf<Double>() // 0: long 1:lat

View File

@@ -23,6 +23,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToServer
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -33,18 +35,20 @@ import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.PM2OperationStatusResponse
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
import com.mogo.och.bus.passenger.bean.PM2RoutesResult
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.bus.passenger.callback.AutoPilotStatusCallback
import com.mogo.och.bus.passenger.callback.DrivingInfoCallback
import com.mogo.och.bus.passenger.constant.BusPassengerConst
import com.mogo.och.bus.passenger.model.PM2ServiceManager.driverAppSn
import com.mogo.och.bus.passenger.network.PM2ModelLoopManager
import com.mogo.och.common.module.bean.AppConnectMsg
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.bean.dpmsg.*
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.data.bean.BusRoutesResult
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.BusTransferData
import mogo.telematics.pad.MessagePad
import kotlin.math.abs
@@ -58,11 +62,11 @@ class PM2DrivingModel private constructor() {
private var mLocation: MogoLocation? = null
private var mRoutePoints = mutableListOf<MogoLocation>()
private var routesResult: PM2RoutesResult? = null
private var routesResult: BusRoutesResult? = null
private var mCurrentAutoStatus = -1
var mStations = mutableListOf<PM2Station>()
var mStations = mutableListOf<BusStationBean>()
private var mNextStationIndex = 0 // A-B要到达站的index
private var isGoingToNextStation = false //是否前往下一站过程中
@@ -94,11 +98,17 @@ class PM2DrivingModel private constructor() {
fun init(context : Context){
mContext = context
initListener()
// TODO: 2022/3/31
queryDriverByLocalDriver()
queryDriverOperationStatus()
startOrStopOrderLoop(true)
}
private fun queryDriverByLocalDriver() {
//本地去请求司机端
val msg = TaskDetailsMsg("task")
sendMsgToServer(GsonUtils.toJson(msg))
}
private fun initListener() {
//自动驾驶状态监听
CallerAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
@@ -118,6 +128,13 @@ class PM2DrivingModel private constructor() {
}
private fun sendMsgToServer(msg: String) {
sendMsgToServer(
OchCommonConst.BUSINESS_STRING,
GsonUtils.toJson(msg).toByteArray()
)
}
fun releaseListener(){
//自动驾驶状态监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
@@ -152,14 +169,43 @@ class PM2DrivingModel private constructor() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
if (OchCommonConst.BUSINESS_STRING == type){
val msg = GsonUtils.fromJson(String(byteArray),AppConnectMsg::class.java) as AppConnectMsg
Logger.d(SceneConstant.M_BUS_P+TAG,"onReceivedMsg = "+GsonUtils.toJson(msg))
if (msg.isPlay){ //播报
speakTTS(msg.msg)
}
if (msg.isViewShow){ //消息盒子显示内容
OCHSocketMessageManager.pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),msg.msg)
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
Logger.d(
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg)
)
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java)
if (msg != null && msg.isPlay){ //播报
speakTTS(msg.msg)
}
if (msg != null && msg.isViewShow) { //消息盒子显示内容
pushAppOperationalMsgBox(
DateTimeUtil.getCurrentTimeStamp(),msg.msg)
}
}else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
val msg = GsonUtils.fromJson(String(byteArray), TaskDetailsMsg::class.java)
Logger.d(
SceneConstant.M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg)
)
if (msg == null || msg.msg?.isEmpty() == true) {
updateLocalOrder()
return
}
val result = GsonUtils.fromJson(msg.msg, BusTransferData::class.java)
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
if (result != null && result.routesResult == null){
updateLocalOrder()
}
if (routesResult == null ||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)) {
routesResult = result.routesResult
updatePassengerRouteInfo(routesResult!!)
}
}
}
}
@@ -288,7 +334,8 @@ class PM2DrivingModel private constructor() {
} else {
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
}
queryDriverOperationDelay()
// queryDriverOperationDelay()
queryDriverByLocalDriver()
}
override fun onFail(code: Int, msg: String) {
@@ -319,10 +366,27 @@ class PM2DrivingModel private constructor() {
return
}
routesResult = data.result
if (routesResult != null &&
routesResult!!.writeVersion < data.result.writeVersion
) {
routesResult = data.result
}
if (routesResult == null) {
routesResult = data.result
}
updatePassengerRouteInfo(data.result)
}
override fun onError() {
CallerLogger.d(
SceneConstant.Companion.M_BUS_P + TAG,
"queryDriverSiteByCoordinate = onError ="
+ ", sn = " + driverAppSn
)
queryDriverByLocalDriver()
}
override fun onFail(code: Int, msg: String?) {
d(SceneConstant.M_BUS_P+TAG, "queryDriverSiteByCoordinate = %s", msg)
if (code == 1003){
@@ -351,19 +415,27 @@ class PM2DrivingModel private constructor() {
mDrivingInfoCallback?.showNoTaskView(true)
}
private fun updatePassengerRouteInfo(result: PM2RoutesResult) {
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
if (result == null) {
updateLocalOrder()
return
}
d(SceneConstant.M_BUS_P+TAG, "queryDriverSiteByCoordinate= update")
routesResult = result
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
if (result.sites != null) {
mDrivingInfoCallback?.showNoTaskView(false)
val stations: List<PM2Station> = result.sites
val stations: List<BusStationBean> = result.sites
mStations.clear()
mStations.addAll(stations)
mDrivingInfoCallback?.updateLineStations(mStations)
for (i in stations.indices) {
val station: PM2Station = stations[i]
val station: BusStationBean = stations[i]
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED
&& station.isLeaving && i + 1 < stations.size) {
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<PM2Station>, i + 1, false)
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<BusStationBean>, i + 1, false)
if (mNextStationIndex != i + 1) {
d(SceneConstant.M_BUS_P+TAG,"och-rotting--start ")
mTwoStationsRouts.clear()
@@ -373,10 +445,11 @@ class PM2DrivingModel private constructor() {
mNextStationIndex = i + 1
return
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
d(SceneConstant.M_BUS_P+TAG,"och-rotting--arrived ")
mPreRouteIndex = 0
isGoingToNextStation = false
startOrStopCalculateRouteInfo(false)
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<PM2Station>, i, true)
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<BusStationBean>, i, true)
return
}
}
@@ -412,7 +485,7 @@ class PM2DrivingModel private constructor() {
fun dynamicCalculateRouteInfo(){
//计算当前位置和下一站的剩余点集合
//计算剩余点总里程和时间
d(SceneConstant.M_BUS_P + TAG, "och-rotting==mTwoStationsRouts.size() = " + mTwoStationsRouts.size)
//计算当前位置和下一站的剩余点集合
//计算剩余点总里程和时间
if (mTwoStationsRouts.size == 0) {
@@ -431,7 +504,7 @@ class PM2DrivingModel private constructor() {
var lastSumLength = 0f
lastSumLength = if (lastPoints.size == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex >= 0) {
val stationNext: PM2Station = mStations[mNextStationIndex]
val stationNext: BusStationBean = mStations[mNextStationIndex]
CoordinateUtils.calculateLineDistance(
stationNext.gcjLon, stationNext.gcjLat,
mLocation!!.longitude, mLocation!!.latitude
@@ -462,8 +535,8 @@ class PM2DrivingModel private constructor() {
if (mStations.size > 1) { //两个站点及以上要计算两个站点间的轨迹路线
if (mNextStationIndex <= mStations.size - 1 && mNextStationIndex - 1 >= 0) {
mTwoStationsRouts.clear()
val stationNext: PM2Station = mStations[mNextStationIndex]
val stationCur: PM2Station = mStations[mNextStationIndex - 1]
val stationNext: BusStationBean = mStations[mNextStationIndex]
val stationCur: BusStationBean = mStations[mNextStationIndex - 1]
//当前站在轨迹中对应的点
val currentRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(
0, mRoutePoints, stationCur.gcjLon, stationCur.gcjLat

View File

@@ -1,6 +1,7 @@
package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.amap.api.maps.model.LatLng
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
@@ -11,6 +12,7 @@ import com.mogo.och.bus.passenger.callback.DrivingInfoCallback
import com.mogo.och.bus.passenger.model.PM2ADASModel
import com.mogo.och.bus.passenger.model.PM2DrivingModel
import com.mogo.och.bus.passenger.ui.PM2DrivingInfoFragment
import com.mogo.och.data.bean.BusStationBean
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback, AutoPilotStatusCallback {
@@ -80,14 +82,35 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
}
}
override fun updateLineStations(stations: MutableList<PM2Station>) {
override fun updateLineStations(stations: MutableList<BusStationBean>) {
val stationsList = mutableListOf<LatLng>()
val stationsListPass = mutableListOf<LatLng>()
for (i in stations.indices){
val station = stations[i]
val latLng = LatLng(station.gcjLat,station.gcjLon)
if(station.drivingStatus==1){//行驶信息0初始值1已经过2当前站3未到站
stationsListPass.add(latLng)
}else if(station.drivingStatus==2){
if(station.isLeaving){
stationsListPass.add(latLng)
}else{
stationsList.add(latLng)
}
}else{
stationsList.add(latLng)
}
}
ThreadUtils.runOnUiThread {
mView?.updateLineStations(stations)
mView?.updateLineStations(stationsList,stationsListPass)
}
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
}
override fun updateStationsInfo(stations: MutableList<PM2Station>, i: Int, isArrived: Boolean) {
override fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean) {
ThreadUtils.runOnUiThread {
mView?.updateStationsInfo(stations,i,isArrived)
}

View File

@@ -1,25 +1,23 @@
package com.mogo.och.bus.passenger.ui
import android.graphics.BitmapFactory
import android.graphics.drawable.AnimationDrawable
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.view.View
import androidx.core.content.ContextCompat
import com.amap.api.maps.model.LatLng
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.function.view.SiteMarkerBean
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.PM2Station
import com.mogo.och.bus.passenger.presenter.PM2DrivingPresenter
import com.mogo.och.common.module.utils.DateTimeUtil.*
import com.mogo.och.common.module.utils.NumberFormatUtil
import com.mogo.och.data.bean.BusStationBean
import kotlinx.android.synthetic.m2.p_m2_driving_info_fragment.*
import java.lang.ref.WeakReference
import me.jessyan.autosize.utils.AutoSizeUtils
import kotlin.math.ceil
import kotlin.math.roundToInt
@@ -53,6 +51,12 @@ class PM2DrivingInfoFragment :
line_name_tv.setTextColor(resources.getColor(R.color.m2_line_name_tv_color))
station_name_tv.setTextColor(resources.getColor(R.color.m2_line_name_tv_color))
speed_tv.setVertrial(true)
val intArrayOf = intArrayOf(
requireContext().resources.getColor(R.color.shuttle_color_43cefe),
requireContext().resources.getColor(R.color.shuttle_color_1466fb)
)
speed_tv.setmColorList(intArrayOf)
// current_time_tv.onClick {
@@ -77,13 +81,15 @@ class PM2DrivingInfoFragment :
// )
// BPRouteDataTestUtils.converToRouteData()
// }
updateCurrentTime()
}
override fun initViews(savedInstanceState: Bundle?) {
super.initViews(savedInstanceState)
overMapView?.let {
it.onCreateView(savedInstanceState)
val radius = AutoSizeUtils.dp2px(requireContext(), 16f)
it.outlineProvider = TextureVideoViewOutlineProvider(radius.toFloat())
it.clipToOutline = true
}
}
@@ -125,18 +131,6 @@ class PM2DrivingInfoFragment :
line_during_tv.text = time
}
private fun updateCurrentTime(){
current_time_tv.text = formatCalendarToString(
DateTimeUtils.getCurrentDateTime(),HH_mm)
val date = formatCalendarToString(
DateTimeUtils.getCurrentDateTime(), yy_MM_dd)
val weekDay = DateTimeUtils.getWeekDayFromCalendar1(DateTimeUtils.getCurrentDateTime())
"$date $weekDay".also { current_weekday_tv.text = it }
sendUpdateTimeTask() // 每10s更新一次
}
fun changeOperationStatus(status:Boolean){
if (!status){
updateNoOrderUI()
@@ -149,18 +143,14 @@ class PM2DrivingInfoFragment :
private fun setLineInfoView(isShow: Boolean){
if (isShow){
line_name_tv.visibility = View.VISIBLE
line_during_tv.visibility = View.VISIBLE
no_line_tv.visibility = View.GONE
}else{
updateNoOrderUI()
}
}
private fun updateNoOrderUI() {
line_name_tv.visibility = View.GONE
line_during_tv.visibility = View.GONE
no_line_tv.visibility = View.VISIBLE
line_name_tv.text = resources.getString(R.string.m2_p_not_select_line_content)
updateNoStationView()
overMapView?.let {
it.clearSiteMarkers()
@@ -172,9 +162,10 @@ class PM2DrivingInfoFragment :
private fun updateNoStationView(){
station_name_tv.setTextColor(resources.getColor(R.color.m2_next_tv_color))
station_name_title_tv.text = resources.getString(R.string.m2_p_station_title_tv)
station_name_tv.text = resources.getString(R.string.m2_p_empty_tv)
remain_mt.text = resources.getString(R.string.m2_p_empty_remain_km_minute)
tv_distance.text = resources.getString(R.string.m2_p_empty_remain_km)
tv_left_time.text = resources.getString(R.string.m2_p_empty_remain_minute)
noLineShow()
}
override fun createPresenter(): PM2DrivingPresenter {
@@ -186,35 +177,44 @@ class PM2DrivingInfoFragment :
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.m2_p_white_color)) }
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.auto_button_bg) }
}else{
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.m2_button_auto_tv_color)) }
context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.shuttle_color_7094ad)) }
context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bg_p_m2_auto) }
}
}
fun updateLineStations(stations: MutableList<PM2Station>){
var stationsList = mutableListOf<LatLng>()
for (i in stations.indices){
val station = stations[i]
var latLng = LatLng(station.gcjLat,station.gcjLon)
stationsList.add(latLng)
}
fun updateLineStations(stations: MutableList<LatLng>,stationsPass: MutableList<LatLng>){
overMapView?.let {
it.drawSiteMarkers(stationsList,
BitmapFactory.decodeResource(resources,R.drawable.m2_map_staton_icon),0.5f,0.9f)
val stationsList: MutableList<SiteMarkerBean> = mutableListOf()
val stationIcon = BitmapFactory.decodeResource(resources, R.drawable.m2_map_staton_icon)
val stationPassIcon = BitmapFactory.decodeResource(resources, R.drawable.m2_map_staton_arrived_icon)
for (stationsPass in stationsPass) {
stationsList.add(SiteMarkerBean(stationsPass,stationPassIcon,0.5f,0.5f))
}
for (stationsPass in stations) {
stationsList.add(SiteMarkerBean(stationsPass,stationIcon,0.5f,0.5f))
}
it.drawSiteMarkers(stationsList)
}
}
fun updateStationsInfo(stations: MutableList<PM2Station>, i: Int, isArrived: Boolean){
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean){
if (stations.size == 0) return
if (0<= i && i<stations.size){
station_name_tv.setTextColor(resources.getColor(R.color.m2_next_tv_color))
station_name_tv.text = stations[i].name
}
if (isArrived){//到站
station_name_title_tv.text = resources.getString(R.string.m2_p_station_title_arrived_tv)
remain_mt.text = resources.getString(R.string.m2_p_empty_remain_km_minute)
tv_distance.text = resources.getString(R.string.m2_p_empty_remain_km)
tv_left_time.text = resources.getString(R.string.m2_p_empty_remain_minute)
tv_next_station_title.text = resources.getString(R.string.m2_p_station_title_arrived_tv)
iv_animal_list.visibility = View.VISIBLE
val animationDrawable = iv_animal_list.drawable as AnimationDrawable
animationDrawable.start()
haveLineAndArrivedStation()
}else{ //前往目的地中
station_name_title_tv.text = resources.getString(R.string.m2_p_station_title_tv)
tv_next_station_title.text = resources.getString(R.string.shuttle_p_next_station_title)
iv_animal_list.visibility = View.GONE
haveLineAndArriveingStation()
}
}
@@ -237,13 +237,33 @@ class PM2DrivingInfoFragment :
val time = ceil(timeInSecond / 60f).toInt()
"$remainDis$disUnit | $time 分钟".also { remain_mt.text = it }
"$remainDis$disUnit".also { tv_distance.text = it }
"$time 分钟".also { tv_left_time.text = it }
}
private fun sendUpdateTimeTask() {
UiThreadHandler.postDelayed({
updateCurrentTime()
},LOOP_TIME_TEXT)
fun noLineShow(){
// 没有线路展示
group_not_select_line.visibility = View.VISIBLE
// 下一个站点
group_stationinfo.visibility = View.GONE
// 距离和剩余大概时间
clg_distance_left_time.visibility = View.GONE
// 到达站点
tv_arrived_notice.visibility = View.GONE
}
// 有线路正在到站点
fun haveLineAndArriveingStation(){
group_not_select_line.visibility = View.GONE
group_stationinfo.visibility = View.VISIBLE
clg_distance_left_time.visibility = View.VISIBLE
tv_arrived_notice.visibility = View.GONE
}
// 有线路到达站点
fun haveLineAndArrivedStation(){
group_not_select_line.visibility = View.GONE
group_stationinfo.visibility = View.VISIBLE
clg_distance_left_time.visibility = View.GONE
tv_arrived_notice.visibility = View.VISIBLE
}
companion object {

View File

@@ -1,9 +1,13 @@
package com.mogo.och.bus.passenger.ui.video
import com.google.gson.reflect.TypeToken
import com.mogo.commons.mvp.MvpFragment
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.PM2VideoPresenter
import com.mogo.och.bus.passenger.ui.widget.video.RotationItem
import com.mogo.och.common.module.wigets.video.AdsDatas
import com.mogo.och.common.module.wigets.video.RotationItem
import kotlinx.android.synthetic.m2.p_m2_video_fragment.*
/**
@@ -48,187 +52,13 @@ class PM2VideoFragment :
}
private fun initResourceData() {
arrayListOf.clear()
arrayListOf.add(
RotationItem(
"https://img.zhidaohulian.com/fileServer/online_car_hailing/1678946244305/dalim2.mp4",
1,
"",
"1"
)
)
// if (BuildConfig.FLAVOR.contains("dali")){ //大理 目前还都使用的mogo 的cos https://img.zhidaohulian.com/fileServer/online_car_hailing/1678932482045/1080%2A565%20.mp4
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1678932482045/1080%2A565%20.mp4",
// 1,
// "",
// "1"
// )
// )
// }else if (BuildConfig.FLAVOR.contains("yantai")){ //烟台
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357256102/1.jpg",
// 0,
// "",
// "1"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
// 0,
// "",
// "2"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357557335/3.mp4",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
// "3"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// 0,
// "",
// "4"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// "5"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676358660379/6.m4v",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// "6"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360154589/7.jpg",
// 0,
// "",
// "7"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360185500/8.jpg",
// 0,
// "",
// "8"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
// 0,
// "",
// "9"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
// "10"
// )
// )
// }else{ // mogo
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357256102/1.jpg",
// 0,
// "",
// "1"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
// 0,
// "",
// "2"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357557335/3.mp4",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
// "3"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// 0,
// "",
// "4"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// "5"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676358660379/6.m4v",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
// "6"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360154589/7.jpg",
// 0,
// "",
// "7"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360185500/8.jpg",
// 0,
// "",
// "8"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
// 0,
// "",
// "9"
// )
// )
// arrayListOf.add(
// RotationItem(
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4",
// 1,
// "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
// "10"
// )
// )
// }
//
try {
arrayListOf.clear()
var datas: AdsDatas = GsonUtils.fromJson(FunctionBuildConfig.tempConfig,object : TypeToken<AdsDatas>() {}.type)
arrayListOf.addAll(datas.ads)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -4,9 +4,10 @@ import android.content.Context
import android.media.AudioManager
import android.util.AttributeSet
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.shuyu.gsyvideoplayer.utils.Debuger
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import me.jessyan.autosize.utils.AutoSizeUtils
/**
* @author: wangmingjun
@@ -19,7 +20,7 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
init {
hideWidget()
GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL)
GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_16_9)
GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
}
@@ -124,4 +125,13 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
private fun setNeedMute(isMute: Boolean){
gsyVideoManager?.player?.setNeedMute(isMute)
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
if (!mIfCurrentIsFullscreen) {
val dp2px = AutoSizeUtils.dp2px(context, 16f)
this.outlineProvider = TextureVideoViewOutlineProvider(dp2px.toFloat())
this.clipToOutline = true
}
}
}

View File

@@ -9,7 +9,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.CountDownTimer
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.wigets.video.RotationItem
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
/**

View File

@@ -13,9 +13,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import com.mogo.och.bus.passenger.R
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import me.jessyan.autosize.utils.AutoSizeUtils
import java.io.File
/**
@@ -28,6 +30,11 @@ class AdvanceVideoView @JvmOverloads constructor(
private var videoRelativeLayout: RelativeLayout? = null
private var cacheImage: ImageView? = null
private var connerTopLeft: ImageView? = null
private var connerTopRight: ImageView? = null
private var connerBottomLeft: ImageView? = null
private var connerBottomRight: ImageView? = null
private var videoViewPlayer: AdvanceGSYVideoPlayer? = null
private var gsyVideoOptionBuilder: GSYVideoOptionBuilder? = null
private var mOnCompletionListener: GSYSampleCallBack? = null
@@ -55,14 +62,15 @@ class AdvanceVideoView @JvmOverloads constructor(
private fun initVideoView() {
videoRelativeLayout = RelativeLayout(context)
addView(videoRelativeLayout, LayoutParams(-1, -1))
val outLayout = LayoutParams(-1, -1)
addView(videoRelativeLayout,outLayout)
if (videoViewPlayer === null) {
//视频播放控件
videoViewPlayer = AdvanceGSYVideoPlayer(context)
}
var layoutParams = LayoutParams(-1, -1)
val layoutParams = LayoutParams(-1, -1)
//设置videoview占满父view播放
layoutParams.addRule(ALIGN_PARENT_LEFT)
layoutParams.addRule(ALIGN_PARENT_RIGHT)
@@ -70,6 +78,40 @@ class AdvanceVideoView @JvmOverloads constructor(
layoutParams.addRule(ALIGN_PARENT_BOTTOM)
videoRelativeLayout?.addView(videoViewPlayer, layoutParams)
val imageSize = AutoSizeUtils.dp2px(context, 25f)
if(connerTopLeft==null){
connerTopLeft = ImageView(context)
connerTopLeft?.setImageResource(R.drawable.m2_video_top_left)
}
val layoutParentTopLeft = LayoutParams(imageSize, imageSize)
layoutParentTopLeft.addRule(ALIGN_PARENT_TOP)
layoutParentTopLeft.addRule(ALIGN_PARENT_LEFT)
videoRelativeLayout?.addView(connerTopLeft, layoutParentTopLeft)
if(connerTopRight==null){
connerTopRight = ImageView(context)
connerTopRight?.setImageResource(R.drawable.m2_video_top_right)
}
val layoutParentTopRight = LayoutParams(imageSize, imageSize)
layoutParentTopRight.addRule(ALIGN_PARENT_TOP)
layoutParentTopRight.addRule(ALIGN_PARENT_RIGHT)
videoRelativeLayout?.addView(connerTopRight, layoutParentTopRight)
if(connerBottomLeft==null){
connerBottomLeft = ImageView(context)
connerBottomLeft?.setImageResource(R.drawable.m2_video_bottom_left)
}
val layoutParentBottomLeft = LayoutParams(imageSize, imageSize)
layoutParentBottomLeft.addRule(ALIGN_PARENT_BOTTOM)
layoutParentBottomLeft.addRule(ALIGN_PARENT_LEFT)
videoRelativeLayout?.addView(connerBottomLeft, layoutParentBottomLeft)
if(connerBottomRight==null){
connerBottomRight = ImageView(context)
connerBottomRight?.setImageResource(R.drawable.m2_video_bottom_right)
}
val layoutParentBottomRight = LayoutParams(imageSize, imageSize)
layoutParentBottomRight.addRule(ALIGN_PARENT_RIGHT)
layoutParentBottomRight.addRule(ALIGN_PARENT_BOTTOM)
videoRelativeLayout?.addView(connerBottomRight, layoutParentBottomRight)
}
fun setVideoPath(path: String,cacheImageUrl: String) {

View File

@@ -5,6 +5,8 @@ import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import androidx.viewpager.widget.ViewPager
import com.mogo.och.common.module.wigets.video.RotationItem
/**
* @author: wangmingjun
* @date: 2023/2/6

View File

@@ -1,12 +0,0 @@
package com.mogo.och.bus.passenger.ui.widget.video
/**
* @author: wangmingjun
* @date: 2023/2/6
* type:0 图片
* type:1 视频
*/
data class RotationItem(var path: String,
var type: Int,
var cacheImgPath: String,
var title: String)

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1018 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

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