調整onResume

This commit is contained in:
Raymond Yang 2023-03-06 17:08:20 +08:00
parent 1b80ae3349
commit 48db07290c

View File

@ -78,12 +78,7 @@ class SplitViewFragment : Fragment() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
//if (viewModel.activePage.value == mPageNum) {
MainScope().launch {
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
playAll() playAll()
}
//}
Log.d("${TAG}_$mPageNum", "onResume()") Log.d("${TAG}_$mPageNum", "onResume()")
} }
@ -167,7 +162,7 @@ class SplitViewFragment : Fragment() {
} }
MainScope().launch { MainScope().launch {
stopAll() stopAll()
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS) delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
//delay((splitMode * 100) + Constants.CONF_DELAY_BASE_MILLIS) //delay((splitMode * 100) + Constants.CONF_DELAY_BASE_MILLIS)
val item = data[position] val item = data[position]
val bundle = Bundle().apply { val bundle = Bundle().apply {
@ -195,16 +190,16 @@ class SplitViewFragment : Fragment() {
} }
} }
fun playAll() /*= MainScope().launch(Dispatchers.Main)*/ { fun playAll() = MainScope().launch(Dispatchers.Main) {
if (videoViews.isEmpty()) return if (videoViews.isEmpty()) return@launch
//delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS) delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
for (index in data.indices) { for (index in data.indices) {
if (!videoViews[index].isReady) continue if (!videoViews[index].isReady) continue
videoViews[index].resetRetryCount() videoViews[index].resetRetryCount()
videoViews[index].play() videoViews[index].play()
//delay(300) //delay(300)
} }
}//.start() }.start()
fun stopAll() /*= MainScope().launch(Dispatchers.Main)*/ { fun stopAll() /*= MainScope().launch(Dispatchers.Main)*/ {
if (videoViews.isEmpty()) return if (videoViews.isEmpty()) return