Merge remote-tracking branch 'origin/dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0' into dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0
This commit is contained in:
@@ -8,10 +8,14 @@ import androidx.fragment.app.Fragment;
|
|||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
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.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.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.constant.BusPassengerConst;
|
||||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -40,6 +44,10 @@ public class MogoOCHBusPassenger implements IMogoOCH {
|
|||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
||||||
this.mContainerId = containerId;
|
this.mContainerId = containerId;
|
||||||
showFragment();
|
showFragment();
|
||||||
|
|
||||||
|
if (AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
MultiDisplayUtils.INSTANCE.startActWithSecond(activity, VideoPlayerActivity.class);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import android.content.Context
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route
|
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.map.CallerMapUIServiceManager.getMapUIController
|
||||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
|
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager.stepInDayMode
|
||||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
|||||||
@@ -512,14 +512,14 @@ object CharterPassengerModel {
|
|||||||
it.dispose()
|
it.dispose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val leadTime = endlast / 1000
|
val leadTime = endlast / 1000+60
|
||||||
subscribeCountDown =
|
subscribeCountDown =
|
||||||
Observable.intervalRange(0L, leadTime, 0, 1, TimeUnit.SECONDS)
|
Observable.intervalRange(0L, leadTime, 0, 1, TimeUnit.SECONDS)
|
||||||
.map { aLong -> leadTime - aLong }
|
.map { aLong -> leadTime - aLong }
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(Schedulers.io())
|
.observeOn(Schedulers.io())
|
||||||
.subscribe{millisUntilFinished->
|
.subscribe{millisUntilFinished->
|
||||||
if (millisUntilFinished <= 300L) {
|
if (millisUntilFinished <= 360L) {
|
||||||
orderInfo?.let {
|
orderInfo?.let {
|
||||||
if (broadcastList.get("${it}$min5Speak") == null
|
if (broadcastList.get("${it}$min5Speak") == null
|
||||||
|| broadcastList.get("${it}$min5Speak") == false
|
|| broadcastList.get("${it}$min5Speak") == false
|
||||||
@@ -544,7 +544,7 @@ object CharterPassengerModel {
|
|||||||
}
|
}
|
||||||
iDistanceTimeCallback?.setOrderTimeCallBack(-1)
|
iDistanceTimeCallback?.setOrderTimeCallBack(-1)
|
||||||
}else{
|
}else{
|
||||||
iDistanceTimeCallback?.setOrderTimeCallBack(millisUntilFinished+60)
|
iDistanceTimeCallback?.setOrderTimeCallBack(millisUntilFinished)
|
||||||
}
|
}
|
||||||
CallerLogger.d(
|
CallerLogger.d(
|
||||||
M_BUS_P + TAG,
|
M_BUS_P + TAG,
|
||||||
|
|||||||
@@ -158,7 +158,10 @@ class BusPassengerPresenter(view: MainFragment?) :
|
|||||||
setOrderTime("--","--")
|
setOrderTime("--","--")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val surplusTime = (timeInSecond / 60).toInt()
|
var surplusTime = (timeInSecond / 60).toInt()
|
||||||
|
if(surplusTime==0){
|
||||||
|
surplusTime = 1
|
||||||
|
}
|
||||||
|
|
||||||
val beforeTime = Calendar.getInstance()
|
val beforeTime = Calendar.getInstance()
|
||||||
beforeTime.add(Calendar.MINUTE, surplusTime)
|
beforeTime.add(Calendar.MINUTE, surplusTime)
|
||||||
|
|||||||
@@ -107,13 +107,13 @@ class LineSiteView @JvmOverloads constructor(
|
|||||||
checkSite = hasSetLineAndSite.second
|
checkSite = hasSetLineAndSite.second
|
||||||
lineList.clear()
|
lineList.clear()
|
||||||
resetData()
|
resetData()
|
||||||
isChangeIngLineAndSite = true
|
|
||||||
} else {
|
} else {
|
||||||
queryLineList()
|
queryLineList()
|
||||||
setEnableLineStatus(true)
|
setEnableLineStatus(true)
|
||||||
setEnableSiteStatus(false)
|
setEnableSiteStatus(false)
|
||||||
onlyChangeSite(false)
|
onlyChangeSite(false)
|
||||||
setSiteAdapterEnable(false)
|
setSiteAdapterEnable(false)
|
||||||
|
setSwitchEnable(false)
|
||||||
isChangeIngLineAndSite = false
|
isChangeIngLineAndSite = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +137,7 @@ class LineSiteView @JvmOverloads constructor(
|
|||||||
setEnableSiteStatus(false)
|
setEnableSiteStatus(false)
|
||||||
onlyChangeSite(false)
|
onlyChangeSite(false)
|
||||||
setSiteAdapterEnable(true)
|
setSiteAdapterEnable(true)
|
||||||
|
isChangeIngLineAndSite = true
|
||||||
lineAdapter.submitLine(it)
|
lineAdapter.submitLine(it)
|
||||||
checkLine?.let {
|
checkLine?.let {
|
||||||
querySitesByLineId(it.lineId.toString(),false)
|
querySitesByLineId(it.lineId.toString(),false)
|
||||||
@@ -210,12 +211,13 @@ class LineSiteView @JvmOverloads constructor(
|
|||||||
|
|
||||||
}
|
}
|
||||||
tv_line_cancle.onClick {
|
tv_line_cancle.onClick {
|
||||||
isChangeIngLineAndSite = false
|
|
||||||
resetData()
|
resetData()
|
||||||
|
tempCheckLine = null
|
||||||
}
|
}
|
||||||
tv_site_cancle.onClick {
|
tv_site_cancle.onClick {
|
||||||
isChangeIngLineAndSite = false
|
|
||||||
resetData()
|
resetData()
|
||||||
|
tempCheckLine = null
|
||||||
|
tempCheckSite = null
|
||||||
}
|
}
|
||||||
tv_line_submit.onClick {
|
tv_line_submit.onClick {
|
||||||
if (tempCheckLine == null) {
|
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)
|
setEnableSiteStatus(true)
|
||||||
onlyChangeSite(false)
|
onlyChangeSite(false)
|
||||||
setSiteAdapterEnable(true)
|
setSiteAdapterEnable(true)
|
||||||
|
setSwitchEnable(false)
|
||||||
tempCheckLineIsSubmit = true
|
tempCheckLineIsSubmit = true
|
||||||
tempCheckLine?.let {
|
tempCheckLine?.let {
|
||||||
lineAdapter.submitLine(it)
|
lineAdapter.submitLine(it)
|
||||||
@@ -368,6 +374,7 @@ class LineSiteView @JvmOverloads constructor(
|
|||||||
setEnableSiteStatus(true)
|
setEnableSiteStatus(true)
|
||||||
onlyChangeSite(false)
|
onlyChangeSite(false)
|
||||||
setSiteAdapterEnable(true)
|
setSiteAdapterEnable(true)
|
||||||
|
setSwitchEnable(true)
|
||||||
checkLine = tempCheckLine
|
checkLine = tempCheckLine
|
||||||
checkSite = tempCheckSite
|
checkSite = tempCheckSite
|
||||||
tempCheckLine = null
|
tempCheckLine = null
|
||||||
@@ -378,7 +385,7 @@ class LineSiteView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
go2StartCar()
|
go2StartCar()
|
||||||
} else {
|
} else {
|
||||||
tempCheckLineIsSubmit = false
|
tempCheckLineIsSubmit = true
|
||||||
ToastUtils.showShort("司机端拒绝请重新选择")
|
ToastUtils.showShort("司机端拒绝请重新选择")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.mogo.och.common.module">
|
package="com.mogo.och.common.module">
|
||||||
|
|
||||||
/
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".wigets.video.VideoPlayerActivity"
|
||||||
|
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:process=":video_ad"
|
||||||
|
android:resizeableActivity="false"
|
||||||
|
android:resumeWhilePausing="true"
|
||||||
|
android:screenOrientation="landscape"
|
||||||
|
android:stateNotNeeded="true"
|
||||||
|
android:theme="@style/Main"
|
||||||
|
android:windowSoftInputMode="adjustPan|stateHidden" />
|
||||||
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -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<RotationItem>) {
|
||||||
|
pagerAdapter?.setData(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setPause() {
|
||||||
|
pagerAdapter?.setPause()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setResume() {
|
||||||
|
pagerAdapter?.setResume()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<VideoPlayerFragment?, VideoPlayerPresenter?>() {
|
||||||
|
|
||||||
|
private var arrayListOf = mutableListOf<RotationItem>()
|
||||||
|
|
||||||
|
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<VideoPlayerFragment?>(view)
|
||||||
@@ -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<RotationItem>()
|
||||||
|
private var viewList = mutableListOf<View>()
|
||||||
|
|
||||||
|
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<RotationItem>) {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/road_video_bg"
|
||||||
|
tools:context="com.mogo.eagle.core.function.main.VideoAdAtc">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/videoPlayerContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- 图片或视频广告-->
|
||||||
|
<com.mogo.och.common.module.wigets.video.ImageVideoRotationView
|
||||||
|
android:id="@+id/imageVideoRotationView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -125,14 +125,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 目前只有金旅星辰乘客屏是连接的双屏
|
// 目前只有金旅星辰乘客屏是连接的双屏
|
||||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||||
&& AppIdentityModeUtils.isJL(FunctionBuildConfig.appIdentityMode)) {
|
|
||||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||||
.build("/passenger/api")
|
.build("/passenger/api")
|
||||||
.navigation(getContext());
|
.navigation(getContext());
|
||||||
MultiDisplayUtils.INSTANCE.startActWithSecond(
|
|
||||||
this,
|
|
||||||
VideoAdAtc.class);
|
|
||||||
} else {
|
} else {
|
||||||
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
ochProvider = (IMoGoFunctionProvider) ARouter.getInstance()
|
||||||
.build("/noop/api")
|
.build("/noop/api")
|
||||||
|
|||||||
Reference in New Issue
Block a user