Merge remote-tracking branch 'origin/dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0

This commit is contained in:
wangmingjun
2023-02-17 17:49:33 +08:00
10 changed files with 93 additions and 70 deletions

View File

@@ -77,6 +77,7 @@ dependencies {
compileOnly project(":libraries:mogo-map")
compileOnly project(':libraries:mogo-adas')
implementation project(':core:mogo-core-res')
testImplementation 'junit:junit:4.12'
}

View File

@@ -99,7 +99,7 @@ class BusPassengerFunctionDevicePresenter(view: BusPassengerFunctionDeviceFragme
}
private fun canOpenOrCloseDoor():String?{
if(gnssSpeed==0.0){
if(gnssSpeed<0.01){
return null
}else{
return "速度:${gnssSpeed}车辆正在运行、请稍后再试"

View File

@@ -52,6 +52,9 @@ class BusPassengerRouteFragment :
v_debug.setOnLongClickListener {
ToggleDebugView.toggleDebugView.toggle(requireContext())
true
}
viewBusPM1MsgBoxButton.onClick {
}
viewBusPM1MsgBoxButton.setClickListener(object : MMsgBoxButtonView.ClickListener {
override fun showMsgBoxList(show: Boolean) {
@@ -70,28 +73,22 @@ class BusPassengerRouteFragment :
}
private fun openSettingPage(tab: String) {
CallerHmiManager.hideToolsView()
val fragmentByTag: Fragment? =
childFragmentManager.findFragmentByTag(BusPassengerFunctionFragment.TAG)
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(BusPassengerFunctionFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(
SceneConstant.M_TAXI + LoginServiceImpl.TAG,
"showLoginDialogFragment 权限验证"
)
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "权限验证")
return
}
}
}
if (bpFunctionGroupDialogFragment?.get() == null) {
bpFunctionGroupDialogFragment =
WeakReference(BusPassengerFunctionFragment.newInstance())
bpFunctionGroupDialogFragment = WeakReference(BusPassengerFunctionFragment.newInstance())
}
val bpFunctionGroup = bpFunctionGroupDialogFragment?.get()
bpFunctionGroup?.arguments?.putString(BusPassengerFunctionFragment.SELECTTAB, tab)
@@ -104,15 +101,11 @@ class BusPassengerRouteFragment :
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
bpFunctionGroup.show(parentFragmentManager, LoginServiceImpl.TAG)
CallerLogger.d(
SceneConstant.M_TAXI + LoginServiceImpl.TAG,
"showLoginDialogFragment 展示登录界面"
)
bpFunctionGroup.show(parentFragmentManager, TAG)
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "展示$tab")
} else {
CallerLogger.d(
SceneConstant.M_TAXI + LoginServiceImpl.TAG,
"showLoginDialogFragment 展示登录界面 1s内执行一次"
SceneConstant.M_BUS_P + TAG, "dialog 1s内执行一次"
)
}
}

View File

@@ -21,6 +21,7 @@ import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
import com.mogo.och.bus.passenger.R
import kotlinx.android.synthetic.m1.bus_p_m1_view_status_bar.view.*
import me.jessyan.autosize.utils.AutoSizeUtils
import kotlin.math.roundToInt
class StatusBarView @JvmOverloads constructor(
context: Context,
@@ -82,15 +83,8 @@ class StatusBarView @JvmOverloads constructor(
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
val bmsSoc = states.bmsSoc
if(bmsSoc >1){
progress.progress = bmsSoc.toInt()
tv_power_cos.text = "${bmsSoc.toInt()}%"
}else{
val currenPower = (bmsSoc * 100).toInt()
progress.progress = currenPower
tv_power_cos.text = "$currenPower%"
}
progress.progress = bmsSoc.toInt()
tv_power_cos.text = "${bmsSoc.roundToInt()}%"
}
}

View File

@@ -1,17 +1,15 @@
//package com.mogo.och.bus.passenger;
//
//import org.junit.Test;
//
//import static org.junit.Assert.*;
//
///**
// * Example local unit test, which will execute on the development machine (host).
// *
// * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
// */
//public class ExampleUnitTest {
// @Test
// public void addition_isCorrect() {
// assertEquals(4, 2 + 2);
// }
//}
package com.mogo.och.bus.passenger;
import org.junit.Test;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
}
}

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84Lis
import com.mogo.eagle.core.function.call.obu.CallerObuLocationWGS84ListenerManager
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.support.obu.model.MogoObuHvBasicsData
@@ -124,6 +125,7 @@ object MoGoLocationDispatcher :
DataSourceType.TELEMATIC
)
}
MultiDisplayUtils.getOtherDisplay()
}
/**

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.view
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Bitmap
import android.graphics.Canvas
@@ -12,6 +13,7 @@ import android.view.View
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.annotation.MainThread
import androidx.core.graphics.drawable.toBitmap
import ch.hsr.geohash.GeoHash
import com.amap.api.maps.AMap
import com.amap.api.maps.CameraUpdate
@@ -68,6 +70,7 @@ class OverMapView @JvmOverloads constructor(
private var resetDrawable: Int = -1
private var resetDrawableMarginRight: Int = -1
private var resetDrawableMarginBottom: Int = -1
private var isClearArrived: Boolean = false
private var mMapView: TextureMapView? = null
private var mAMap: AMap? = null
@@ -94,6 +97,7 @@ class OverMapView @JvmOverloads constructor(
// 计算索引并设置对应的Bitmap
var arrivedBitmap: BitmapDescriptor? = null
var unArrivedBitmap: BitmapDescriptor? = null
var transparentBitmap: BitmapDescriptor? = null
// 绘制轨迹线的集合
private val textureList: MutableList<BitmapDescriptor?> = ArrayList()
@@ -123,8 +127,15 @@ class OverMapView @JvmOverloads constructor(
unArrivedDrawable =
typedArray.getResourceId(R.styleable.OverMapView_unArrivedDrawable, -1)
resetDrawable = typedArray.getResourceId(R.styleable.OverMapView_resetDrawable, -1)
resetDrawableMarginRight = typedArray.getResourceId(R.styleable.OverMapView_resetDrawableMarginRight, AutoSizeUtils.dp2px(context,40f))
resetDrawableMarginBottom = typedArray.getResourceId(R.styleable.OverMapView_resetDrawableMarginBottom, AutoSizeUtils.dp2px(context,40f))
resetDrawableMarginRight = typedArray.getResourceId(
R.styleable.OverMapView_resetDrawableMarginRight,
AutoSizeUtils.dp2px(context, 40f)
)
resetDrawableMarginBottom = typedArray.getResourceId(
R.styleable.OverMapView_resetDrawableMarginBottom,
AutoSizeUtils.dp2px(context, 40f)
)
isClearArrived = typedArray.getBoolean(R.styleable.OverMapView_isClearArrived, false)
typedArray.recycle()
initView(context)
} catch (e: Exception) {
@@ -174,7 +185,12 @@ class OverMapView @JvmOverloads constructor(
* (anchorX,anchorY)为锚点坐标,各自取值范围为[0,1],默认值为(0.5,1)
*/
@MainThread
fun drawSiteMarkers(siteLatLngs: List<LatLng>?, bitmap: Bitmap, anchorX: Float, anchorY: Float) {
fun drawSiteMarkers(
siteLatLngs: List<LatLng>?,
bitmap: Bitmap,
anchorX: Float,
anchorY: Float
) {
if (siteLatLngs.isNullOrEmpty()) return
clearSiteMarkers()
val markerOptionsList = ArrayList<MarkerOptions>()
@@ -214,31 +230,37 @@ class OverMapView @JvmOverloads constructor(
mEndMarker?.isVisible = false
}
@SuppressLint("UseCompatLoadingForDrawables")
private fun initView(context: Context) {
mContext = context
val smpView = LayoutInflater.from(context).inflate(R.layout.module_overview_map_view, this)
mMapView = smpView.findViewById(R.id.aMapView)
overLayerView = findViewById(R.id.overLayer)
overLayerView?.let {
it.background =
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
val layoutParams = it.layoutParams
layoutParams as RelativeLayout.LayoutParams
layoutParams.rightMargin =resetDrawableMarginRight
layoutParams.bottomMargin =resetDrawableMarginBottom
it.layoutParams = layoutParams
}
overLayerView?.background =
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
arrivedBitmap =
BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived)
unArrivedBitmap =
BitmapDescriptorFactory.fromResource(if (unArrivedDrawable != -1) unArrivedDrawable else R.drawable.taxi_map_arrow_un_arrive)
transparentBitmap = BitmapDescriptorFactory.fromBitmap(
resources.getDrawable(R.drawable.transparent_background, null)
.toBitmap(AutoSizeUtils.dp2px(context, 32f), AutoSizeUtils.dp2px(context, 230f))
)
CallerPlanningRottingListenerManager.addListener(TAG, this)
initAMapView(context)
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
//设置全览模式
overLayerView?.setOnClickListener { displayCustomOverView() }
overLayerView?.let {
it.background =
resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
val layoutParams = it.layoutParams
layoutParams as RelativeLayout.LayoutParams
layoutParams.rightMargin = resetDrawableMarginRight
layoutParams.bottomMargin = resetDrawableMarginBottom
it.layoutParams = layoutParams
}
}
private fun initAMapView(context: Context) {
@@ -523,7 +545,7 @@ class OverMapView @JvmOverloads constructor(
*/
private fun displayCustomOverView() {
val linePointsLatLng = planningPoints
if (linePointsLatLng.size > 1) {
if (linePointsLatLng.size > 1 && mLocation != null) {
//圈定地图显示范围
//存放经纬度
val boundsBuilder = LatLngBounds.Builder()
@@ -607,15 +629,15 @@ class OverMapView @JvmOverloads constructor(
}
for (i in coordinates.indices) {
if (i <= locIndex) {
// 已走过的置灰
arrivedBitmap?.let {
textureList.add(it)
if (isClearArrived) {
textureList.add(transparentBitmap)
} else {
// 已走过的置灰
textureList.add(arrivedBitmap)
}
} else {
// 未走过的纹理
unArrivedBitmap?.let {
textureList.add(it)
}
textureList.add(unArrivedBitmap)
}
texIndexList.add(i)
}

View File

@@ -22,5 +22,7 @@
<attr name="resetDrawableMarginRight" format="dimension" />
<!-- 重置位置图片下面margin -->
<attr name="resetDrawableMarginBottom" format="dimension" />
<!-- 是否擦除已走过的路线 -->
<attr name="isClearArrived" format="boolean" />
</declare-styleable>
</resources>

View File

@@ -39,10 +39,11 @@ object MultiDisplayUtils {
// 获取除了内置屏幕(主屏幕)的其它屏幕
val displays = mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
// 初始化新的集合进行接收排序后的屏幕信息
val displaysList = arrayOfNulls<Display>(displays.size)
var displaysList = arrayOfNulls<Display>(displays.size)
// 判断副屏个数
if (displays.isNotEmpty()) {
displaysList = arrayOfNulls(displays.size)
// 循环出来副屏幕进行重新排序
for (i in displays.indices) {
// 这里如果需要固定某个屏幕, 使用 if( display.toString().indexOf("port=1")!=-1) ) 而不是使用 display[i]
@@ -62,6 +63,18 @@ object MultiDisplayUtils {
}
}
}
// 处理EB5副屏幕
else {
if (mDisplayManager.displays.isNotEmpty()) {
displaysList = arrayOfNulls(1)
// EB5目前副屏幕ID为固定4096
for (i in mDisplayManager.displays.indices) {
if (mDisplayManager.displays[i].displayId == 4096) {
displaysList[0] = mDisplayManager.displays[i]
}
}
}
}
return displaysList
}
@@ -83,11 +96,9 @@ object MultiDisplayUtils {
* @param activity 要在第二个屏幕启动的页面
*/
fun startActWithSecond(context: Context, activity: Class<*>) {
val launchDisplayId: Int
if (isSupportMultiDisplay(context)) {
if (getOtherDisplay().size > 1 && getOtherDisplay()[0] != null) {
launchDisplayId = getOtherDisplay()[0]!!.displayId
if (getOtherDisplay().isNotEmpty() && getOtherDisplay()[0] != null) {
val launchDisplayId = getOtherDisplay()[0]!!.displayId
// 要加上Intent.FLAG_ACTIVITY_NEW_TASK
val options = ActivityOptions.makeBasic()
options.launchDisplayId = launchDisplayId

View File

@@ -213,7 +213,7 @@ public class AutopilotAbilityManager {
if (!IDENTITY_MODE.BUS_DRIVER_VAN.equalsIgnoreCase(identityMode)) {
//金旅Bus和清扫车 档位不正常
if (IDENTITY_MODE.BUS_DRIVER_BASE.equalsIgnoreCase(identityMode) || IDENTITY_MODE.SWEEPER_DRIVER_FT.equalsIgnoreCase(identityMode)) {
if (gear == Chassis.GearPosition.GEAR_N) {
if (gear == Chassis.GearPosition.GEAR_N || gear == Chassis.GearPosition.GEAR_R) {
isAutopilotAbility = false;
unableAutopilotReason = "挡位不正常";
}