fix:【光环助手】视频横屏滑动专题的显示问题 https://jira.shanqu.cc/browse/GHZS-5117
This commit is contained in:
@ -4,6 +4,8 @@ import android.graphics.Rect
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.forEach
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
@ -88,6 +90,12 @@ class ScrollCalculatorHelper(val mListRv: RecyclerView, private val mPlayId: Int
|
||||
if (child is RecyclerView && child.layoutManager is LinearLayoutManager) {
|
||||
val hasChildVideoPlaying = playChildVideo(child)
|
||||
if (hasChildVideoPlaying) break
|
||||
} else if (child is ViewGroup) {
|
||||
val childList = findRecyclerView(child)
|
||||
if (childList != null) {
|
||||
val hasChildVideoPlaying = playChildVideo(childList)
|
||||
if (hasChildVideoPlaying) break
|
||||
}
|
||||
}
|
||||
|
||||
val player: View? = child?.findViewById(mPlayId)
|
||||
@ -163,6 +171,20 @@ class ScrollCalculatorHelper(val mListRv: RecyclerView, private val mPlayId: Int
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果布局层次结构复杂,这里递归可能过深,为避免此情况,这里暂时只考虑一层的情况
|
||||
*/
|
||||
private fun findRecyclerView(container: ViewGroup): RecyclerView? {
|
||||
val childCount = container.childCount
|
||||
for (index in 0 until childCount) {
|
||||
val child = container.getChildAt(index)
|
||||
if (child is RecyclerView && child.layoutManager is LinearLayoutManager) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private inner class PlayRunnable(var videoView: AutomaticVideoView?) : Runnable {
|
||||
override fun run() {
|
||||
if (videoView != null && !videoView!!.isInPlayingState) {
|
||||
|
||||
Reference in New Issue
Block a user