光环助手V3.7.2 RELEASE 20200117-1830 测试汇总 3,4 https://gitlab.ghzs.com/pm/halo-app-issues/issues/764

This commit is contained in:
张玉久
2020-01-19 15:34:26 +08:00
parent 347cfdb72d
commit dcfa4fdaaf
3 changed files with 50 additions and 12 deletions

View File

@ -2,6 +2,7 @@ package com.gh.download.cache;
import com.danikula.videocache.file.FileNameGenerator;
import com.danikula.videocache.file.Md5FileNameGenerator;
import com.gh.common.AppExecutor;
import com.halo.assistant.HaloApp;
import com.shuyu.gsyvideoplayer.utils.StorageUtils;
@ -214,10 +215,12 @@ public class CacheManager {
}
public void removeAllCall() {
for (Map.Entry<String, Call> entry : getDownCalls().entrySet()) {
entry.getValue().cancel();
}
getDownCalls().clear();
AppExecutor.getIoExecutor().execute(() -> {
for (Map.Entry<String, Call> entry : getDownCalls().entrySet()) {
entry.getValue().cancel();
}
AppExecutor.getUiExecutor().execute(() -> getDownCalls().clear());
});
}
private List<File> getAllFile() {

View File

@ -28,9 +28,11 @@ import com.gh.gamecenter.adapter.OnCommentCallBackListener
import com.gh.gamecenter.baselist.ListAdapter
import com.gh.gamecenter.baselist.ListFragment
import com.gh.gamecenter.entity.CommentEntity
import com.gh.gamecenter.eventbus.EBReuse
import com.gh.gamecenter.qa.answer.detail.AnswerDetailFragment
import com.halo.assistant.HaloApp
import com.lightgame.utils.Util_System_Keyboard
import org.greenrobot.eventbus.EventBus
open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>(), OnCommentCallBackListener, KeyboardHeightObserver {
@ -172,11 +174,14 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
if (this !is NewCommentConversationFragment) {
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
}
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
}
override fun onPause() {
super.onPause()
mKeyboardHeightProvider?.setKeyboardHeightObserver(null)
mBaseHandler.postDelayed({EventBus.getDefault().post(EBReuse(COMMENT_PAUSE))},1000)
}
override fun onDestroy() {
@ -351,6 +356,10 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
}
companion object {
const val COMMENT_PAUSE = "comment_pause"
const val COMMENT_RESUME = "comment_resume"
fun getAnswerCommentInstance(answerId: String,
showSoftKeyboardOnStartUp: Boolean,
commentCount: Int,

View File

@ -31,8 +31,11 @@ import com.gh.gamecenter.entity.LinkEntity
import com.gh.gamecenter.entity.VideoEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.gh.gamecenter.eventbus.EBReuse
import com.gh.gamecenter.manager.UserManager
import com.gh.gamecenter.qa.comment.CommentActivity
import com.gh.gamecenter.qa.comment.NewCommentFragment
import com.halo.assistant.HaloApp
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.listeners.OnBackPressedListener
@ -142,6 +145,9 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (!isShowSlide) {
showSlideGuide()
}
if (mIsHomeVideo) {
setAdvertisement(0)
}
}
}
@ -184,10 +190,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mViewModel.needToUpdateVideoInfo.observeNonNull(this) {
findFirstCompletelyVisibleVideoViewByPosition()?.updateViewDetail(it)
}
if (mIsHomeVideo) {
setAdvertisement(0)
}
}
private fun initListener() {
@ -439,7 +441,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
videoView?.run {
if (videoView.isInPlayingState) {
// CustomManager.onResume("detail_${mViewModel.uuid}", false)
videoView.onVideoResume(false)
} else {//快速切换视频后再切换页面可能没有播放
videoView.startButton?.performClick()
@ -469,7 +470,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
videoView.uploadVideoStreamingPlaying("暂停页面")
if (pauseVideo[mViewModel.uuid] == true) {
if (videoView.isInPlayingState) {
// CustomManager.onPause("detail_${mViewModel.uuid}")
videoView.onVideoPause()
} else {
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
@ -482,7 +482,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
SPUtils.setBoolean(Constants.SP_SHOW_SLIDE_GUIDE, true)
CacheManager.getInstance().removeAllCall()
val proxy = CustomProxyCacheManager.getProxy(requireContext(), null)
runOnIoThread {
proxy.allClients.forEach {
@ -497,6 +496,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
serverSocket.close()
}*/
super.onPause()
CacheManager.getInstance().removeAllCall()
}
override fun onDestroyView() {
@ -505,12 +505,12 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mBaseHandler.postDelayed({
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
}, 500)
CacheManager.getInstance().removeAllCall()
if (mAdCountDownTimer != null && !mAdCountDownTimer!!.isDisposed) {
mAdCountDownTimer?.dispose()
}
pauseVideo.remove(mViewModel.uuid)
super.onDestroyView()
CacheManager.getInstance().removeAllCall()
}
private fun findFirstCompletelyVisibleVideoViewByPosition(): DetailPlayerView? {
@ -654,6 +654,32 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBReuse) {
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
//处理打开评论页面按手机Home键回到桌面还会听到视频的声音
if (NewCommentFragment.COMMENT_PAUSE == status.type) {
if (!HaloApp.getInstance().isRunningForeground) {
videoView?.onVideoPause()
}
}
//产品没说回到前台需要继续恢复播放,先注释掉
/*else if (NewCommentFragment.COMMENT_RESUME == status.type) {
val activityStack = AppManager.getInstance().activityStack
var i = activityStack.size - 1
while (i >= 0) {
val activity = activityStack[i]
if (activity is VideoDetailActivity || activity is MainActivity) {
if (requireActivity().componentName == activity.componentName) {
videoView?.onVideoResume(false)
}
break
}
i--
}
}*/
}
override fun onHandleBackPressed(): Boolean {
if (::mAdapter.isInitialized) {
return mAdapter.onBackPressed(findFirstCompletelyVisibleVideoViewByPosition())