Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev

This commit is contained in:
kehaoyuan
2020-03-05 10:32:03 +08:00
2 changed files with 14 additions and 15 deletions

View File

@ -673,13 +673,11 @@ class GameDetailFragment : NormalFragment() {
mTopVideoView.video = topVideo
mTopVideoView.updateThumb(topVideo.poster)
val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
if (NetworkUtils.isWifiConnected(requireContext()) || !trafficVideo) {
//val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
if (NetworkUtils.isWifiConnected(requireContext()) /*|| !trafficVideo*/) {
if (mViewModel.isTopVideoPartlyCached(topVideo.url)) {
mBaseHandler.postDelayed({ mTopVideoView.updateMuteStatus() }, 500)
mTopVideoView.startPlayLogic(isAutoPlay = true)
} else {
mBaseHandler.postDelayed({ mTopVideoView.updateMuteStatus() }, INITIAL_DELAY + 500)
// 未有缓存时,为避免影响页面加载,延迟自动播放视频
postDelayedRunnable({
if (activity != null && activity?.isFinishing != true) {

View File

@ -119,6 +119,7 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
fun startPlayLogic(isAutoPlay: Boolean) {
postDelayed({ updateMuteStatus() }, 500)
DownloadManager.getInstance(context).updateSpeedLimitationReleaseDelay(5)
if (isAutoPlay) {
MtaHelper.onEvent("游戏详情_顶部视频", "视频播放方式", "自动播放")
@ -194,17 +195,17 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
// 不需要弹弹窗,直接播放
override fun showWifiDialog() {
startPlayLogic(false)
val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
//val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
//if (trafficVideo) {
// 不延迟的话 isCacheFile 可能直接返回 false
if (trafficVideo) {
postDelayed({
if (!NetworkUtils.isAvailable(mContext) && !GSYVideoManager.instance().isCacheFile) {
Utils.toast(context, "网络异常,请检查手机网络状态")
} else if (!NetworkUtils.isWifiConnected(mContext) && !GSYVideoManager.instance().isCacheFile) {
Utils.toast(context, "当前为非Wi-Fi环境请注意流量消耗")
}
}, 100)
}
postDelayed({
if (!NetworkUtils.isAvailable(mContext) && !GSYVideoManager.instance().isCacheFile) {
Utils.toast(context, "网络异常,请检查手机网络状态")
} else if (!NetworkUtils.isWifiConnected(mContext) && !GSYVideoManager.instance().isCacheFile) {
Utils.toast(context, "当前为非Wi-Fi环境请注意流量消耗")
}
}, 100)
// }
}
@ -256,7 +257,7 @@ class TopVideoView @JvmOverloads constructor(context: Context, attrs: AttributeS
replayIv.setOnClickListener {
MtaHelper.onEvent("游戏详情_顶部视频", "${getMtaKeyPrefix()}-点击重新播放", combinedTitleAndId)
startButton.performClick()
postDelayed({updateMuteStatus()},500)
postDelayed({ updateMuteStatus() }, 500)
}
updateThumb(video!!.poster)
} else {