|
|
@ -105,7 +105,7 @@ object AudioPlay { |
|
|
|
book.durChapterIndex = index |
|
|
|
book.durChapterIndex = index |
|
|
|
book.durChapterPos = 0 |
|
|
|
book.durChapterPos = 0 |
|
|
|
durChapter = null |
|
|
|
durChapter = null |
|
|
|
saveRead(book) |
|
|
|
saveRead() |
|
|
|
play(context) |
|
|
|
play(context) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -120,7 +120,7 @@ object AudioPlay { |
|
|
|
book.durChapterIndex = book.durChapterIndex - 1 |
|
|
|
book.durChapterIndex = book.durChapterIndex - 1 |
|
|
|
book.durChapterPos = 0 |
|
|
|
book.durChapterPos = 0 |
|
|
|
durChapter = null |
|
|
|
durChapter = null |
|
|
|
saveRead(book) |
|
|
|
saveRead() |
|
|
|
play(context) |
|
|
|
play(context) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -134,17 +134,11 @@ object AudioPlay { |
|
|
|
book.durChapterIndex = book.durChapterIndex + 1 |
|
|
|
book.durChapterIndex = book.durChapterIndex + 1 |
|
|
|
book.durChapterPos = 0 |
|
|
|
book.durChapterPos = 0 |
|
|
|
durChapter = null |
|
|
|
durChapter = null |
|
|
|
saveRead(book) |
|
|
|
saveRead() |
|
|
|
play(context) |
|
|
|
play(context) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun addTimer() { |
|
|
|
|
|
|
|
val intent = Intent(appCtx, AudioPlayService::class.java) |
|
|
|
|
|
|
|
intent.action = IntentAction.addTimer |
|
|
|
|
|
|
|
appCtx.startService(intent) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setTimer(minute: Int) { |
|
|
|
fun setTimer(minute: Int) { |
|
|
|
val intent = Intent(appCtx, AudioPlayService::class.java) |
|
|
|
val intent = Intent(appCtx, AudioPlayService::class.java) |
|
|
|
intent.action = IntentAction.setTimer |
|
|
|
intent.action = IntentAction.setTimer |
|
|
@ -152,7 +146,8 @@ object AudioPlay { |
|
|
|
appCtx.startService(intent) |
|
|
|
appCtx.startService(intent) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun saveRead(book: Book) { |
|
|
|
fun saveRead() { |
|
|
|
|
|
|
|
book?.let { book -> |
|
|
|
book.lastCheckCount = 0 |
|
|
|
book.lastCheckCount = 0 |
|
|
|
book.durChapterTime = System.currentTimeMillis() |
|
|
|
book.durChapterTime = System.currentTimeMillis() |
|
|
|
Coroutine.async { |
|
|
|
Coroutine.async { |
|
|
@ -164,6 +159,7 @@ object AudioPlay { |
|
|
|
book.save() |
|
|
|
book.save() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存章节长度 |
|
|
|
* 保存章节长度 |
|
|
|