將延遲參數常數化
This commit is contained in:
parent
4cf5ae5094
commit
53763bfa34
@ -1,5 +1,5 @@
|
|||||||
package com.ray650128.gstreamer_demo_app
|
package com.ray650128.gstreamer_demo_app
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
const val CONF_DELAY_BASE_MILLIS = 300L
|
const val CONF_DELAY_BASE_MILLIS = 500L
|
||||||
}
|
}
|
||||||
@ -9,6 +9,7 @@ import android.view.ViewGroup
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.gridlayout.widget.GridLayout
|
import androidx.gridlayout.widget.GridLayout
|
||||||
|
import com.ray650128.gstreamer_demo_app.Constants
|
||||||
import com.ray650128.gstreamer_demo_app.databinding.FragmentSplitViewBinding
|
import com.ray650128.gstreamer_demo_app.databinding.FragmentSplitViewBinding
|
||||||
import com.ray650128.gstreamer_demo_app.dp
|
import com.ray650128.gstreamer_demo_app.dp
|
||||||
import com.ray650128.gstreamer_demo_app.model.Device
|
import com.ray650128.gstreamer_demo_app.model.Device
|
||||||
@ -67,7 +68,7 @@ class SplitViewFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
//stopAll()
|
stopAll()
|
||||||
super.onPause()
|
super.onPause()
|
||||||
Log.d("${TAG}_$mPageNum", "onPause()")
|
Log.d("${TAG}_$mPageNum", "onPause()")
|
||||||
}
|
}
|
||||||
@ -76,7 +77,7 @@ class SplitViewFragment : Fragment() {
|
|||||||
super.onResume()
|
super.onResume()
|
||||||
if (viewModel.activePage.value == mPageNum) {
|
if (viewModel.activePage.value == mPageNum) {
|
||||||
MainScope().launch {
|
MainScope().launch {
|
||||||
delay(splitMode * 500L)
|
delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
|
||||||
playAll()
|
playAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +157,7 @@ class SplitViewFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
MainScope().launch {
|
MainScope().launch {
|
||||||
stopAll()
|
stopAll()
|
||||||
delay(splitMode * 300L)
|
delay(splitMode * Constants.CONF_DELAY_BASE_MILLIS)
|
||||||
val item = data[position]
|
val item = data[position]
|
||||||
val bundle = Bundle().apply {
|
val bundle = Bundle().apply {
|
||||||
//putInt(MonitoringActivity.BUNDLE_DEVICE_ID, item.id)
|
//putInt(MonitoringActivity.BUNDLE_DEVICE_ID, item.id)
|
||||||
@ -196,8 +197,9 @@ class SplitViewFragment : Fragment() {
|
|||||||
if (videoViews.isEmpty()) return@launch
|
if (videoViews.isEmpty()) return@launch
|
||||||
for (index in data.indices) {
|
for (index in data.indices) {
|
||||||
videoViews[index].stopRetryCount()
|
videoViews[index].stopRetryCount()
|
||||||
|
if (!videoViews[index].isPlaying || videoViews[index].isLoading) continue
|
||||||
videoViews[index].stop()
|
videoViews[index].stop()
|
||||||
delay(300)
|
delay(100)
|
||||||
}
|
}
|
||||||
}.start()
|
}.start()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user