[6.7.0]
[fix] [核销问题]
This commit is contained in:
@@ -38,9 +38,9 @@ object TicketModel : IOchOnMessageListener<WriteOffPassenger>{
|
||||
|
||||
private const val SELECTWRITEOFFCOUNT = "SELECTWRITEOFFCOUNT"
|
||||
|
||||
private var emitterMain: ObservableEmitter<Int>?=null
|
||||
private var emitterMain: ObservableEmitter<Pair<Int,Int>>?=null
|
||||
|
||||
private val observable = Observable.create(ObservableOnSubscribe<Int> { emitter -> emitterMain = emitter })
|
||||
private val observable = Observable.create(ObservableOnSubscribe<Pair<Int,Int>> { emitter -> emitterMain = emitter })
|
||||
|
||||
private val writeOffMsg = object : ILanMessageListener<WriteOffMsg> {
|
||||
override fun targetLan(): Class<WriteOffMsg> = WriteOffMsg::class.java
|
||||
@@ -106,7 +106,7 @@ object TicketModel : IOchOnMessageListener<WriteOffPassenger>{
|
||||
object : OchCommonServiceCallback<WriteOffCountResponse> {
|
||||
override fun onSuccess(data: WriteOffCountResponse?) {
|
||||
data?.data?.let {
|
||||
emitterMain?.onNext(it)
|
||||
emitterMain?.onNext(Pair<Int,Int>(firstStation.siteId,it))
|
||||
d(SceneConstant.M_BUS + TAG, "${firstStation.name}核销人数:${it}")
|
||||
OchChainLogManager.writeChainLog("核销人数","任务:${currentTask.taskId} zhan'dian")
|
||||
}
|
||||
@@ -120,11 +120,11 @@ object TicketModel : IOchOnMessageListener<WriteOffPassenger>{
|
||||
}
|
||||
|
||||
}
|
||||
emitterMain?.onNext(0)
|
||||
emitterMain?.onNext(Pair(0,0))
|
||||
d(SceneConstant.M_BUS + TAG, "线路或者站点未空")
|
||||
}
|
||||
|
||||
fun getWriteOffCountObservable():Observable<Int>{
|
||||
fun getWriteOffCountObservable():Observable<Pair<Int,Int>>{
|
||||
return observable
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.ui.writeoff.WriteOffView
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
@@ -28,7 +29,6 @@ class TaskRunningAdapter(
|
||||
companion object{
|
||||
const val TAG = "TaskRunningAdapter"
|
||||
}
|
||||
private var startStationIndex:Int = -1
|
||||
|
||||
private val argbEvaluator: ArgbEvaluator = ArgbEvaluator()
|
||||
private val startColor = ResourcesUtils.getColor(R.color.shuttle_driver_1970FF)
|
||||
@@ -37,14 +37,13 @@ class TaskRunningAdapter(
|
||||
private val halfHeight = 16.5f
|
||||
private var totalHeight = 0f
|
||||
|
||||
fun setDataList(dataList: List<BusStationBean>, startStationIndex:Int) {
|
||||
this.startStationIndex = startStationIndex
|
||||
fun setDataList(dataList: List<BusStationBean>) {
|
||||
this.mData.clear()
|
||||
this.mData.addAll(dataList)
|
||||
if(startStationIndex==0){
|
||||
if(LineModel.startStationIndex==0){
|
||||
totalHeight = 33 + (dataList.size-2)*heightItem
|
||||
}else{
|
||||
totalHeight = (halfHeight+(dataList.size-1-startStationIndex)*heightItem).toFloat()
|
||||
totalHeight = (halfHeight+(dataList.size-1-LineModel.startStationIndex)*heightItem).toFloat()
|
||||
}
|
||||
notifyItemRangeChanged(0,dataList.size,true)
|
||||
}
|
||||
@@ -63,6 +62,8 @@ class TaskRunningAdapter(
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val line = mData[currentPosition]
|
||||
holder.actvStationName.text = line.name
|
||||
holder.actvWriteOffCount.setSiteId(line.siteId)
|
||||
val startStationIndex = LineModel.startStationIndex
|
||||
if (startStationIndex>0) {
|
||||
CallerLogger.d(TAG, "位置:$currentPosition 当前站${mData[startStationIndex]} ")
|
||||
}
|
||||
@@ -70,14 +71,16 @@ class TaskRunningAdapter(
|
||||
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())
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.bus_color_2EACFF))
|
||||
|
||||
holder.actvWriteOffCount.visibility = View.VISIBLE
|
||||
if(LineModel.startStationIndex==mData.size-1){
|
||||
holder.actvWriteOffCount.visibility = View.GONE
|
||||
}else{
|
||||
holder.actvWriteOffCount.visibility = View.VISIBLE
|
||||
}
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
}else{
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.white))
|
||||
|
||||
@@ -110,7 +110,7 @@ class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback
|
||||
actv_running_task_time.text = "班次:${LineModel.getTaskTime()}"
|
||||
LineModel.stationList?.takeIf { it.size>=2 }?.let {
|
||||
actv_running_task_last_station.text = "往${it.last().name ?: ""}"
|
||||
mAdapter.setDataList(it,LineModel.startStationIndex)
|
||||
mAdapter.setDataList(it)
|
||||
CallerLogger.d(TAG,"BusLineModel.startStationIndex:${LineModel.startStationIndex}___$it")
|
||||
val currentStation = it.get(LineModel.startStationIndex)
|
||||
if(currentStation.isLeaving){
|
||||
|
||||
@@ -2,13 +2,14 @@ package com.mogo.och.weaknet.ui.writeoff
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
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.och.shuttle.weaknet.R
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_wirte_off_view.view.tv_write_off_count
|
||||
|
||||
class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback {
|
||||
|
||||
@@ -22,10 +23,16 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
|
||||
private var viewModel:WriteOffViewModel? = null
|
||||
|
||||
private var siteId:Int = 0
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
if(ProjectUtils.isDali()&& AppIdentityModeUtils.isShuttleDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count,0)
|
||||
text = showText
|
||||
}
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(WriteOffViewModel::class.java)
|
||||
}
|
||||
@@ -38,6 +45,11 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
private fun stopListenerWriteOff(){
|
||||
viewModel?.setWriteOffCallback(null)
|
||||
visibility = GONE
|
||||
if(ProjectUtils.isDali()&& AppIdentityModeUtils.isShuttleDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, 0)
|
||||
text = showText
|
||||
}
|
||||
}
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
@@ -57,8 +69,14 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
}
|
||||
}
|
||||
|
||||
override fun setWriteOffCount(showText: String) {
|
||||
text = showText
|
||||
override fun setWriteOffCount(showText: String,siteId: Int) {
|
||||
if(this.siteId==siteId) {
|
||||
text = showText
|
||||
}
|
||||
}
|
||||
|
||||
fun setSiteId(siteId: Int) {
|
||||
this.siteId = siteId
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class WriteOffViewModel : ViewModel() {
|
||||
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
private val observer = object : Observer<String> {
|
||||
private val observer = object : Observer<Pair<String,Int>> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
disposable = d
|
||||
}
|
||||
@@ -37,21 +37,24 @@ class WriteOffViewModel : ViewModel() {
|
||||
|
||||
}
|
||||
|
||||
override fun onNext(countInfo: String) {
|
||||
viewCallback?.setWriteOffCount(countInfo)
|
||||
override fun onNext(countInfo: Pair<String,Int>) {
|
||||
viewCallback?.setWriteOffCount(countInfo.first,countInfo.second)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setWriteOffCallback(viewCallback: IwriteOffViewCallback?) {
|
||||
this.viewCallback = viewCallback
|
||||
if(viewCallback==null){
|
||||
RxUtils.disposeSubscribe(disposable)
|
||||
}
|
||||
TicketModel
|
||||
.getWriteOffCountObservable()
|
||||
.flatMap { t ->
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, t)
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, t.second)
|
||||
CallerLogger.d(SceneConstant.M_BUS + TAG, "显示文案:${showText}")
|
||||
Observable.just(showText)
|
||||
Observable.just(Pair(showText,t.first))
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(observer)
|
||||
@@ -64,7 +67,7 @@ class WriteOffViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
interface IwriteOffViewCallback {
|
||||
fun setWriteOffCount(count:String)
|
||||
fun setWriteOffCount(count:String,siteId: Int)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user