Skip to content

Commit

Permalink
Long Press programme to see detail.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jul 20, 2024
1 parent d821a42 commit ebd7f26
Show file tree
Hide file tree
Showing 6 changed files with 312 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ internal class ProgrammeRepositoryImpl @Inject constructor(
val url = response.request.url
val contentType = response.header("Content-Type").orEmpty()

val isGzip = "gzip" in contentType || url.pathSegments.lastOrNull()?.endsWith(".gz") == true
val isGzip = "gzip" in contentType ||
// soft rule, cover the situation which with wrong MIME_TYPE(text, octect etc.)
url.pathSegments.lastOrNull()?.endsWith(".gz") == true

response
.body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.m3u.feature.channel
import android.content.pm.ActivityInfo
import android.view.KeyEvent
import androidx.activity.compose.BackHandler
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.animateIntAsState
Expand Down Expand Up @@ -84,6 +85,7 @@ import com.m3u.material.components.mask.MaskButton
import com.m3u.material.components.mask.MaskCircleButton
import com.m3u.material.components.mask.MaskPanel
import com.m3u.material.components.mask.MaskState
import com.m3u.material.effects.currentBackStackEntry
import com.m3u.material.ktx.leanback
import com.m3u.material.ktx.thenIf
import com.m3u.material.model.LocalSpacing
Expand Down Expand Up @@ -113,7 +115,6 @@ internal fun ChannelMask(
isPanelExpanded: Boolean,
hasTrack: Boolean,
onFavourite: () -> Unit,
onBackPressed: () -> Unit,
openDlnaDevices: () -> Unit,
openChooseFormat: () -> Unit,
openOrClosePanel: () -> Unit,
Expand All @@ -129,6 +130,10 @@ internal fun ChannelMask(
val leanback = leanback()
val coroutineScope = rememberCoroutineScope()

val onBackPressedDispatcher = checkNotNull(
LocalOnBackPressedDispatcherOwner.current
).onBackPressedDispatcher

var gesture: MaskGesture? by remember { mutableStateOf(null) }

// because they will be updated frequently,
Expand Down Expand Up @@ -224,10 +229,11 @@ internal fun ChannelMask(
PlayerMask(
state = maskState,
header = {
val backStackEntry by currentBackStackEntry()
MaskButton(
state = maskState,
icon = Icons.AutoMirrored.Rounded.ArrowBack,
onClick = onBackPressed,
icon = backStackEntry?.navigationIcon ?: Icons.AutoMirrored.Rounded.ArrowBack,
onClick = { onBackPressedDispatcher.onBackPressed() },
contentDescription = stringResource(string.feat_channel_tooltip_on_back_pressed)
)
Spacer(modifier = Modifier.weight(1f))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import kotlin.time.Duration.Companion.milliseconds
@Composable
fun ChannelRoute(
modifier: Modifier = Modifier,
onBackPressed: () -> Unit,
viewModel: ChannelViewModel = hiltViewModel(),
) {
val openInExternalPlayerString = stringResource(string.feat_channel_open_in_external_app)
Expand Down Expand Up @@ -200,7 +199,6 @@ fun ChannelRoute(
}
},
onFavourite = viewModel::onFavourite,
onBackPressed = onBackPressed,
maskState = maskState,
playerState = playerState,
playlist = playlist,
Expand Down Expand Up @@ -266,7 +264,6 @@ private fun ChannelPlayer(
volume: Float,
brightness: Float,
onFavourite: () -> Unit,
onBackPressed: () -> Unit,
openDlnaDevices: () -> Unit,
openChooseFormat: () -> Unit,
openOrClosePanel: () -> Unit,
Expand Down Expand Up @@ -319,7 +316,6 @@ private fun ChannelPlayer(
hasTrack = hasTrack,
isPanelExpanded = isPanelExpanded,
onFavourite = onFavourite,
onBackPressed = onBackPressed,
openDlnaDevices = openDlnaDevices,
openChooseFormat = openChooseFormat,
openOrClosePanel = openOrClosePanel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class PlayerActivity : ComponentActivity() {
alwaysUseDarkTheme = true
) {
ChannelRoute(
onBackPressed = { finish() },
viewModel = viewModel
)
}
Expand Down
Loading

0 comments on commit ebd7f26

Please sign in to comment.