[m2] UI 处理
This commit is contained in:
@@ -133,9 +133,6 @@ class PM2DrivingModel private constructor() {
|
||||
if (msg.isPlay){ //播报
|
||||
showNotice(msg.msg)
|
||||
}
|
||||
if (msg.isViewShow){//显示
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,7 +241,10 @@ class PM2DrivingModel private constructor() {
|
||||
PM2ServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse>{
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
if (data?.result == null || data.result.sites == null) {
|
||||
if (data?.result === routesResult) {
|
||||
return
|
||||
}
|
||||
if (data?.result?.sites === null) {
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
isGoingToNextStation = false
|
||||
@@ -252,9 +252,6 @@ class PM2DrivingModel private constructor() {
|
||||
mDrivingInfoCallback?.showNoTaskView(true)
|
||||
return
|
||||
}
|
||||
if (data.result === routesResult) {
|
||||
return
|
||||
}
|
||||
routesResult = data.result
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg
|
||||
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
@@ -38,6 +44,27 @@ class PM2DrivingInfoFragment :
|
||||
speed_tv.onClick {
|
||||
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)
|
||||
)
|
||||
}
|
||||
updateCurrentTime()
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +80,8 @@ class PM2HPMapFragment :
|
||||
) {
|
||||
//开启线程执行起终点marker设置
|
||||
val setMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
"setMapMaker= " + Thread.currentThread().name,
|
||||
uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
||||
)
|
||||
d("setMapMaker= " + Thread.currentThread().name,
|
||||
uuid + "=latitude=" + station[1] + ",longitude=" + station[0])
|
||||
val options = MogoMarkerOptions()
|
||||
.owner(TYPE_MARKER_M2_LINE)
|
||||
.anchor(0.5f, 0.5f)
|
||||
@@ -115,9 +113,7 @@ class PM2HPMapFragment :
|
||||
val removeMapMarkerRunnable = Runnable {
|
||||
d("RemoveMapMaker=" + Thread.currentThread().name, uuid)
|
||||
Objects.requireNonNull(
|
||||
getMarkerManager(
|
||||
AbsMogoApplication.getApp()
|
||||
)
|
||||
getMarkerManager(AbsMogoApplication.getApp())
|
||||
)?.removeMarkers(uuid)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import com.shuyu.gsyvideoplayer.utils.Debuger
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/17
|
||||
* 隐藏所有控件的player
|
||||
*/
|
||||
class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
|
||||
constructor(context: Context?) : super(context)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
||||
|
||||
init {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun hideAllWidget() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToNormal() {
|
||||
Debuger.printfLog("changeUiToNormal")
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToPreparingShow() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToPlayingShow() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToPauseShow() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToCompleteShow() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
override fun changeUiToPlayingBufferingShow() {
|
||||
hideWidget()
|
||||
}
|
||||
|
||||
private fun hideWidget(){
|
||||
setViewShowState(mBottomContainer, GONE)
|
||||
setViewShowState(mProgressBar, GONE)
|
||||
setViewShowState(mCurrentTimeTextView, GONE)
|
||||
setViewShowState(mTotalTimeTextView, GONE)
|
||||
setViewShowState(mBottomProgressBar, GONE)
|
||||
setViewShowState(mBackButton, GONE)
|
||||
setViewShowState(mStartButton, GONE)
|
||||
|
||||
setViewShowState(mTopContainer, GONE)
|
||||
|
||||
setViewShowState(mLoadingProgressBar, GONE)
|
||||
setViewShowState(mThumbImageViewLayout, GONE)
|
||||
setViewShowState(mThumbImageView, GONE)
|
||||
setViewShowState(
|
||||
mLockScreen, GONE
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class AdvanceImageView @JvmOverloads constructor(
|
||||
@SuppressLint("CheckResult")
|
||||
fun setImagePath(path: String){
|
||||
imageView?.let { Glide.with(context).load(path)
|
||||
.apply { RequestOptions().placeholder(R.drawable.m2_p_video_holder).centerCrop() }
|
||||
.apply(RequestOptions().placeholder(R.drawable.m2_p_video_holder).centerCrop())
|
||||
.into(it) }
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
|
||||
if (viewList[mViewPager.currentItem] is AdvanceVideoView) {//有人反应第一个是视频不播放这边优化了一下
|
||||
Logger.d("onPageScrollStateChanged", "第一个是视频")
|
||||
val video = viewList[mViewPager.currentItem] as AdvanceVideoView
|
||||
video.setVideo(gsySampleCallBack)
|
||||
video.setVideo(gsySampleCallBack,mViewPager.currentItem)
|
||||
|
||||
} else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
|
||||
Logger.d("onPageScrollStateChanged", "startTimer()_1")
|
||||
@@ -125,16 +125,12 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
|
||||
"state = $state currentItem = $currentItem lastPosition = $lastPosition")
|
||||
|
||||
if (viewList.size > 1) { //多于1,才会循环跳转
|
||||
// if (lastPosition != -1 && lastPosition != mViewPager.currentItem
|
||||
// && viewList[lastPosition] is AdvanceVideoView
|
||||
// ) {
|
||||
// val videoView: AdvanceVideoView = viewList[lastPosition] as AdvanceVideoView
|
||||
// videoView.setPause()
|
||||
// }
|
||||
|
||||
if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
|
||||
|
||||
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
|
||||
videoView.setVideo(gsySampleCallBack)
|
||||
videoView.setCacheImageView(dataList[mViewPager.currentItem].cacheImgPath)
|
||||
videoView.setVideo(gsySampleCallBack,mViewPager.currentItem)
|
||||
|
||||
} else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
|
||||
Logger.d("onPageScrollStateChanged", "startTimer()")
|
||||
@@ -149,18 +145,17 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
|
||||
private var gsySampleCallBack = object : GSYSampleCallBack() {
|
||||
|
||||
override fun onPrepared(url: String?, vararg objects: Any?) {
|
||||
super.onPrepared(url, *objects)
|
||||
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
|
||||
Logger.d("onPageScrollStateChanged", "onPrepared")
|
||||
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
|
||||
UiThreadHandler.postDelayed({
|
||||
videoView.setCacheImageViewGone()
|
||||
},400)
|
||||
},2000)
|
||||
}
|
||||
|
||||
override fun onAutoComplete(url: String?, vararg objects: Any?) {
|
||||
super.onAutoComplete(url, *objects)
|
||||
Logger.d("onPageScrollStateChanged", "onAutoComplete()")
|
||||
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
|
||||
videoView.onVideoReset()
|
||||
videoView.setCacheImageView(dataList[mViewPager.currentItem].cacheImgPath)
|
||||
goNextItemView()
|
||||
}
|
||||
@@ -169,6 +164,7 @@ class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter
|
||||
super.onPlayError(url, *objects)
|
||||
Logger.d("onPageScrollStateChanged", "onPlayError()")
|
||||
val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
|
||||
videoView.onVideoReset()
|
||||
videoView.setCacheImageView(dataList[mViewPager.currentItem].cacheImgPath)
|
||||
goNextItemView()
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@ package com.mogo.och.bus.passenger.ui.widget.video
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
import android.widget.RelativeLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.RequestOptions
|
||||
import com.mogo.eagle.core.utilcode.util.BitmapHelper
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -24,7 +21,7 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
private var videoRelativeLayout: RelativeLayout? = null
|
||||
private var cacheImage: ImageView? = null
|
||||
private var videoViewPlayer: StandardGSYVideoPlayer? = null
|
||||
private var videoViewPlayer: AdvanceGSYVideoPlayer? = null
|
||||
private var gsyVideoOptionBuilder: GSYVideoOptionBuilder? = null
|
||||
private var path: String? = null
|
||||
|
||||
@@ -33,8 +30,8 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
initCacheImgView()
|
||||
initVideoView()
|
||||
initCacheImgView()
|
||||
}
|
||||
|
||||
private fun initCacheImgView() {
|
||||
@@ -49,13 +46,8 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
if (videoViewPlayer === null) {
|
||||
//视频播放控件
|
||||
videoViewPlayer = StandardGSYVideoPlayer(context)
|
||||
videoViewPlayer = AdvanceGSYVideoPlayer(context)
|
||||
}
|
||||
if (gsyVideoOptionBuilder === null) {
|
||||
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
}
|
||||
|
||||
videoViewPlayer?.isFocusableInTouchMode = false
|
||||
|
||||
var layoutParams = LayoutParams(-1, -1)
|
||||
//设置videoview占满父view播放
|
||||
@@ -77,32 +69,32 @@ class AdvanceVideoView @JvmOverloads constructor(
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun setCacheImageView(imgPath: String) {
|
||||
|
||||
cacheImage?.let {
|
||||
Glide.with(context)
|
||||
.apply { RequestOptions().placeholder(R.drawable.m2_p_video_holder).centerCrop() }
|
||||
.load(imgPath).into(it)
|
||||
.load(imgPath)
|
||||
.apply(RequestOptions().placeholder(R.drawable.m2_p_video_holder).centerCrop())
|
||||
.into(it)
|
||||
}
|
||||
|
||||
cacheImage?.visibility = VISIBLE
|
||||
}
|
||||
|
||||
fun setVideo(onCompletionListener: GSYSampleCallBack) {
|
||||
fun setVideo(onCompletionListener: GSYSampleCallBack,position: Int) {
|
||||
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
|
||||
gsyVideoOptionBuilder?.setUrl(path)
|
||||
?.setPlayTag(path + position)
|
||||
?.setCacheWithPlay(false)
|
||||
// ?.setAutoFullWithSize(true)
|
||||
// ?.setShowPauseCover(false)
|
||||
// ?.setFullHideActionBar(true)
|
||||
// ?.setFullHideStatusBar(true)
|
||||
// ?.setIsTouchWiget(false)
|
||||
// ?.setIsTouchWigetFull(false)
|
||||
// ?.setNeedLockFull(true)
|
||||
// ?.setLockLand(true)
|
||||
// ?.setAutoFullWithSize(true)
|
||||
// ?.setNeedShowWifiTip(false)
|
||||
?.setThumbPlay(false)
|
||||
?.build(videoViewPlayer)
|
||||
|
||||
videoViewPlayer?.isFocusableInTouchMode = false
|
||||
videoViewPlayer?.setVideoAllCallBack(onCompletionListener)
|
||||
videoViewPlayer?.startPlayLogic()
|
||||
}
|
||||
|
||||
videoViewPlayer?.startButton?.performClick()
|
||||
fun onVideoReset(){
|
||||
videoViewPlayer?.onVideoReset()
|
||||
}
|
||||
|
||||
fun setCacheImageViewGone() {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -12,6 +12,7 @@
|
||||
android:layout_height="match_parent"
|
||||
app:mapStyleExtraPath="@string/m2_over_map_style_extra_path"
|
||||
app:mapStylePath="@string/m2_over_map_style_path"
|
||||
app:carDrawable = "@drawable/m2_map_car_icon"
|
||||
app:startPointDrawable="@drawable/m2_map_start_icon"
|
||||
app:endPointDrawable="@drawable/m2_map_end_icon"/>
|
||||
|
||||
@@ -34,6 +35,7 @@
|
||||
android:textColor="@color/m2_p_speed_tv_color"
|
||||
android:textSize="@dimen/dp_56"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/img_drive_bg"
|
||||
android:layout_marginLeft="@dimen/dp_24"
|
||||
app:layout_constraintTop_toTopOf="@+id/img_drive_bg"
|
||||
@@ -43,7 +45,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_8"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:text="@string/m2_p_speed_unit_txt"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/speed_tv"
|
||||
@@ -51,10 +53,10 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/auto_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/dp_66"
|
||||
android:layout_height="@dimen/dp_38"
|
||||
android:background="@drawable/bg_p_m2_auto"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:text="@string/m2_p_auto_tv"
|
||||
android:textSize="@dimen/dp_18"
|
||||
android:gravity="center"
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:layout_marginLeft="@dimen/dp_26"/>
|
||||
|
||||
<!--pnc行为决策-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -18,37 +18,37 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/left_nor_image"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="left|center_vertical"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:src="@drawable/m2_zuozhuan_un_open" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/right_nor_image"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginRight="@dimen/dp_10"
|
||||
android:layout_marginRight="@dimen/dp_5"
|
||||
android:src="@drawable/m2_youzhuan_un_open" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/left_select_image"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="left|top"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginLeft="@dimen/dp_5"
|
||||
android:layout_marginTop="2dp"
|
||||
android:src="@drawable/m2_zuozhuan_open"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/right_select_image"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:src="@drawable/m2_youzhuan_open"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
Reference in New Issue
Block a user