[8.2.2][fix] 乘客屏修复站点切换卡住和广告视频播放卡住BUG,优化报站更新距离和时间方法,乘客屏数据接收开启子线程
This commit is contained in:
@@ -21,6 +21,7 @@ import com.mogo.och.biz.media.video.MediaLoopPlayView
|
||||
import com.mogo.och.biz.media.video.MediaPlayLogger
|
||||
import com.mogo.och.biz.media.video.ads.AdMediaViewModel.AdMediaViewCallback
|
||||
import com.mogo.och.common.module.biz.media.data.MediaItem
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.skin.utils.SkinResources
|
||||
import com.mogo.skin.widget.SkinImageView
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
@@ -78,6 +79,11 @@ class AdMediaView : FrameLayout, AdMediaViewCallback {
|
||||
}
|
||||
|
||||
override fun startPlayImage(mediaItem: MediaItem) {
|
||||
BizLoopManager.runInMainThread {
|
||||
myStartPlayImage(mediaItem)
|
||||
}
|
||||
}
|
||||
private fun myStartPlayImage(mediaItem: MediaItem) {
|
||||
adVideoPlayer?.visibility = GONE
|
||||
imagePlayer?.visibility = VISIBLE
|
||||
imagePlayer?.also {
|
||||
@@ -114,6 +120,11 @@ class AdMediaView : FrameLayout, AdMediaViewCallback {
|
||||
}
|
||||
|
||||
override fun startPlayVideo(mediaItem: MediaItem, playerCallback: GSYSampleCallBack) {
|
||||
BizLoopManager.runInMainThread {
|
||||
myStartPlayVideo(mediaItem, playerCallback)
|
||||
}
|
||||
}
|
||||
private fun myStartPlayVideo(mediaItem: MediaItem, playerCallback: GSYSampleCallBack) {
|
||||
try {
|
||||
adVideoPlayer?.visibility = VISIBLE
|
||||
imagePlayer?.visibility = GONE
|
||||
@@ -151,6 +162,11 @@ class AdMediaView : FrameLayout, AdMediaViewCallback {
|
||||
}
|
||||
|
||||
override fun startPlayStationVideo(stationMediaItem: MediaItem,adMediaItem:MediaItem?,playerCallback: GSYSampleCallBack) {
|
||||
BizLoopManager.runInMainThread {
|
||||
myStartPlayStationVideo(stationMediaItem, adMediaItem, playerCallback)
|
||||
}
|
||||
}
|
||||
private fun myStartPlayStationVideo(stationMediaItem: MediaItem,adMediaItem:MediaItem?,playerCallback: GSYSampleCallBack) {
|
||||
try {
|
||||
if(adMediaItem?.isVideoType()==true&&adVideoPlayer?.playTag == adMediaItem.fileUrl){
|
||||
adMediaItem.pausePosition = adVideoPlayer.currentPositionWhenPlaying
|
||||
@@ -188,11 +204,15 @@ class AdMediaView : FrameLayout, AdMediaViewCallback {
|
||||
}
|
||||
|
||||
override fun pauseVideo() {
|
||||
adVideoPlayer.onVideoPause()
|
||||
BizLoopManager.runInMainThread {
|
||||
adVideoPlayer.onVideoPause()
|
||||
}
|
||||
}
|
||||
|
||||
override fun resumeVideo() {
|
||||
adVideoPlayer.onVideoResume()
|
||||
BizLoopManager.runInMainThread {
|
||||
adVideoPlayer.onVideoResume()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,7 +140,7 @@ object DownloadManager {
|
||||
|
||||
override fun onProgress(url: String, downloaded: Long, total: Long) {
|
||||
first.listener?.onProgress(url,downloaded,total)
|
||||
OchChainLogManager.writechainLogDownload("下载中","url:${url}_downloaded${downloaded}_total:${total}",upload = false)
|
||||
// OchChainLogManager.writechainLogDownload("下载中","url:${url}_downloaded${downloaded}_total:${total}",upload = false)
|
||||
}
|
||||
|
||||
override fun onFinished(url: String, path: String) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import androidx.annotation.RequiresApi
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
@@ -53,7 +52,6 @@ object LanSocketManager : LanSocketManagerJava() {
|
||||
@JvmStatic
|
||||
fun sendMsgToClient(msg: BaseDPMsg?) {
|
||||
val message = GsonUtils.toJson(msg)
|
||||
CallerLogger.d(TAG, "sendMsgToClient: $message")
|
||||
OchChainLogManager.writeChainLogLanSocket("发送msg到各个端",message,"send")
|
||||
CallerTelematicManager.sendMsgToAllClients(OchCommonConst.BUSINESS_STRING, message.toByteArray())
|
||||
}
|
||||
@@ -61,13 +59,11 @@ object LanSocketManager : LanSocketManagerJava() {
|
||||
@JvmStatic
|
||||
fun sendMsgToServer(msg: BaseDPMsg?) {
|
||||
val message = GsonUtils.toJson(msg)
|
||||
CallerLogger.d(TAG, "sendMsgToServer:$message")
|
||||
OchChainLogManager.writeChainLogLanSocket("发送msg到服务端(司机)",message,"send")
|
||||
CallerTelematicManager.sendMsgToServer(OchCommonConst.BUSINESS_STRING, message.toByteArray())
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
CallerLogger.d(TAG, "收到数据:_type:${type},byteArray:${String(byteArray)}");
|
||||
OchChainLogManager.writeChainLogLanSocket("收到数据","type:${type},byteArray:${String(byteArray)}","receive");
|
||||
super.onReceivedMsg(type, byteArray)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManage
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.common.module.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg;
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -54,24 +55,28 @@ public class LanSocketManagerJava implements IReceivedMsgListener {
|
||||
|
||||
@Override
|
||||
public void onReceivedMsg(int type, @NonNull byte[] byteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
try {
|
||||
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
|
||||
if(baseMsg!=null){
|
||||
List<ILanMessageListener> iLanMessageListenerJavas = mListeners.get(baseMsg.getType());
|
||||
if(iLanMessageListenerJavas!=null){
|
||||
for (ILanMessageListener iLanMessageListenerJava : iLanMessageListenerJavas) {
|
||||
Class<? extends BaseDPMsg> target = iLanMessageListenerJava.targetLan();
|
||||
BaseDPMsg baseDPMsg = GsonUtils.fromJson(new String(byteArray), target);
|
||||
iLanMessageListenerJava.onLanMsgReceived(baseDPMsg);
|
||||
BizLoopManager.INSTANCE.runInIoThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
try {
|
||||
BaseDPMsg baseMsg = GsonUtils.fromJson(new String(byteArray), BaseDPMsg.class);
|
||||
if(baseMsg!=null){
|
||||
List<ILanMessageListener> iLanMessageListenerJavas = mListeners.get(baseMsg.getType());
|
||||
if(iLanMessageListenerJavas!=null){
|
||||
for (ILanMessageListener iLanMessageListenerJava : iLanMessageListenerJavas) {
|
||||
Class<? extends BaseDPMsg> target = iLanMessageListenerJava.targetLan();
|
||||
BaseDPMsg baseDPMsg = GsonUtils.fromJson(new String(byteArray), target);
|
||||
iLanMessageListenerJava.onLanMsgReceived(baseDPMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,6 +74,7 @@ class PM2DrivingInfoFragment :
|
||||
emptyView.visibility = View.VISIBLE
|
||||
arriveView.visibility = View.GONE
|
||||
lineView.visibility = View.GONE
|
||||
lineView.clear()
|
||||
}else{
|
||||
if(isArrived&&i!=0){
|
||||
emptyView.visibility = View.GONE
|
||||
|
||||
@@ -88,5 +88,8 @@ class LineView : ConstraintLayout, LineViewModel.LineViewCallback {
|
||||
}
|
||||
}
|
||||
|
||||
fun clear(){
|
||||
mAdapter.clear()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,15 +9,16 @@ import com.mogo.och.shuttle.weaknet.passenger.R
|
||||
class StationAdapter : ListAdapter<BusStationBean, StationViewHolder>(MessageDiffCallback()) {
|
||||
|
||||
var currentIndex = 0
|
||||
var isLeaving = false
|
||||
var showPassOmit = false
|
||||
var showFuluterOmit = false
|
||||
|
||||
|
||||
var distanceAndTime = ""
|
||||
|
||||
override fun submitList(list: MutableList<BusStationBean>?) {
|
||||
val newDataList = mutableListOf<BusStationBean>()
|
||||
var isLeaving = false
|
||||
list?.let {
|
||||
var showPassOmit = false
|
||||
var showFuluterOmit = false
|
||||
it.forEachIndexed { index, busStationBean ->
|
||||
if (busStationBean.drivingStatus == 2) {
|
||||
currentIndex = index
|
||||
@@ -166,13 +167,23 @@ class StationAdapter : ListAdapter<BusStationBean, StationViewHolder>(MessageDif
|
||||
}
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
super.submitList(null)
|
||||
currentIndex = 0
|
||||
distanceAndTime = ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onViewRecycled(holder: StationViewHolder) {
|
||||
super.onViewRecycled(holder)
|
||||
holder.viewRecycled(holder)
|
||||
}
|
||||
|
||||
fun notifyDistanceAndTime(distance: String, time: String) {
|
||||
distanceAndTime = "${distance}·${time}"
|
||||
notifyItemChanged(currentIndex)
|
||||
if (currentList.isNotEmpty() && currentIndex < itemCount) {
|
||||
distanceAndTime = "${distance}·${time}"
|
||||
notifyItemChanged(currentIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user