This commit is contained in:
chenjuntao
2019-09-11 18:27:49 +08:00
parent 34ac30cdfe
commit b30e60dfde
4 changed files with 34 additions and 6 deletions

View File

@ -17,6 +17,8 @@ public class Constants {
public static final String DEVICE_KEY = "deviceKey";
public static final String SHOULD_SHOW_VIDEO_MOBILE_WARNING = "should_show_video_mobile_warning";
public static final String XPOSED_INSTALLER_PACKAGE_NAME = "de.robv.android.xposed.installer";
// 最近显示的弹窗信息

View File

@ -5,11 +5,13 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.gh.common.constant.Constants;
import com.gh.common.exposure.meta.MetaUtil;
import com.gh.common.repository.ReservationRepository;
import com.gh.common.util.NetworkUtils;
import com.gh.download.DownloadNotification;
import com.gh.gamecenter.eventbus.EBNetworkState;
import com.halo.assistant.HaloApp;
import org.greenrobot.eventbus.EventBus;
@ -27,6 +29,10 @@ public class NetworkStateReceiver extends BroadcastReceiver {
if (manager != null) {
manager.cancel(DownloadNotification.WAIT_NOTIFY_ID);
}
if (NetworkUtils.isMobileConnected(context)) {
HaloApp.put(Constants.SHOULD_SHOW_VIDEO_MOBILE_WARNING, true);
}
}
}

View File

@ -7,14 +7,13 @@ import android.view.Surface
import android.view.View
import android.widget.ImageView
import androidx.core.content.ContextCompat
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.DirectUtils
import com.gh.common.util.ImageUtils
import com.gh.common.util.ShareUtils
import com.gh.common.constant.Constants
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.qa.comment.CommentActivity
import com.halo.assistant.HaloApp
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import com.squareup.picasso.Picasso
@ -117,6 +116,20 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
}
override fun showWifiDialog() {
DialogUtils.showAlertDialog(
context,
"注意",
"您当前使用的移动网络,确定要继续播放视频吗?",
"继续播放",
"暂时不了",
{
HaloApp.put(Constants.SHOULD_SHOW_VIDEO_MOBILE_WARNING, false)
startButton.performClick()
},
null)
}
fun updateThumb(url: String) {
Picasso.with(context).load(url).into(findViewById<ImageView>(R.id.thumbImage))
}
@ -156,6 +169,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
override fun changeUiToPreparingShow() {
super.changeUiToPreparingShow()
setViewShowState(mThumbImageViewLayout, View.VISIBLE)
setViewShowState(mBottomProgressBar, View.VISIBLE)
}

View File

@ -2,6 +2,7 @@ package com.gh.gamecenter.video.detail
import android.os.Bundle
import butterknife.BindView
import com.gh.common.constant.Constants
import com.gh.common.util.observeNonNull
import com.gh.common.util.viewModelProvider
import com.gh.common.util.viewModelProviderFromParent
@ -9,6 +10,7 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.normal.NormalFragment
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel.ActionType
import com.halo.assistant.HaloApp
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
class VideoDetailFragment : NormalFragment() {
@ -68,11 +70,15 @@ class VideoDetailFragment : NormalFragment() {
override fun onResume() {
super.onResume()
// 更新 container fragment 当前屏幕显示的视频
mContainerViewModel.currentDisplayingVideo = mViewModel.videoDetail
videoView.isNeedShowWifiTip = HaloApp.get(Constants.SHOULD_SHOW_VIDEO_MOBILE_WARNING, false) as Boolean?
?: false
if (!videoView.isInPlayingState) {
videoView.startButton.performClick()
}
mContainerViewModel.currentDisplayingVideo = mViewModel.videoDetail
}
companion object {