diff --git a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java
index 4eca36933e..3bf45d5f18 100644
--- a/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java
+++ b/OCH/mogo-och-bus-passenger/src/jinlvvan/java/com/mogo/och/bus/passenger/MogoOCHBusPassenger.java
@@ -8,10 +8,14 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.android.arouter.facade.annotation.Route;
+import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
+import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
+import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils;
import com.mogo.och.bus.passenger.constant.BusPassengerConst;
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
+import com.mogo.och.common.module.wigets.video.VideoPlayerActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -40,6 +44,10 @@ public class MogoOCHBusPassenger implements IMogoOCH {
this.mActivity = activity;
this.mContainerId = containerId;
showFragment();
+
+ if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
+ MultiDisplayUtils.INSTANCE.startActWithSecond(activity, VideoPlayerActivity.class);
+ }
return null;
}
diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/BusPassengerM2.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/BusPassengerM2.kt
index 2fdb5c96b0..2fa5cd6d09 100644
--- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/BusPassengerM2.kt
+++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/BusPassengerM2.kt
@@ -4,9 +4,6 @@ import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
-import com.mogo.commons.module.status.IMogoStatusChangedListener
-import com.mogo.commons.module.status.MogoStatusManager
-import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
diff --git a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/model/CharterPassengerModel.kt b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/model/CharterPassengerModel.kt
index 87f5e7edbb..61c0e352ad 100644
--- a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/model/CharterPassengerModel.kt
+++ b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/model/CharterPassengerModel.kt
@@ -512,14 +512,14 @@ object CharterPassengerModel {
it.dispose()
}
}
- val leadTime = endlast / 1000
+ val leadTime = endlast / 1000+60
subscribeCountDown =
Observable.intervalRange(0L, leadTime, 0, 1, TimeUnit.SECONDS)
.map { aLong -> leadTime - aLong }
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe{millisUntilFinished->
- if (millisUntilFinished <= 300L) {
+ if (millisUntilFinished <= 360L) {
orderInfo?.let {
if (broadcastList.get("${it}$min5Speak") == null
|| broadcastList.get("${it}$min5Speak") == false
@@ -544,7 +544,7 @@ object CharterPassengerModel {
}
iDistanceTimeCallback?.setOrderTimeCallBack(-1)
}else{
- iDistanceTimeCallback?.setOrderTimeCallBack(millisUntilFinished+60)
+ iDistanceTimeCallback?.setOrderTimeCallBack(millisUntilFinished)
}
CallerLogger.d(
M_BUS_P + TAG,
diff --git a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerPresenter.kt b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerPresenter.kt
index 578c629247..d39f78c6a9 100644
--- a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerPresenter.kt
+++ b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/presenter/BusPassengerPresenter.kt
@@ -158,7 +158,10 @@ class BusPassengerPresenter(view: MainFragment?) :
setOrderTime("--","--")
return
}
- val surplusTime = (timeInSecond / 60).toInt()
+ var surplusTime = (timeInSecond / 60).toInt()
+ if(surplusTime==0){
+ surplusTime = 1
+ }
val beforeTime = Calendar.getInstance()
beforeTime.add(Calendar.MINUTE, surplusTime)
diff --git a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt
index ee41893145..2561332e9e 100644
--- a/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt
+++ b/OCH/mogo-och-charter-passenger/src/m1/java/com/mogo/och/bus/passenger/ui/view/LineSiteView.kt
@@ -107,13 +107,13 @@ class LineSiteView @JvmOverloads constructor(
checkSite = hasSetLineAndSite.second
lineList.clear()
resetData()
- isChangeIngLineAndSite = true
} else {
queryLineList()
setEnableLineStatus(true)
setEnableSiteStatus(false)
onlyChangeSite(false)
setSiteAdapterEnable(false)
+ setSwitchEnable(false)
isChangeIngLineAndSite = false
}
@@ -137,6 +137,7 @@ class LineSiteView @JvmOverloads constructor(
setEnableSiteStatus(false)
onlyChangeSite(false)
setSiteAdapterEnable(true)
+ isChangeIngLineAndSite = true
lineAdapter.submitLine(it)
checkLine?.let {
querySitesByLineId(it.lineId.toString(),false)
@@ -210,12 +211,13 @@ class LineSiteView @JvmOverloads constructor(
}
tv_line_cancle.onClick {
- isChangeIngLineAndSite = false
resetData()
+ tempCheckLine = null
}
tv_site_cancle.onClick {
- isChangeIngLineAndSite = false
resetData()
+ tempCheckLine = null
+ tempCheckSite = null
}
tv_line_submit.onClick {
if (tempCheckLine == null) {
@@ -333,6 +335,9 @@ class LineSiteView @JvmOverloads constructor(
}
}
}
+ private fun setSwitchEnable(enable: Boolean){
+ tv_switch_line.isEnabled = enable
+ }
/**
* 接收司机屏反馈信息
@@ -353,6 +358,7 @@ class LineSiteView @JvmOverloads constructor(
setEnableSiteStatus(true)
onlyChangeSite(false)
setSiteAdapterEnable(true)
+ setSwitchEnable(false)
tempCheckLineIsSubmit = true
tempCheckLine?.let {
lineAdapter.submitLine(it)
@@ -368,6 +374,7 @@ class LineSiteView @JvmOverloads constructor(
setEnableSiteStatus(true)
onlyChangeSite(false)
setSiteAdapterEnable(true)
+ setSwitchEnable(true)
checkLine = tempCheckLine
checkSite = tempCheckSite
tempCheckLine = null
@@ -378,7 +385,7 @@ class LineSiteView @JvmOverloads constructor(
}
go2StartCar()
} else {
- tempCheckLineIsSubmit = false
+ tempCheckLineIsSubmit = true
ToastUtils.showShort("司机端拒绝请重新选择")
}
}
diff --git a/OCH/mogo-och-common-module/src/main/AndroidManifest.xml b/OCH/mogo-och-common-module/src/main/AndroidManifest.xml
index fad19aeea9..01f5dc90e8 100644
--- a/OCH/mogo-och-common-module/src/main/AndroidManifest.xml
+++ b/OCH/mogo-och-common-module/src/main/AndroidManifest.xml
@@ -1,5 +1,18 @@
- /
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/ImageVideoRotationView.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/ImageVideoRotationView.kt
new file mode 100644
index 0000000000..6457ffd54b
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/ImageVideoRotationView.kt
@@ -0,0 +1,45 @@
+package com.mogo.och.common.module.wigets.video
+
+import AdvancePagerAdapter
+import AdvanceViewPager
+import RotationItem
+import android.annotation.SuppressLint
+import android.content.Context
+import android.util.AttributeSet
+import android.widget.RelativeLayout
+
+class ImageVideoRotationView @JvmOverloads constructor(
+ context: Context, attrs: AttributeSet? = null
+) : RelativeLayout(context, attrs) {
+
+ private var viewPager: AdvanceViewPager? = null
+ private var pagerAdapter: AdvancePagerAdapter? = null
+
+ companion object {
+ const val TAG = "ImageAndVideoRotation"
+ }
+
+ init {
+ initView()
+ }
+
+ @SuppressLint("ClickableViewAccessibility")
+ private fun initView() {
+ viewPager = AdvanceViewPager(context)
+ pagerAdapter = AdvancePagerAdapter(context, viewPager!!)
+ viewPager?.adapter = pagerAdapter
+ addView(viewPager, LayoutParams(-1, -1))
+ }
+
+ fun setData(list: MutableList) {
+ pagerAdapter?.setData(list)
+ }
+
+ fun setPause() {
+ pagerAdapter?.setPause()
+ }
+
+ fun setResume() {
+ pagerAdapter?.setResume()
+ }
+}
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerActivity.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerActivity.kt
new file mode 100644
index 0000000000..ee855ae81c
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerActivity.kt
@@ -0,0 +1,18 @@
+package com.mogo.och.common.module.wigets.video
+
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import com.mogo.eagle.core.utilcode.util.BarUtils
+import com.mogo.och.common.module.R
+
+class VideoPlayerActivity : AppCompatActivity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_video_player)
+ val fragment = VideoPlayerFragment()
+ supportFragmentManager.beginTransaction().add(R.id.videoPlayerContainer, fragment)
+ .commitAllowingStateLoss()
+ BarUtils.hideStatusBarAndSticky(this.window)
+ }
+}
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerFragment.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerFragment.kt
new file mode 100644
index 0000000000..f1a759a353
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerFragment.kt
@@ -0,0 +1,135 @@
+package com.mogo.och.common.module.wigets.video
+
+import RotationItem
+import com.mogo.commons.mvp.MvpFragment
+import com.mogo.commons.mvp.Presenter
+import com.mogo.och.common.module.R
+import kotlinx.android.synthetic.main.fragment_video_player.*
+
+/**
+ * @author: wangmingjun
+ * @date: 2022/4/12
+ */
+class VideoPlayerFragment :
+ MvpFragment() {
+
+ private var arrayListOf = mutableListOf()
+
+ override fun getLayoutId(): Int {
+ return R.layout.fragment_video_player
+ }
+
+ override fun createPresenter(): VideoPlayerPresenter {
+ return VideoPlayerPresenter(this)
+ }
+
+ companion object {
+ private val TAG = VideoPlayerFragment::class.java.simpleName
+ }
+
+ override fun getTagName(): String {
+ return TAG
+ }
+
+ override fun initViews() {
+ initResourceData()
+ imageVideoRotationView.setData(arrayListOf)
+ }
+
+ override fun onPause() {
+ super.onPause()
+ imageVideoRotationView.setPause()
+ }
+
+ override fun onResume() {
+ super.onResume()
+ imageVideoRotationView.setResume()
+ }
+
+ private fun initResourceData() {
+ arrayListOf.clear()
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357256102/1.jpg",
+ 0,
+ "",
+ "1"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
+ 0,
+ "",
+ "2"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357557335/3.mp4",
+ 1,
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357382357/2.png",
+ "3"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
+ 0,
+ "",
+ "4"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357834634/5.m4v",
+ 1,
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
+ "5"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676358660379/6.m4v",
+ 1,
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676357598483/4.jpg",
+ "6"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360154589/7.jpg",
+ 0,
+ "",
+ "7"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360185500/8.jpg",
+ 0,
+ "",
+ "8"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
+ 0,
+ "",
+ "9"
+ )
+ )
+ arrayListOf.add(
+ RotationItem(
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360274126/10.mp4",
+ 1,
+ "https://img.zhidaohulian.com/fileServer/online_car_hailing/1676360224773/9.png",
+ "10"
+ )
+ )
+ }
+}
+
+class VideoPlayerPresenter(view: VideoPlayerFragment?) :
+ Presenter(view)
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerView.kt b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerView.kt
new file mode 100644
index 0000000000..d5d218220a
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/video/VideoPlayerView.kt
@@ -0,0 +1,576 @@
+import android.annotation.SuppressLint
+import android.content.Context
+import android.media.AudioManager
+import android.net.Uri
+import android.util.AttributeSet
+import android.view.MotionEvent
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.RelativeLayout
+import androidx.viewpager.widget.PagerAdapter
+import androidx.viewpager.widget.ViewPager
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.RequestOptions
+import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
+import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
+import com.mogo.eagle.core.utilcode.breakpoint.utils.DownloadUtils
+import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
+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.util.CountDownTimer
+import com.mogo.eagle.core.utilcode.util.FileUtils
+import com.mogo.eagle.core.utilcode.util.ThreadUtils
+import com.mogo.eagle.core.utilcode.util.UiThreadHandler
+import com.mogo.och.common.module.R
+import com.mogo.och.common.module.wigets.video.ImageVideoRotationView
+import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
+import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
+import com.shuyu.gsyvideoplayer.utils.Debuger
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
+import java.io.File
+
+class AdvanceVideoView @JvmOverloads constructor(
+ context: Context, attrs: AttributeSet? = null
+) : RelativeLayout(context, attrs) {
+
+ private var videoRelativeLayout: RelativeLayout? = null
+ private var cacheImage: ImageView? = null
+ private var videoViewPlayer: AdvanceGSYVideoPlayer? = null
+ private var gsyVideoOptionBuilder: GSYVideoOptionBuilder? = null
+ private var mOnCompletionListener: GSYSampleCallBack? = null
+ private var downloadVideoName = ""
+ private var fileNetPath: String? = ""
+ private var cacheImageUrl: String? = ""
+ private var mVideoDirPath: String? = ""
+
+ init {
+ mVideoDirPath = context.filesDir.absolutePath + File.separator + "video" + File.separator
+ initView()
+ }
+
+ private fun initView() {
+ initCacheImgView()
+ initVideoView()
+ }
+
+ private fun initCacheImgView() {
+ cacheImage = ImageView(context)
+ cacheImage?.scaleType = ImageView.ScaleType.FIT_XY
+ }
+
+ private fun initVideoView() {
+ videoRelativeLayout = RelativeLayout(context)
+ addView(videoRelativeLayout, LayoutParams(-1, -1))
+
+ if (videoViewPlayer === null) {
+ //视频播放控件
+ videoViewPlayer = AdvanceGSYVideoPlayer(context)
+ }
+
+ var layoutParams = LayoutParams(-1, -1)
+ //设置videoview占满父view播放
+ layoutParams.addRule(ALIGN_PARENT_LEFT)
+ layoutParams.addRule(ALIGN_PARENT_RIGHT)
+ layoutParams.addRule(ALIGN_PARENT_TOP)
+ layoutParams.addRule(ALIGN_PARENT_BOTTOM)
+
+ videoRelativeLayout?.addView(videoViewPlayer, layoutParams)
+ }
+
+ 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]
+ }
+ loadCacheImg()
+ }
+
+ private fun loadCacheImg() {
+ videoViewPlayer?.thumbImageView = cacheImage
+ cacheImage?.setImageResource(R.drawable.video_holder)
+ setCacheImageViewVisible()
+ Logger.d(ImageVideoRotationView.TAG, "setVideoPath")
+ cacheImage?.let {
+ Glide.with(context).load(cacheImageUrl)
+ .apply(
+ RequestOptions().placeholder(R.drawable.video_holder)
+ .error(R.drawable.video_holder)
+ .fallback(R.drawable.video_holder)
+ .centerCrop()
+ )
+ .into(it)
+ }
+ }
+
+ fun clearLocalErrorVideo() {
+ if (downloadVideoName.isNotEmpty()
+ && FileUtils.isFileExists(mVideoDirPath + downloadVideoName)
+ ) {
+ FileUtils.delete(mVideoDirPath + downloadVideoName)
+ }
+ }
+
+ @SuppressLint("CheckResult")
+ fun setCacheImageViewVisible() {
+ videoViewPlayer?.setCacheImageViewVisible()
+ }
+
+ fun setCacheImageViewGone() {
+ videoViewPlayer?.setCacheImageViewGone()
+ }
+
+ fun setVideo(onCompletionListener: GSYSampleCallBack) {
+ Logger.d(ImageVideoRotationView.TAG, "setVideo")
+ mOnCompletionListener = onCompletionListener
+ //判断是否已经下载
+ if (downloadVideoName.isNotEmpty()) {
+ Logger.d(
+ ImageVideoRotationView.TAG,
+ "video local url = $mVideoDirPath$downloadVideoName"
+ )
+ if (FileUtils.isFileExists(mVideoDirPath + downloadVideoName)) {
+ Logger.d(ImageVideoRotationView.TAG, "have cache startPlay")
+ startPlay()
+ return
+ }
+ startDownLoadVideo()
+ }
+ }
+
+ private fun startDownLoadVideo() {
+ //下载视频, 下载成功后再播放
+ Logger.d(ImageVideoRotationView.TAG, "startDownLoadVideo")
+ FileUtils.createFileDir(mVideoDirPath)
+ DownloadUtils.downLoad(
+ context, fileNetPath, mVideoDirPath, downloadVideoName, 5, downListener
+ )
+ }
+
+ private fun startPlay() {
+ try {
+ Logger.d(ImageVideoRotationView.TAG, "startPlay")
+ gsyVideoOptionBuilder = GSYVideoOptionBuilder()
+ gsyVideoOptionBuilder
+ ?.setUrl(
+ Uri.fromFile(File(mVideoDirPath + downloadVideoName)).toString()
+ ) // "/data/user/0/com.mogo.launcher.f/files/video/"
+ ?.setPlayTag(downloadVideoName)
+ ?.setCacheWithPlay(false)
+ ?.setThumbPlay(false)
+ ?.build(videoViewPlayer)
+
+ videoViewPlayer?.isFocusableInTouchMode = false
+ videoViewPlayer?.setVideoAllCallBack(mOnCompletionListener)
+ videoViewPlayer?.startPlayLogic()
+ } catch (e: Exception) {
+ Logger.d(ImageVideoRotationView.TAG, "startPlay e = ${e.message}")
+ }
+ }
+
+ fun onVideoReset() {
+ videoViewPlayer?.onVideoReset()
+ mOnCompletionListener = null
+ }
+
+ fun setPause() {
+ if (videoViewPlayer !== null) {
+ videoViewPlayer?.onVideoPause()
+ }
+ }
+
+ fun setResume() {
+ if (videoViewPlayer !== null) {
+ videoViewPlayer?.onVideoResume()
+ }
+ }
+
+ private val downListener = object : IDownload {
+ override fun onStart(url: String?) {
+ Logger.d(ImageVideoRotationView.TAG, "download-onStart")
+ }
+
+ override fun onPause(url: String?, threadBean: ThreadBean?) {
+ Logger.d(ImageVideoRotationView.TAG, "download-onPause")
+// UiThreadHandler.postDelayed(Runnable {
+// startDownLoadVideo()
+// },DOWNLOAD_DELAY)
+ // todo 测试下网络断掉是否会走onpause,且网络回复也不会继续下载
+ }
+
+ override fun onProgress(url: String?, length: Int) {
+ Logger.d(ImageVideoRotationView.TAG, "download-onProgress== $length")
+ }
+
+ override fun onFinished(url: String?, threadBean: ThreadBean?) {
+ Logger.d(ImageVideoRotationView.TAG, "download-onFinished = $url")
+ if (url.equals(fileNetPath)) { //发现下载工具在断网又连网后,已完成的任务又都下载,跳转播放出现问题
+ //下载完成
+ ThreadUtils.runOnUiThread {
+ startPlay()
+ }
+ } else {//如果当前文件不存在再次去下载当前的
+ Logger.d(
+ ImageVideoRotationView.TAG, "download-onFinished = not current" +
+ ",currentUrl = $fileNetPath "
+ )
+ if (FileUtils.isFileExists(mVideoDirPath + downloadVideoName)) {
+ Logger.d(ImageVideoRotationView.TAG, "have download startPlay")
+ startPlay()
+ return
+ } else {
+ startDownLoadVideo()
+ }
+ }
+ }
+
+ override fun onError(url: String?, errorMsg: String?) {
+ Logger.d(ImageVideoRotationView.TAG, "download-onError-$errorMsg")
+ //出错再次下载
+ if (errorMsg != null) {
+ if (errorMsg.startsWith("initFailed")) {
+ startDownLoadVideo()
+ }
+ }
+ }
+ }
+}
+
+class AdvanceViewPager : ViewPager {
+ constructor(context: Context) : super(context)
+ constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
+
+ override fun onTouchEvent(ev: MotionEvent?): Boolean {
+ return false
+ }
+
+ override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean {
+ return false
+ }
+}
+
+class AdvancePagerAdapter(context: Context, viewPager: ViewPager) : PagerAdapter(),
+ ViewPager.OnPageChangeListener {
+ private val mContext: Context = context
+ private val mViewPager: ViewPager = viewPager
+
+ private var dataList = mutableListOf()
+ private var viewList = mutableListOf()
+
+ private var lastPosition = -1
+
+ private var current = 0
+ private val time = 5000
+ private var pause = false
+ private var countDownTimer: CountDownTimer? = null
+
+ fun setData(list: MutableList) {
+ if (list.isEmpty()) return
+ dataList.addAll(list)
+ viewList.clear()
+ list.forEach {
+ addView(it)
+ }
+
+ mViewPager.addOnPageChangeListener(this)
+ notifyDataSetChanged()
+ mViewPager.currentItem = 0
+
+ if (viewList.size > 0) {
+ if (viewList[mViewPager.currentItem] is AdvanceVideoView) {//有人反应第一个是视频不播放这边优化了一下
+ Logger.d(ImageVideoRotationView.TAG, "第一个是视频")
+ val video = viewList[mViewPager.currentItem] as AdvanceVideoView
+ video.setVideo(gsySampleCallBack)
+ } else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
+ Logger.d(ImageVideoRotationView.TAG, "startTimer()_1")
+ current = 0//换页重新计算时间
+ startTimer()
+ }
+ }
+ }
+
+ override fun getCount(): Int {
+ return dataList.size
+ }
+
+ override fun isViewFromObject(view: View, `object`: Any): Boolean {
+ return view === `object`
+ }
+
+ override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
+ container.removeView(viewList[position])
+ }
+
+ override fun instantiateItem(container: ViewGroup, position: Int): Any {
+ val view: View = viewList[position]
+ container.addView(view)
+ return view
+ }
+
+ override fun getItemPosition(`object`: Any): Int {
+ return POSITION_NONE
+ }
+
+ private fun addView(item: RotationItem) {
+ if (item.type == 1) { // 表示视频
+ val videoView = AdvanceVideoView(mContext)
+ videoView.setVideoPath(item.path, item.cacheImgPath)
+ viewList.add(videoView)
+ } else { // 表示图片
+ val imageView = AdvanceImageView(mContext)
+ imageView.setImagePath(item.path)
+ viewList.add(imageView)
+ }
+ }
+
+ fun setPause() {
+ pause = true
+ if (viewList.size > 0 && viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = viewList[mViewPager.currentItem] as AdvanceVideoView
+ videoView.setPause()
+ }
+ }
+
+ fun setResume() {
+ pause = false
+ if (viewList.size > 0 && viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = viewList[mViewPager.currentItem] as AdvanceVideoView
+ videoView.setResume()
+ }
+ }
+
+ override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
+ }
+
+ override fun onPageSelected(position: Int) {
+ }
+
+ override fun onPageScrollStateChanged(state: Int) {
+ // 由于viewpager的预加载机制onPageSelected这里面加载videoview 放的跟玩一样 等操作完成后再播放videoview就香了 很丝滑
+ if (state == 0) { //静止,什么都没做
+ val currentItem = mViewPager.currentItem
+ Logger.d(
+ ImageVideoRotationView.TAG,
+ "state = $state currentItem = $currentItem lastPosition = $lastPosition"
+ )
+ if (viewList.size > 1) { //多于1,才会循环跳转
+ if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
+ videoView.setCacheImageViewVisible()
+ videoView.setVideo(gsySampleCallBack)
+ } else if (viewList[mViewPager.currentItem] is AdvanceImageView) {
+ Logger.d(ImageVideoRotationView.TAG, "startTimer()")
+ current = 0//换页重新计算时间
+ startTimer()
+ }
+ lastPosition = mViewPager.currentItem
+ }
+ }
+ }
+
+ private var gsySampleCallBack = object : GSYSampleCallBack() {
+
+ override fun onPrepared(url: String?, vararg objects: Any?) {
+ Logger.d(ImageVideoRotationView.TAG, "onPrepared")
+ if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
+ UiThreadHandler.postDelayed(Runnable {
+ videoView.setCacheImageViewGone()
+ }, 1500)
+ }
+ }
+
+ override fun onAutoComplete(url: String?, vararg objects: Any?) {
+ Logger.d(ImageVideoRotationView.TAG, "onAutoComplete()")
+ if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
+ videoView.onVideoReset()
+ videoView.setCacheImageViewVisible()
+ goNextItemView()
+ }
+ }
+
+ override fun onPlayError(url: String?, vararg objects: Any?) {
+ super.onPlayError(url, *objects)
+ Logger.d(ImageVideoRotationView.TAG, "onPlayError()-${objects}")
+ if (viewList[mViewPager.currentItem] is AdvanceVideoView) {
+ val videoView = (viewList[mViewPager.currentItem] as AdvanceVideoView)
+ videoView.onVideoReset()
+ videoView.setCacheImageViewVisible()
+ videoView.clearLocalErrorVideo()
+ goNextItemView()
+ }
+ }
+ }
+
+ private fun startTimer() {
+ if (countDownTimer != null) {
+ countDownTimer?.cancel()
+ countDownTimer = null
+ }
+ countDownTimer = object : CountDownTimer(5000, 1000) {
+ override fun onTick(millisUntilFinished: Long) {
+ CallerLogger.d(
+ SceneConstant.M_BUS_P + "startTimer",
+ "倒计时秒 = ${millisUntilFinished / 1000}"
+ )
+ }
+
+ override fun onFinish() {
+ CallerLogger.d(ImageVideoRotationView.TAG + "startTimer", "5s到,跳转")
+ goNextItemView()
+ }
+ }.start()
+ }
+
+ /**
+ * view 跳转
+ */
+ private fun goNextItemView() {
+ if (mViewPager.currentItem == viewList.size - 1) {//已经到最后一个
+ mViewPager.post {
+ mViewPager.setCurrentItem(0, true)
+ }
+ } else {
+ mViewPager.post {
+ mViewPager.setCurrentItem(mViewPager.currentItem + 1, true)
+ }
+ }
+ }
+}
+
+data class RotationItem(
+ var path: String,
+ var type: Int,
+ var cacheImgPath: String,
+ var title: String
+)
+
+class AdvanceImageView @JvmOverloads constructor(
+ context: Context, attrs: AttributeSet? = null
+) : RelativeLayout(context, attrs) {
+
+ private var imageView: ImageView? = null
+
+ init {
+ initView()
+ }
+
+ private fun initView() {
+ imageView = ImageView(context)
+ imageView?.scaleType = ImageView.ScaleType.FIT_XY
+ addView(imageView, LayoutParams(-1, -1))
+ }
+
+ @SuppressLint("CheckResult")
+ fun setImagePath(path: String) {
+ imageView?.setImageResource(R.drawable.video_holder)
+ imageView?.let {
+ Glide.with(context).load(path)
+ .apply(
+ RequestOptions().placeholder(R.drawable.video_holder)
+ .error(R.drawable.video_holder)
+ .fallback(R.drawable.video_holder)
+ .centerCrop()
+ )
+ .into(it)
+ }
+ }
+}
+
+class AdvanceGSYVideoPlayer : StandardGSYVideoPlayer {
+ constructor(context: Context?) : super(context)
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
+
+ init {
+ hideWidget()
+ GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL)
+ GSYVideoType.setRenderType(GSYVideoType.GLSURFACE)
+ }
+
+ 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, INVISIBLE)
+ setViewShowState(mProgressBar, INVISIBLE)
+ setViewShowState(mCurrentTimeTextView, INVISIBLE)
+ setViewShowState(mTotalTimeTextView, INVISIBLE)
+ setViewShowState(mBottomProgressBar, INVISIBLE)
+ setViewShowState(mBackButton, INVISIBLE)
+ setViewShowState(mStartButton, INVISIBLE)
+ setViewShowState(mTopContainer, INVISIBLE)
+ setViewShowState(mLoadingProgressBar, INVISIBLE)
+ setViewShowState(
+ mLockScreen, INVISIBLE
+ )
+
+ setIsTouchWiget(false)
+ isFocusableInTouchMode = false
+ }
+
+ fun setCacheImageViewVisible() {
+ setViewShowState(mThumbImageViewLayout, VISIBLE)
+ setViewShowState(mThumbImageView, VISIBLE)
+ }
+
+ fun setCacheImageViewGone() {
+ setViewShowState(mThumbImageViewLayout, INVISIBLE)
+ setViewShowState(mThumbImageView, INVISIBLE)
+ }
+
+ //失去焦点声音压低
+ override fun onLossTransientCanDuck() {
+ setNeedMute(true)
+ }
+
+ //获取焦点声音恢复
+ override fun onGankAudio() {
+ setNeedMute(false)
+ }
+
+ private fun setStreamVolume(percent: Float){
+ var mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
+ var maxVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC)
+ var volume = (percent * maxVolume).toInt()
+ if (volume < 0 ){
+ volume = 0
+ }
+ mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,volume,0)
+ }
+
+ private fun setNeedMute(isMute: Boolean){
+ gsyVideoManager?.player?.setNeedMute(isMute)
+ }
+}
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/res/drawable-nodpi/video_holder.png b/OCH/mogo-och-common-module/src/main/res/drawable-nodpi/video_holder.png
new file mode 100644
index 0000000000..99bfcefc6f
Binary files /dev/null and b/OCH/mogo-och-common-module/src/main/res/drawable-nodpi/video_holder.png differ
diff --git a/OCH/mogo-och-common-module/src/main/res/layout/activity_video_player.xml b/OCH/mogo-och-common-module/src/main/res/layout/activity_video_player.xml
new file mode 100644
index 0000000000..4af9cb07d9
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/res/layout/activity_video_player.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/OCH/mogo-och-common-module/src/main/res/layout/fragment_video_player.xml b/OCH/mogo-och-common-module/src/main/res/layout/fragment_video_player.xml
new file mode 100644
index 0000000000..44c0c0702f
--- /dev/null
+++ b/OCH/mogo-och-common-module/src/main/res/layout/fragment_video_player.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
index 87fc4118c7..3d8721a439 100644
--- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
+++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/main/MainLauncherActivity.java
@@ -125,14 +125,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
}
} else {
// 目前只有金旅星辰乘客屏是连接的双屏
- if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
- && AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
+ if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/passenger/api")
.navigation(getContext());
- MultiDisplayUtils.INSTANCE.startActWithSecond(
- this,
- VideoAdAtc.class);
} else {
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
.build("/noop/api")