[6.8.4]
[fea] [reset log]
This commit is contained in:
@@ -7,6 +7,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
||||
@@ -34,7 +35,7 @@ import com.mogo.och.weaknet.util.BusTrajectoryManager
|
||||
@Route(path = OchCommonConst.SHUTTLE_DRIVER_WEAKNET)
|
||||
class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
|
||||
private val TAG = ShuttleDriverProvider::class.java.simpleName
|
||||
private val TAG = M_BUS+ShuttleDriverProvider::class.java.simpleName
|
||||
private var busFragment: ShuttleFragment? = null
|
||||
|
||||
override fun init(context: Context) {
|
||||
@@ -49,6 +50,7 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
}
|
||||
|
||||
override fun getFragment(): Fragment {
|
||||
d(TAG, "getFragment")
|
||||
if (busFragment == null) {
|
||||
busFragment = ShuttleFragment()
|
||||
}
|
||||
@@ -60,6 +62,7 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
}
|
||||
|
||||
override fun resetFragment() {
|
||||
d(TAG, "resetFragment")
|
||||
busFragment = null
|
||||
OchAutopilotAnalytics.ochEventKey = null
|
||||
LineModel.release()
|
||||
@@ -69,6 +72,7 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
}
|
||||
|
||||
override fun createOchBusinessView(context: Context?): View? {
|
||||
d(TAG, "createOchBusinessView")
|
||||
return context?.let {
|
||||
SwitchBizView(it)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
class TaskUsedAction() :
|
||||
IOchOnMessageListener<TaskUsedMsg> {
|
||||
|
||||
private val tag = "OperateAction"
|
||||
private val tag = M_BUS + "OperateAction"
|
||||
|
||||
override fun target(): Class<TaskUsedMsg> {
|
||||
|
||||
@@ -19,7 +19,7 @@ class TaskUsedAction() :
|
||||
}
|
||||
|
||||
override fun onMsgReceived(obj: TaskUsedMsg?) {
|
||||
i(M_BUS + tag, "onMsgReceived = $obj")
|
||||
i(tag, "onMsgReceived = $obj")
|
||||
obj?.apply {
|
||||
if (LoginStatusManager.getLoginInfo()?.businessType==businessType
|
||||
&&RepositoryManager.supportDb()) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.och.weaknet.model
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -27,6 +29,8 @@ object EventModel {
|
||||
|
||||
private var eventUpdateInfo: Disposable? = null
|
||||
|
||||
const val TAG = "${M_BUS}EventModel"
|
||||
|
||||
|
||||
fun load(){
|
||||
if (RepositoryManager.supportDb() || RepositoryManager.supportWriteOffDb()) {
|
||||
@@ -38,6 +42,7 @@ object EventModel {
|
||||
}
|
||||
|
||||
fun release(){
|
||||
isUpdating.set(false)
|
||||
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||
}
|
||||
|
||||
@@ -56,7 +61,8 @@ object EventModel {
|
||||
|
||||
private fun updateEvent(){
|
||||
if(isUpdating.get()){
|
||||
OchChainLogManager.writeChainLogDb("上报event","正在上传 等待下一次轮训 ${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-正在上传 等待下一次轮训 ")
|
||||
OchChainLogManager.writeChainLogDb("上报event","正在上传 等待下一次轮训")
|
||||
return
|
||||
}
|
||||
isUpdating.set(true)
|
||||
@@ -65,7 +71,8 @@ object EventModel {
|
||||
val waitUpdateLineEvent = EventDb.queryWaitUpdateEvent()
|
||||
val waitUpdateWriteOffEvent = WriteOffDb.queryWaitUpdateEvent()
|
||||
if (waitUpdateLineEvent.isNullOrEmpty() && waitUpdateWriteOffEvent.isNullOrEmpty()) {
|
||||
OchChainLogManager.writeChainLogDb("上报event","没有数据需要上报${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-没有数据需要上报 ")
|
||||
OchChainLogManager.writeChainLogDb("上报event","没有数据需要上报")
|
||||
isUpdating.set(false)
|
||||
createDefault.onNext(isUpdating.get())
|
||||
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||
@@ -74,11 +81,13 @@ object EventModel {
|
||||
}
|
||||
return@submit
|
||||
}
|
||||
OchChainLogManager.writeChainLogDb("上报event","开始上报:${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-开始上报 ")
|
||||
OchChainLogManager.writeChainLogDb("上报event","开始上")
|
||||
val transformDb2Net = ShuttleEventRequest.transformDb2Net(waitUpdateLineEvent,waitUpdateWriteOffEvent)
|
||||
RepositoryManager.reportCabinEvent(AbsMogoApplication.getApp()!!,transformDb2Net,object :OchCommonServiceCallback<BaseData?>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
OchChainLogManager.writeChainLogDb("上报event成功","$transformDb2Net ${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-上报event成功 $transformDb2Net ")
|
||||
OchChainLogManager.writeChainLogDb("上报event成功","$transformDb2Net")
|
||||
|
||||
waitUpdateLineEvent?.let {lineEvents->
|
||||
lineEvents.forEach {
|
||||
@@ -119,7 +128,8 @@ object EventModel {
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
isUpdating.set(false)
|
||||
createDefault.onNext(isUpdating.get())
|
||||
OchChainLogManager.writeChainLogDb("上报event失败","$transformDb2Net ${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-上报event失败 $transformDb2Net code:$code msg:$msg ")
|
||||
OchChainLogManager.writeChainLogDb("上报event失败","$transformDb2Net ")
|
||||
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||
eventUpdateInfo = RxUtils.createSubscribe(10*1000) {
|
||||
updateEvent()
|
||||
@@ -129,7 +139,8 @@ object EventModel {
|
||||
override fun onError() {
|
||||
isUpdating.set(false)
|
||||
createDefault.onNext(isUpdating.get())
|
||||
OchChainLogManager.writeChainLogDb("上报event失败","$transformDb2Net ${Thread.currentThread().name}")
|
||||
d(TAG,"上报event-上报event失败 $transformDb2Net ")
|
||||
OchChainLogManager.writeChainLogDb("上报event失败","$transformDb2Net")
|
||||
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||
eventUpdateInfo = RxUtils.createSubscribe(10*1000) {
|
||||
updateEvent()
|
||||
|
||||
@@ -55,7 +55,7 @@ object LineModel {
|
||||
|
||||
private val mBusLinesCallbackMap: MutableMap<String, IBusLinesCallback> = ConcurrentHashMap()
|
||||
|
||||
const val TAG = "BusLineModel"
|
||||
const val TAG = "${M_BUS}BusLineModel"
|
||||
|
||||
private val context = AbsMogoApplication.getApp()
|
||||
|
||||
@@ -93,6 +93,7 @@ object LineModel {
|
||||
fun release() {
|
||||
d(TAG,"release")
|
||||
mContext = null
|
||||
isRequesting.set(false)
|
||||
EventModel.release()
|
||||
mBusLinesCallbackMap.clear()
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
@@ -401,11 +402,11 @@ object LineModel {
|
||||
val (startStation, _) = LineManager.getStations()
|
||||
if (startStation!=null&&startStation.isLeaving) {
|
||||
OrderModel.startBeautificationMode()
|
||||
d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)")
|
||||
d(TAG, "美化模式-ignore:置为true(每次滑动出发)")
|
||||
} else if (startStationIndex > 0 && startStationIndex < stationList!!.size - 1) {
|
||||
//美化模式下 中间站点到站 引导线要一直绘制,所以此处不出强制绘制不传false
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(false)
|
||||
d(M_BUS + TAG, "美化模式-ignore:false(到达中间站)")
|
||||
d(TAG, "美化模式-ignore:false(到达中间站)")
|
||||
} else {
|
||||
OrderModel.closeBeautificationMode()
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object OrderModel {
|
||||
private val TAG: String = OrderModel::class.java.simpleName
|
||||
private val TAG: String = M_BUS+OrderModel::class.java.simpleName
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
@@ -103,7 +103,7 @@ object OrderModel {
|
||||
|
||||
private val ochAutopilotStatusListener = object : IOchAutopilotStatusListener{
|
||||
override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation?) {
|
||||
e(M_BUS + TAG, "行程日志-onAutopilotArriveAtStation arrive")
|
||||
e(TAG, "行程日志-onAutopilotArriveAtStation arrive")
|
||||
onArriveAt(arrivedStation, "底盘触发进站")
|
||||
}
|
||||
|
||||
@@ -162,20 +162,20 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusRoutes() {
|
||||
d(M_BUS + TAG, "查询小巴路线")
|
||||
d(TAG, "查询小巴路线")
|
||||
RepositoryManager.loadCurrentTaskInfo()
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<Boolean> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
d(M_BUS + TAG, "queryBusRoutes onSubscribe")
|
||||
d(TAG, "queryBusRoutes onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
e.printStackTrace()
|
||||
d(M_BUS + TAG, "queryBusRoutes onError${e.printStackTrace()}")
|
||||
d(TAG, "queryBusRoutes onError${e.printStackTrace()}")
|
||||
LineModel.haveNoRunningTask()
|
||||
d(M_BUS + TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||
LineManager.setLineInfo(null)
|
||||
updateBusStatus()
|
||||
closeBeautificationMode()
|
||||
@@ -183,7 +183,7 @@ object OrderModel {
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
d(M_BUS + TAG, "queryBusRoutes onComplete")
|
||||
d(TAG, "queryBusRoutes onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
@@ -192,7 +192,7 @@ object OrderModel {
|
||||
updateBusStatus()
|
||||
}else{
|
||||
LineModel.haveNoRunningTask()
|
||||
d(M_BUS + TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||
LineManager.setLineInfo(null)
|
||||
updateBusStatus()
|
||||
closeBeautificationMode()
|
||||
@@ -209,7 +209,7 @@ object OrderModel {
|
||||
@JvmStatic
|
||||
fun completeTask() {
|
||||
OCHThreadPoolManager.getsInstance().execute {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
d(TAG, "结束当前路线abortTask")
|
||||
removeTipRunnables()
|
||||
LineModel.endTask()
|
||||
|
||||
@@ -242,7 +242,7 @@ object OrderModel {
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false //是否强制绘制引导线
|
||||
CallerAutoPilotControlManager.setIgnoreConditionDraw(false) // 同步给乘客屏
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(false) //是否自动启动自驾
|
||||
d(M_BUS + TAG, "美化模式-ignore:置为false")
|
||||
d(TAG, "美化模式-ignore:置为false")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ object OrderModel {
|
||||
@JvmStatic
|
||||
fun onArriveAt(data: ArrivedStation?, type: String) {
|
||||
if (LineManager.getStations().second==null) {
|
||||
e(M_BUS + TAG, "行程日志-到站异常,取消后续操作结束")
|
||||
e(TAG, "行程日志-到站异常,取消后续操作结束")
|
||||
OchChainLogManager.writeChainLog("shuttle弱网","$type 行程日志-到站异常,取消后续操作结束")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.mogo.och.weaknet.util.ShuttleVoiceManager
|
||||
|
||||
object ThirdDeviceData {
|
||||
|
||||
const val TAG = "ThirdDeviceData"
|
||||
const val TAG = M_BUS+"ThirdDeviceData"
|
||||
|
||||
@JvmStatic
|
||||
val busRoutesResult: BusRoutesResult = BusRoutesResult()
|
||||
@@ -136,7 +136,7 @@ object ThirdDeviceData {
|
||||
if (LineManager.lineInfos == null || LineModel.currentTask == null || LineModel.stationList.isNullOrEmpty()) {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, null)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
d(TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
} else {
|
||||
LineManager.getLineInfo {lineInfo ->
|
||||
@@ -148,7 +148,7 @@ object ThirdDeviceData {
|
||||
busRoutesResult.writeVersion = System.currentTimeMillis()
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
d(TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
@@ -40,7 +41,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object TicketModel {
|
||||
|
||||
private const val TAG = "TicketModel"
|
||||
private const val TAG = M_BUS+"TicketModel"
|
||||
|
||||
private const val SELECTWRITEOFFCOUNT = "SELECTWRITEOFFCOUNT"
|
||||
|
||||
@@ -64,7 +65,7 @@ object TicketModel {
|
||||
|
||||
override fun onMsgReceived(passenger: WriteOffPassenger?) {
|
||||
//进行播报
|
||||
i(SceneConstant.M_BUS + TAG, "后台socket 核验:passenger = " + GsonUtil.jsonFromObject(passenger))
|
||||
i(TAG, "后台socket 核验:passenger = " + GsonUtil.jsonFromObject(passenger))
|
||||
if(passenger==null||passenger.passengerSize==0){
|
||||
return
|
||||
}
|
||||
@@ -133,10 +134,7 @@ object TicketModel {
|
||||
|
||||
override fun onNext(count: Int) {
|
||||
emitterMain?.onNext(Pair<Int, Int>(firstStation.siteId, count))
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"${firstStation.name}核销人数:${count}"
|
||||
)
|
||||
d(TAG, "${firstStation.name}核销人数:${count}")
|
||||
OchChainLogManager.writeChainLog(
|
||||
"核销人数",
|
||||
"任务:${currentTask.taskId} 站点:${firstStation.siteId}_${firstStation.name}"
|
||||
@@ -151,7 +149,7 @@ object TicketModel {
|
||||
|
||||
}
|
||||
emitterMain?.onNext(Pair(0,0))
|
||||
d(SceneConstant.M_BUS + TAG, "线路或者站点未空")
|
||||
d(TAG, "线路或者站点未空")
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +174,7 @@ object TicketModel {
|
||||
override fun onError(e: Throwable) {
|
||||
d(TAG, "receiveWrteOffDefailtInfo onError${e.printStackTrace()}")
|
||||
if (e is DataException) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "核销失败 ${e.code}-----${e.msg}")
|
||||
d(TAG, "核销失败 ${e.code}-----${e.msg}")
|
||||
parseData(e.code,e.msg?:"",writeOffDetialMsg.phone?:"",writeOffDetialMsg.orderNo?:"")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
@@ -29,7 +30,7 @@ import io.reactivex.Observable
|
||||
|
||||
object RepositoryManager {
|
||||
|
||||
private val TAG = "RepositoryManager"
|
||||
private val TAG = "${M_BUS}RepositoryManager"
|
||||
private var lineRepository: ILineRepository?=null
|
||||
get() {
|
||||
if(field==null){
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.och.weaknet.repository.db.repository
|
||||
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
@@ -15,7 +16,7 @@ import io.reactivex.Observable
|
||||
|
||||
object TaskDb : IDbRepository {
|
||||
|
||||
private const val TAG = "TaskDb"
|
||||
private const val TAG = "${M_BUS}TaskDb"
|
||||
|
||||
private var taskDataDao: TaskDataDao? = null
|
||||
get() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.weaknet.repository.db.repository
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.weaknet.repository.db.IDbRepository
|
||||
@@ -11,7 +12,7 @@ import com.mogo.och.weaknet.repository.db.exception.DbException
|
||||
|
||||
object TaskSiteDb: IDbRepository {
|
||||
|
||||
private const val TAG = "TaskSiteDb"
|
||||
private const val TAG = "${M_BUS}TaskSiteDb"
|
||||
|
||||
private var taskSiteDataDao: TaskSiteDataDao? = null
|
||||
get() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
@@ -29,7 +30,7 @@ import io.reactivex.Observable
|
||||
|
||||
class NormalRepository: ILineRepository {
|
||||
|
||||
private val tag = "NormalRepository"
|
||||
private val tag = "${M_BUS}NormalRepository"
|
||||
|
||||
private var normalLineInterface: NetInterface?=null
|
||||
get() {
|
||||
@@ -72,6 +73,7 @@ class NormalRepository: ILineRepository {
|
||||
"业务数据",
|
||||
"本地没有正在运行的数据,服务器端有${busRoutesResult}"
|
||||
)
|
||||
CallerLogger.d(tag,"本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||
val result = mutableListOf<BusStationBean>()
|
||||
var temp: BusStationBean?
|
||||
var currentStationIndex = -1
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.mogo.och.weaknet.repository.net.project.saas.shuttle.SaasShuttleServi
|
||||
import io.reactivex.Observable
|
||||
|
||||
class WeaknetRepository : ILineRepository {
|
||||
private val TAG = "ShuttleSaasRepository"
|
||||
private val TAG = "${M_BUS}ShuttleSaasRepository"
|
||||
private val context = AbsMogoApplication.getApp()
|
||||
|
||||
private var weakNetInterface: NetInterface?=null
|
||||
@@ -75,12 +75,12 @@ class WeaknetRepository : ILineRepository {
|
||||
val runningTaskInfo = TaskDb.queryRunningTask()
|
||||
if (runningTaskInfo.isNullOrEmpty()) {
|
||||
// 本地没有进行中的任务
|
||||
CallerLogger.d(M_BUS + TAG, "loadCurrentTaskInfo 没有查询到正在运行的任务")
|
||||
CallerLogger.d(TAG, "loadCurrentTaskInfo 没有查询到正在运行的任务")
|
||||
return@flatMap loadServerRuningTask()
|
||||
} else if (runningTaskInfo.size > 1) {
|
||||
// 本地有多条正在进行的任务 需要check event
|
||||
// 1 比对event表 1 清理错误数据 2 加载后台数据
|
||||
CallerLogger.d(M_BUS + TAG, "loadCurrentTaskInfo 查询到多个正在执行的任务")
|
||||
CallerLogger.d(TAG, "loadCurrentTaskInfo 查询到多个正在执行的任务")
|
||||
return@flatMap selectRightData(runningTaskInfo)
|
||||
} else {
|
||||
// 只有一条进行中的任务
|
||||
@@ -90,7 +90,7 @@ class WeaknetRepository : ILineRepository {
|
||||
// 获取正在进行中的具体信息
|
||||
val runnintTaskAndSites = TaskSiteDb.queryRunningTask(it)
|
||||
if(runnintTaskAndSites.isNullOrEmpty()||runnintTaskAndSites.size<2){
|
||||
CallerLogger.d(M_BUS + TAG, "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
|
||||
CallerLogger.d(TAG, "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
|
||||
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
|
||||
TaskSiteDb.deleteErrorData(it)
|
||||
return@flatMap loadServerRuningTask()
|
||||
@@ -114,6 +114,7 @@ class WeaknetRepository : ILineRepository {
|
||||
if (lineId == null || lineId!! < 0L||csvFileUrl.isNullOrEmpty()||csvFileMd5.isNullOrEmpty()||txtFileUrl.isNullOrEmpty()||txtFileMd5.isNullOrEmpty()) {
|
||||
ToastUtils.showLong("请设置轨迹信息")
|
||||
OchChainLogManager.writeChainLogAutopilot("轨迹错误",this.toString())
|
||||
CallerLogger.d(TAG,"轨迹错误,$this")
|
||||
}
|
||||
LineManager.setContraiInfo(ContraiInfo(lineId!!,csvFileUrl!!,csvFileMd5!!,txtFileUrl!!,txtFileMd5!!,contrailSaveTime!!))
|
||||
}
|
||||
@@ -142,6 +143,7 @@ class WeaknetRepository : ILineRepository {
|
||||
it.status = TaskDataBean.used
|
||||
}
|
||||
TaskDb.addOrUpdate(*tempList.toTypedArray())
|
||||
CallerLogger.d(TAG,"异常情况:多个正在进行的任务 task:${runningTaskInfo} event:${queryLastData.taskId}有一个和event表对应使用相同的一个 另一个置为已使用")
|
||||
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:多个正在进行的任务 task:${runningTaskInfo} event:${queryLastData.taskId}有一个和event表对应使用相同的一个 另一个置为已使用")
|
||||
return@flatMap loadServerRuningTask()
|
||||
}
|
||||
@@ -150,6 +152,7 @@ class WeaknetRepository : ILineRepository {
|
||||
runningTaskInfo.forEach {
|
||||
it.status = TaskDataBean.used
|
||||
}
|
||||
CallerLogger.d(TAG,"异常情况:多个正在进行的任务 task:${runningTaskInfo} 全部置为已使用 从后台加载正在使用的任务")
|
||||
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:多个正在进行的任务 task:${runningTaskInfo} 全部置为已使用 从后台加载正在使用的任务")
|
||||
TaskDb.addOrUpdate(*runningTaskInfo.toTypedArray())
|
||||
return@flatMap loadCurrentTaskInfo()
|
||||
@@ -166,7 +169,7 @@ class WeaknetRepository : ILineRepository {
|
||||
"业务数据",
|
||||
"本地没有正在运行的数据,服务器端有${busRoutesResult}"
|
||||
)
|
||||
CallerLogger.d(M_BUS + TAG,"本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||
CallerLogger.d(TAG,"本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||
LineDb.saveRunningInfo(
|
||||
busRoutesResult.lineId,
|
||||
busRoutesResult.name,
|
||||
@@ -227,6 +230,7 @@ class WeaknetRepository : ILineRepository {
|
||||
"滑动出发",
|
||||
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||
)
|
||||
CallerLogger.d(TAG,"滑动出发:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||
// 设置滑动出发任务
|
||||
LineManager.getLineInfo { lineInfo ->
|
||||
EventDb.saveEventTaskLeaveSite(
|
||||
@@ -244,6 +248,7 @@ class WeaknetRepository : ILineRepository {
|
||||
val changeInfo =
|
||||
"taskId:${currentTask?.taskId}--lineId:${currentTask?.lineId}--currentStationName:${startStation?.name}--finalNextStationName:${endStation?.name}"
|
||||
OchChainLogManager.writeChainLog("滑动出发", changeInfo)
|
||||
CallerLogger.d(TAG,"滑动出发:$changeInfo")
|
||||
// 开始任务成功
|
||||
return@flatMap Observable.just(true)
|
||||
}
|
||||
@@ -283,6 +288,7 @@ class WeaknetRepository : ILineRepository {
|
||||
"到站_数据更新_error",
|
||||
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||
)
|
||||
CallerLogger.d(TAG,"到站_数据更新_error:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||
}
|
||||
// 结束站点: drivingStatus 3-2
|
||||
if (currentTask != null && currentTask!!.taskId != null) {
|
||||
@@ -298,10 +304,12 @@ class WeaknetRepository : ILineRepository {
|
||||
"到站_数据更新_error",
|
||||
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||
)
|
||||
CallerLogger.d(TAG,"到站_数据更新_error:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||
}
|
||||
val changeInfo =
|
||||
"taskId:${currentTask?.taskId}--lineId:${currentTask?.lineId}--currentStationName:${start.name}--finalNextStationName:${end.name}"
|
||||
OchChainLogManager.writeChainLog("到站", changeInfo)
|
||||
CallerLogger.d(TAG,"到站:$changeInfo")
|
||||
}
|
||||
return@flatMap Observable.just(true)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
@@ -31,8 +32,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class WriteOffCacheRepository : IWriteOffRepository {
|
||||
private val TAG = "ShuttleSaasRepository"
|
||||
private val context = AbsMogoApplication.getApp()
|
||||
private val TAG = "${M_BUS}ShuttleSaasRepository"
|
||||
|
||||
private var weakNetInterface: NetInterface?=null
|
||||
get() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.weaknet.bean.WaitUploadLine
|
||||
@@ -26,7 +27,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
|
||||
class WriteOffNormallRepository: IWriteOffRepository {
|
||||
|
||||
private val TAG = "WriteOffNormallRepository"
|
||||
private val TAG = "${M_BUS}WriteOffNormallRepository"
|
||||
|
||||
private var normalNetInterface: NetInterface?=null
|
||||
get() {
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
package com.mogo.och.weaknet.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_stations_common_item.view.*
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/9/15
|
||||
*/
|
||||
class BusStationCommonItem @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : LinearLayout(context, attrs, defStyleAttr){
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.shuttle_weak_stations_common_item,this,true)
|
||||
}
|
||||
|
||||
fun setStationName(name: String){
|
||||
busStationNameTv.text = name
|
||||
}
|
||||
|
||||
fun setStationNameColor(color: Int){
|
||||
busStationNameTv.setTextColor(color)
|
||||
}
|
||||
|
||||
fun setStationPointBg(type: Int) { // 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
BlinkAnimationUtil.clearAnimation(busCircleIv)
|
||||
when (type) {
|
||||
0 -> {
|
||||
busCircleIvBg.visibility = GONE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_grey_bus
|
||||
)
|
||||
)
|
||||
}
|
||||
1 -> {
|
||||
busCircleIvBg.visibility = VISIBLE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_green_bus
|
||||
)
|
||||
)
|
||||
BlinkAnimationUtil.setAnimation(busCircleIv)
|
||||
}
|
||||
2 -> {
|
||||
busCircleIvBg.visibility = GONE
|
||||
busCircleIv.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_point_blue_bus
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun getCircleImageView() : ImageView{
|
||||
return busCircleIv
|
||||
}
|
||||
|
||||
fun setStationArrowBg(type: Int){// 0:灰色 过站 1:绿色 前往下一站 2:蓝色 未到站
|
||||
when(type){
|
||||
0 -> busArrowBg.setImageResource(R.drawable.icon_arrow_grey_bus)
|
||||
1 -> busArrowBg.setImageResource(R.drawable.icon_arrow_green_bus)
|
||||
2 -> busArrowBg.setImageResource(R.drawable.icon_arrow_blue_bus)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setStationTag(tag: String){ // 0:起 1:终
|
||||
if (tag.isNullOrEmpty()){
|
||||
busTagTxt.visibility = GONE
|
||||
}else{
|
||||
busTagTxt.text = tag
|
||||
busTagTxt.visibility = VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
fun showOrHideStationArrowBg(isShow:Boolean){
|
||||
if (isShow){
|
||||
busArrowBg.visibility = VISIBLE
|
||||
}else{
|
||||
busArrowBg.visibility = GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "SwitchBizView"
|
||||
const val TAG = M_BUS+"SwitchBizView"
|
||||
}
|
||||
|
||||
private var viewModel: SwtichBizeModel?=null
|
||||
@@ -51,7 +51,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
CallerLogger.d(M_BUS+TAG,"SwitchBizView:onAttachedToWindow")
|
||||
CallerLogger.d(TAG,"SwitchBizView:onAttachedToWindow")
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it)[SwtichBizeModel::class.java]
|
||||
@@ -61,7 +61,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerLogger.d(M_BUS+TAG,"SwitchBizView:onDetachedFromWindow")
|
||||
CallerLogger.d(TAG,"SwitchBizView:onDetachedFromWindow")
|
||||
}
|
||||
|
||||
var startLoading = System.currentTimeMillis()
|
||||
@@ -74,13 +74,13 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
*/
|
||||
override fun showLoadingView(){
|
||||
startLoading = System.currentTimeMillis()
|
||||
CallerLogger.d(M_BUS+TAG,"开始展示 lading 时间:${startLoading}")
|
||||
CallerLogger.d(TAG,"开始展示 lading 时间:${startLoading}")
|
||||
loading_biz.visibility = VISIBLE
|
||||
swtichLine.visibility = GONE
|
||||
swtichTask.visibility = GONE
|
||||
queryTimeout = RxUtils.createSubscribe(10_1000) {
|
||||
OchChainLogManager.writeChainLog("Loading超时","loading 展示了10s")
|
||||
CallerLogger.d(M_BUS+TAG,"Loading超时:loading 展示了10s")
|
||||
CallerLogger.d(TAG,"Loading超时:loading 展示了10s")
|
||||
viewModel?.queryRuningTask()
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(M_BUS+TAG,"展示任务 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(TAG,"展示任务 lading 展示了 ${dex}毫秒")
|
||||
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
@@ -118,7 +118,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(M_BUS+TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
swtichLine.visibility = VISIBLE
|
||||
@@ -132,7 +132,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(M_BUS+TAG,"展示运行中任务 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(TAG,"展示运行中任务 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
swtichLine.visibility = GONE
|
||||
|
||||
@@ -16,18 +16,18 @@ import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
*/
|
||||
class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
private val TAG = SwtichBizeModel::class.java.simpleName
|
||||
private val TAG = M_BUS + SwtichBizeModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: SwtichLineViewCallback? = null
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
d(M_BUS + TAG,"onCleared")
|
||||
d(TAG, "onCleared")
|
||||
LineModel.setBusLinesCallback(TAG, null)
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
d(M_BUS + TAG,"setDistanceCallback")
|
||||
d(TAG, "setDistanceCallback")
|
||||
LineModel.setBusLinesCallback(TAG, this)
|
||||
this.viewCallback = viewCallback
|
||||
this.viewCallback?.showLoadingView()
|
||||
@@ -36,14 +36,14 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
}
|
||||
|
||||
fun queryRuningTask(){
|
||||
fun queryRuningTask() {
|
||||
ThreadUtils.getIoPool().execute {
|
||||
OrderModel.queryBusRoutes()
|
||||
}
|
||||
}
|
||||
|
||||
fun loadingSwitchTask(lineInfo: LineDataBean) {
|
||||
d(M_BUS+TAG, "loadingSwitchTask 查询线路的任务线路信息:${lineInfo}")
|
||||
d(TAG, "loadingSwitchTask 查询线路的任务线路信息:${lineInfo}")
|
||||
viewCallback?.showSwitchTaskByLineInfo(lineInfo)
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
override fun onNoRunningTask() {
|
||||
this.viewCallback?.loadLineData()
|
||||
d(M_BUS+TAG,"没有任务去加载线路")
|
||||
d(TAG, "没有任务去加载线路")
|
||||
}
|
||||
|
||||
override fun onRunningTask() {
|
||||
this.viewCallback?.loadRunningTask()
|
||||
d(M_BUS+TAG,"有任务去加载正在执行的任务")
|
||||
d(TAG, "有任务去加载正在执行的任务")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
@@ -44,7 +45,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum) {
|
||||
d(SceneConstant.M_BUS + TAG, " loginStatus =" + isLogin())
|
||||
d(TAG, " loginStatus =" + isLogin())
|
||||
if (!isLogin()) {
|
||||
BusTrajectoryManager.stopTrajReqLoop()
|
||||
OrderModel.closeBeautificationMode()
|
||||
@@ -52,6 +53,6 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPresenter"
|
||||
private const val TAG = M_BUS+"BusPresenter"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.bridge.ui.drawline.LineView
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
@@ -124,6 +125,6 @@ class ShuttleFragment : MvpFragment<ShuttleFragment?, BusPresenter?>() {
|
||||
* END
|
||||
*/
|
||||
companion object {
|
||||
private const val TAG = "BaseBusTabFragment"
|
||||
private const val TAG = "${M_BUS}BaseBusTabFragment"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ImageUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
@@ -21,7 +22,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
class QrOpenView : AppCompatImageView {
|
||||
|
||||
private val TAG = "QrOpenView"
|
||||
private val TAG = M_BUS + "QrOpenView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
@@ -42,7 +43,7 @@ class QrOpenView : AppCompatImageView {
|
||||
|
||||
onClick {
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG, "changeOverview Event qrcode,sn = "
|
||||
TAG, "changeOverview Event qrcode,sn = "
|
||||
+ SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val qrUrl = String.format(
|
||||
@@ -64,7 +65,7 @@ class QrOpenView : AppCompatImageView {
|
||||
.cancelStr(ResourcesUtils.getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(ActivityUtils.getTopActivity())!!.show()
|
||||
} else {
|
||||
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
|
||||
d(TAG, "bmQr = null ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.DiffUtil.Callback
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.weaknet.ui.switchline.SwitchLineAdapter.SwitchLineViewHolder
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
@@ -22,7 +23,7 @@ class SwitchLineAdapter(
|
||||
val mData: MutableList<LineDataBean>
|
||||
) : RecyclerView.Adapter<SwitchLineViewHolder>() {
|
||||
companion object{
|
||||
const val TAG = "SwitchLineAdapter"
|
||||
const val TAG = M_BUS+"SwitchLineAdapter"
|
||||
}
|
||||
// RecyclerView设置点击事件
|
||||
private var mItemClickListener: LineItemClickListener? = null
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
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.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -48,7 +49,7 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "SwitchLineView"
|
||||
const val TAG = "${M_BUS}SwitchLineView"
|
||||
}
|
||||
|
||||
private var viewModel:SwtichLineModel?=null
|
||||
@@ -81,7 +82,7 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
|
||||
//设置item 点击事件
|
||||
mAdapter.setOnLineItemClickListener(object : SwitchLineAdapter.LineItemClickListener{
|
||||
override fun onItemClick(data: LineDataBean) {
|
||||
CallerLogger.d(LineModel.TAG,"选择线路 线路信息:${data}")
|
||||
CallerLogger.d(TAG,"选择线路 线路信息:${data}")
|
||||
viewbizModel?.loadingSwitchTask(data)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
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.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
||||
@@ -26,7 +27,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
*/
|
||||
class SwtichLineModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
private val TAG = SwtichLineModel::class.java.simpleName
|
||||
private val TAG = M_BUS+SwtichLineModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:SwtichLineViewCallback?=null
|
||||
|
||||
@@ -34,7 +35,7 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
CallerLogger.d(TAG,"onCleared")
|
||||
d(TAG,"onCleared")
|
||||
LineModel.setBusLinesCallback(TAG,null)
|
||||
}
|
||||
|
||||
@@ -51,20 +52,20 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
|
||||
?.subscribe(object : Observer<List<LineDataBean>?> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
endTaskDisposable = d
|
||||
d(LineModel.TAG, "queryBusLines onSubscribe")
|
||||
d(TAG, "queryBusLines onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
d(LineModel.TAG, "queryBusLines onError${e.printStackTrace()}")
|
||||
d(TAG, "queryBusLines onError${e.printStackTrace()}")
|
||||
viewCallback?.onBusLinesChangeFaile()
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
d(LineModel.TAG, "queryBusLines onComplete")
|
||||
d(TAG, "queryBusLines onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: List<LineDataBean>) {
|
||||
d(LineModel.TAG, "queryBusLines onNext ${data}")
|
||||
d(TAG, "queryBusLines onNext ${data}")
|
||||
val tempData = data.distinctBy { it.lineId }
|
||||
viewCallback?.onBusLinesChange(tempData.toMutableList(),loading)
|
||||
if(RepositoryManager.supportDb()) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
@@ -42,7 +43,7 @@ class SwitchTaskView: WindowRelativeLayout, SwtichTaskModel.SwtichLineViewCallba
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "BadCaseManagerView"
|
||||
const val TAG = M_BUS+"BadCaseManagerView"
|
||||
}
|
||||
|
||||
private var viewModel:SwtichTaskModel?=null
|
||||
@@ -93,7 +94,7 @@ class SwitchTaskView: WindowRelativeLayout, SwtichTaskModel.SwtichLineViewCallba
|
||||
}
|
||||
tv_error_msg.onClick {
|
||||
viewModel?.tasksBelongLine?.let {
|
||||
d(LineModel.TAG,"刷新线路 线路信息:${it}")
|
||||
d(TAG,"刷新线路 线路信息:${it}")
|
||||
viewbizModel?.loadingSwitchTask(it)
|
||||
}
|
||||
}
|
||||
@@ -112,7 +113,7 @@ class SwitchTaskView: WindowRelativeLayout, SwtichTaskModel.SwtichLineViewCallba
|
||||
}
|
||||
|
||||
fun queryTaskByLineInfo(lineInfo: LineDataBean) {
|
||||
d(LineModel.TAG, "queryTaskByLineInfo 查询线路的任务线路id:${lineInfo}")
|
||||
d(TAG, "queryTaskByLineInfo 查询线路的任务线路id:${lineInfo}")
|
||||
viewModel?.queryBusLineTasksById(lineInfo)
|
||||
busLineName.text = lineInfo.lineName
|
||||
actvLineEndStationName.text = "往${lineInfo.endStationName}方向"
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.och.weaknet.ui.switchtask
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -23,7 +24,7 @@ import io.reactivex.schedulers.Schedulers
|
||||
*/
|
||||
class SwtichTaskModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
private val TAG = SwtichTaskModel::class.java.simpleName
|
||||
private val TAG = M_BUS+SwtichTaskModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:SwtichLineViewCallback?=null
|
||||
|
||||
@@ -44,27 +45,27 @@ class SwtichTaskModel : ViewModel(), IBusLinesCallback {
|
||||
fun queryBusLineTasksById(lineInfo: LineDataBean) {
|
||||
tasksBelongLine = lineInfo
|
||||
RxUtils.disposeSubscribe(searchTaskBylineIdDisposable)
|
||||
d(LineModel.TAG, "queryBusLineTasksById 查询线路的任务线路id:${tasksBelongLine}")
|
||||
d(TAG, "queryBusLineTasksById 查询线路的任务线路id:${tasksBelongLine}")
|
||||
RepositoryManager.queryCanUserTask(lineInfo.lineId?:-1L)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<List<TaskDataBean>?> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
searchTaskBylineIdDisposable = d
|
||||
d(LineModel.TAG, "queryBusLineTasksById onSubscribe")
|
||||
d(TAG, "queryBusLineTasksById onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
d(LineModel.TAG, "queryBusLineTasksById onError${e.printStackTrace()}")
|
||||
d(TAG, "queryBusLineTasksById onError${e.printStackTrace()}")
|
||||
onBusLineTasksError()
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
d(LineModel.TAG, "queryBusLineTasksById onComplete")
|
||||
d(TAG, "queryBusLineTasksById onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: List<TaskDataBean>) {
|
||||
d(LineModel.TAG, "queryBusLineTasksById onNext ${data}")
|
||||
d(TAG, "queryBusLineTasksById onNext ${data}")
|
||||
onBusLineTasks(data.toMutableList())
|
||||
RxUtils.disposeSubscribe(searchTaskBylineIdDisposable)
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
|
||||
class TaskBottomDecoration(val distance: Int) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private val TAG = "TaskBottomDecoration"
|
||||
private val TAG = M_BUS + "TaskBottomDecoration"
|
||||
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
@@ -19,22 +20,26 @@ class TaskBottomDecoration(val distance: Int) : RecyclerView.ItemDecoration() {
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
val pos = parent.getChildAdapterPosition(view)
|
||||
|
||||
/**
|
||||
* 通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间
|
||||
*/
|
||||
val itemCount = parent.adapter!!.itemCount
|
||||
val layoutManager = parent.layoutManager
|
||||
|
||||
if(layoutManager is GridLayoutManager){
|
||||
if (layoutManager is GridLayoutManager) {
|
||||
var lastPathCount = itemCount % layoutManager.spanCount
|
||||
//2 5 % 3
|
||||
CallerLogger.d(TAG,"位置---${pos}_lastPathCount:${lastPathCount}_____itemCount:${itemCount}__spanCount:${layoutManager.spanCount}")
|
||||
if(lastPathCount==0){
|
||||
//2 5 % 3
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"位置---${pos}_lastPathCount:${lastPathCount}_____itemCount:${itemCount}__spanCount:${layoutManager.spanCount}"
|
||||
)
|
||||
if (lastPathCount == 0) {
|
||||
lastPathCount = layoutManager.spanCount
|
||||
}
|
||||
if(pos<itemCount-lastPathCount){
|
||||
if (pos < itemCount - lastPathCount) {
|
||||
|
||||
}else{
|
||||
} else {
|
||||
outRect.bottom = distance
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
|
||||
@@ -15,7 +16,7 @@ import com.mogo.och.shuttle.weaknet.R
|
||||
*/
|
||||
class RunningTaskGatewayView : ConstraintLayout {
|
||||
|
||||
private val TAG = "LineView"
|
||||
private val TAG = M_BUS + "LineView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
@@ -30,7 +31,8 @@ class RunningTaskGatewayView : ConstraintLayout {
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.common_line_view, this, true)
|
||||
findViewById<ImageView>(R.id.iv_toolkit_item_head).setImageResource(R.drawable.bus_running_task_history)
|
||||
findViewById<TextView>(R.id.iv_toolkit_item_title).text = ResourcesUtils.getString(R.string.bus_running_tasked_gateway)
|
||||
findViewById<TextView>(R.id.iv_toolkit_item_title).text =
|
||||
ResourcesUtils.getString(R.string.bus_running_tasked_gateway)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
|
||||
@@ -22,19 +22,20 @@ import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.eagle.core.utilcode.kotlin.lifeCycleOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.PopupWindowReminder
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import kotlin.math.abs
|
||||
|
||||
object RunningTaskManager : LifecycleEventObserver{
|
||||
object RunningTaskManager : LifecycleEventObserver {
|
||||
|
||||
const val TAG = "BadCase"
|
||||
const val TAG = M_BUS + "RunningTaskManager"
|
||||
|
||||
private var hideFloat: (() -> Unit)? = null
|
||||
|
||||
fun init(context: Context) {
|
||||
fun init() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,9 +64,21 @@ object RunningTaskManager : LifecycleEventObserver{
|
||||
}
|
||||
|
||||
|
||||
fun enqueuePop(content: View, width: Int, height: Int, key: String = "", startX: Int = 0, startY: Int = 0, gravity: Int = Gravity.START, onOuterViewClicked:((focus: View) -> Unit)? = null, isOverride: Boolean = false, isFocusable: Boolean = true): () -> Unit {
|
||||
val topActivity = ActivityUtils.getTopActivity()
|
||||
val activity = (topActivity as? FragmentActivity) ?: throw IllegalStateException("please use Activity to trigger pop show.")
|
||||
fun enqueuePop(
|
||||
content: View,
|
||||
width: Int,
|
||||
height: Int,
|
||||
key: String = "",
|
||||
startX: Int = 0,
|
||||
startY: Int = 0,
|
||||
gravity: Int = Gravity.START,
|
||||
onOuterViewClicked: ((focus: View) -> Unit)? = null,
|
||||
isOverride: Boolean = false,
|
||||
isFocusable: Boolean = true
|
||||
): () -> Unit {
|
||||
val topActivity = ActivityUtils.getTopActivity()
|
||||
val activity = (topActivity as? FragmentActivity)
|
||||
?: throw IllegalStateException("please use Activity to trigger pop show.")
|
||||
val isImmersiveMode = BarUtils.isImmersiveMode(activity)
|
||||
var tempReminder: PopupWindowReminder? = null
|
||||
activity.lifecycleScope.launchWhenResumed {
|
||||
@@ -86,16 +99,18 @@ object RunningTaskManager : LifecycleEventObserver{
|
||||
return@setTouchInterceptor false
|
||||
}
|
||||
|
||||
when(event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
when (event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
x = event.x
|
||||
y = event.y
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val deltaX = event.x - x
|
||||
val deltaY = event.y - y
|
||||
isClicked = !(abs(deltaX) > touchSlop || abs(deltaY) > touchSlop)
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if (isClicked) {
|
||||
isClicked = false
|
||||
@@ -129,6 +144,7 @@ object RunningTaskManager : LifecycleEventObserver{
|
||||
override fun show() {
|
||||
pop.showAtLocation(activity.window.decorView, gravity, startX, startY)
|
||||
}
|
||||
|
||||
override fun isOverride(): Boolean = isOverride
|
||||
}
|
||||
tempReminder = reminder
|
||||
@@ -140,6 +156,4 @@ object RunningTaskManager : LifecycleEventObserver{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.wigets.WindowRelativeLayout
|
||||
@@ -23,24 +24,33 @@ import kotlinx.android.synthetic.main.shuttle_wadk_task_running.view.upload_btn_
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
|
||||
class RunningTaskManagerView: WindowRelativeLayout, RunningTastViewModel.RunningTaskViewCallback {
|
||||
class RunningTaskManagerView : WindowRelativeLayout, RunningTastViewModel.RunningTaskViewCallback {
|
||||
|
||||
|
||||
constructor(context: Context?) : super(context)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
constructor(
|
||||
context: Context?,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "BadCaseManagerView"
|
||||
const val TAG = M_BUS + "RunningTaskManagerView"
|
||||
}
|
||||
|
||||
private var clickListener:ClickListener?=null
|
||||
private var viewModel:RunningTastViewModel?=null
|
||||
private var clickListener: ClickListener? = null
|
||||
private var viewModel: RunningTastViewModel? = null
|
||||
|
||||
private lateinit var mAdapter: RunningTaskAdapter
|
||||
private lateinit var linearLayoutManager: WrapContentLinearLayoutManager
|
||||
@@ -50,7 +60,7 @@ class RunningTaskManagerView: WindowRelativeLayout, RunningTastViewModel.Running
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
private fun initView() {
|
||||
//关闭BadCase管理窗口
|
||||
ivTaskRunningClose.setOnClickListener {
|
||||
clickListener?.onClose()
|
||||
@@ -90,9 +100,14 @@ class RunningTaskManagerView: WindowRelativeLayout, RunningTastViewModel.Running
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
if (isVisible) {
|
||||
viewModel?.queryNewData()
|
||||
actvCurrentDate.setText(DateTimeUtil.formatLongToString(System.currentTimeMillis(),DateTimeUtil.MM_dd_HH_mm_china))
|
||||
actvCurrentDate.setText(
|
||||
DateTimeUtil.formatLongToString(
|
||||
System.currentTimeMillis(),
|
||||
DateTimeUtil.MM_dd_HH_mm_china
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,12 +117,12 @@ class RunningTaskManagerView: WindowRelativeLayout, RunningTastViewModel.Running
|
||||
|
||||
override fun showData(data: MutableList<WaitUploadLine>) {
|
||||
mAdapter.setDataList(data)
|
||||
if(data.isEmpty()){
|
||||
if (data.isEmpty()) {
|
||||
rvDataLiet.visibility = GONE
|
||||
no_order_data_view.visibility = VISIBLE
|
||||
aciv_show_data.visibility = GONE
|
||||
upload_btn_commit.visibility = GONE
|
||||
}else{
|
||||
} else {
|
||||
rvDataLiet.visibility = VISIBLE
|
||||
no_order_data_view.visibility = GONE
|
||||
aciv_show_data.visibility = VISIBLE
|
||||
@@ -116,12 +131,13 @@ class RunningTaskManagerView: WindowRelativeLayout, RunningTastViewModel.Running
|
||||
}
|
||||
|
||||
override fun showUpdating(isupload: Boolean) {
|
||||
if(isupload){
|
||||
if (isupload) {
|
||||
upload_btn_commit_progress.visibility = VISIBLE
|
||||
upload_btn_commit_title.text = "上传中"
|
||||
}else{
|
||||
} else {
|
||||
upload_btn_commit_progress.visibility = GONE
|
||||
upload_btn_commit_title.text = ResourcesUtils.getString(R.string.bus_running_task_upload)
|
||||
upload_btn_commit_title.text =
|
||||
ResourcesUtils.getString(R.string.bus_running_task_upload)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.och.weaknet.ui.taskrunned
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.weaknet.bean.WaitUploadLine
|
||||
@@ -16,42 +17,42 @@ import io.reactivex.schedulers.Schedulers
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class RunningTastViewModel : ViewModel() {
|
||||
class RunningTastViewModel : ViewModel() {
|
||||
|
||||
private val TAG = RunningTastViewModel::class.java.simpleName
|
||||
private val TAG = M_BUS + RunningTastViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:RunningTaskViewCallback?=null
|
||||
private var subscribe: Disposable?=null
|
||||
private var viewCallback: RunningTaskViewCallback? = null
|
||||
private var subscribe: Disposable? = null
|
||||
|
||||
|
||||
fun setDistanceCallback(viewCallback:RunningTaskViewCallback){
|
||||
fun setDistanceCallback(viewCallback: RunningTaskViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
EventModel.getUploadTaskObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<Boolean> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
subscribe = d
|
||||
CallerLogger.d(TAG, "onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
CallerLogger.d(TAG, "onError${e.printStackTrace()}")
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
CallerLogger.d(TAG, "onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
CallerLogger.d(TAG, "onNext:${data}")
|
||||
this@RunningTastViewModel.viewCallback?.showUpdating(data)
|
||||
if(!data){
|
||||
queryNewData()
|
||||
EventModel.getUploadTaskObservable()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Observer<Boolean> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
subscribe = d
|
||||
CallerLogger.d(TAG, "onSubscribe")
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
override fun onError(e: Throwable) {
|
||||
CallerLogger.d(TAG, "onError${e.printStackTrace()}")
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
CallerLogger.d(TAG, "onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
CallerLogger.d(TAG, "onNext:${data}")
|
||||
this@RunningTastViewModel.viewCallback?.showUpdating(data)
|
||||
if (!data) {
|
||||
queryNewData()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
@@ -88,9 +89,9 @@ class RunningTastViewModel : ViewModel() {
|
||||
EventModel.notifySyn()
|
||||
}
|
||||
|
||||
interface RunningTaskViewCallback{
|
||||
interface RunningTaskViewCallback {
|
||||
fun showData(data: MutableList<WaitUploadLine>)
|
||||
fun showUpdating(isupload:Boolean)
|
||||
fun showUpdating(isupload: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
@@ -26,8 +27,8 @@ class TaskRunningAdapter(
|
||||
val mData: MutableList<BusStationBean>
|
||||
) : RecyclerView.Adapter<TaskRunningAdapter.TaskRunningViewHolder>() {
|
||||
|
||||
companion object{
|
||||
const val TAG = "TaskRunningAdapter"
|
||||
companion object {
|
||||
const val TAG = "${M_BUS}TaskRunningAdapter"
|
||||
}
|
||||
|
||||
private val argbEvaluator: ArgbEvaluator = ArgbEvaluator()
|
||||
@@ -40,12 +41,13 @@ class TaskRunningAdapter(
|
||||
fun setDataList(dataList: List<BusStationBean>) {
|
||||
this.mData.clear()
|
||||
this.mData.addAll(dataList)
|
||||
if(LineModel.startStationIndex==0){
|
||||
totalHeight = 33 + (dataList.size-2)*heightItem
|
||||
}else{
|
||||
totalHeight = (halfHeight+(dataList.size-1-LineModel.startStationIndex)*heightItem).toFloat()
|
||||
if (LineModel.startStationIndex == 0) {
|
||||
totalHeight = 33 + (dataList.size - 2) * heightItem
|
||||
} else {
|
||||
totalHeight =
|
||||
(halfHeight + (dataList.size - 1 - LineModel.startStationIndex) * heightItem).toFloat()
|
||||
}
|
||||
notifyItemRangeChanged(0,dataList.size,true)
|
||||
notifyItemRangeChanged(0, dataList.size, true)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
@@ -64,27 +66,36 @@ class TaskRunningAdapter(
|
||||
holder.actvStationName.text = line.name
|
||||
holder.actvWriteOffCount.setSiteId(line.siteId)
|
||||
val startStationIndex = LineModel.startStationIndex
|
||||
if (startStationIndex>0) {
|
||||
if (startStationIndex > 0) {
|
||||
CallerLogger.d(TAG, "位置:$currentPosition 当前站${mData[startStationIndex]} ")
|
||||
}
|
||||
|
||||
if(currentPosition<startStationIndex){
|
||||
holder.actvStationName.setTextSize(TypedValue.COMPLEX_UNIT_PX, AutoSizeUtils.dp2px(mContext,40f).toFloat())
|
||||
if (currentPosition < startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.bus_color_4dffffff))
|
||||
holder.actvWriteOffCount.visibility = View.GONE
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_switch_line_adapter_point_pass)
|
||||
}else if(currentPosition==startStationIndex){
|
||||
holder.actvStationName.setTextSize(TypedValue.COMPLEX_UNIT_PX, AutoSizeUtils.dp2px(mContext,45f).toFloat())
|
||||
} else if (currentPosition == startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 45f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.bus_color_2EACFF))
|
||||
if(LineModel.startStationIndex==mData.size-1){
|
||||
if (LineModel.startStationIndex == mData.size - 1) {
|
||||
holder.actvWriteOffCount.visibility = View.GONE
|
||||
}else{
|
||||
} else {
|
||||
holder.actvWriteOffCount.visibility = View.VISIBLE
|
||||
}
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
}else{
|
||||
} else {
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.white))
|
||||
holder.actvStationName.setTextSize(TypedValue.COMPLEX_UNIT_PX, AutoSizeUtils.dp2px(mContext,40f).toFloat())
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.itemView.background = null
|
||||
holder.actvWriteOffCount.visibility = View.GONE
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
@@ -98,118 +109,138 @@ class TaskRunningAdapter(
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.VISIBLE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if(startStationIndex==0){
|
||||
if(line.isLeaving){
|
||||
if (startStationIndex == 0) {
|
||||
if (line.isLeaving) {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}else{
|
||||
} else {
|
||||
// 下端 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(orientation, intArrayOf(
|
||||
startColor,
|
||||
endColor
|
||||
))
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColor,
|
||||
endColor
|
||||
)
|
||||
)
|
||||
holder.startStationBg.background = temp01
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
mData.size-1 -> {
|
||||
|
||||
mData.size - 1 -> {
|
||||
holder.acivStationHeadBig.visibility = View.VISIBLE
|
||||
holder.acivStationHead.visibility = View.INVISIBLE
|
||||
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_end)
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.VISIBLE
|
||||
if(startStationIndex==itemCount-1){
|
||||
if(line.isLeaving){
|
||||
if (startStationIndex == itemCount - 1) {
|
||||
if (line.isLeaving) {
|
||||
holder.endStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
}else{
|
||||
} else {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
holder.endStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// 上端 彩色
|
||||
holder.itemView.background = null
|
||||
val startColorTemp = argbEvaluator.evaluate(((totalHeight-halfHeight)/totalHeight).toFloat(),startColor,endColor) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(1f,startColor,endColor) as Int
|
||||
val startColorTemp = argbEvaluator.evaluate(
|
||||
((totalHeight - halfHeight) / totalHeight).toFloat(),
|
||||
startColor,
|
||||
endColor
|
||||
) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(1f, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
))
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.endStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
holder.acivStationHeadBig.visibility = View.GONE
|
||||
holder.acivStationHead.visibility = View.VISIBLE
|
||||
holder.middleStationBg.visibility = View.VISIBLE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if(currentPosition==startStationIndex){
|
||||
if(line.isLeaving){
|
||||
if (currentPosition == startStationIndex) {
|
||||
if (line.isLeaving) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}else{
|
||||
} else {
|
||||
// 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
val startColorTemp = argbEvaluator.evaluate(0f,startColor,endColor) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(100f/totalHeight,startColor,endColor) as Int
|
||||
val startColorTemp = argbEvaluator.evaluate(0f, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(100f / totalHeight, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
))
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
}else if(currentPosition<startStationIndex){
|
||||
// 灰色
|
||||
} else if (currentPosition < startStationIndex) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.shuttle_driver_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}else{
|
||||
} else {
|
||||
var dex = 0f
|
||||
if(startStationIndex==0){
|
||||
if (startStationIndex == 0) {
|
||||
val firstItemData = mData[0]
|
||||
if(!firstItemData.isLeaving){
|
||||
if (!firstItemData.isLeaving) {
|
||||
dex = halfHeight
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
val checkIndex = mData.get(startStationIndex)
|
||||
if(!checkIndex.isLeaving){
|
||||
if (!checkIndex.isLeaving) {
|
||||
dex = heightItem
|
||||
}
|
||||
}
|
||||
// 彩色
|
||||
holder.itemView.background = null
|
||||
val index = (currentPosition - startStationIndex-1) * 100
|
||||
val index = (currentPosition - startStationIndex - 1) * 100
|
||||
val startFraction = (dex + index) / totalHeight
|
||||
val endFraction = (dex + index + 100) / totalHeight
|
||||
CallerLogger.d(TAG,"位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}")
|
||||
val startColorTemp = argbEvaluator.evaluate(startFraction,startColor,endColor) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(endFraction,startColor,endColor) as Int
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}"
|
||||
)
|
||||
val startColorTemp =
|
||||
argbEvaluator.evaluate(startFraction, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(endFraction, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
))
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
}
|
||||
if(currentPosition==startStationIndex+1){
|
||||
val preLine = mData[currentPosition-1]
|
||||
if(preLine.isLeaving){
|
||||
if (currentPosition == startStationIndex + 1) {
|
||||
val preLine = mData[currentPosition - 1]
|
||||
if (preLine.isLeaving) {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
}else{
|
||||
} else {
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
@@ -222,9 +253,12 @@ class TaskRunningAdapter(
|
||||
|
||||
class TaskRunningViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val actvStationName: AppCompatTextView = itemView.findViewById(R.id.actv_station_name)//站点名称
|
||||
val acivStationHead: AppCompatImageView = itemView.findViewById(R.id.aciv_station_head)//普通站点标识 不是起始和终点坐标
|
||||
val acivStationHeadBig: AppCompatImageView = itemView.findViewById(R.id.aciv_station_head_big)//起始和终点坐标标识
|
||||
val actvWriteOffCount: WriteOffView = itemView.findViewById(R.id.actv_write_off_count) //此战核销的人数
|
||||
val acivStationHead: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head)//普通站点标识 不是起始和终点坐标
|
||||
val acivStationHeadBig: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head_big)//起始和终点坐标标识
|
||||
val actvWriteOffCount: WriteOffView =
|
||||
itemView.findViewById(R.id.actv_write_off_count) //此战核销的人数
|
||||
val middleStationBg: View = itemView.findViewById(R.id.bg_pass_bg) //贯通背景调
|
||||
val endStationBg: View = itemView.findViewById(R.id.bg_pass_head_bg) //终点的背景
|
||||
val startStationBg: View = itemView.findViewById(R.id.bg_pass_bottom_bg) //起点坐标的背景
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.weaknet.ui.taskrunning
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
@@ -11,42 +12,42 @@ import com.mogo.och.weaknet.model.OrderModel
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
private val TAG = TaskRunningModel::class.java.simpleName
|
||||
private val TAG = M_BUS + TaskRunningModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:SwtichLineViewCallback?=null
|
||||
private var viewCallback: SwtichLineViewCallback? = null
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback:SwtichLineViewCallback){
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
LineModel.setBusLinesCallback(TAG,this)
|
||||
LineModel.setBusLinesCallback(TAG, this)
|
||||
}
|
||||
|
||||
fun leaveStation() {
|
||||
OrderModel.driveToNextStation()
|
||||
}
|
||||
|
||||
interface SwtichLineViewCallback{
|
||||
interface SwtichLineViewCallback {
|
||||
fun showRunningTaskInfo()
|
||||
fun hideLoadingAndshowRunningTaskInfo()
|
||||
fun smoothScrollToPosition(position:Int)
|
||||
fun smoothScrollToPosition(position: Int)
|
||||
fun completeTaskFail()
|
||||
}
|
||||
|
||||
override fun onLeaveStaionSuccess() {
|
||||
BizLoopManager.runInMainThread{
|
||||
BizLoopManager.runInMainThread {
|
||||
viewCallback?.hideLoadingAndshowRunningTaskInfo()
|
||||
smoothScrollToPosition()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun smoothScrollToPosition(){
|
||||
BizLoopManager.runInMainThread(object :Runnable{
|
||||
fun smoothScrollToPosition() {
|
||||
BizLoopManager.runInMainThread(object : Runnable {
|
||||
override fun run() {
|
||||
viewCallback?.smoothScrollToPosition(LineModel.startStationIndex)
|
||||
}
|
||||
@@ -58,7 +59,7 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
|
||||
override fun onArriveStationSuccess() {
|
||||
BizLoopManager.runInMainThread{
|
||||
BizLoopManager.runInMainThread {
|
||||
smoothScrollToPosition()
|
||||
viewCallback?.showRunningTaskInfo()
|
||||
}
|
||||
@@ -70,7 +71,7 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
override fun onCompleteTaskFail() {
|
||||
super.onCompleteTaskFail()
|
||||
BizLoopManager.runInMainThread{
|
||||
BizLoopManager.runInMainThread {
|
||||
viewCallback?.completeTaskFail()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
@@ -27,24 +28,33 @@ import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.loading_arr
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.rl_running_task_station_list
|
||||
|
||||
|
||||
class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
|
||||
class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
|
||||
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = "TaskRunningView"
|
||||
const val TAG = M_BUS + "TaskRunningView"
|
||||
}
|
||||
|
||||
private var viewModel:TaskRunningModel?=null
|
||||
private var viewbizModel:SwtichBizeModel?=null
|
||||
private var viewModel: TaskRunningModel? = null
|
||||
private var viewbizModel: SwtichBizeModel? = null
|
||||
|
||||
private lateinit var mAdapter: TaskRunningAdapter
|
||||
|
||||
@@ -55,7 +65,7 @@ class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
private fun initView() {
|
||||
linearLayoutManager = WrapContentLinearLayoutManager(context)
|
||||
rl_running_task_station_list.setLayoutManager(linearLayoutManager)
|
||||
mAdapter = TaskRunningAdapter(context, mutableListOf())
|
||||
@@ -104,23 +114,26 @@ class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback
|
||||
}
|
||||
|
||||
override fun showRunningTaskInfo() {
|
||||
LineManager.getLineInfo {lineInfo ->
|
||||
LineManager.getLineInfo { lineInfo ->
|
||||
bus_task_running_line_name.text = lineInfo.lineName
|
||||
}
|
||||
actv_running_task_time.text = "班次:${LineModel.getTaskTime()}"
|
||||
LineModel.stationList?.takeIf { it.size>=2 }?.let {
|
||||
LineModel.stationList?.takeIf { it.size >= 2 }?.let {
|
||||
actv_running_task_last_station.text = "往${it.last().name ?: ""}"
|
||||
mAdapter.setDataList(it)
|
||||
CallerLogger.d(TAG,"BusLineModel.startStationIndex:${LineModel.startStationIndex}___$it")
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"BusLineModel.startStationIndex:${LineModel.startStationIndex}___$it"
|
||||
)
|
||||
val currentStation = it.get(LineModel.startStationIndex)
|
||||
if(currentStation.isLeaving){
|
||||
showArriverStationAndCompleteTask()
|
||||
}else{
|
||||
showLeaveStationView()
|
||||
}
|
||||
if(LineModel.startStationIndex==it.size-1){
|
||||
if (currentStation.isLeaving) {
|
||||
showArriverStationAndCompleteTask()
|
||||
} else {
|
||||
showLeaveStationView()
|
||||
}
|
||||
if (LineModel.startStationIndex == it.size - 1) {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
}else{
|
||||
} else {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
}
|
||||
}
|
||||
@@ -138,19 +151,19 @@ class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback
|
||||
override fun smoothScrollToPosition(position: Int) {
|
||||
try {
|
||||
rl_running_task_station_list.smoothScrollToPosition(position)
|
||||
}catch (e:Exception){
|
||||
OchChainLogManager.writeChainLog("错误","e:${e.message}")
|
||||
} catch (e: Exception) {
|
||||
OchChainLogManager.writeChainLog("错误", "e:${e.message}")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun showLeaveStationView(){
|
||||
fun showLeaveStationView() {
|
||||
aciv_task_leave_station_slide_bg.visibility = VISIBLE
|
||||
actv_arriver_station.visibility = GONE
|
||||
actv_complete_task.visibility = GONE
|
||||
}
|
||||
|
||||
fun showArriverStationAndCompleteTask(){
|
||||
fun showArriverStationAndCompleteTask() {
|
||||
aciv_task_leave_station_slide_bg.visibility = INVISIBLE
|
||||
actv_arriver_station.visibility = VISIBLE
|
||||
actv_complete_task.visibility = VISIBLE
|
||||
|
||||
@@ -7,30 +7,35 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
import com.mogo.och.weaknet.ui.taskrunning.TaskRunningAdapter
|
||||
|
||||
class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback {
|
||||
|
||||
private val TAG = "ItineraryView"
|
||||
private val TAG = M_BUS + "WriteOffView"
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
private var viewModel:WriteOffViewModel? = null
|
||||
private var viewModel: WriteOffViewModel? = null
|
||||
|
||||
private var siteId:Int = 0
|
||||
private var siteId: Int = 0
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
if(RepositoryManager.supportWriteOff()) {
|
||||
if (RepositoryManager.supportWriteOff()) {
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count,0)
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, 0)
|
||||
text = showText
|
||||
}
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
@@ -38,12 +43,13 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
}
|
||||
}
|
||||
|
||||
private fun startListenerWriteOff(){
|
||||
private fun startListenerWriteOff() {
|
||||
viewModel?.setWriteOffCallback(this)
|
||||
}
|
||||
private fun stopListenerWriteOff(){
|
||||
|
||||
private fun stopListenerWriteOff() {
|
||||
viewModel?.setWriteOffCallback(null)
|
||||
if(RepositoryManager.supportWriteOff()) {
|
||||
if (RepositoryManager.supportWriteOff()) {
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, 0)
|
||||
text = showText
|
||||
@@ -52,9 +58,9 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
if (isVisible) {
|
||||
startListenerWriteOff()
|
||||
}else{
|
||||
} else {
|
||||
stopListenerWriteOff()
|
||||
}
|
||||
}
|
||||
@@ -67,8 +73,8 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
}
|
||||
}
|
||||
|
||||
override fun setWriteOffCount(showText: String,siteId: Int) {
|
||||
if(this.siteId==siteId) {
|
||||
override fun setWriteOffCount(showText: String, siteId: Int) {
|
||||
if (this.siteId == siteId) {
|
||||
text = showText
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.och.weaknet.model.TicketModel
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
@@ -14,7 +15,7 @@ import io.reactivex.disposables.Disposable
|
||||
|
||||
class WriteOffViewModel : ViewModel() {
|
||||
|
||||
private val TAG = WriteOffViewModel::class.java.simpleName
|
||||
private val TAG = M_BUS + WriteOffViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IwriteOffViewCallback? = null
|
||||
|
||||
@@ -24,7 +25,7 @@ class WriteOffViewModel : ViewModel() {
|
||||
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
private val observer = object : Observer<Pair<String,Int>> {
|
||||
private val observer = object : Observer<Pair<String, Int>> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
disposable = d
|
||||
}
|
||||
@@ -37,24 +38,25 @@ class WriteOffViewModel : ViewModel() {
|
||||
|
||||
}
|
||||
|
||||
override fun onNext(countInfo: Pair<String,Int>) {
|
||||
viewCallback?.setWriteOffCount(countInfo.first,countInfo.second)
|
||||
override fun onNext(countInfo: Pair<String, Int>) {
|
||||
viewCallback?.setWriteOffCount(countInfo.first, countInfo.second)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setWriteOffCallback(viewCallback: IwriteOffViewCallback?) {
|
||||
this.viewCallback = viewCallback
|
||||
if(viewCallback==null){
|
||||
if (viewCallback == null) {
|
||||
RxUtils.disposeSubscribe(disposable)
|
||||
}
|
||||
TicketModel
|
||||
.getWriteOffCountObservable()
|
||||
.flatMap { t ->
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, t.second)
|
||||
AbsMogoApplication.getApp()
|
||||
.getString(R.string.shuttle_write_off_count, t.second)
|
||||
CallerLogger.d(SceneConstant.M_BUS + TAG, "显示文案:${showText}")
|
||||
Observable.just(Pair(showText,t.first))
|
||||
Observable.just(Pair(showText, t.first))
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observer)
|
||||
@@ -67,7 +69,7 @@ class WriteOffViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
interface IwriteOffViewCallback {
|
||||
fun setWriteOffCount(count:String,siteId: Int)
|
||||
fun setWriteOffCount(count: String, siteId: Int)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager.isLogin
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager.contraiInfo
|
||||
@@ -31,7 +32,7 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
object BusTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
private val TAG: String = BusTrajectoryManager::class.java.simpleName
|
||||
private val TAG: String = M_BUS + BusTrajectoryManager::class.java.simpleName
|
||||
|
||||
private var mAutopilotControlParameters: AutopilotControlParameters? = null
|
||||
private var mSendReqDisposable: Disposable? = null
|
||||
@@ -40,11 +41,11 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
mAutopilotControlParameters = AutopilotControlParameters()
|
||||
}
|
||||
|
||||
fun load(){
|
||||
TrajectoryManager.addListener(TAG,this)
|
||||
fun load() {
|
||||
TrajectoryManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun release(){
|
||||
fun release() {
|
||||
TrajectoryManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@@ -69,11 +70,11 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
)
|
||||
}
|
||||
if (isLogin() && currentTask != null && startStationIndex == 0 && !isGoingToNextStation) {
|
||||
d(SceneConstant.M_BUS + TAG, "syncTrajectoryInfo() start.")
|
||||
d(TAG, "syncTrajectoryInfo() start.")
|
||||
startTrajReqLoop()
|
||||
} else {
|
||||
// 无路线信息or当前未在始发站
|
||||
d(SceneConstant.M_BUS + TAG, "syncTrajectoryInfo() stop.")
|
||||
d(TAG, "syncTrajectoryInfo() stop.")
|
||||
stopTrajReqLoop()
|
||||
}
|
||||
}
|
||||
@@ -94,10 +95,7 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
val contraiInfo = contraiInfo
|
||||
val lineInfos = lineInfos
|
||||
if (contraiInfo == null || lineInfos == null) {
|
||||
e(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"setupAutoPilotLine(): routesResult is null."
|
||||
)
|
||||
e(TAG, "setupAutoPilotLine(): routesResult is null.")
|
||||
return
|
||||
} else {
|
||||
mAutopilotControlParameters = initAutopilotControlParameters()
|
||||
@@ -128,21 +126,17 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable!!.isDisposed) {
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS + TAG, "startTrajReqLoop()")
|
||||
d(TAG, "startTrajReqLoop()")
|
||||
setupAutoPilotLine()
|
||||
mSendReqDisposable = Observable.interval(
|
||||
BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS
|
||||
)
|
||||
.map((Function { aLong: Long -> aLong + 1 }))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { aLong: Long ->
|
||||
BusConst.LOOP_DELAY, BusConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS
|
||||
).map((Function { aLong: Long -> aLong + 1 })).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread()).subscribe { aLong: Long ->
|
||||
if (aLong > BusConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
stopTrajReqLoop()
|
||||
return@subscribe
|
||||
}
|
||||
d(SceneConstant.M_BUS + TAG, "loop sendTrajectoryReq: $aLong")
|
||||
d(TAG, "loop sendTrajectoryReq: $aLong")
|
||||
sendTrajectoryReq()
|
||||
}
|
||||
}
|
||||
@@ -164,7 +158,7 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
)
|
||||
}
|
||||
if (mSendReqDisposable != null) {
|
||||
d(SceneConstant.M_BUS + TAG, "stopTrajReqLoop()")
|
||||
d(TAG, "stopTrajReqLoop()")
|
||||
mSendReqDisposable!!.dispose()
|
||||
mSendReqDisposable = null
|
||||
clearAutoPilotLine()
|
||||
@@ -173,7 +167,7 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
private fun sendTrajectoryReq() {
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null || mAutopilotControlParameters!!.autoPilotLine!!.lineId == -1L) {
|
||||
e(SceneConstant.M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
e(TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
setupAutoPilotLine()
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null || mAutopilotControlParameters!!.autoPilotLine!!.lineId == -1L) {
|
||||
return
|
||||
@@ -186,10 +180,7 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
sendTrajectoryDownloadReq(mAutopilotControlParameters!!.autoPilotLine!!, 0)
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutopilotControlParameters)
|
||||
)
|
||||
d(TAG, "sendTrajectoryReq(): " + GsonUtils.toJson(mAutopilotControlParameters))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
package com.mogo.och.weaknet.view
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_leave_station_view.view.actv_draggable
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_task_leave_station_view.view.lottie_bg
|
||||
|
||||
class BizLeaveStationView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
companion object {
|
||||
const val TAG = "LoadingMapStatusView"
|
||||
}
|
||||
|
||||
|
||||
private var initialX = 0f
|
||||
private var initialY = 0f
|
||||
private val tempSet = ConstraintSet()
|
||||
|
||||
private var draggableButton: AppCompatTextView
|
||||
|
||||
private var slideListener:SlideListener?=null
|
||||
|
||||
fun setSlideListener(slideListener:SlideListener){
|
||||
this.slideListener = slideListener
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.shuttle_weak_task_leave_station_view, this, true)
|
||||
draggableButton = findViewById(R.id.actv_draggable)
|
||||
lottie_bg.setImageAssetsFolder("images")
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerLogger.d(TAG,"onAttachedToWindow")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 为该组件的触碰事件重写事件处理方法
|
||||
*/
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
initialX = event.rawX;
|
||||
initialY = event.rawY;
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val dx = event.rawX - initialX;
|
||||
val dy = event.rawY - initialY;
|
||||
initialX = event.rawX;
|
||||
initialY = event.rawY;
|
||||
|
||||
if(draggableButton.translationX<0){
|
||||
tempSet.clone(this)
|
||||
tempSet.setTranslationX(draggableButton.id, 0f)
|
||||
tempSet.applyTo(this)
|
||||
}else if(draggableButton.translationX>=0&&draggableButton.translationX<=width-draggableButton.width){
|
||||
tempSet.clone(this)
|
||||
val dex = (draggableButton.translationX + dx).takeIf { it>=0 }?:0f
|
||||
val newDex = dex.takeIf { it<=width-draggableButton.width }?:(width-draggableButton.width).toFloat()
|
||||
tempSet.setTranslationX(draggableButton.id, newDex)
|
||||
tempSet.applyTo(this)
|
||||
}else{
|
||||
tempSet.clone(this)
|
||||
val dex = (draggableButton.translationX + dx).takeIf { it<=width-draggableButton.width }?:(width-draggableButton.width).toFloat()
|
||||
tempSet.setTranslationX(draggableButton.id, dex)
|
||||
tempSet.applyTo(this)
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if(draggableButton.translationX<(width-draggableButton.width)){
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton, "translationX", draggableButton.translationX,
|
||||
0f
|
||||
).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
}else if (draggableButton.translationX>=(width-draggableButton.width)){
|
||||
lottie_bg.setAnimation("data.json")
|
||||
lottie_bg.playAnimation()
|
||||
actv_draggable.setTextColor(ResourcesUtils.getColor(R.color.shuttle_driver_80FFFFFF))
|
||||
RxUtils.createSubscribe(1_000) {
|
||||
slideListener?.slideEnd()
|
||||
}
|
||||
}else{
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton, "translationX", draggableButton.translationX,
|
||||
0f
|
||||
).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
lottie_bg.setAnimation("slide.json")
|
||||
lottie_bg.playAnimation()
|
||||
actv_draggable.setTextColor(ResourcesUtils.getColor(R.color.white))
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton, "translationX", draggableButton.translationX,
|
||||
0f
|
||||
).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerLogger.d(TAG,"onDetachedFromWindow")
|
||||
}
|
||||
|
||||
fun setTextValue(value: String) {
|
||||
actv_draggable.text = value
|
||||
}
|
||||
|
||||
interface SlideListener{
|
||||
fun slideEnd()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user