Merge branch 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0' into 'dev_RoboBus_P_230220_1.0.1'
Dev robobus m1 p app module 1.0.0 230112 1.0.0 See merge request zhjt/AndroidApp/MoGoEagleEye!613
This commit is contained in:
@@ -136,7 +136,7 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?)
|
||||
"打开空调,模式$modeCmd--档位${windSpeedCmd}--温度:$temperatureCmd")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(1,modeCmd,windSpeedCmd,temperatureCmd)
|
||||
disposeSubscribe(airconditionDisposable)
|
||||
airconditionDisposable = createSubscribe(5000){
|
||||
airconditionDisposable = createSubscribe(10000){
|
||||
if (!OCHM1LightAirconditionDoorStatusManager.airconditionStatus.isOpen&&
|
||||
OCHM1LightAirconditionDoorStatusManager.airconditionStatus.windSpeed!=windSpeedCmd&&
|
||||
OCHM1LightAirconditionDoorStatusManager.airconditionStatus.temperature!=temperatureCmd&&
|
||||
@@ -149,7 +149,7 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭空调")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1AirConditionerCmd(2,0,0,0)
|
||||
disposeSubscribe(airconditionDisposable)
|
||||
airconditionDisposable = createSubscribe(5000){
|
||||
airconditionDisposable = createSubscribe(10000){
|
||||
if (OCHM1LightAirconditionDoorStatusManager.airconditionStatus.isOpen) {
|
||||
ToastUtils.showShort("空调操作未生效,请稍后重试吧~")
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "打开暖风机、档位${windSpeedCmd}")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(1,windSpeedCmd)
|
||||
disposeSubscribe(heaterDisposable)
|
||||
heaterDisposable = createSubscribe(5000){
|
||||
heaterDisposable = createSubscribe(10000){
|
||||
if (!OCHM1LightAirconditionDoorStatusManager.heaterStatue.isOpen&&
|
||||
OCHM1LightAirconditionDoorStatusManager.heaterStatue.windSpeed!=windSpeedCmd) {
|
||||
ToastUtils.showShort("暖风机操作未生效,请稍后重试吧~")
|
||||
@@ -174,9 +174,9 @@ class BusPassengerFunctionSoftPresenter(view: BusPassengerFunctionSoftFragment?)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭暖风机")
|
||||
CallerAutoPilotControlManager.sendRoboBusJinlvM1HeaderCmd(2,0)
|
||||
disposeSubscribe(heaterDisposable)
|
||||
heaterDisposable = createSubscribe(5000){
|
||||
if (!OCHM1LightAirconditionDoorStatusManager.heaterStatue.isOpen) {
|
||||
ToastUtils.showShort("暖风机操作未生效,请稍后重试吧~")
|
||||
heaterDisposable = createSubscribe(10000){
|
||||
if (OCHM1LightAirconditionDoorStatusManager.heaterStatue.isOpen) {
|
||||
ToastUtils.showShort("暖风机操作未生效,请稍后重试吧~")//还是开着的
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ import android.media.AudioManager
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.RadioButton
|
||||
import android.widget.SeekBar
|
||||
import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
@@ -39,6 +42,7 @@ import kotlinx.android.synthetic.m1.bus_p_function_setting_soft_fragment.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
/**
|
||||
* @author: yangyakun
|
||||
* @date: 2023/1/28
|
||||
@@ -55,30 +59,46 @@ class BusPassengerFunctionSoftFragment :
|
||||
private var subscribeLightTop1: Disposable? = null
|
||||
private var subscribeLightTop2: Disposable? = null
|
||||
private var subscribeAtmosphere: Disposable? = null
|
||||
private var subscribeAnimator: Disposable? = null
|
||||
|
||||
private var animator1: ObjectAnimator? = null
|
||||
private val loadingAni = ObjectAnimator.ofFloat(iv_loading, "rotation", 0f, 90f ,180f, 270f, 360f).apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
duration = 1000
|
||||
}
|
||||
|
||||
|
||||
override fun initViews() {
|
||||
rg_select_function.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.tv_setting_aircondition -> {
|
||||
g_aircondition_setting.visibility = View.VISIBLE
|
||||
g_light_setting.visibility = View.GONE
|
||||
g_voice_setting.visibility = View.GONE
|
||||
if(loadingAni.isRunning){
|
||||
iv_loading.visibility = View.VISIBLE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
}else{
|
||||
g_aircondition_setting.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
R.id.tv_setting_lighting -> {
|
||||
g_light_setting.visibility = View.VISIBLE
|
||||
g_voice_setting.visibility = View.GONE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
iv_loading.visibility = View.GONE
|
||||
}
|
||||
R.id.tv_setting_voice -> {
|
||||
g_voice_setting.visibility = View.VISIBLE
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
g_light_setting.visibility = View.GONE
|
||||
iv_loading.visibility = View.GONE
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
if(rb_pattern_heating.isChecked){
|
||||
iv_temperature_select.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
rg_select_function.check(R.id.tv_setting_aircondition)
|
||||
setAirconditionListener()
|
||||
@@ -100,30 +120,43 @@ class BusPassengerFunctionSoftFragment :
|
||||
}
|
||||
}
|
||||
|
||||
fun showAni(){
|
||||
iv_loading.visibility = View.VISIBLE
|
||||
loadingAni.target = iv_loading
|
||||
loadingAni.start()
|
||||
g_aircondition_setting.visibility = View.GONE
|
||||
subscribeAnimator = Observable.timer(10000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
loadingAni.cancel()
|
||||
iv_loading.visibility = View.GONE
|
||||
if(tv_setting_aircondition.isChecked){
|
||||
g_aircondition_setting.visibility = View.VISIBLE
|
||||
if(rb_pattern_heating.isChecked){
|
||||
iv_temperature_select.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun setAirconditionListener() {
|
||||
// 开关空调或暖风机
|
||||
tv_aircondition_switch.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
if(!buttonView.isPressed){
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
if(isChecked){
|
||||
tv_aircondition_switch.setText("关闭空调")
|
||||
}else{
|
||||
tv_aircondition_switch.setText("打开空调")
|
||||
}
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {
|
||||
if (isChecked) {// 打开暖风机
|
||||
openHeater()
|
||||
} else {// 关闭暖风机
|
||||
closeHeater()
|
||||
}
|
||||
} else {
|
||||
if (isChecked) {// 打开空调
|
||||
openAircondition()
|
||||
} else {//关闭空调
|
||||
closeAircondition()
|
||||
if(isChecked){//打开
|
||||
tv_aircondition_switch.setText("关闭空调")
|
||||
if (rg_setting_pattern.checkedRadioButtonId == R.id.rb_pattern_heating) {
|
||||
openHeater()// 打开暖风机
|
||||
} else {
|
||||
openAircondition()// 打开空调
|
||||
}
|
||||
showAni()
|
||||
}else{// 关闭
|
||||
tv_aircondition_switch.setText("打开空调")
|
||||
closeHeater()// 关闭暖风机
|
||||
closeAircondition()//关闭空调
|
||||
}
|
||||
}
|
||||
// 模式调节
|
||||
@@ -162,6 +195,9 @@ class BusPassengerFunctionSoftFragment :
|
||||
openAircondition()
|
||||
}
|
||||
}
|
||||
if(tv_aircondition_switch.isChecked) {
|
||||
showAni()
|
||||
}
|
||||
}
|
||||
|
||||
// 风速调节
|
||||
@@ -361,9 +397,6 @@ class BusPassengerFunctionSoftFragment :
|
||||
private fun closeHeater() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "关闭暖风")
|
||||
heaterAirEnable(true)
|
||||
if (!tv_aircondition_switch.isChecked) {
|
||||
return
|
||||
}
|
||||
mPresenter?.closeHeader()
|
||||
}
|
||||
|
||||
@@ -603,6 +636,8 @@ class BusPassengerFunctionSoftFragment :
|
||||
mPresenter?.disposeSubscribe(subscribeLightTop1)
|
||||
mPresenter?.disposeSubscribe(subscribeLightTop2)
|
||||
mPresenter?.disposeSubscribe(subscribeAtmosphere)
|
||||
mPresenter?.disposeSubscribe(subscribeAnimator)
|
||||
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
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
|
||||
@@ -47,6 +48,7 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
CallerHmiViewControlListenerManager.setListenerHz(TAG,5)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
|
||||
@@ -82,9 +84,11 @@ class StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
|
||||
val bmsSoc = states.bmsSoc
|
||||
progress.progress = bmsSoc.toInt()
|
||||
tv_power_cos.text = "${bmsSoc.roundToInt()}%"
|
||||
UiThreadHandler.post {
|
||||
val bmsSoc = states.bmsSoc
|
||||
progress.progress = bmsSoc.toInt()
|
||||
tv_power_cos.text = "${bmsSoc.roundToInt()}%"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="1000"
|
||||
android:fromDegrees="0"
|
||||
android:pivotX="50%"
|
||||
android:pivotY="50%"
|
||||
android:repeatCount="-1"
|
||||
android:toDegrees="360" />
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -287,6 +287,17 @@
|
||||
android:textSize="@dimen/dp_24" />
|
||||
</RadioGroup>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_loading"
|
||||
android:visibility="gone"
|
||||
android:src="@drawable/bus_p_loading"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_aircondition"
|
||||
android:layout_width="@dimen/dp_73"
|
||||
android:layout_height="@dimen/dp_73"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/g_aircondition_setting"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,12 @@
|
||||
package com.mogo.och.bus.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.Handler
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -17,7 +22,6 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManage
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
@@ -34,7 +38,6 @@ import com.mogo.och.bus.passenger.network.PM2ModelLoopManager
|
||||
import com.mogo.och.common.module.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import kotlin.math.abs
|
||||
|
||||
@@ -103,6 +106,9 @@ class PM2DrivingModel private constructor() {
|
||||
//自动驾驶轨迹监听
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
|
||||
//网络监听
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
}
|
||||
|
||||
fun releaseListener(){
|
||||
@@ -126,6 +132,14 @@ class PM2DrivingModel private constructor() {
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener =
|
||||
object : IReceivedMsgListener{
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
|
||||
@@ -133,12 +147,40 @@ class PM2DrivingModel private constructor() {
|
||||
val msg = GsonUtils.fromJson(String(byteArray),AppConnectMsg::class.java) as AppConnectMsg
|
||||
Logger.d(TAG,"onReceivedMsg = "+GsonUtils.toJson(msg))
|
||||
if (msg.isPlay){ //播报
|
||||
showNotice(msg.msg)
|
||||
speakTTS(msg.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun speakTTS(msg: String) {
|
||||
|
||||
// var mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
// var mAudioAttributes = AudioAttributes.Builder()
|
||||
// .setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途
|
||||
// .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型
|
||||
// .build()
|
||||
// var mAudioFocusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型
|
||||
// .setAudioAttributes(mAudioAttributes) //设置声音属性
|
||||
// .setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取
|
||||
// .build()
|
||||
// mAudioManager.requestAudioFocus(mAudioFocusRequest) //抢占焦点
|
||||
|
||||
AIAssist.getInstance(mContext).speakTTSVoiceWithLevel(msg,AIAssist.LEVEL0,object : IMogoVoiceCmdCallBack{
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
// mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakError(speakText: String?, errorMsg: String?) {
|
||||
// mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
// mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener{
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
@@ -293,6 +335,7 @@ class PM2DrivingModel private constructor() {
|
||||
&& station.isLeaving && i + 1 < stations.size) {
|
||||
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<PM2Station>, i + 1, false)
|
||||
if (mNextStationIndex != i + 1) {
|
||||
d(TAG,"轨迹排查--开始行程")
|
||||
mTwoStationsRouts.clear()
|
||||
startRemainRouteInfo()
|
||||
}
|
||||
@@ -300,9 +343,6 @@ class PM2DrivingModel private constructor() {
|
||||
mNextStationIndex = i + 1
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
if (i == 0) {
|
||||
// startOrStopRouteAndWipe(false)
|
||||
}
|
||||
mPreRouteIndex = 0
|
||||
isGoingToNextStation = false
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
@@ -419,17 +459,6 @@ class PM2DrivingModel private constructor() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mTwoStationsRouts.size > 0) {
|
||||
val sumLength = CoordinateCalculateRouteUtil.calculateRouteSumLength(
|
||||
mTwoStationsRouts
|
||||
)
|
||||
mContext?.let {
|
||||
SharedPrefsMgr.getInstance(it).putInt(
|
||||
BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS,
|
||||
sumLength.toInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,25 +48,27 @@ class PM2DrivingInfoFragment :
|
||||
context?.let { it -> ToggleDebugView.toggleDebugView.toggle(it) }
|
||||
}
|
||||
current_time_tv.onClick {
|
||||
//测试V2X消息
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.V2X,
|
||||
V2XMsg(
|
||||
"6666",
|
||||
"超速行驶",
|
||||
""
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
val noticeTrafficStylePushData = NoticeTrafficStylePushData()
|
||||
noticeTrafficStylePushData.content= "测试公告布局"
|
||||
val noticeFromCloudMsg = NoticeFrCloudMsg(null, noticeTrafficStylePushData, 1)
|
||||
CallerMsgBoxManager.saveMsgBox(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.NOTICE, noticeFromCloudMsg)
|
||||
)
|
||||
// //测试V2X消息
|
||||
// CallerMsgBoxManager.saveMsgBox(
|
||||
// MsgBoxBean(
|
||||
// MsgBoxType.V2X,
|
||||
// V2XMsg(
|
||||
// "6666",
|
||||
// "超速行驶",
|
||||
// ""
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
//
|
||||
// val noticeTrafficStylePushData = NoticeTrafficStylePushData()
|
||||
// noticeTrafficStylePushData.content= "测试公告布局"
|
||||
// val noticeFromCloudMsg = NoticeFrCloudMsg(null, noticeTrafficStylePushData, 1)
|
||||
// CallerMsgBoxManager.saveMsgBox(
|
||||
// MsgBoxBean(
|
||||
// MsgBoxType.NOTICE, noticeFromCloudMsg)
|
||||
// )
|
||||
// BPRouteDataTestUtils.converToRouteData()
|
||||
}
|
||||
updateCurrentTime()
|
||||
}
|
||||
@@ -118,7 +120,9 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
|
||||
fun changeOperationStatus(status:Boolean){
|
||||
setLineInfoView(status)
|
||||
if (!status){
|
||||
updateNoOrderUI()
|
||||
}
|
||||
}
|
||||
|
||||
fun showNoTaskView(haveTask: Boolean){
|
||||
@@ -131,15 +135,19 @@ class PM2DrivingInfoFragment :
|
||||
line_during_tv.visibility = View.VISIBLE
|
||||
no_line_tv.visibility = View.GONE
|
||||
}else{
|
||||
line_name_tv.visibility = View.GONE
|
||||
line_during_tv.visibility = View.GONE
|
||||
no_line_tv.visibility = View.VISIBLE
|
||||
updateNoStationView()
|
||||
overMapView.clearSiteMarkers()
|
||||
overMapView.clearCustomPolyline()
|
||||
updateNoOrderUI()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoOrderUI() {
|
||||
line_name_tv.visibility = View.GONE
|
||||
line_during_tv.visibility = View.GONE
|
||||
no_line_tv.visibility = View.VISIBLE
|
||||
updateNoStationView()
|
||||
overMapView.clearSiteMarkers()
|
||||
overMapView.clearCustomPolyline()
|
||||
}
|
||||
|
||||
private fun updateNoStationView(){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.m2_no_line_tv_color))
|
||||
station_name_title_tv.text = resources.getString(R.string.m2_p_station_title_tv)
|
||||
@@ -203,7 +211,7 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
|
||||
val time = ceil(timeInSecond as Double / 60f).toInt()
|
||||
val time = ceil(timeInSecond / 60f).toInt()
|
||||
|
||||
"$remainDis$disUnit | $time 分钟".also { remain_mt.text = it }
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
|
||||
private fun addView(item: RotationItem) {
|
||||
if (item.type == 1) { // 表示视频
|
||||
val videoView = AdvanceVideoView(mContext)
|
||||
videoView.setVideoPath(item.path)
|
||||
videoView.setVideoPath(item.path,item.cacheImgPath)
|
||||
viewList.add(videoView)
|
||||
} else { // 表示图片
|
||||
val imageView = AdvanceImageView(mContext)
|
||||
|
||||
@@ -35,6 +35,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
private var mOnCompletionListener: GSYSampleCallBack? = null
|
||||
private var downloadVideoName = ""
|
||||
private var fileNetPath: String? = ""
|
||||
private var cacheImageUrl: String? = ""
|
||||
|
||||
init {
|
||||
initView()
|
||||
@@ -69,10 +70,11 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
videoRelativeLayout?.addView(videoViewPlayer, layoutParams)
|
||||
}
|
||||
|
||||
fun setVideoPath(path: String) {
|
||||
fun setVideoPath(path: String,cacheImageUrl: String) {
|
||||
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v
|
||||
// https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4
|
||||
this.fileNetPath = path
|
||||
this.cacheImageUrl = cacheImageUrl
|
||||
val pathList = path.split("/")
|
||||
if (pathList.isNotEmpty()){
|
||||
this.downloadVideoName = pathList[pathList.size - 1]
|
||||
@@ -83,22 +85,37 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
private fun loadCacheImg() {
|
||||
// BitmapHelper.getVideoThumbnail(path) /*获取第一帧图*/
|
||||
cacheImage?.setImageResource(R.drawable.m2_p_video_holder)
|
||||
setCacheImageViewVisible()
|
||||
Thread{
|
||||
var bitmap = BitmapHelper.getVideoThumbnail(fileNetPath)
|
||||
Thread {
|
||||
var bitmap = BitmapHelper.getVideoThumbnail(fileNetPath)
|
||||
Logger.d(ImageAndVideoRotation.TAG, "setVideoPath")
|
||||
ThreadUtils.runOnUiThread {
|
||||
Logger.d(ImageAndVideoRotation.TAG, "bitmap加载")
|
||||
cacheImage?.let {
|
||||
Glide.with(context).load(bitmap)
|
||||
.apply(
|
||||
RequestOptions().placeholder(R.drawable.m2_p_video_holder).centerCrop()
|
||||
RequestOptions().placeholder(R.drawable.m2_p_video_holder)
|
||||
.error(R.drawable.m2_p_video_holder)
|
||||
.fallback(R.drawable.m2_p_video_holder)
|
||||
.centerCrop()
|
||||
)
|
||||
.into(it)
|
||||
}
|
||||
videoViewPlayer?.thumbImageView = cacheImage
|
||||
}
|
||||
}.start()
|
||||
// Logger.d(ImageAndVideoRotation.TAG, "bitmap加载")
|
||||
// cacheImage?.let {
|
||||
// Glide.with(context).load(cacheImageUrl)
|
||||
// .apply(
|
||||
// RequestOptions().placeholder(R.drawable.m2_p_video_holder)
|
||||
// .error(R.drawable.m2_p_video_holder)
|
||||
// .fallback(R.drawable.m2_p_video_holder)
|
||||
// .centerCrop()
|
||||
// )
|
||||
// .into(it)
|
||||
// }
|
||||
// videoViewPlayer?.thumbImageView = cacheImage
|
||||
}
|
||||
|
||||
fun clearLocalErrorVideo(){
|
||||
@@ -110,11 +127,13 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun setCacheImageViewVisible() {
|
||||
videoViewPlayer?.thumbImageView = cacheImage
|
||||
videoViewPlayer?.setCacheImageViewVisible()
|
||||
}
|
||||
|
||||
fun setCacheImageViewGone() {
|
||||
videoViewPlayer?.setCacheImageViewGone()
|
||||
videoViewPlayer?.clearThumbImageView()
|
||||
}
|
||||
|
||||
fun setVideo(onCompletionListener: GSYSampleCallBack) {
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
app:layout_constraintCircle="@id/cbMsgBoxM1"
|
||||
app:layout_constraintCircleAngle="35"
|
||||
app:layout_constraintCircleRadius="25dp"
|
||||
tools:ignore="MissingConstraints" />
|
||||
tools:ignore="MissingConstraints"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user