光环助手V3.7.4-测试问题汇总(20200311-1900)3,4 https://gitlab.ghzs.com/pm/halo-app-issues/issues/797

This commit is contained in:
Jack
2020-03-12 15:52:19 +08:00
parent 7af2b7c2d7
commit 838b775a3e
4 changed files with 86 additions and 95 deletions

View File

@ -16,6 +16,7 @@ public class PagerLayoutManager extends LinearLayoutManager {
private static final int HORIZONTAL = OrientationHelper.HORIZONTAL;
private static final int VERTICAL = OrientationHelper.VERTICAL;
private int mOrientation;
private int mLastPosition = -1;
/**
* 位移,用来判断移动方向
*/
@ -115,9 +116,11 @@ public class PagerLayoutManager extends LinearLayoutManager {
positionIdle = getPosition(viewIdle);
}
int childCount = getChildCount();
if (mOnViewPagerListener != null && childCount == 1) {
// if (mOnViewPagerListener != null && childCount == 1) {
if (mOnViewPagerListener != null && positionIdle != mLastPosition) {
mOnViewPagerListener.onPageSelected(positionIdle,
positionIdle == childCount - 1);
mLastPosition = positionIdle;
}
break;
case RecyclerView.SCROLL_STATE_DRAGGING:

View File

@ -564,18 +564,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
if (notifyUserInfo != null && mUserInfoEntity == null) { // 单个用户,首次触发
EventBus.getDefault().post(new EBConcernChanged());
/**
* default_icon_ 判断是不是默认头像
* 具体默认头像链接请看:
* {@link com.gh.common.util.UserIconUtils#getUserIconUrl(int)}
*/
LoginTokenEntity loginToken = UserManager.getInstance().getLoginTokenEntity();
if (loginToken != null && loginToken.getId() != null &&
sp.getBoolean(loginToken.getId(), true) &&
notifyUserInfo.getIcon() != null &&
notifyUserInfo.getIcon().contains("default_icon_")) {
//mIconHint.setVisibility(View.VISIBLE);
}
LoginTokenEntity loginTokenEntity = UserManager.getInstance().getLoginTokenEntity();
if (mIsLogging && loginTokenEntity != null) {

View File

@ -104,7 +104,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
if (newClickTime - mLastClickTime < 300) {
touchDoubleUp(event)
} else {
mHandler?.sendEmptyMessageDelayed(1, 200)
mHandler?.sendEmptyMessageDelayed(1, 300)
}
mLastClickTime = newClickTime
}

View File

@ -187,7 +187,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
mViewModel.needToUpdateVideoInfo.observeNonNull(this) {
findFirstCompletelyVisibleVideoViewByPosition()?.updateViewDetail(it)
findVisibleVideoViewByPosition()?.updateViewDetail(it)
}
}
@ -234,17 +234,14 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
override fun onPageSelected(position: Int, isBottom: Boolean) {
smartRefreshLayout.isEnableLoadMore = isBottom
smartRefreshLayout.setNoMoreData(isBottom)
if (mScheduledPlayDisposable != null && !mScheduledPlayDisposable!!.isDisposed) {
mScheduledPlayDisposable!!.dispose()
mScheduledPlayDisposable = null
}
val isShowClick = SPUtils.getBoolean(Constants.SP_SHOW_CLICK_GUIDE)
if (!isShowClick) {
showClickGuide()
}
var visitCount = SPUtils.getInt(Constants.SP_SHOW_DOUBLE_CLICK_GUIDE, 0)
visitCount++
if (visitCount == 5) {
@ -254,64 +251,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
SPUtils.setBoolean(Constants.SP_SHOW_SLIDE_GUIDE, true)
SPUtils.setBoolean(Constants.SP_SHOW_CLICK_GUIDE, true)
val pos = mViewPagerLayoutManager.findFirstCompletelyVisibleItemPosition()
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
videoView?.observeVolume(requireActivity() as AppCompatActivity)
if (userVisibleHint) {
//延时处理,快速滑动不播放视频
mScheduledPlayDisposable = rxTimer(1) {
if (it >= 100) {
mScheduledPlayDisposable?.dispose()
mScheduledPlayDisposable = null
if (pos + 2 <= mAdapter.videoList.size - 1) {//预加载视频
ExoCacheManager.preload(mAdapter.videoList[pos + 1].url)
ExoCacheManager.preload(mAdapter.videoList[pos + 2].url)
Picasso.with(context).load(mAdapter.videoList[pos + 1].getThumb()).fetch()
Picasso.with(context).load(mAdapter.videoList[pos + 2].getThumb()).fetch()
} else if (pos + 1 <= mAdapter.videoList.size - 1) {
ExoCacheManager.preload(mAdapter.videoList[pos + 1].url)
Picasso.with(context).load(mAdapter.videoList[pos + 1].getThumb()).fetch()
}
if (mLastPosition != pos /*&& videoView?.isInPlayingState != true*/) {
ExoCacheManager.cancel(mAdapter.videoList[pos].url)
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
videoView?.startButton?.performClick()
mBaseHandler.postDelayed({
videoView?.updateMuteStatus()
}, 500)
}
mLastPosition = pos
mViewModel.addHistoryRecord(mAdapter.videoList[pos])
}
}
}
mViewModel.videoList.value?.apply {
if (pos > mViewModel.startPosition) {//向上滑动
val videoId = if (mLocation == VideoDetailContainerViewModel.Location.VIDEO_CHOICENESS.value || mLocation == VideoDetailContainerViewModel.Location.VIDEO_HOT.value) {
mInitialVideoId
} else {
this[size - 1].id
}
if (pos == size - 5) {//获取下面的视频
mViewModel.getVideoDetailList(videoId, mLocation, isLoadNext = true)
}
//防止视频流分页获取的数据为空不会触发循环
if (pos == size - 1 && mLocation == VideoDetailContainerViewModel.Location.VIDEO_CHOICENESS.value) {
mViewModel.getVideoDetailList(videoId, mLocation, isLoadNext = true)
}
setAdvertisement(pos)
} else {//向下滑动
if (pos == 4) {//获取上面的视频
mViewModel.getVideoDetailList(this[0].id, mLocation, isLoadNext = false)
}
}
mViewModel.startPosition = pos
mViewModel.currentDisplayingVideo = mAdapter.videoList[mViewModel.startPosition]
}
playVideo()
}
})
@ -323,6 +263,66 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
private fun playVideo() {
// val pos = mViewPagerLayoutManager.findFirstCompletelyVisibleItemPosition()
val pos = mViewPagerLayoutManager.findLastCompletelyVisibleItemPosition()
val videoView = findVisibleVideoViewByPosition()
videoView?.observeVolume(requireActivity() as AppCompatActivity)
if (userVisibleHint) {
//延时处理,快速滑动不播放视频
mScheduledPlayDisposable = rxTimer(1) {
if (it >= 100) {
mScheduledPlayDisposable?.dispose()
mScheduledPlayDisposable = null
if (pos + 2 <= mAdapter.videoList.size - 1) {//预加载视频
ExoCacheManager.preload(mAdapter.videoList[pos + 1].url)
ExoCacheManager.preload(mAdapter.videoList[pos + 2].url)
Picasso.with(context).load(mAdapter.videoList[pos + 1].getThumb()).fetch()
Picasso.with(context).load(mAdapter.videoList[pos + 2].getThumb()).fetch()
} else if (pos + 1 <= mAdapter.videoList.size - 1) {
ExoCacheManager.preload(mAdapter.videoList[pos + 1].url)
Picasso.with(context).load(mAdapter.videoList[pos + 1].getThumb()).fetch()
}
if (mLastPosition != pos /*&& videoView?.isInPlayingState != true*/) {
ExoCacheManager.cancel(mAdapter.videoList[pos].url)
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
videoView?.startButton?.performClick()
mBaseHandler.postDelayed({
videoView?.updateMuteStatus()
}, 500)
}
mLastPosition = pos
mViewModel.addHistoryRecord(mAdapter.videoList[pos])
}
}
}
mViewModel.videoList.value?.apply {
if (pos > mViewModel.startPosition) {//向上滑动
val videoId = if (mLocation == VideoDetailContainerViewModel.Location.VIDEO_CHOICENESS.value || mLocation == VideoDetailContainerViewModel.Location.VIDEO_HOT.value) {
mInitialVideoId
} else {
this[size - 1].id
}
if (pos == size - 5) {//获取下面的视频
mViewModel.getVideoDetailList(videoId, mLocation, isLoadNext = true)
}
//防止视频流分页获取的数据为空不会触发循环
if (pos == size - 1 && mLocation == VideoDetailContainerViewModel.Location.VIDEO_CHOICENESS.value) {
mViewModel.getVideoDetailList(videoId, mLocation, isLoadNext = true)
}
setAdvertisement(pos)
} else {//向下滑动
if (pos == 4) {//获取上面的视频
mViewModel.getVideoDetailList(this[0].id, mLocation, isLoadNext = false)
}
}
mViewModel.startPosition = pos
mViewModel.currentDisplayingVideo = mAdapter.videoList[mViewModel.startPosition]
}
}
//显示滑动引导
private fun showSlideGuide() {
mBaseHandler.postDelayed({
@ -354,7 +354,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mBaseHandler.postDelayed({
guideRl.visibility = View.VISIBLE
guideTitle.text = "点击查看更多视频"
val gameTitleY = findFirstCompletelyVisibleVideoViewByPosition()?.getGameTitleY() ?: 0
val gameTitleY = findVisibleVideoViewByPosition()?.getGameTitleY() ?: 0
val layoutParams = slideGuideAnimation.layoutParams as RelativeLayout.LayoutParams
layoutParams.height = DisplayUtils.dip2px(68f)
@ -422,7 +422,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (pos < 0) return@setOnClickListener
val videoEntity = mAdapter.videoList[pos]
MtaHelper.onEvent("视频详情", "视频广告", "${videoEntity.title}${videoEntity.id}")
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("点击广告")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("点击广告")
DirectUtils.directToLinkPage(requireContext(), LinkEntity(link = link, type = linkType, community = linkCommunity), "", "视频详情")
}
@ -431,7 +431,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (pos < 0) return@setOnClickListener
val videoEntity = mAdapter.videoList[pos]
MtaHelper.onEvent("视频详情", "视频广告", "${videoEntity.title}${videoEntity.id}")
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("点击广告")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("点击广告")
if (linkType == "web") {
// 当前入口打开Web页面要显示分享按钮
@ -454,7 +454,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (finish) {
marquee_ad.visibility = View.GONE
icon_ad.visibility = View.GONE
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("关闭广告")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("关闭广告")
}
}
}
@ -470,10 +470,10 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
override fun onFragmentResume() {
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("恢复页面")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("恢复页面")
DownloadManager.getInstance(requireContext()).addObserver(dataWatcher)
if (mViewModel.isPauseVideo) {
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
val videoView = findVisibleVideoViewByPosition()
videoView?.run {
if (videoView.isInPlayingState) {
videoView.onVideoResume(false)
@ -500,7 +500,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
mScheduledPlayDisposable = null
}
DownloadManager.getInstance(requireContext()).removeObserver(dataWatcher)
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
val videoView = findVisibleVideoViewByPosition()
videoView?.run {
videoView.uploadVideoStreamingPlaying("暂停页面")
if (mViewModel.isPauseVideo) {
@ -521,7 +521,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
}
override fun onDestroyView() {
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("退出页面")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("退出页面")
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
mBaseHandler.postDelayed({
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
@ -533,8 +533,8 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
ExoCacheManager.cancelAll()
}
private fun findFirstCompletelyVisibleVideoViewByPosition(): DetailPlayerView? {
val pos = mViewPagerLayoutManager.findFirstCompletelyVisibleItemPosition()
private fun findVisibleVideoViewByPosition(): DetailPlayerView? {
val pos = mViewPagerLayoutManager.findLastCompletelyVisibleItemPosition()
val holder = recyclerview?.findViewHolderForAdapterPosition(pos)
return holder?.itemView as? DetailPlayerView
@ -599,16 +599,16 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (UserManager.getInstance().isLoggedIn) {
if (video.me.isVideoFavorite) {
MtaHelper.onEvent("视频详情", "更多-取消收藏", combinedTitleAndId)
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-取消收藏")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-取消收藏")
mViewModel.undoCollect()
} else {
MtaHelper.onEvent("视频详情", "更多-收藏", combinedTitleAndId)
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-收藏")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-收藏")
mViewModel.collect()
}
popupWindow.dismiss()
} else {
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-收藏-跳转登录")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-收藏-跳转登录")
CheckLoginUtils.checkLogin(context, "(视频详情)", {})
}
}
@ -617,7 +617,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
share()
popupWindow.dismiss()
MtaHelper.onEvent("视频详情", "更多-分享", combinedTitleAndId)
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-分享")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-分享")
}
}
@ -635,7 +635,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
it.title,
shareSummary,
ShareUtils.ShareType.video) {
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-取消分享")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("更多-取消分享")
}
}
}
@ -648,9 +648,9 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
if (commentCount > 0) {
val videoEntity = mAdapter.videoList[mViewModel.startPosition]
videoEntity.commentCount = commentCount
findFirstCompletelyVisibleVideoViewByPosition()?.updateViewDetail(videoEntity)
findVisibleVideoViewByPosition()?.updateViewDetail(videoEntity)
}
findFirstCompletelyVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("关闭评论弹窗")
findVisibleVideoViewByPosition()?.uploadVideoStreamingPlaying("关闭评论弹窗")
}
}
}
@ -676,7 +676,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBReuse) {
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
val videoView = findVisibleVideoViewByPosition()
//处理打开评论页面按手机Home键回到桌面还会听到视频的声音
if (NewCommentFragment.COMMENT_PAUSE == status.type) {
val haveMoreElementCount = AppManager.getInstance().haveMoreElementCount(requireActivity())
@ -704,7 +704,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
override fun onHandleBackPressed(): Boolean {
if (::mAdapter.isInitialized) {
return mAdapter.onBackPressed(findFirstCompletelyVisibleVideoViewByPosition())
return mAdapter.onBackPressed(findVisibleVideoViewByPosition())
}
return false
}