This commit is contained in:
Horis
2024-08-27 15:09:34 +08:00
parent 280d659b5f
commit 2e7f72eb78
5 changed files with 9 additions and 22 deletions

View File

@@ -17,6 +17,7 @@ import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor
import androidx.media3.datasource.cache.SimpleCache
import androidx.media3.exoplayer.DefaultLoadControl
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.LoadControl.Parameters
import androidx.media3.exoplayer.offline.DefaultDownloaderFactory
import androidx.media3.exoplayer.offline.DownloadRequest
import androidx.media3.exoplayer.offline.Downloader
@@ -596,22 +597,8 @@ class HttpReadAloudService : BaseReadAloudService(),
}
inner class CustomLoadControl : DefaultLoadControl() {
override fun shouldStartPlayback(
timeline: Timeline,
mediaPeriodId: MediaSource.MediaPeriodId,
bufferedDurationUs: Long,
playbackSpeed: Float,
rebuffering: Boolean,
targetLiveOffsetUs: Long
): Boolean {
return super.shouldStartPlayback(
timeline,
mediaPeriodId,
bufferedDurationUs,
playbackSpeed,
rebuffering,
targetLiveOffsetUs
) || bufferedPercentage == 100
override fun shouldStartPlayback(parameters: Parameters): Boolean {
return super.shouldStartPlayback(parameters) || bufferedPercentage == 100
}
}

View File

@@ -292,7 +292,7 @@ class ReadBookActivity : BaseReadBookActivity(),
}
}
override fun onNewIntent(intent: Intent?) {
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
if (!ReadBook.inBookshelf) {
viewModel.removeFromBookshelf(null)

View File

@@ -93,9 +93,9 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
receiptIntent(intent)
}
override fun onNewIntent(data: Intent?) {
super.onNewIntent(data)
receiptIntent(data)
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
receiptIntent(intent)
}
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {

View File

@@ -8,7 +8,7 @@ import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContract
fun ActivityResultLauncher<*>.launch() {
fun <T> ActivityResultLauncher<T?>.launch() {
launch(null)
}

View File

@@ -39,7 +39,7 @@ room = "2.6.1"
splitties = "3.0.0"
rhino = "1.7.15"
activity = "1.8.2"
activity = "1.9.1"
kotlinxSerialization = "1.7.1"
swiperefreshlayout = "1.1.0"
viewpager2 = "1.1.0"