style: remove unused code

This commit is contained in:
tunbmoon
2026-04-10 13:31:28 +08:00
parent 171d6b34d4
commit 3a18d4b4a6
6 changed files with 4 additions and 27 deletions
@@ -131,7 +131,7 @@ class Media3Player(private val context: Context) {
if (isRtmp) {
val rtmpSource = androidx.media3.exoplayer.source.ProgressiveMediaSource.Factory(
androidx.media3.datasource.rtmp.RtmpDataSource.Factory()
).createMediaSource(androidx.media3.common.MediaItem.fromUri(cleanedUrl))
).createMediaSource(MediaItem.fromUri(cleanedUrl))
setMediaSource(rtmpSource)
} else {
setMediaItem(createMediaItem(cleanedUrl))
@@ -6,7 +6,6 @@ import android.media.MediaCodecList
import androidx.media3.common.AudioAttributes
import androidx.media3.common.C
import androidx.media3.datasource.DefaultHttpDataSource
import androidx.media3.datasource.rtmp.RtmpDataSource
import androidx.media3.exoplayer.DefaultLoadControl
import androidx.media3.exoplayer.DefaultRenderersFactory
import androidx.media3.exoplayer.ExoPlayer
@@ -70,7 +70,6 @@ fun PlayerControlsOverlay(
) {
var currentPosition by remember { mutableLongStateOf(media3Player?.currentPosition ?: 0L) }
var bufferedPosition by remember { mutableLongStateOf(media3Player?.bufferedPosition ?: 0L) }
var duration by remember { mutableLongStateOf(media3Player?.duration ?: 0L) }
var estimatedProgress by rememberSaveable { mutableFloatStateOf(0f) }
var localCycleDuration by remember { mutableFloatStateOf(currentCycleDuration) }
@@ -83,7 +82,6 @@ fun PlayerControlsOverlay(
while (true) {
currentPosition = media3Player?.currentPosition ?: 0L
bufferedPosition = media3Player?.bufferedPosition ?: 0L
duration = media3Player?.duration ?: 0L
watchTimeTracker.update()
val watchSeconds = watchTimeTracker.getAccumulatedTime() / 1000f
@@ -20,7 +20,6 @@ private class PlayerTextureView @JvmOverloads constructor(
private val player: Media3Player? = null,
initialAspectRatio: Int = 0,
initialMirrorFlip: Boolean = false,
private val isBackgroundRetained: Boolean = false,
private val onSurfaceReady: () -> Unit = {}
) : TextureView(context), MeasureHelper.MeasureFormVideoParamsListener {
@@ -133,7 +132,6 @@ fun PlayerSurface(
modifier: Modifier = Modifier,
mirrorFlip: Boolean = false,
onSurfaceReady: () -> Unit = {},
isBackgroundRetained: Boolean = false,
currentChannelUrl: String = ""
) {
val textureViewRef = remember { mutableStateOf<TextureView?>(null) }
@@ -190,7 +188,7 @@ fun PlayerSurface(
if (surfaceReady) {
AndroidView(
factory = { ctx ->
PlayerTextureView(ctx, player, aspectRatio, mirrorFlip, isBackgroundRetained, onSurfaceReady).also {
PlayerTextureView(ctx, player, aspectRatio, mirrorFlip, onSurfaceReady).also {
textureViewRef.value = it
}
},
@@ -129,7 +129,6 @@ fun LogcatPage(onNavigateBack: () -> Unit) {
val failedMsg = stringResource(R.string.export_failed)
var exportContent by remember { mutableStateOf("") }
var exportFileName by remember { mutableStateOf("") }
val exportLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.CreateDocument("text/plain")
@@ -9,8 +9,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.serialization.json.Json
@@ -36,8 +34,7 @@ object EpgManager {
private var epgJob: kotlinx.coroutines.Job? = null
private val _refreshingEpgUrls = MutableStateFlow<List<String>>(emptyList())
val refreshingEpgUrls: StateFlow<List<String>> = _refreshingEpgUrls.asStateFlow()
private const val CACHE_EXPIRY_MS = 7L * 24 * 60 * 60 * 1000
private const val PAGE_SIZE = 50
@@ -168,21 +165,7 @@ object EpgManager {
return emptyList()
}
fun getProgramsPage(relationId: String, offset: Int = 0, limit: Int = PAGE_SIZE): List<EpgProgram> {
val epgUrls = getEpgUrlsFromIndex(relationId)
val allPrograms = if (epgUrls.isNotEmpty()) {
epgUrls.firstNotNullOfOrNull { epgUrl ->
epgDataBySource[epgUrl]?.get(relationId)
} ?: emptyList()
} else {
epgDataBySource.values.firstNotNullOfOrNull { it[relationId] } ?: emptyList()
}
return allPrograms.drop(offset).take(limit)
}
private fun loadCachedEpgData() {
val sourcesByUrl = mutableMapOf<String, Map<String, List<EpgProgram>>>()
mmkv.allKeys()?.forEach { key ->