修复点击悬浮框的进入崩溃,原因是加载中的时候进入了进度条修改的代码。
This commit is contained in:
parent
ec6350c733
commit
f763279f89
@ -496,23 +496,24 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
binding.progressDurationTv.text = currentString
|
||||
if (MediaControllerManager.getDuration() > 0) {
|
||||
binding.totalDurationTv.visibility = View.VISIBLE
|
||||
|
||||
binding.totalDurationTv.text =
|
||||
convertMillisToMinutesAndSecondsString(MediaControllerManager.getDuration())
|
||||
val valueTo = MediaControllerManager.getDuration().toFloat()
|
||||
binding.sbProgress.valueTo = valueTo
|
||||
val value = MediaControllerManager.getCurrentPosition().toFloat()
|
||||
if (valueTo > value) {
|
||||
binding.sbProgress.value = value
|
||||
}
|
||||
updateProgressState()
|
||||
|
||||
binding.progressBar.progress = MediaControllerManager.getBufferedPosition().toInt()
|
||||
binding.progressBar.max = MediaControllerManager.getDuration().toInt()
|
||||
updateProgressBufferingState()
|
||||
updatePlayListDataAndAdapter()
|
||||
} else {
|
||||
binding.totalDurationTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.totalDurationTv.text =
|
||||
convertMillisToMinutesAndSecondsString(MediaControllerManager.getDuration())
|
||||
binding.sbProgress.valueTo = MediaControllerManager.getDuration().toFloat()
|
||||
val value = MediaControllerManager.getCurrentPosition().toFloat()
|
||||
if (binding.sbProgress.valueTo > value) {
|
||||
binding.sbProgress.value = value
|
||||
}
|
||||
updateProgressState()
|
||||
|
||||
binding.progressBar.progress = MediaControllerManager.getBufferedPosition().toInt()
|
||||
binding.progressBar.max = MediaControllerManager.getDuration().toInt()
|
||||
updateProgressBufferingState()
|
||||
updatePlayListDataAndAdapter()
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,7 +638,9 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
toggleBottomLayout()
|
||||
}
|
||||
binding.progressBar.progress = 0
|
||||
binding.sbProgress.value = 0f
|
||||
if (binding.sbProgress.valueTo > 0f) {
|
||||
binding.sbProgress.value = 0f
|
||||
}
|
||||
binding.sbProgress.addOnChangeListener { slider, value, fromUser ->
|
||||
if (fromUser) {
|
||||
if (meController != null) {
|
||||
@ -822,7 +825,9 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
}
|
||||
|
||||
private fun updateProgressUi() {
|
||||
binding.sbProgress.value = 0f
|
||||
if (binding.sbProgress.valueTo > 0f) {
|
||||
binding.sbProgress.value = 0f
|
||||
}
|
||||
binding.progressBar.progress = 0
|
||||
binding.progressDurationTv.text = convertMillisToMinutesAndSecondsString(0L)
|
||||
binding.totalDurationTv.visibility = View.GONE
|
||||
@ -890,7 +895,6 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
val currentBufferedPosition = MediaControllerManager.getBufferedPosition()
|
||||
binding.progressBar.progress = currentBufferedPosition.toInt()
|
||||
|
||||
|
||||
val value = currentPosition.toFloat()
|
||||
if (binding.sbProgress.valueTo > value) {
|
||||
binding.sbProgress.value = value
|
||||
|
||||
@ -292,8 +292,6 @@
|
||||
android:id="@+id/sbProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:value="10"
|
||||
android:valueTo="100"
|
||||
app:labelBehavior="gone"
|
||||
app:thumbColor="@color/white"
|
||||
app:thumbRadius="6dp"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user