优化 #5437
This commit is contained in:
@@ -49,6 +49,7 @@ object AudioPlay : CoroutineScope by MainScope() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var playMode = PlayMode.LIST_END_STOP
|
var playMode = PlayMode.LIST_END_STOP
|
||||||
var status = Status.STOP
|
var status = Status.STOP
|
||||||
private var activityContext: Context? = null
|
private var activityContext: Context? = null
|
||||||
@@ -81,6 +82,7 @@ object AudioPlay : CoroutineScope by MainScope() {
|
|||||||
chapterSize
|
chapterSize
|
||||||
}
|
}
|
||||||
if (durChapterIndex != book.durChapterIndex) {
|
if (durChapterIndex != book.durChapterIndex) {
|
||||||
|
stopPlay()
|
||||||
durChapterIndex = book.durChapterIndex
|
durChapterIndex = book.durChapterIndex
|
||||||
durChapterPos = book.durChapterPos
|
durChapterPos = book.durChapterPos
|
||||||
durPlayUrl = ""
|
durPlayUrl = ""
|
||||||
@@ -155,6 +157,8 @@ object AudioPlay : CoroutineScope by MainScope() {
|
|||||||
}.onError {
|
}.onError {
|
||||||
AppLog.put("获取资源链接出错\n$it", it, true)
|
AppLog.put("获取资源链接出错\n$it", it, true)
|
||||||
upLoading(false)
|
upLoading(false)
|
||||||
|
}.onCancel {
|
||||||
|
removeLoading(index)
|
||||||
}.onFinally {
|
}.onFinally {
|
||||||
removeLoading(index)
|
removeLoading(index)
|
||||||
}
|
}
|
||||||
@@ -293,12 +297,14 @@ object AudioPlay : CoroutineScope by MainScope() {
|
|||||||
loadPlayUrl()
|
loadPlayUrl()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayMode.SINGLE_LOOP -> {
|
PlayMode.SINGLE_LOOP -> {
|
||||||
durChapterPos = 0
|
durChapterPos = 0
|
||||||
durPlayUrl = ""
|
durPlayUrl = ""
|
||||||
saveRead()
|
saveRead()
|
||||||
loadPlayUrl()
|
loadPlayUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayMode.RANDOM -> {
|
PlayMode.RANDOM -> {
|
||||||
durChapterIndex = (0 until simulatedChapterSize).random()
|
durChapterIndex = (0 until simulatedChapterSize).random()
|
||||||
durChapterPos = 0
|
durChapterPos = 0
|
||||||
@@ -306,6 +312,7 @@ object AudioPlay : CoroutineScope by MainScope() {
|
|||||||
saveRead()
|
saveRead()
|
||||||
loadPlayUrl()
|
loadPlayUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayMode.LIST_LOOP -> {
|
PlayMode.LIST_LOOP -> {
|
||||||
durChapterIndex = (durChapterIndex + 1) % simulatedChapterSize
|
durChapterIndex = (durChapterIndex + 1) % simulatedChapterSize
|
||||||
durChapterPos = 0
|
durChapterPos = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user