[M2] M2 行程信息UI初稿

This commit is contained in:
wangmingjun
2023-02-06 19:38:28 +08:00
parent 95e41e4e94
commit eb929dec00
4 changed files with 224 additions and 25 deletions

View File

@@ -25,6 +25,7 @@ import com.mogo.och.bus.passenger.network.PM2ModelLoopManager
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
import mogo.telematics.pad.MessagePad
import kotlin.math.abs
/**
* @author: wangmingjun
@@ -73,12 +74,18 @@ class PM2DrivingModel private constructor() {
CallerAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
// 定位监听
CallerChassisLocationGCJ20ListenerManager.addListener(TAG,
mMapLocationListener
)
CallerChassisLocationGCJ20ListenerManager.addListener(TAG, mMapLocationListener)
}
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback){
public fun releaseListener(){
//自动驾驶状态监听
CallerAutoPilotStatusListenerManager.removeListener(TAG)
// 定位监听
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
}
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
mDrivingInfoCallback = drivingInfoCallback
}
@@ -87,14 +94,16 @@ class PM2DrivingModel private constructor() {
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
if (null == mogoLocation) return
mLocation = mogoLocation
updateSpeed()
updateSpeed(mogoLocation)
}
}
private fun updateSpeed() {
//todo 传入速度
mDrivingInfoCallback?.updateSpeed(0)
private fun updateSpeed(mogoLocation: MogoLocation) {
// km/h
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
mDrivingInfoCallback?.updateSpeed(speedKM)
}
private val mAutoPilotStatusListener: IMoGoAutopilotStatusListener =

View File

@@ -1,7 +1,61 @@
package com.mogo.och.bus.passenger.presenter
import androidx.lifecycle.LifecycleOwner
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.passenger.callback.DrivingInfoCallback
import com.mogo.och.bus.passenger.model.PM2DrivingModel
import com.mogo.och.bus.passenger.ui.PM2DrivingInfoFragment
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
Presenter<PM2DrivingInfoFragment?>(view)
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback {
init {
PM2DrivingModel.INSTANCE.init(context)
initListener()
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
PM2DrivingModel.INSTANCE.releaseListener()
}
private fun initListener(){
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(this)
}
private fun destroyListener(){
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(null)
}
override fun updateSpeed(speed: Int) {
UiThreadHandler.post {
mView?.updateSpeed(speed)
}
}
override fun updatePlateNumber(carNum: String) {
UiThreadHandler.post {
mView?.updateCarPlateNum(carNum)
}
}
override fun updateLine(lineName: String, lineDuring: String) {
UiThreadHandler.post {
mView?.updateTaskName(lineName)
mView?.updateTaskDuringTime(lineDuring)
}
}
override fun updateRemainMT(meters: Long, timeInSecond: Long) {
TODO("Not yet implemented")
}
override fun changeOperationStatus(loginStatus: Boolean) {
TODO("Not yet implemented")
}
override fun showNoTaskView(isTrue: Boolean) {
TODO("Not yet implemented")
}
}

View File

@@ -48,6 +48,30 @@ class PM2DrivingInfoFragment :
overMapView.onDestroy()
}
fun updateSpeed(speed: Int){
speed_tv.text = speed.toString()
}
fun updateCarPlateNum(plateNum : String){
car_plate_tv.text = plateNum
}
fun updateTaskName(name: String){
task_name_tv.text = name
}
fun updateTaskDuringTime(time : String){
task_during_tv.text = time
}
fun updateCurrentTime(){
// current_time_tv.text =
// current_weekday_tv.text =
}
fun changeOperationStatus(status:Boolean){
}
override fun createPresenter(): PM2DrivingPresenter {
return PM2DrivingPresenter(this)
}

View File

@@ -4,29 +4,141 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 行车卡片--><!-- 全览地图带站点-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/driving_view"
android:layout_width="@dimen/dp_800"
android:layout_height="@dimen/dp_600"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="这是driving"
android:textSize="@dimen/dp_60"/>
android:padding="@dimen/dp_30">
<!-- 红绿灯-->
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView/>-->
<!-- 行车卡片-->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/speed_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="@dimen/dp_45"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- 转向灯 IMoGoChassisLamplightListener-->
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:textSize="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="@+id/speed_tv"
app:layout_constraintLeft_toRightOf="@+id/speed_tv" />
<!-- <com.mogo.eagle.core.function.hmi.ui.turnlight.TurnLightViewStatus-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content" />-->
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/auto_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:text="--"
android:textColor="@color/color_FFFFFF"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/speed_tv" />
<!-- 转向灯 IMoGoChassisLamplightListener-->
<com.mogo.eagle.core.function.hmi.ui.vehicle.TurnLightViewStatus
android:id="@+id/turn_light_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
app:layout_constraintLeft_toRightOf="@+id/auto_tv"
app:layout_constraintTop_toTopOf="@+id/auto_tv" />
<!-- 红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/traffic_light_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
app:layout_constraintLeft_toRightOf="@+id/turn_light_view"
app:layout_constraintTop_toTopOf="@+id/auto_tv" />
<View
android:id="@+id/dividing_line_1"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:layout_marginTop="@dimen/dp_40"
android:background="@color/bus_p_traffic_light_bg_stroke"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/auto_tv" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/car_plate_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_1"
android:textStyle="bold"
android:text="--"
android:textSize="@dimen/dp_24"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/task_name_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toRightOf="@+id/car_plate_tv"
app:layout_constraintBottom_toBottomOf="@+id/car_plate_tv"
android:textStyle="bold"
android:text="--"
android:textSize="@dimen/dp_24"
android:textColor="@color/bus_p_line_name_color"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/task_during_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/car_plate_tv"
android:layout_marginTop="@dimen/dp_20"
android:textSize="@dimen/dp_20"
android:text="--"
android:textColor="@color/bus_p_line_name_color"/>
<View
android:id="@+id/dividing_line_2"
android:layout_width="match_parent"
android:layout_height="@dimen/bus_p_route_line_dividing_view_height"
android:layout_marginTop="@dimen/dp_40"
android:background="@color/bus_p_traffic_light_bg_stroke"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/task_during_tv" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_time_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dividing_line_2"
android:textSize="@dimen/dp_24"
android:textStyle="bold"
android:text="--"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/current_weekday_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/current_time_tv"
android:textSize="@dimen/dp_24"
android:text="--"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- 全览地图带站点-->
<com.mogo.eagle.core.function.overview.view.OverMapView
android:id="@+id/overMapView"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_400"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
android:layout_width="0dp"
android:layout_height="@dimen/dp_600"
app:layout_constraintLeft_toRightOf="@+id/driving_view"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>