diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java index 3dd98d36ea..de2f21f05a 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java @@ -23,6 +23,7 @@ public class DateTimeUtil { public static final String yy_MM_dd = "yy.MM.dd"; public static final String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm"; public static final String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss"; + public static final String HH_mm_ss = "HH:mm:ss"; public static final String MM_dd_HH_mm_china = "yyyy年MM月dd日"; public static String formatCalendarToString(Calendar calendar, String format){ diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/ResourcesUtils.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/ResourcesUtils.kt index fdc1c8bc9a..0af2640eb4 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/ResourcesUtils.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/utils/ResourcesUtils.kt @@ -1,5 +1,6 @@ package com.mogo.och.common.module.utils +import android.content.res.ColorStateList import android.graphics.BitmapFactory import androidx.annotation.ColorRes import androidx.annotation.StringRes @@ -11,6 +12,10 @@ object ResourcesUtils { fun getColor(@ColorRes id: Int): Int { return ContextCompat.getColor(AbsMogoApplication.getApp(),id) } + @JvmStatic + fun getColors(@ColorRes id: Int): ColorStateList? { + return ContextCompat.getColorStateList(AbsMogoApplication.getApp(),id) + } @JvmStatic fun getString(@StringRes id: Int): String { diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/BusQueryLinesResponse.java b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/BusQueryLinesResponse.java index dc24f45ae7..71a885c737 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/BusQueryLinesResponse.java +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/BusQueryLinesResponse.java @@ -36,7 +36,6 @@ public class BusQueryLinesResponse extends BaseData { public String startSiteName;//始发站名称 public String endSiteName;//终点名称 - public boolean open;//true 打开状态 false public boolean haveTask; public List taskList; diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/callback/IBusLinesCallback.java b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/callback/IBusLinesCallback.java index 9927dda46c..41d43009ee 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/callback/IBusLinesCallback.java +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/callback/IBusLinesCallback.java @@ -10,9 +10,9 @@ import java.util.List; * @date: 2022/2/9 */ public interface IBusLinesCallback { - void onBusLinesChange(List data); + default void onBusLinesChange(List data){} void onChangeLineIdSuccess(); - void onBusLineTasks(List o, int position,boolean autoRefresh); + default void onBusLineTasks(List o){} void onRefreshSuccess(long currentTimeStamp); diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/BusLineModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/BusLineModel.kt index 469cb23a3b..18eeb09bc3 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/BusLineModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/BusLineModel.kt @@ -48,6 +48,7 @@ import com.mogo.och.weaknet.database.transform.transform4DataBase import com.mogo.och.weaknet.net.OrderServiceManager import io.reactivex.Observer import io.reactivex.disposables.Disposable +import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicBoolean /** @@ -57,7 +58,9 @@ import java.util.concurrent.atomic.AtomicBoolean @SuppressLint("StaticFieldLeak") object BusLineModel { private var mContext: Context? = null - private var mBusLinesCallback: IBusLinesCallback? = null + + private val mBusLinesCallbackMap: MutableMap = ConcurrentHashMap() + private const val TAG = "BusLineModel" private const val LoopCarInfo = "LoopCarInfo" @@ -101,13 +104,18 @@ object BusLineModel { fun release() { mContext = null EventModel.release() - mBusLinesCallback = null + mBusLinesCallbackMap.clear() BizLoopManager.removeCallback(loopQueryInfo) } @JvmStatic - fun setBusLinesCallback(callback: IBusLinesCallback?) { - mBusLinesCallback = callback + fun setBusLinesCallback(tag:String,callback: IBusLinesCallback?) { + if (tag == null || "" == tag) return + if (callback == null) { + mBusLinesCallbackMap.remove(tag) + return + } + mBusLinesCallbackMap[tag] = callback } fun refreshTask() { @@ -139,7 +147,9 @@ object BusLineModel { SharedPrefsMgr.getInstance().putLong(executableChangeTime, currentTimeStamp) val sameDay = DateTimeUtil.isSameDay(currentTimeStamp, lastUpdateTime) - mBusLinesCallback?.onRefreshSuccess(currentTimeStamp) + mBusLinesCallbackMap.forEach { + it.value.onRefreshSuccess(currentTimeStamp) + } if(isBackground){ if (currentRequest == lastChangeMd5 && sameDay) { return @@ -203,7 +213,9 @@ object BusLineModel { } override fun onNext(data: List) { - mBusLinesCallback?.onBusLinesChange(data) + mBusLinesCallbackMap.forEach { + it.value.onBusLinesChange(data) + } } }) @@ -215,7 +227,7 @@ object BusLineModel { * @param position 位置 */ @JvmStatic - fun queryBusLineTasksById(lineId: Long, position: Int, autoRefresh: Boolean) { + fun queryBusLineTasksById(lineId: Long) { TaskRepository.queryCanUserTask(lineId) ?.transform4DataBase(TransformTask()) ?.subscribe(object : Observer> { @@ -232,8 +244,8 @@ object BusLineModel { } override fun onNext(data: List) { - if (mBusLinesCallback != null) { - mBusLinesCallback!!.onBusLineTasks(data, position, autoRefresh) + mBusLinesCallbackMap.forEach { + it.value.onBusLineTasks(data) } } @@ -254,12 +266,16 @@ object BusLineModel { SharedPrefsMgr.getInstance() .putLong(LASTCOMMITLINEID, line.lineId) EventRepository.saveEventTaskStart(task.id,line.lineId,task.taskStartTime,line.name) - mBusLinesCallback?.onChangeLineIdSuccess() + mBusLinesCallbackMap.forEach { + it.value.onChangeLineIdSuccess() + } } override fun startFail(msg: String) { ToastUtils.showShort("选择任务失败:$msg") - mBusLinesCallback?.onChangeLineIdFail() + mBusLinesCallbackMap.forEach { + it.value.onChangeLineIdFail() + } } }) diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwitchBizView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwitchBizView.kt new file mode 100644 index 0000000000..72b45359be --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwitchBizView.kt @@ -0,0 +1,125 @@ +package com.mogo.och.weaknet.ui.bizswitch + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.och.common.module.utils.ResourcesUtils +import com.mogo.och.common.module.wigets.WindowRelativeLayout +import com.mogo.och.shuttle.weaknet.R +import com.mogo.och.weaknet.bean.BusQueryLinesResponse +import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.loading_biz +import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.swtichLine +import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.swtichTask + +class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.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, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + + companion object { + const val TAG = "SwitchBizView" + } + + private var viewModel: SwtichBizeModel?=null + + + init { + LayoutInflater.from(context).inflate(R.layout.shuttle_weak_switch_biz, this, true) + initView() + } + + private fun initView(){ + loading_biz.setEmptyText(ResourcesUtils.getString(R.string.bus_switch_biz_loading)) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(SwtichBizeModel::class.java) + } + viewModel?.setDistanceCallback(this) + } + + var startLoading = System.currentTimeMillis() + + // 展示loading页面 + override fun showLoadingView(){ + startLoading = System.currentTimeMillis() + loading_biz.visibility = VISIBLE + swtichLine.visibility = GONE + swtichTask.visibility = GONE + } + + + /** + * 初始化数据 + */ + override fun loadLineData() { + showLoadingView() + swtichLine.loadingDatas() + } + + + override fun showSwitchTaskByLineInfo(lineInfo: BusQueryLinesResponse.Result) { + // 展示loading + showLoadingView() + swtichTask.queryTaskByLineInfo(lineInfo) + } + + override fun showSwitchTaskInfo() { + val endLoading = System.currentTimeMillis() + val dex = endLoading - startLoading + CallerLogger.d(TAG,"展示线路任务 lading 展示了 ${dex}毫秒") + if(dex <100){ + ThreadUtils.runOnUiThreadDelayed({ + loading_biz.visibility = GONE + swtichLine.visibility = GONE + swtichTask.visibility = VISIBLE + },100-dex,ThreadUtils.MODE.QUEUE) + }else{ + loading_biz.visibility = GONE + swtichLine.visibility = GONE + swtichTask.visibility = VISIBLE + } + } + + // 展示选择线路页面 + override fun showSwtichLineView() { + val endLoading = System.currentTimeMillis() + val dex = endLoading - startLoading + CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒") + if(dex <100){ + ThreadUtils.runOnUiThreadDelayed({ + loading_biz.visibility = GONE + swtichLine.visibility = VISIBLE + swtichTask.visibility = GONE + },100-dex,ThreadUtils.MODE.QUEUE) + }else{ + loading_biz.visibility = GONE + swtichLine.visibility = VISIBLE + swtichTask.visibility = GONE + } + + } + + fun showSwitchTaskView(){ + + } + fun showRunningTaskView(){ + + } + + + +} diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwtichBizeModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwtichBizeModel.kt new file mode 100644 index 0000000000..e24cb8cdfe --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/bizswitch/SwtichBizeModel.kt @@ -0,0 +1,56 @@ +package com.mogo.och.weaknet.ui.bizswitch + +import androidx.lifecycle.ViewModel +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.och.weaknet.bean.BusQueryLinesResponse +import com.mogo.och.weaknet.model.BusLineModel + +/** + * @author XuXinChao + * @description BadCase录包管理页面 + * @since: 2022/12/15 + */ +class SwtichBizeModel : ViewModel() { + + private val TAG = SwtichBizeModel::class.java.simpleName + + private var viewCallback:SwtichLineViewCallback?=null + + + override fun onCleared() { + } + + fun setDistanceCallback(viewCallback:SwtichLineViewCallback){ + this.viewCallback = viewCallback + this.viewCallback?.loadLineData() + } + + fun loadingSwitchTask(lineInfo:BusQueryLinesResponse.Result){ + viewCallback?.showSwitchTaskByLineInfo(lineInfo) + } + + fun showSwitchTaskInfo() { + viewCallback?.showSwitchTaskInfo() + } + + fun showSwitchLineInfo() { + viewCallback?.loadLineData() + } + fun showSwitchLineInfoResult(){ + viewCallback?.showSwtichLineView() + } + + fun showRunningTaskView() { + + } + + interface SwtichLineViewCallback{ + fun showSwtichLineView() + fun showLoadingView() + fun showSwitchTaskByLineInfo(lineInfo: BusQueryLinesResponse.Result) + fun showSwitchTaskInfo() + fun loadLineData() + } + +} + diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewBig.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewBig.kt new file mode 100644 index 0000000000..260bf2d547 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewBig.kt @@ -0,0 +1,69 @@ +package com.mogo.och.weaknet.ui.loading + +import android.animation.ObjectAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.animation.LinearInterpolator +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.map.listener.IMogoMapListener +import com.mogo.och.shuttle.weaknet.R +import kotlinx.android.synthetic.main.shuttle_weak_loading_view.view.actv_loading_text +import kotlinx.android.synthetic.main.shuttle_weak_loading_view.view.loading_view + +class LoadingViewBig @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener { + companion object { + const val TAG = "LoadingMapStatusView" + } + + private var autopilotLoadingAnimator: ObjectAnimator? = null + + init { + LayoutInflater.from(context).inflate(R.layout.shuttle_weak_loading_view, this, true) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerLogger.d(TAG,"onAttachedToWindow") + if (autopilotLoadingAnimator == null) { + autopilotLoadingAnimator = ObjectAnimator.ofFloat(loading_view, "rotation", 0f, 360f) + autopilotLoadingAnimator?.setInterpolator(LinearInterpolator()) + autopilotLoadingAnimator?.setRepeatCount(-1) //无限循环 + autopilotLoadingAnimator?.setDuration(1000) //设置持续时间 + } + } + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(isVisible){ + autopilotLoadingAnimator?.start() + }else{ + autopilotLoadingAnimator?.cancel() + } + } + + fun setEmptyText(text:CharSequence){ + if (ThreadUtils.isMainThread()) { + actv_loading_text.text = text + }else{ + ThreadUtils.runOnUiThread( { + actv_loading_text.text = text + },ThreadUtils.MODE.QUEUE) + } + } + + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerLogger.d(TAG,"onDetachedFromWindow") + } + + + +} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewSmall.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewSmall.kt new file mode 100644 index 0000000000..d6cbcdff9d --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/loading/LoadingViewSmall.kt @@ -0,0 +1,56 @@ +package com.mogo.och.weaknet.ui.loading + +import android.animation.ObjectAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.animation.LinearInterpolator +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.map.listener.IMogoMapListener +import com.mogo.och.shuttle.weaknet.R +import kotlinx.android.synthetic.main.shuttle_weak_loading_view_samll.view.loading_view_samll + +class LoadingViewSmall @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener { + companion object { + const val TAG = "LoadingMapStatusView" + } + + private var autopilotLoadingAnimator: ObjectAnimator? = null + + init { + LayoutInflater.from(context).inflate(R.layout.shuttle_weak_loading_view_samll, this, true) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerLogger.d(TAG,"onAttachedToWindow") + if (autopilotLoadingAnimator == null) { + autopilotLoadingAnimator = ObjectAnimator.ofFloat(loading_view_samll, "rotation", 0f, 360f) + autopilotLoadingAnimator?.setInterpolator(LinearInterpolator()) + autopilotLoadingAnimator?.setRepeatCount(-1) //无限循环 + autopilotLoadingAnimator?.setDuration(1000) //设置持续时间 + } + } + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(isVisible){ + autopilotLoadingAnimator?.start() + }else{ + autopilotLoadingAnimator?.cancel() + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerLogger.d(TAG,"onDetachedFromWindow") + } + + + +} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineAdapter.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineAdapter.kt index e4cb67be3f..0d7b905afd 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineAdapter.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineAdapter.kt @@ -60,97 +60,21 @@ class SwitchLineAdapter( holder.lineName.text = line.name val string = mContext.getString(R.string.bus_line_goto_end, line.endSiteName) holder.lineEndName.text = string - holder.rvLineTask.layoutManager = GridLayoutManager(mContext, 3) - val switchLineTaskAdapter = SwitchLineTaskAdapter( - mContext, - if(checkTask==null) -1 else checkTask!!.id, - line.taskList, - object : SwitchLineTaskAdapter.TaskItemClickListener { - override fun onItemClick(position: Int,isCheck:Boolean) { - try { - if(isCheck) { - checkLine = line - checkTask = line.taskList[position] - }else{ - checkLine=null - checkTask=null - } - }catch (e:Exception){ - e.printStackTrace() - checkLine=null - checkTask=null - } - } - }) - holder.rvLineTask.adapter = switchLineTaskAdapter - holder.rvLineTask.isFocusableInTouchMode = false - holder.actvShowMore.visibility = View.VISIBLE - - if(line.open){ - if(line.taskList==null||line.taskList.isEmpty()){ - holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task) - holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,R.color.bus_color_4dffffff)) - holder.vLineTask.visibility = View.GONE - holder.rvLineTask.visibility = View.GONE - holder.selectIv.visibility = View.INVISIBLE - holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal) - }else { - holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task) - holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,android.R.color.white)) - holder.vLineTask.visibility = View.VISIBLE - holder.rvLineTask.visibility = View.VISIBLE - holder.selectIv.visibility = View.VISIBLE - holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_selected) - holder.selectIv.apply { - pivotX = 9.5f - pivotY = 17f - rotation = 90f - } - } - }else{ - if(line.haveTask){ - holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_no_task) - holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,R.color.bus_color_4dffffff)) - holder.vLineTask.visibility = View.GONE - holder.rvLineTask.visibility = View.GONE - holder.selectIv.visibility = View.INVISIBLE - holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal) - }else { - holder.actvShowMore.text = mContext.getString(R.string.bus_switch_line_select_task) - holder.actvShowMore.setTextColor(ContextCompat.getColor(mContext,android.R.color.white)) - holder.vLineTask.visibility = View.GONE - holder.rvLineTask.visibility = View.GONE - holder.selectIv.visibility = View.VISIBLE - holder.itemView.setBackgroundResource(R.drawable.bus_shape_select_line_item_bg_normal) - holder.selectIv.apply { - pivotX = 9.5f - pivotY = 17f - rotation = 0f - } - } - } //设置item点击事件 holder.itemView.setOnClickListener { - if(holder.actvShowMore.text==mContext.getString(R.string.bus_switch_line_no_task)){ - return@setOnClickListener - } mData.forEachIndexed { index, result -> - if(result.open){ - result.open = false; - notifyItemChanged(index) - if(result.taskList!=null) { - result.taskList.clear() - } - if(index==currentPosition){// 点击当前已经打开的item 去关闭定时网络请求 - mItemClickListener?.onItemClick(currentPosition,true) - return@setOnClickListener - } + notifyItemChanged(index) + if(result.taskList!=null) { + result.taskList.clear() + } + if(index==currentPosition){// 点击当前已经打开的item 去关闭定时网络请求 + mItemClickListener?.onItemClick(currentPosition,true) + return@setOnClickListener } } mItemClickListener?.onItemClick(currentPosition,false) - line.open = holder.rvLineTask.visibility == View.GONE } } @@ -163,21 +87,8 @@ class SwitchLineAdapter( } class SwitchLineViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - val selectIv: ImageView - val lineName: AppCompatTextView//线路名称 - val lineEndName: AppCompatTextView //终点 - val actvShowMore: AppCompatTextView //选择时间 - val rvLineTask: RecyclerView// 排班时间 - val vLineTask: View// 白色分割线 - - init { - selectIv = itemView.findViewById(R.id.switch_line_item_select_iv) - lineName = itemView.findViewById(R.id.switch_line_name) - lineEndName = itemView.findViewById(R.id.switch_line_end_station) - rvLineTask = itemView.findViewById(R.id.rv_line_task_list) - vLineTask = itemView.findViewById(R.id.v_line_task) - actvShowMore = itemView.findViewById(R.id.actv_show_more) - } + val lineName: AppCompatTextView = itemView.findViewById(R.id.switch_line_name)//线路名称 + val lineEndName: AppCompatTextView = itemView.findViewById(R.id.switch_line_end_station) //终点 } interface LineItemClickListener { diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineTaskAdapter.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineTaskAdapter.kt deleted file mode 100644 index fed59bb858..0000000000 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineTaskAdapter.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.mogo.och.weaknet.ui.switchline - -import android.content.Context -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import com.mogo.eagle.core.utilcode.util.TimeUtils -import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse -import com.mogo.och.weaknet.ui.switchline.SwitchLineTaskAdapter.SwitchLineTaskViewHolder -import com.mogo.och.shuttle.weaknet.R - -/** - * 路线列表adapter - */ -class SwitchLineTaskAdapter( - private val mContext: Context, - private var checkTaskId:Long, - private val mData: List?, - private val mTaskItemClickListener: TaskItemClickListener? -) : RecyclerView.Adapter() { - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SwitchLineTaskViewHolder { - val view = LayoutInflater.from(mContext).inflate( - R.layout.shuttle_weak_switch_line_list_task_item, parent, false - ) - return SwitchLineTaskViewHolder(view) - } - - override fun onBindViewHolder(holder: SwitchLineTaskViewHolder, position: Int) { - val currentPosition = holder.bindingAdapterPosition - val task = mData!![currentPosition] - val taskStartTime = TimeUtils.millis2String(task.taskStartTime, "HH:mm") - holder.lineTask.text = taskStartTime - if(checkTaskId==task.id){ - holder.lineTask.setBackgroundResource(R.drawable.bus_shape_select_line_item_time_bg_selected) - }else{ - holder.lineTask.setBackgroundResource(R.drawable.bus_shape_select_line_item_time_bg) - } - holder.lineTask.setOnClickListener { - if(checkTaskId==task.id){ - checkTaskId = -1 - mTaskItemClickListener?.onItemClick(currentPosition,false) - }else { - resetOther() - checkTaskId = task.id - mTaskItemClickListener?.onItemClick(currentPosition,true) - } - notifyItemChanged(currentPosition) - } - } - - private fun resetOther() { - mData?.forEachIndexed { index, result -> - if(result.id==checkTaskId){ - checkTaskId = -1 - notifyItemChanged(index) - } - } - } - - override fun getItemCount(): Int { - return mData?.size ?: 0 - } - - class SwitchLineTaskViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - val lineTask: TextView // 时间 - init { - lineTask = itemView.findViewById(R.id.actv_line_task) - } - } - - interface TaskItemClickListener { - fun onItemClick(position: Int,isCheck:Boolean) - } -} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt index b768d290c4..72cff90e0a 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt @@ -3,12 +3,11 @@ package com.mogo.och.weaknet.ui.switchline import android.animation.ObjectAnimator import android.animation.ValueAnimator import android.content.Context -import android.content.res.ColorStateList -import android.graphics.Color import android.util.AttributeSet import android.view.LayoutInflater import android.view.View import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner import androidx.recyclerview.widget.LinearLayoutManager import com.mogo.commons.storage.SharedPrefsMgr import com.mogo.eagle.core.utilcode.kotlin.onClick @@ -21,14 +20,12 @@ import com.mogo.och.shuttle.weaknet.R import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse import com.mogo.och.weaknet.bean.BusQueryLinesResponse import com.mogo.och.weaknet.model.BusLineModel +import com.mogo.och.weaknet.ui.bizswitch.SwtichBizeModel import kotlinx.android.synthetic.main.shuttle_wadk_task_running.view.no_order_data_view import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.aciv_refresh_task import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.actv_last_refresh_date -import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.pb_start_task -import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.switch_line_btn_commit -import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.switch_line_close import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.switch_line_rv -import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.tv_start_task +import me.jessyan.autosize.utils.AutoSizeUtils class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallback { @@ -47,8 +44,8 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba const val TAG = "BadCaseManagerView" } - private var clickListener:ClickListener?=null private var viewModel:SwtichLineModel?=null + private var viewbizModel:SwtichBizeModel?=null private lateinit var mAdapter: SwitchLineAdapter @@ -63,32 +60,20 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba } private fun initView(){ - switch_line_close.onClick { - clickListener?.onClose() - } - switch_line_btn_commit.onClick { - if(mAdapter.checkLine!=null&&mAdapter.checkTask!=null){ - viewModel?.let { - it.commitSwitchLineId(mAdapter.checkTask!!,mAdapter.checkLine!!) - startTaskLoading() - } - }else{ - ToastUtils.showLong("请选择任务") - } - } linearLayoutManager = LinearLayoutManager(context) switch_line_rv.setLayoutManager(linearLayoutManager) mAdapter = SwitchLineAdapter(context, mutableListOf()) switch_line_rv.addItemDecoration( SpacesItemDecoration( - 4 + AutoSizeUtils.dp2px(context,20f) ) ) switch_line_rv.setAdapter(mAdapter) //设置item 点击事件 mAdapter.setOnLineItemClickListener(object : SwitchLineAdapter.LineItemClickListener{ override fun onItemClick(position: Int, close: Boolean) { - viewModel?.queryBusLineTasks(mAdapter.mData[position].lineId, position, close) + viewbizModel?.loadingSwitchTask(mAdapter.mData[position]) + //viewModel?.queryBusLineTasks(mAdapter.mData[position].lineId, position, close) } }) @@ -102,72 +87,40 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba } animator?.start() } - pb_start_task.progressTintList = ColorStateList.valueOf(Color.WHITE) - } /** * 初始化数据 */ - private fun initDatas() { + fun loadingDatas() { viewModel?.queryBusLines() viewModel?.setRefreshTime() } - fun setOnClickListener(clickListener: ClickListener) { - this.clickListener = clickListener - } - - - interface ClickListener { - fun onClose() - } - override fun onAttachedToWindow() { super.onAttachedToWindow() - viewModel = ViewModelProvider(this).get(SwtichLineModel::class.java) - viewModel?.setDistanceCallback(this) - initDatas() - } + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(SwtichLineModel::class.java) + } + viewbizModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(SwtichBizeModel::class.java) + } - fun startTaskLoading(){ - pb_start_task.visibility = View.VISIBLE - tv_start_task.text = "创建中" + viewModel?.setDistanceCallback(this) } override fun startTaskState(success: Boolean) { - pb_start_task.visibility = View.GONE - if(success){ - tv_start_task.text = "创建成功" - }else{ - tv_start_task.text = "创建失败" - UiThreadHandler.postDelayed({ - tv_start_task.text = "确定" - },1_000) - } + } override fun onBusLinesChange(data: MutableList?) { if (data.isNullOrEmpty()) { showNoData(true) - return - } - val lastCommitLineid = SharedPrefsMgr.getInstance().getLong(BusLineModel.LASTCOMMITLINEID, -1) - if (data.size > 0) { + }else{ showNoData(false) mAdapter.setDataList(data) - if(lastCommitLineid>0){ - mAdapter.mData.forEachIndexed { index, line -> - if(line.lineId==lastCommitLineid){ - line.open = true - viewModel?.queryBusLineTasks(line.lineId,index,false) - return - } - } - } - } else { - showNoData(true) } + viewbizModel?.showSwitchLineInfoResult() } /** @@ -177,11 +130,9 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba private fun showNoData(b: Boolean) { if (b) { switch_line_rv.visibility = View.GONE - switch_line_btn_commit.visibility = View.GONE no_order_data_view.visibility = View.VISIBLE } else { switch_line_rv.visibility = View.VISIBLE - switch_line_btn_commit.visibility = View.VISIBLE no_order_data_view.visibility = View.GONE } } @@ -190,46 +141,6 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba ToastUtils.showLong(resources.getString(R.string.bus_change_line_commit_tip_s)) viewModel?.queryBusRoutes() mAdapter.setOnLineItemClickListener(null) - clickListener?.onClose() - } - - override fun onBusLineTasks(lineTaskInfo: List, position: Int, autoRefresh:Boolean) { - val result = mAdapter.mData[position] - if (result.taskList == null) { - result.taskList = ArrayList() - } - if (lineTaskInfo == null) { - result.haveTask = true - // 打开操作 - mAdapter.notifyItemChanged(position) - } else { - if ( lineTaskInfo.isEmpty()) { - result.haveTask = true - } - if (lineTaskInfo.size != result.taskList.size) { // 不相等有变动 重新赋值 - result.taskList.clear() - result.taskList.addAll(lineTaskInfo) - if(autoRefresh) { - mAdapter.checkTask = null - mAdapter.checkLine = null - lineTaskInfo.forEach {lineTaskInfoInner-> - mAdapter.checkTask?.let { - if (lineTaskInfoInner.id == it.id) { - mAdapter.checkTask = lineTaskInfoInner - mAdapter.checkLine = result - } - } - } - } - // 打开操作 - mAdapter.notifyItemChanged(position) - linearLayoutManager.stackFromEnd = - (position == mAdapter.itemCount - 1 || position == mAdapter.itemCount - 2) && mAdapter.itemCount > 6 - switch_line_rv.smoothScrollToPosition(position) - }else if(lineTaskInfo.isEmpty()){ - mAdapter.notifyItemChanged(position) - } - } } override fun refreshDate(formatLongToString: String?) { diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt index 6c88562e6d..271af171ea 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt @@ -2,25 +2,14 @@ package com.mogo.och.weaknet.ui.switchline import androidx.lifecycle.ViewModel import com.mogo.commons.storage.SharedPrefsMgr -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.och.common.module.utils.DateTimeUtil -import com.mogo.och.common.module.utils.RxUtils import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse import com.mogo.och.weaknet.bean.BusQueryLinesResponse -import com.mogo.och.weaknet.bean.WaitUploadLine import com.mogo.och.weaknet.callback.IBusLinesCallback import com.mogo.och.weaknet.model.BusLineModel import com.mogo.och.weaknet.model.BusLineModel.executableChangeTime -import com.mogo.och.weaknet.model.BusLineModel.queryBusLineTasksById -import com.mogo.och.weaknet.model.EventModel import com.mogo.och.weaknet.model.OrderModel -import io.reactivex.Observable -import io.reactivex.Observer -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.Disposable -import io.reactivex.schedulers.Schedulers -import java.util.concurrent.TimeUnit /** * @author XuXinChao @@ -33,16 +22,14 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback { private var viewCallback:SwtichLineViewCallback?=null - private var subscribe: Disposable? = null override fun onCleared() { - RxUtils.disposeSubscribe(subscribe) - BusLineModel.setBusLinesCallback(null) + BusLineModel.setBusLinesCallback(TAG,null) } fun setDistanceCallback(viewCallback:SwtichLineViewCallback){ this.viewCallback = viewCallback - BusLineModel.setBusLinesCallback(this) + BusLineModel.setBusLinesCallback(TAG,this) } fun queryBusLines() { @@ -60,23 +47,6 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback { BusLineModel.refreshTask() } - fun queryBusLineTasks(lineId: Long, position: Int, close: Boolean) { - if (subscribe != null && !subscribe!!.isDisposed) { - subscribe!!.dispose() - } - if (close) { - return - } - queryBusLineTasksById(lineId, position, false) - subscribe = Observable.interval(3, TimeUnit.MINUTES).subscribe { aLong: Long? -> - queryBusLineTasksById(lineId, position, true) - } - } - - fun commitSwitchLineId(taskId: BusQueryLineTaskResponse.Result, lineId: BusQueryLinesResponse.Result) { - BusLineModel.commitSwitchLineId(taskId, lineId) - } - fun queryBusRoutes() { OrderModel.queryBusRoutes() } @@ -85,12 +55,6 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback { fun startTaskState(success: Boolean) fun onBusLinesChange(data: MutableList?) fun onChangeLineIdSuccess() - fun onBusLineTasks( - lineTaskInfo: List, - position: Int, - autoRefresh: Boolean - ) - fun refreshDate(formatLongToString: String?) } @@ -104,17 +68,9 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback { },ThreadUtils.MODE.QUEUE) } - override fun onBusLineTasks( - o: MutableList, - position: Int, - autoRefresh: Boolean - ) { - viewCallback?.onBusLineTasks(o,position,autoRefresh) - } - override fun onRefreshSuccess(currentTimeStamp: Long) { viewCallback?.refreshDate( - DateTimeUtil.formatLongToString(currentTimeStamp, DateTimeUtil.yyyy_MM_dd_HH_mm_ss) + DateTimeUtil.formatLongToString(currentTimeStamp, DateTimeUtil.HH_mm_ss) ) } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchLineTaskAdapter.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchLineTaskAdapter.kt new file mode 100644 index 0000000000..31531da6ed --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchLineTaskAdapter.kt @@ -0,0 +1,129 @@ +package com.mogo.och.weaknet.ui.switchtask + +import android.content.Context +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.appcompat.widget.AppCompatCheckedTextView +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.DiffUtil.Callback +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse +import com.mogo.och.weaknet.ui.switchtask.SwitchLineTaskAdapter.SwitchLineTaskViewHolder +import com.mogo.och.shuttle.weaknet.R + +/** + * 路线列表adapter + */ +@Suppress("UNUSED_EXPRESSION") +class SwitchLineTaskAdapter( + private val mContext: Context, + private var checkTask:BusQueryLineTaskResponse.Result?, + private val mData: MutableList, +) : RecyclerView.Adapter() { + + fun setDataList(dataList: List) { + if (this.mData == dataList) { + // 如果新旧列表一致,则直接返回 + return + } + + checkTask = null + + val diffResult = DiffUtil.calculateDiff(MyDiffCallback(this.mData, dataList)) + this.mData.clear() + this.mData.addAll(dataList) + diffResult.dispatchUpdatesTo(this) + } + + fun getCheckTask():BusQueryLineTaskResponse.Result?{ + return checkTask + } + + private var mTaskItemClickListener: TaskItemClickListener? = null + + fun setOnLineItemClickListener(mTaskItemClickListener: TaskItemClickListener?) { + this.mTaskItemClickListener = mTaskItemClickListener + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SwitchLineTaskViewHolder { + val view = LayoutInflater.from(mContext).inflate( + R.layout.shuttle_weak_switch_task_item, parent, false + ) + return SwitchLineTaskViewHolder(view) + } + + override fun onBindViewHolder(holder: SwitchLineTaskViewHolder, position: Int) { + val currentPosition = holder.bindingAdapterPosition + val task = mData[currentPosition] + val taskStartTime = TimeUtils.millis2String(task.taskStartTime, "HH:mm") + holder.taskTime.text = taskStartTime + + holder.taskTime.isChecked = if(checkTask!=null) checkTask!!.id == task.id else false + holder.taskTime.setOnClickListener { + if(checkTask==null){ + resetOther() + checkTask = task + mTaskItemClickListener?.onItemClick(currentPosition,true) + }else{ + if(checkTask!!.id==task.id){ + checkTask = null + mTaskItemClickListener?.onItemClick(currentPosition,false) + }else { + resetOther() + checkTask = task + mTaskItemClickListener?.onItemClick(currentPosition,true) + } + } + + notifyItemChanged(currentPosition) + } + + } + + private fun resetOther() { + mData.forEachIndexed { index, result -> + if(checkTask!=null && result.id==checkTask!!.id){ + checkTask = null + notifyItemChanged(index) + } + } + } + + override fun getItemCount(): Int { + return mData.size + } + + class SwitchLineTaskViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + val taskTime: AppCompatCheckedTextView = itemView.findViewById(R.id.actv_task_time) // 时间 + } + + interface TaskItemClickListener { + fun onItemClick(position: Int,isCheck:Boolean) + } + + inner class MyDiffCallback(private val oldData:List, private val newData:List): + Callback(){ + override fun getOldListSize(): Int { + return oldData.size + } + + override fun getNewListSize(): Int { + return newData.size + } + + override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { + val oldItem = oldData[oldItemPosition] + val newItem = newData[newItemPosition] + return oldItem.id == newItem.id + } + + override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { + val oldItem = oldData[oldItemPosition] + val newItem = newData[newItemPosition] + return oldItem.id == newItem.id + } + + } +} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt new file mode 100644 index 0000000000..7d0b96feb9 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwitchTaskView.kt @@ -0,0 +1,154 @@ +package com.mogo.och.weaknet.ui.switchtask + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.findViewTreeViewModelStoreOwner +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.eagle.core.utilcode.kotlin.onClick +import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.common.module.utils.ResourcesUtils +import com.mogo.och.common.module.wigets.WindowRelativeLayout +import com.mogo.och.shuttle.weaknet.R +import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse +import com.mogo.och.weaknet.bean.BusQueryLinesResponse +import com.mogo.och.weaknet.ui.bizswitch.SwtichBizeModel +import com.mogo.och.weaknet.ui.switchtask.SwitchLineTaskAdapter.TaskItemClickListener +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.actvLineEndStationName +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.actv_cancle_task +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.actv_submit_task +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.busLineName +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.cl_submit_task +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.include_empty +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.loading_start_line +import kotlinx.android.synthetic.main.shuttle_weak_switch_task.view.rv_switch_task +import me.jessyan.autosize.utils.AutoSizeUtils + + +class SwitchTaskView: WindowRelativeLayout, SwtichTaskModel.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, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes) + + + companion object { + const val TAG = "BadCaseManagerView" + } + + private var viewModel:SwtichTaskModel?=null + private var viewbizModel:SwtichBizeModel?=null + + private lateinit var mAdapter: SwitchLineTaskAdapter + + private lateinit var linearLayoutManager:LinearLayoutManager + + init { + LayoutInflater.from(context).inflate(R.layout.shuttle_weak_switch_task, this, true) + initView() + } + + private fun initView(){ + linearLayoutManager = GridLayoutManager(context, 3) + rv_switch_task.setLayoutManager(linearLayoutManager) + mAdapter = SwitchLineTaskAdapter(context,null, mutableListOf()) + rv_switch_task.setAdapter(mAdapter) + mAdapter.setOnLineItemClickListener(object : TaskItemClickListener{ + override fun onItemClick(position: Int, isCheck: Boolean) { + + } + }) + //rv_switch_task.setRecycledViewPool(null); + rv_switch_task.addItemDecoration( + TaskBottomDecoration( + AutoSizeUtils.dp2px(context, 174f) + ) + ) + + actv_submit_task.onClick { + val tempCheckTask = mAdapter.getCheckTask() + if(tempCheckTask==null){ + ToastUtils.showShort("请选择任务") + }else{ + viewModel?.changeLineStart(tempCheckTask) + } + } + actv_cancle_task.onClick { + viewbizModel?.showSwitchLineInfo() + } + } + + /** + * 初始化数据 + */ + private fun initDatas() { + viewModel?.queryBusLines() + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + + viewModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(SwtichTaskModel::class.java) + } + viewbizModel = findViewTreeViewModelStoreOwner()?.let { + ViewModelProvider(it).get(SwtichBizeModel::class.java) + } + viewModel?.setDistanceCallback(this) + initDatas() + } + + fun queryTaskByLineInfo(lineInfo: BusQueryLinesResponse.Result) { + viewModel?.queryBusLineTasksById(lineInfo) + busLineName.text = lineInfo.name + actvLineEndStationName.text = lineInfo.endSiteName + } + + override fun showTaskByLineIdResult(taskList: MutableList) { + if(taskList.isEmpty()){ + showEmptyView() + }else { + showData() + mAdapter.setDataList(taskList) + } + viewbizModel?.showSwitchTaskInfo() + } + + private fun showData(){ + actv_submit_task.setTextColor(ResourcesUtils.getColors(R.color.bus_task_submit_text_color_selector)) + actv_submit_task.isEnabled = true + rv_switch_task.visibility = VISIBLE + include_empty.visibility = GONE + } + override fun showLoading(){ + loading_start_line.visibility = VISIBLE + actv_submit_task.isEnabled = false + actv_cancle_task.isEnabled = false + } + + override fun hideLoading(){ + loading_start_line.visibility = GONE + actv_submit_task.isEnabled = true + actv_cancle_task.isEnabled = true + } + + override fun startTaskSuccess() { + viewbizModel?.showRunningTaskView() + } + + private fun showEmptyView(){ + actv_submit_task.setTextColor(ResourcesUtils.getColor(R.color.bus_color_66666)) + actv_submit_task.isEnabled = false + rv_switch_task.visibility = GONE + include_empty.visibility = VISIBLE + } + +} diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt new file mode 100644 index 0000000000..a9d06374c6 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/SwtichTaskModel.kt @@ -0,0 +1,98 @@ +package com.mogo.och.weaknet.ui.switchtask + +import androidx.lifecycle.ViewModel +import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.och.common.module.utils.RxUtils +import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse +import com.mogo.och.weaknet.bean.BusQueryLinesResponse +import com.mogo.och.weaknet.callback.IBusLinesCallback +import com.mogo.och.weaknet.model.BusLineModel +import io.reactivex.disposables.Disposable + +/** + * @author XuXinChao + * @description BadCase录包管理页面 + * @since: 2022/12/15 + */ +class SwtichTaskModel : ViewModel(), IBusLinesCallback { + + private val TAG = SwtichTaskModel::class.java.simpleName + + private var viewCallback:SwtichLineViewCallback?=null + + private var tasksBelongLine: BusQueryLinesResponse.Result? = null + + private var subscribe: Disposable? = null + + override fun onCleared() { + RxUtils.disposeSubscribe(subscribe) + BusLineModel.setBusLinesCallback(TAG,null) + } + + fun setDistanceCallback(viewCallback:SwtichLineViewCallback){ + this.viewCallback = viewCallback + BusLineModel.setBusLinesCallback(TAG,this) + } + + fun queryBusLines() { + BusLineModel.queryBusLines() + } + + fun queryBusLineTasksById(lineInfo: BusQueryLinesResponse.Result) { + tasksBelongLine = lineInfo + BusLineModel.queryBusLineTasksById(lineInfo.lineId) + } + + interface SwtichLineViewCallback{ + fun showTaskByLineIdResult(taskList: MutableList) + fun showLoading() + fun hideLoading() + fun startTaskSuccess() + } + + override fun onBusLineTasks(o: MutableList) { + viewCallback?.showTaskByLineIdResult(o) + } + + override fun onRefreshSuccess(currentTimeStamp: Long) { + TODO("Not yet implemented") + } + + // 选择线路成功 + override fun onChangeLineIdSuccess() { + if (ThreadUtils.isMainThread()) { + viewCallback?.hideLoading() + viewCallback?.startTaskSuccess() + }else{ + ThreadUtils.runOnUiThread({ + viewCallback?.hideLoading() + viewCallback?.startTaskSuccess() + },ThreadUtils.MODE.QUEUE) + } + + } + // 选择线路失败 + override fun onChangeLineIdFail() { + if (ThreadUtils.isMainThread()) { + viewCallback?.hideLoading() + }else{ + ThreadUtils.runOnUiThread({ + viewCallback?.hideLoading() + },ThreadUtils.MODE.QUEUE) + } + viewCallback?.hideLoading() + } + + fun changeLineStart(checkTask:BusQueryLineTaskResponse.Result) { + if(tasksBelongLine==null){ + ToastUtils.showShort("请重新选择线路") + return + } + viewCallback?.showLoading() + BusLineModel.commitSwitchLineId(checkTask,tasksBelongLine!!) + } + + +} + diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/TaskBottomDecoration.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/TaskBottomDecoration.kt new file mode 100644 index 0000000000..a6d7158f1e --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchtask/TaskBottomDecoration.kt @@ -0,0 +1,46 @@ +package com.mogo.och.weaknet.ui.switchtask + +import android.graphics.Rect +import android.view.View +import android.widget.LinearLayout +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger + +class TaskBottomDecoration(val distance: Int) : RecyclerView.ItemDecoration() { + + private val TAG = "TaskBottomDecoration" + + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + val pos = parent.getChildAdapterPosition(view) + /** + * 通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间 + */ + val itemCount = parent.adapter!!.itemCount + val layoutManager = parent.layoutManager + + 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){ + lastPathCount = layoutManager.spanCount + } + if(pos + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/color/bus_task_text_color_selector.xml b/OCH/shuttle/driver_weaknet/src/main/res/color/bus_task_text_color_selector.xml new file mode 100644 index 0000000000..d25528bf6f --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/color/bus_task_text_color_selector.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png new file mode 100755 index 0000000000..b65431da08 Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg_header.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg_header.png new file mode 100755 index 0000000000..8cc1c9e36e Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_biz_bg_header.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_line_task_arrow.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_line_task_arrow.png old mode 100644 new mode 100755 index b32f0693a6..47c387eb9f Binary files a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_line_task_arrow.png and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_line_task_arrow.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_big.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_big.png new file mode 100755 index 0000000000..2073b0eb67 Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_big.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_samll.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_samll.png new file mode 100755 index 0000000000..468b00604f Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_biz_loading_samll.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_line_adapter_point.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_line_adapter_point.png new file mode 100755 index 0000000000..b2c4edba60 Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_switch_line_adapter_point.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_weak_switch_task_bottom.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_weak_switch_task_bottom.png new file mode 100755 index 0000000000..07eae67fbe Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/bus_weak_switch_task_bottom.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_refresh_task.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_refresh_task.png old mode 100644 new mode 100755 index 74006bcc6c..9928698738 Binary files a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_refresh_task.png and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_refresh_task.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_weak_empty.png b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_weak_empty.png new file mode 100755 index 0000000000..93393ca8d0 Binary files /dev/null and b/OCH/shuttle/driver_weaknet/src/main/res/drawable-nodpi/shuttle_weak_empty.png differ diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_shape_select_line_item_bg_normal.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_shape_select_line_item_bg_normal.xml index 272e718cce..01a809ee6a 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_shape_select_line_item_bg_normal.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_shape_select_line_item_bg_normal.xml @@ -1,7 +1,6 @@ - + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_normal.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_normal.xml new file mode 100644 index 0000000000..01a809ee6a --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_normal.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selected.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selected.xml new file mode 100644 index 0000000000..c236e4a6e4 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selected.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selector.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selector.xml new file mode 100644 index 0000000000..6f1e2e2037 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_line_selector.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_normal.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_normal.xml new file mode 100644 index 0000000000..01a809ee6a --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_normal.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selected.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selected.xml new file mode 100644 index 0000000000..0e6053471f --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selected.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selector.xml b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selector.xml new file mode 100644 index 0000000000..67b7a651be --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/drawable/bus_switch_task_selector.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml index e66b6e78cf..6c307be248 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_base_fragment.xml @@ -364,4 +364,10 @@ app:layout_constraintStart_toStartOf="parent" /> + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_empty_view.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_empty_view.xml new file mode 100644 index 0000000000..a373c03087 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_empty_view.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view.xml new file mode 100644 index 0000000000..1267ed89a6 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view.xml @@ -0,0 +1,31 @@ + + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view_samll.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view_samll.xml new file mode 100644 index 0000000000..90cae6970a --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_loading_view_samll.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml new file mode 100644 index 0000000000..bb5bb00351 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_biz.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml index a2467b96bf..a2c9d13e8b 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml @@ -1,31 +1,20 @@ - - + android:layout_width="@dimen/dp_880" + android:layout_height="@dimen/dp_966" + xmlns:tools="http://schemas.android.com/tools"> - - + android:layout_width="@dimen/dp_60" + android:layout_height="@dimen/dp_50"/> @@ -63,41 +42,12 @@ android:id="@+id/switch_line_rv" android:layout_width="match_parent" android:layout_height="@dimen/dp_0" - app:layout_constraintLeft_toLeftOf="@+id/switch_line_1" + android:layout_marginStart="@dimen/dp_54" + android:layout_marginEnd="@dimen/bus_dp_52" app:layout_constraintTop_toBottomOf="@+id/actv_last_refresh_date" - app:layout_constraintBottom_toTopOf="@+id/switch_line_btn_commit" - android:layout_marginTop="@dimen/dp_50" - android:layout_marginBottom="@dimen/dp_30"/> - - - - - - + android:layout_marginTop="@dimen/dp_22" + android:layout_marginBottom="@dimen/dp_24"/> + android:background="@drawable/bus_switch_line_selector"> - + + @@ -33,15 +31,16 @@ android:id="@+id/switch_line_name" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="@dimen/dp_80" - android:layout_marginTop="@dimen/dp_34" + android:layout_marginStart="@dimen/dp_20" + android:layout_marginEnd="@dimen/dp_20" android:ellipsize="end" android:singleLine="true" android:textColor="@android:color/white" - android:textSize="@dimen/dp_46" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintEnd_toStartOf="@+id/actv_show_more" + android:textSize="@dimen/dp_40" + app:layout_constraintTop_toTopOf="@+id/aciv_line_point" + app:layout_constraintBottom_toBottomOf="@+id/aciv_line_point" + app:layout_constraintStart_toEndOf="@+id/aciv_line_point" + app:layout_constraintEnd_toStartOf="@+id/switch_line_item_select_iv" tools:text="@string/bus_switch_line_name" /> - - - - - \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml new file mode 100644 index 0000000000..874cc64731 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task_item.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task_item.xml new file mode 100644 index 0000000000..a015a562d6 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_task_item.xml @@ -0,0 +1,23 @@ + + + + diff --git a/OCH/shuttle/driver_weaknet/src/main/res/values/colors.xml b/OCH/shuttle/driver_weaknet/src/main/res/values/colors.xml index 6ee14e3379..456c3ab8f5 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/values/colors.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/values/colors.xml @@ -49,9 +49,16 @@ #FFFFE198 #FFFF9B00 #59FFFFFF + #4D000000 + #80000000 + #B3FFFFFF + #4D2EACFF + #666666 #CCB9C3E9 #4Dffffff + #B3ffffff + #2EACFF #8E9DD4 #2B6EFF diff --git a/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml b/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml index 4d614afe8f..ade46e7a91 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/values/strings.xml @@ -5,9 +5,12 @@ 启动成功 启动失败 自动驾驶 - 任务列表 + 请选择任务 暂无任务 选择时间 + 确认班次 + 返回 + 加载中…… 路线: 起点: 终点: @@ -17,6 +20,7 @@ 自动驾驶状态中,不可切换或结束路线 当前行程未完成,不可切换路线 当前车辆无路线\n请联系运营人员绑定 + 暂无任务 起点: 终点: 往%1$s方向 diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiCurrentTaskViewModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiCurrentTaskViewModel.kt index 5e8c681631..edcfce921e 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiCurrentTaskViewModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiCurrentTaskViewModel.kt @@ -274,7 +274,6 @@ class TaxiCurrentTaskViewModel : BaseViewModel(), val endStation = MogoLocation() endStation.longitude = curTaskAndOrder.endSite!!.gcjLon endStation.latitude = curTaskAndOrder.endSite!!.gcjLat - LineManager.setLineInfo(LineInfo(result.lineId,"")) TrajectoryAndDistanceManager.setStationPoint( startStation, endStation, diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt index c66d29a8b4..60a0b8b058 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt @@ -1119,6 +1119,9 @@ object TaxiTaskModel { data?.data?.also { mTaskTrajectoryList.addAll(it) mCurrentTaskTrajectory = it.first { currentTaskLineId == it.lineId } + mCurrentTaskTrajectory?.let {traj-> + LineManager.setLineInfo(LineInfo(traj.lineId,traj.lineName)) + } } mTaxiTaskWithOrderCallbackMap.forEach { val listener = it.value @@ -1304,7 +1307,6 @@ object TaxiTaskModel { val endStation = MogoLocation() endStation.longitude = curTaskAndOrder.endSite!!.gcjLon endStation.latitude = curTaskAndOrder.endSite!!.gcjLat - LineManager.setLineInfo(LineInfo(curTaskAndOrder.lineId,"")) TrajectoryAndDistanceManager.setStationPoint( startStation, endStation, diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml index a4e640e404..81273f9b37 100644 --- a/core/mogo-core-res/src/main/res/values/dimens.xml +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -1028,6 +1028,7 @@ 1000dp 1003dp 1017dp + 1051dp 1055dp 1090dp 1092dp