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
@@ -17,6 +17,7 @@ import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor
import androidx.media3.datasource.cache.SimpleCache import androidx.media3.datasource.cache.SimpleCache
import androidx.media3.exoplayer.DefaultLoadControl import androidx.media3.exoplayer.DefaultLoadControl
import androidx.media3.exoplayer.ExoPlayer import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.exoplayer.LoadControl.Parameters
import androidx.media3.exoplayer.offline.DefaultDownloaderFactory import androidx.media3.exoplayer.offline.DefaultDownloaderFactory
import androidx.media3.exoplayer.offline.DownloadRequest import androidx.media3.exoplayer.offline.DownloadRequest
import androidx.media3.exoplayer.offline.Downloader import androidx.media3.exoplayer.offline.Downloader
@@ -596,22 +597,8 @@ class HttpReadAloudService : BaseReadAloudService(),
} }
inner class CustomLoadControl : DefaultLoadControl() { inner class CustomLoadControl : DefaultLoadControl() {
override fun shouldStartPlayback( override fun shouldStartPlayback(parameters: Parameters): Boolean {
timeline: Timeline, return super.shouldStartPlayback(parameters) || bufferedPercentage == 100
mediaPeriodId: MediaSource.MediaPeriodId,
bufferedDurationUs: Long,
playbackSpeed: Float,
rebuffering: Boolean,
targetLiveOffsetUs: Long
): Boolean {
return super.shouldStartPlayback(
timeline,
mediaPeriodId,
bufferedDurationUs,
playbackSpeed,
rebuffering,
targetLiveOffsetUs
) || bufferedPercentage == 100
} }
} }
@@ -292,7 +292,7 @@ class ReadBookActivity : BaseReadBookActivity(),
} }
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent) super.onNewIntent(intent)
if (!ReadBook.inBookshelf) { if (!ReadBook.inBookshelf) {
viewModel.removeFromBookshelf(null) viewModel.removeFromBookshelf(null)
@@ -93,9 +93,9 @@ class SearchActivity : VMBaseActivity<ActivityBookSearchBinding, SearchViewModel
receiptIntent(intent) receiptIntent(intent)
} }
override fun onNewIntent(data: Intent?) { override fun onNewIntent(intent: Intent) {
super.onNewIntent(data) super.onNewIntent(intent)
receiptIntent(data) receiptIntent(intent)
} }
override fun onCompatCreateOptionsMenu(menu: Menu): Boolean { override fun onCompatCreateOptionsMenu(menu: Menu): Boolean {
@@ -8,7 +8,7 @@ import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContract import androidx.activity.result.contract.ActivityResultContract
fun ActivityResultLauncher<*>.launch() { fun <T> ActivityResultLauncher<T?>.launch() {
launch(null) launch(null)
} }
+1 -1
View File
@@ -39,7 +39,7 @@ room = "2.6.1"
splitties = "3.0.0" splitties = "3.0.0"
rhino = "1.7.15" rhino = "1.7.15"
activity = "1.8.2" activity = "1.9.1"
kotlinxSerialization = "1.7.1" kotlinxSerialization = "1.7.1"
swiperefreshlayout = "1.1.0" swiperefreshlayout = "1.1.0"
viewpager2 = "1.1.0" viewpager2 = "1.1.0"