完善论坛信息流视频播放逻辑
This commit is contained in:
@ -1,16 +1,14 @@
|
||||
package com.gh.gamecenter.forum.home
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.util.AttributeSet
|
||||
import android.view.Surface
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.*
|
||||
@ -18,6 +16,7 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.video.detail.CustomManager
|
||||
import com.lightgame.utils.Utils
|
||||
import com.shuyu.gsyvideoplayer.utils.CommonUtil
|
||||
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
|
||||
@ -26,41 +25,40 @@ import java.util.*
|
||||
|
||||
class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : StandardGSYVideoPlayer(context, attrs) {
|
||||
|
||||
// private var mMuteCallback: MuteCallback
|
||||
// private var mVolumeObserver: VolumeObserver
|
||||
private var mVideoEntity: ForumVideoEntity? = null
|
||||
private var mMuteDisposable: Disposable? = null
|
||||
private var mIsAutoPlay = false
|
||||
var uuid = UUID.randomUUID().toString()
|
||||
|
||||
var thumbImage: SimpleDraweeView = findViewById(R.id.thumbImage)
|
||||
var durationTv: TextView = findViewById(R.id.durationTv)
|
||||
var completeContainer: LinearLayout = findViewById(R.id.completeContainer)
|
||||
var replayIv: ImageView = findViewById(R.id.replayIv)
|
||||
var completeContainer: View = findViewById(R.id.completeContainer)
|
||||
var replayTv: TextView = findViewById(R.id.replayTv)
|
||||
var shareIv: ImageView = findViewById(R.id.shareIv)
|
||||
var shareTv: TextView = findViewById(R.id.shareTv)
|
||||
var volume: ImageView = findViewById(R.id.volume)
|
||||
var remainingTv: TextView = findViewById(R.id.remainingTv)
|
||||
var back: ImageView = findViewById(R.id.back)
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.layout_article_item_video
|
||||
}
|
||||
|
||||
init {
|
||||
SPUtils.setBoolean(getMuteKey(), SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true))
|
||||
|
||||
post {
|
||||
volume.setOnClickListener { toggleMute() }
|
||||
}
|
||||
|
||||
// mMuteCallback = object : MuteCallback {
|
||||
// override fun onMute(isMute: Boolean) {
|
||||
// if (isMute) {
|
||||
// mute()
|
||||
// } else {
|
||||
// unMute()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// mVolumeObserver = VolumeObserver(context, Handler(), mMuteCallback)
|
||||
if (mIfCurrentIsFullscreen) {
|
||||
showBackBtn()
|
||||
} else {
|
||||
hideBackBtn()
|
||||
}
|
||||
|
||||
setBackFromFullScreenListener {
|
||||
clearFullscreenLayout()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getGSYVideoManager(): GSYVideoViewBridge {
|
||||
@ -68,15 +66,17 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
return CustomManager.getCustomManager(getKey())
|
||||
}
|
||||
|
||||
override fun startPlayLogic() {
|
||||
super.startPlayLogic()
|
||||
val topVideoVoiceStatus = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
if (topVideoVoiceStatus) {
|
||||
violenceUpdateMuteStatus()
|
||||
}
|
||||
fun startPlayLogic(isAutoPlay: Boolean) {
|
||||
mIsAutoPlay = isAutoPlay
|
||||
startPlayLogic()
|
||||
}
|
||||
|
||||
private fun violenceUpdateMuteStatus() {
|
||||
override fun prepareVideo() {
|
||||
super.prepareVideo()
|
||||
violenceUpdateMuteStatus()
|
||||
}
|
||||
|
||||
fun violenceUpdateMuteStatus() {
|
||||
if (mMuteDisposable != null) {
|
||||
mMuteDisposable?.dispose()
|
||||
mMuteDisposable = null
|
||||
@ -86,13 +86,13 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
mMuteDisposable?.dispose()
|
||||
mMuteDisposable = null
|
||||
}
|
||||
mute()
|
||||
updateMuteStatus()
|
||||
}
|
||||
}
|
||||
|
||||
// 不需要弹弹窗,直接播放
|
||||
override fun showWifiDialog() {
|
||||
startPlayLogic()
|
||||
startPlayLogic(false)
|
||||
//val trafficVideo = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(SettingsFragment.TRAFFIC_VIDEO_SP_KEY, false)
|
||||
//if (trafficVideo) {
|
||||
// 不延迟的话 isCacheFile 可能直接返回 false
|
||||
@ -138,9 +138,57 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
super.onSurfaceUpdated(surface)
|
||||
if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
|
||||
mThumbImageViewLayout.visibility = View.INVISIBLE
|
||||
uploadVideoStreamingPlaying("开始播放")
|
||||
}
|
||||
}
|
||||
|
||||
//监控播放错误
|
||||
// override fun onError(what: Int, extra: Int) {
|
||||
// super.onError(what, extra)
|
||||
// Utils.toast(context, "网络错误,视频播放失败")
|
||||
// setViewShowState(mStartButton, View.INVISIBLE)
|
||||
//// errorContainer.visibility = View.VISIBLE
|
||||
// }
|
||||
|
||||
override fun releaseVideos() {
|
||||
uploadVideoStreamingPlaying("结束播放")
|
||||
CustomManager.releaseAllVideos(getKey())
|
||||
}
|
||||
|
||||
override fun onVideoPause() {
|
||||
super.onVideoPause()
|
||||
uploadVideoStreamingPlaying("暂停播放")
|
||||
}
|
||||
|
||||
// 重载以减少横竖屏切换的时间
|
||||
override fun checkoutState() {
|
||||
removeCallbacks(mCheckoutTask)
|
||||
postDelayed(mCheckoutTask, 300)
|
||||
}
|
||||
|
||||
override fun clearFullscreenLayout() {
|
||||
super.clearFullscreenLayout()
|
||||
updateMuteStatus()
|
||||
hideBackBtn()
|
||||
}
|
||||
|
||||
override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
|
||||
super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
|
||||
if (remainingTv.visibility == View.VISIBLE) {
|
||||
remainingTv.text = CommonUtil.stringForTime(totalTime - currentTime)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showBackBtn() {
|
||||
mTopContainer.background = ContextCompat.getDrawable(context, R.drawable.video_title_bg)
|
||||
back.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun hideBackBtn() {
|
||||
mTopContainer?.setBackgroundResource(0)
|
||||
back.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun updateThumb(url: String) {
|
||||
ImageUtils.display(thumbImage, url)
|
||||
}
|
||||
@ -180,18 +228,6 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
super.setStateAndUi(state)
|
||||
if (currentState == GSYVideoView.CURRENT_STATE_PREPAREING) {
|
||||
setViewShowState(durationTv, View.GONE)
|
||||
replayIv.setOnClickListener {
|
||||
startButton.performClick()
|
||||
// violenceUpdateMuteStatus()
|
||||
// uploadVideoStreamingPlaying("重新播放")
|
||||
}
|
||||
replayTv.setOnClickListener { replayIv.performClick() }
|
||||
shareIv.setOnClickListener {
|
||||
share()
|
||||
}
|
||||
shareTv.setOnClickListener {
|
||||
shareIv.performClick()
|
||||
}
|
||||
}
|
||||
|
||||
// if (currentState == GSYVideoView.CURRENT_STATE_PLAYING) {
|
||||
@ -201,6 +237,15 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
if (currentState == GSYVideoView.CURRENT_STATE_AUTO_COMPLETE) {
|
||||
hideAllWidget()
|
||||
setViewShowState(completeContainer, View.VISIBLE)
|
||||
mTopContainer.visibility = View.VISIBLE
|
||||
replayTv.setOnClickListener {
|
||||
startButton.performClick()
|
||||
violenceUpdateMuteStatus()
|
||||
uploadVideoStreamingPlaying("重新播放")
|
||||
}
|
||||
shareTv.setOnClickListener {
|
||||
share()
|
||||
}
|
||||
} else {
|
||||
setViewShowState(completeContainer, View.GONE)
|
||||
}
|
||||
@ -208,18 +253,24 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
|
||||
override fun changeUiToPlayingShow() {
|
||||
super.changeUiToPlayingShow()
|
||||
setViewShowState(mBottomProgressBar, View.VISIBLE)
|
||||
if (!mIfCurrentIsFullscreen) setViewShowState(mBottomProgressBar, View.VISIBLE)
|
||||
}
|
||||
|
||||
override fun changeUiToPlayingClear() {
|
||||
super.changeUiToPlayingClear()
|
||||
if (mIfCurrentIsFullscreen) setViewShowState(mBottomProgressBar, View.GONE)
|
||||
}
|
||||
|
||||
private fun toggleMute() {
|
||||
if (mVideoEntity?.videoIsMuted == true) {
|
||||
unMute()
|
||||
unMute(true)
|
||||
} else {
|
||||
mute()
|
||||
mute(true)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateMuteStatus() {
|
||||
mVideoEntity?.videoIsMuted = SPUtils.getBoolean(getMuteKey(), true)
|
||||
if (mVideoEntity?.videoIsMuted == true) {
|
||||
mute()
|
||||
} else {
|
||||
@ -227,16 +278,35 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
}
|
||||
}
|
||||
|
||||
private fun mute() {
|
||||
private fun mute(isManual: Boolean = false) {
|
||||
mVideoEntity?.videoIsMuted = true
|
||||
SPUtils.setBoolean(getMuteKey(), true)
|
||||
volume.setImageResource(R.drawable.ic_article_video_volume_off)
|
||||
CustomManager.getCustomManager(getKey()).isNeedMute = true
|
||||
if (isManual) {
|
||||
// Utils.toast(context, "当前处于静音状态")
|
||||
uploadVideoStreamingPlaying("点击静音")
|
||||
}
|
||||
}
|
||||
|
||||
private fun unMute() {
|
||||
private fun unMute(isManual: Boolean = false) {
|
||||
mVideoEntity?.videoIsMuted = false
|
||||
SPUtils.setBoolean(getMuteKey(), false)
|
||||
volume.setImageResource(R.drawable.ic_article_video_volume_on)
|
||||
CustomManager.getCustomManager(getKey()).isNeedMute = false
|
||||
if (isManual) {
|
||||
uploadVideoStreamingPlaying("取消静音")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
super.onAutoCompletion()
|
||||
uploadVideoStreamingPlaying("播放完毕")
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar?) {
|
||||
super.onStopTrackingTouch(seekBar)
|
||||
uploadVideoStreamingPlaying("拖动")
|
||||
}
|
||||
|
||||
private fun share() {
|
||||
@ -259,47 +329,30 @@ class ArticleItemVideoView @JvmOverloads constructor(context: Context, attrs: At
|
||||
}
|
||||
|
||||
override fun onCancel() {
|
||||
// uploadVideoStreamingPlaying("取消分享")
|
||||
uploadVideoStreamingPlaying("取消分享")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun uploadVideoStreamingPlaying(action: String) {
|
||||
|
||||
// fun observeVolume(activity: AppCompatActivity) {
|
||||
// activity.contentResolver?.registerContentObserver(
|
||||
// android.provider.Settings.System.CONTENT_URI, true, mVolumeObserver)
|
||||
//
|
||||
// activity.application?.registerActivityLifecycleCallbacks(
|
||||
// object : Application.ActivityLifecycleCallbacks {
|
||||
// override fun onActivityPaused(a: Activity) {
|
||||
// if (activity == a) {
|
||||
// activity.contentResolver?.unregisterContentObserver(mVolumeObserver)
|
||||
// activity.application?.unregisterActivityLifecycleCallbacks(this)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onActivityStarted(activity: Activity) {
|
||||
// }
|
||||
//
|
||||
// override fun onActivityDestroyed(activity: Activity) {
|
||||
// }
|
||||
//
|
||||
// override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
|
||||
// }
|
||||
//
|
||||
// override fun onActivityStopped(activity: Activity) {
|
||||
// }
|
||||
//
|
||||
// override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
|
||||
// }
|
||||
//
|
||||
// override fun onActivityResumed(activity: Activity) {
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
}
|
||||
|
||||
fun setFullViewStatus() {
|
||||
mProgressBar.visibility = View.VISIBLE
|
||||
mCurrentTimeTextView.visibility = View.VISIBLE
|
||||
mTotalTimeTextView.visibility = View.VISIBLE
|
||||
mBottomProgressBar.visibility = View.GONE
|
||||
remainingTv.visibility = View.GONE
|
||||
durationTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun getKey(): String {
|
||||
return uuid
|
||||
}
|
||||
|
||||
fun getMuteKey(): String {
|
||||
return Constants.SP_VIDEO_PLAY_MUTE + uuid
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,16 @@
|
||||
package com.gh.gamecenter.forum.home
|
||||
|
||||
|
||||
import android.app.Activity
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.common.util.*
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.databinding.CommunityAnswerItemBinding
|
||||
import com.gh.gamecenter.entity.CommunityEntity
|
||||
import com.gh.gamecenter.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.forum.detail.ForumDetailActivity
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.qa.answer.BaseAnswerOrArticleItemViewHolder
|
||||
@ -22,6 +23,8 @@ import com.gh.gamecenter.qa.questions.invite.QuestionsInviteActivity
|
||||
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity
|
||||
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
import com.shuyu.gsyvideoplayer.utils.OrientationUtils
|
||||
|
||||
class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : BaseAnswerOrArticleItemViewHolder(binding.root) {
|
||||
|
||||
@ -66,7 +69,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
|
||||
binding.imageContainer.bindData(entity, entrance, path)
|
||||
if (entity.type == "video") {
|
||||
bindVideoData(entity)
|
||||
bindVideoData(entity.transformForumVideoEntity())
|
||||
} else {
|
||||
bindArticleVideoData(entity)
|
||||
}
|
||||
@ -105,7 +108,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
|
||||
private fun bindVideoData(entity: AnswerEntity) {
|
||||
private fun bindVideoData(entity: ForumVideoEntity) {
|
||||
binding.run {
|
||||
if (entity.url.isEmpty()) {
|
||||
horizontalVideoView.visibility = View.GONE
|
||||
@ -122,6 +125,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
horizontalVideoView
|
||||
}
|
||||
|
||||
val orientationUtils = OrientationUtils(itemView.context as Activity, visibleView)
|
||||
orientationUtils.isEnable = false
|
||||
GSYVideoOptionBuilder()
|
||||
.setIsTouchWiget(false)
|
||||
.setUrl(entity.url)
|
||||
@ -131,14 +136,35 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
.setReleaseWhenLossAudio(true)
|
||||
.setLooping(false)
|
||||
.setShowFullAnimation(false)
|
||||
.setEnlargeImageRes(R.drawable.ic_article_video_full_screen)
|
||||
.setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen)
|
||||
.setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen)
|
||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||
override fun onQuitFullscreen(url: String?, vararg objects: Any) {
|
||||
orientationUtils.backToProtVideo()
|
||||
visibleView.uploadVideoStreamingPlaying("退出全屏")
|
||||
}
|
||||
})
|
||||
.build(visibleView)
|
||||
visibleView.run {
|
||||
updateVideoData(entity.transformForumVideoEntity())
|
||||
updateVideoData(entity)
|
||||
updateThumb(entity.poster)
|
||||
updateDurationTv(TimeUtils.formatDuration(entity.length))
|
||||
updateMuteStatus()
|
||||
// observeVolume(itemView.context as AppCompatActivity)
|
||||
|
||||
fullscreenButton.setOnClickListener {
|
||||
val horizontalVideoView = startWindowFullscreen(itemView.context, true, true) as? ArticleItemVideoView
|
||||
if (horizontalVideoView == null) {
|
||||
toastInInternalRelease("全屏失败,请向技术人员提供具体的操作步骤")
|
||||
return@setOnClickListener
|
||||
}
|
||||
orientationUtils.resolveByClick()
|
||||
horizontalVideoView.uuid = uuid
|
||||
horizontalVideoView.updateVideoData(entity)
|
||||
horizontalVideoView.updateThumb(entity.poster)
|
||||
horizontalVideoView.violenceUpdateMuteStatus()
|
||||
horizontalVideoView.setFullViewStatus()
|
||||
uploadVideoStreamingPlaying("开始播放")
|
||||
uploadVideoStreamingPlaying("点击全屏")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -161,6 +187,8 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
horizontalVideoView
|
||||
}
|
||||
|
||||
val orientationUtils = OrientationUtils(itemView.context as Activity, visibleView)
|
||||
orientationUtils.isEnable = false
|
||||
GSYVideoOptionBuilder()
|
||||
.setIsTouchWiget(false)
|
||||
.setUrl(video.url)
|
||||
@ -170,14 +198,35 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) : B
|
||||
.setReleaseWhenLossAudio(true)
|
||||
.setLooping(false)
|
||||
.setShowFullAnimation(false)
|
||||
.setEnlargeImageRes(R.drawable.ic_article_video_full_screen)
|
||||
.setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen)
|
||||
.setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen)
|
||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||
override fun onQuitFullscreen(url: String?, vararg objects: Any) {
|
||||
orientationUtils.backToProtVideo()
|
||||
visibleView.uploadVideoStreamingPlaying("退出全屏")
|
||||
}
|
||||
})
|
||||
.build(visibleView)
|
||||
visibleView.run {
|
||||
updateVideoData(entity.transformForumVideoEntity())
|
||||
updateThumb(video.poster)
|
||||
updateDurationTv(video.duration)
|
||||
updateMuteStatus()
|
||||
// observeVolume(itemView.context as AppCompatActivity)
|
||||
|
||||
fullscreenButton.setOnClickListener {
|
||||
val horizontalVideoView = startWindowFullscreen(itemView.context, true, true) as? ArticleItemVideoView
|
||||
if (horizontalVideoView == null) {
|
||||
toastInInternalRelease("全屏失败,请向技术人员提供具体的操作步骤")
|
||||
return@setOnClickListener
|
||||
}
|
||||
orientationUtils.resolveByClick()
|
||||
horizontalVideoView.uuid = uuid
|
||||
horizontalVideoView.updateVideoData(entity.transformForumVideoEntity())
|
||||
horizontalVideoView.updateThumb(video.poster)
|
||||
horizontalVideoView.violenceUpdateMuteStatus()
|
||||
horizontalVideoView.setFullViewStatus()
|
||||
uploadVideoStreamingPlaying("开始播放")
|
||||
uploadVideoStreamingPlaying("点击全屏")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.gh.gamecenter.personalhome.home
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.util.SparseBooleanArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.constant.ItemViewType
|
||||
import com.gh.common.util.*
|
||||
@ -18,10 +18,13 @@ import com.gh.gamecenter.databinding.PersonalHomeRatingBinding
|
||||
import com.gh.gamecenter.databinding.UserHistoryItemBinding
|
||||
import com.gh.gamecenter.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.entity.PersonalHistoryEntity
|
||||
import com.gh.gamecenter.forum.home.ArticleItemVideoView
|
||||
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
|
||||
import com.gh.gamecenter.personalhome.PersonalItemViewHolder
|
||||
import com.gh.gamecenter.qa.entity.AnswerEntity
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
import com.shuyu.gsyvideoplayer.utils.OrientationUtils
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class UserHistoryAdapter(context: Context,
|
||||
@ -146,6 +149,8 @@ class UserHistoryAdapter(context: Context,
|
||||
horizontalVideoView
|
||||
}
|
||||
|
||||
val orientationUtils = OrientationUtils(mContext as Activity, visibleView)
|
||||
orientationUtils.isEnable = false
|
||||
GSYVideoOptionBuilder()
|
||||
.setIsTouchWiget(false)
|
||||
.setUrl(entity.url)
|
||||
@ -155,14 +160,35 @@ class UserHistoryAdapter(context: Context,
|
||||
.setReleaseWhenLossAudio(true)
|
||||
.setLooping(false)
|
||||
.setShowFullAnimation(false)
|
||||
.setEnlargeImageRes(R.drawable.ic_article_video_full_screen)
|
||||
.setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen)
|
||||
.setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen)
|
||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||
override fun onQuitFullscreen(url: String?, vararg objects: Any) {
|
||||
orientationUtils.backToProtVideo()
|
||||
visibleView.uploadVideoStreamingPlaying("退出全屏")
|
||||
}
|
||||
})
|
||||
.build(visibleView)
|
||||
visibleView.run {
|
||||
updateVideoData(entity)
|
||||
updateThumb(entity.poster)
|
||||
updateDurationTv(TimeUtils.formatDuration(entity.length))
|
||||
updateMuteStatus()
|
||||
// observeVolume(mContext as AppCompatActivity)
|
||||
|
||||
fullscreenButton.setOnClickListener {
|
||||
val horizontalVideoView = startWindowFullscreen(mContext, true, true) as? ArticleItemVideoView
|
||||
if (horizontalVideoView == null) {
|
||||
toastInInternalRelease("全屏失败,请向技术人员提供具体的操作步骤")
|
||||
return@setOnClickListener
|
||||
}
|
||||
orientationUtils.resolveByClick()
|
||||
horizontalVideoView.uuid = uuid
|
||||
horizontalVideoView.updateVideoData(entity)
|
||||
horizontalVideoView.updateThumb(entity.poster)
|
||||
horizontalVideoView.violenceUpdateMuteStatus()
|
||||
horizontalVideoView.setFullViewStatus()
|
||||
uploadVideoStreamingPlaying("开始播放")
|
||||
uploadVideoStreamingPlaying("点击全屏")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -185,6 +211,8 @@ class UserHistoryAdapter(context: Context,
|
||||
horizontalVideoView
|
||||
}
|
||||
|
||||
val orientationUtils = OrientationUtils(mContext as Activity, visibleView)
|
||||
orientationUtils.isEnable = false
|
||||
GSYVideoOptionBuilder()
|
||||
.setIsTouchWiget(false)
|
||||
.setUrl(video.url)
|
||||
@ -194,14 +222,35 @@ class UserHistoryAdapter(context: Context,
|
||||
.setReleaseWhenLossAudio(true)
|
||||
.setLooping(false)
|
||||
.setShowFullAnimation(false)
|
||||
.setEnlargeImageRes(R.drawable.ic_article_video_full_screen)
|
||||
.setEnlargeImageRes(R.drawable.ic_game_detail_enter_full_screen)
|
||||
.setShrinkImageRes(R.drawable.ic_game_detail_exit_full_screen)
|
||||
.setVideoAllCallBack(object : GSYSampleCallBack() {
|
||||
override fun onQuitFullscreen(url: String?, vararg objects: Any) {
|
||||
orientationUtils.backToProtVideo()
|
||||
visibleView.uploadVideoStreamingPlaying("退出全屏")
|
||||
}
|
||||
})
|
||||
.build(visibleView)
|
||||
visibleView.run {
|
||||
updateVideoData(entity.transformForumVideoEntity())
|
||||
updateThumb(video.poster)
|
||||
updateDurationTv(video.duration)
|
||||
updateMuteStatus()
|
||||
// observeVolume(mContext as AppCompatActivity)
|
||||
|
||||
fullscreenButton.setOnClickListener {
|
||||
val horizontalVideoView = startWindowFullscreen(mContext, true, true) as? ArticleItemVideoView
|
||||
if (horizontalVideoView == null) {
|
||||
toastInInternalRelease("全屏失败,请向技术人员提供具体的操作步骤")
|
||||
return@setOnClickListener
|
||||
}
|
||||
orientationUtils.resolveByClick()
|
||||
horizontalVideoView.uuid = uuid
|
||||
horizontalVideoView.updateVideoData(entity.transformForumVideoEntity())
|
||||
horizontalVideoView.updateThumb(video.poster)
|
||||
horizontalVideoView.violenceUpdateMuteStatus()
|
||||
horizontalVideoView.setFullViewStatus()
|
||||
uploadVideoStreamingPlaying("开始播放")
|
||||
uploadVideoStreamingPlaying("点击全屏")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB |
@ -37,6 +37,13 @@
|
||||
android:scaleType="centerCrop" />
|
||||
</RelativeLayout>
|
||||
|
||||
<moe.codeest.enviews.ENDownloadView
|
||||
android:id="@+id/loading"
|
||||
android:layout_width="28dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start"
|
||||
@ -86,7 +93,7 @@
|
||||
android:progressDrawable="@drawable/progressbar_video_detail"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/completeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@ -96,36 +103,60 @@
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/replayIv"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_article_video_replay" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/replayTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:drawableLeft="@drawable/ic_video_replay"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="重播"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shareIv"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginLeft="24dp"
|
||||
android:src="@drawable/ic_article_video_share" />
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/shareTv" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shareTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:drawableLeft="@drawable/ic_video_share"
|
||||
android:drawablePadding="8dp"
|
||||
android:text="分享"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/replayTv" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toEndOf="@+id/back_tiny"
|
||||
android:layout_toRightOf="@+id/back_tiny"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/video_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</com.gh.common.view.RadiusCardView>
|
||||
|
||||
@ -22,12 +22,13 @@
|
||||
android:id="@+id/fullscreen"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:src="@drawable/ic_article_video_volume_off"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_game_detail_enter_full_screen"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/total"
|
||||
android:id="@+id/remainingTv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="16dp"
|
||||
android:gravity="center"
|
||||
@ -49,18 +50,38 @@
|
||||
android:visibility="gone"
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:max="100"
|
||||
android:maxHeight="4dp"
|
||||
android:minHeight="4dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:progressDrawable="@drawable/bg_game_detail_seekbar"
|
||||
android:thumb="@drawable/video_seek_thumb"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/current"
|
||||
app:layout_constraintRight_toLeftOf="@id/total"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/total"
|
||||
style="@style/game_detail_video_time_text"
|
||||
android:layout_marginRight="12dp"
|
||||
android:text="00:00"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/fullscreen"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/current"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
style="@style/game_detail_video_time_text"
|
||||
android:text="00:00"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/volume"
|
||||
android:layout_marginLeft="12dp"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user