Skip to content

Commit

Permalink
Import tv-components with tv prefix alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed May 29, 2024
1 parent 3797a05 commit 7664920
Show file tree
Hide file tree
Showing 13 changed files with 131 additions and 131 deletions.
6 changes: 4 additions & 2 deletions androidApp/src/main/java/com/m3u/androidApp/ui/Scaffold.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ import com.m3u.ui.helper.useRailNav
import dev.chrisbanes.haze.HazeState
import dev.chrisbanes.haze.HazeStyle
import dev.chrisbanes.haze.hazeChild
import androidx.tv.material3.Icon as TvIcon
import androidx.tv.material3.Text as TvText

@Composable
@OptIn(InternalComposeApi::class)
Expand Down Expand Up @@ -237,7 +239,7 @@ internal fun NavigationItemLayout(
contentDescription = null
)
} else {
androidx.tv.material3.Icon(
TvIcon(
imageVector = when {
fob != null && usefob -> fob.icon
selected -> currentRootDestination.selectedIcon
Expand All @@ -257,7 +259,7 @@ internal fun NavigationItemLayout(
).uppercase()
)
} else {
androidx.tv.material3.Text(
TvText(
text = stringResource(
if (usefob && fob != null) fob.iconTextId
else currentRootDestination.iconTextId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.tv.material3.Border
import androidx.tv.material3.Card
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.MaterialTheme
import com.m3u.androidApp.ui.Items
import com.m3u.androidApp.ui.MainContent
import com.m3u.androidApp.ui.NavigationItemLayout
Expand All @@ -34,6 +30,10 @@ import com.m3u.material.ktx.plus
import com.m3u.material.model.LocalSpacing
import com.m3u.ui.Destination
import com.m3u.ui.helper.Metadata
import androidx.tv.material3.Border as TvBorder
import androidx.tv.material3.Card as TvCard
import androidx.tv.material3.CardDefaults as TvCardDefaults
import androidx.tv.material3.MaterialTheme as TvMaterialTheme

@Composable
@InternalComposeApi
Expand Down Expand Up @@ -61,7 +61,7 @@ fun TelevisionScaffoldImpl(
_: @Composable () -> Unit ->
val source = remember { MutableInteractionSource() }
val focused by source.collectIsFocusedAsState()
val currentContainerColor by with(MaterialTheme.colorScheme) {
val currentContainerColor by with(TvMaterialTheme.colorScheme) {
animateColorAsState(
targetValue = when {
selected -> inverseSurface
Expand All @@ -71,7 +71,7 @@ fun TelevisionScaffoldImpl(
label = "scaffold-navigation-container"
)
}
val currentContentColor by with(MaterialTheme.colorScheme) {
val currentContentColor by with(TvMaterialTheme.colorScheme) {
animateColorAsState(
targetValue = when {
selected -> inverseOnSurface
Expand All @@ -81,16 +81,16 @@ fun TelevisionScaffoldImpl(
label = "scaffold-navigation-content"
)
}
Card(
TvCard(
onClick = onClick,
colors = CardDefaults.colors(
colors = TvCardDefaults.colors(
containerColor = currentContainerColor,
contentColor = currentContentColor
),
interactionSource = source,
shape = CardDefaults.shape(CircleShape),
border = CardDefaults.border(focusedBorder = Border.None),
scale = CardDefaults.scale(
shape = TvCardDefaults.shape(CircleShape),
border = TvCardDefaults.border(focusedBorder = TvBorder.None),
scale = TvCardDefaults.scale(
scale = if (selected) 1.1f else 1f,
focusedScale = if (selected) 1.2f else 1.1f
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import androidx.tv.foundation.lazy.grid.TvGridCells
import androidx.tv.foundation.lazy.grid.TvGridItemSpan
import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid
import androidx.tv.foundation.lazy.grid.items
import androidx.tv.material3.Card
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.Glow
import androidx.tv.material3.Card as TvCard
import androidx.tv.material3.CardDefaults as TvCardDefaults
import androidx.tv.material3.Glow as TvGlow
import com.m3u.core.util.basic.title
import com.m3u.core.wrapper.Resource
import com.m3u.data.database.model.Stream
Expand Down Expand Up @@ -199,15 +199,15 @@ private fun RandomTips(
.then(modifier)
)
} else {
Card(
TvCard(
onClick = onClick,
glow = CardDefaults.glow(
Glow(
glow = TvCardDefaults.glow(
TvGlow(
elevationColor = Color.Transparent,
elevation = spacing.small
)
),
scale = CardDefaults.scale(
scale = TvCardDefaults.scale(
scale = 0.95f,
focusedScale = 1f
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
import androidx.tv.material3.ListItem as TvListItem
import androidx.tv.material3.MaterialTheme as TvMaterialTheme
import androidx.tv.material3.Text as TvText

@Composable
internal fun FavoriteItem(
Expand Down Expand Up @@ -134,9 +136,9 @@ private fun TvFavouriteItemImpl(
onClick = onClick,
onLongClick = onLongClick,
headlineContent = {
androidx.tv.material3.Text(
TvText(
text = stream.title,
style = androidx.tv.material3.MaterialTheme.typography.bodyMedium,
style = TvMaterialTheme.typography.bodyMedium,
maxLines = 1
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.tv.material3.Carousel
import androidx.tv.material3.Carousel as TvCarousel
import com.m3u.core.wrapper.eventOf
import com.m3u.data.database.model.Playlist
import com.m3u.data.database.model.Stream
Expand Down Expand Up @@ -78,7 +78,7 @@ internal fun RecommendGallery(
)
}
} else {
Carousel(
TvCarousel(
itemCount = recommend.size,
contentTransformEndToStart =
fadeIn(tween(1000)) togetherWith fadeOut(tween(1000)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.util.lerp
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.CardScale
import androidx.tv.material3.Glow
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.m3u.core.architecture.preferences.hiltPreferences
Expand All @@ -37,6 +34,11 @@ import com.m3u.material.model.LocalSpacing
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import kotlin.time.Duration.Companion.days
import androidx.tv.material3.Card as TvCard
import androidx.tv.material3.CardDefaults as TvCardDefaults
import androidx.tv.material3.CardScale as TvCardScale
import androidx.tv.material3.Glow as TvGlow
import androidx.tv.material3.LocalContentColor as TvLocalContentColor

@Composable
internal fun RecommendItem(
Expand Down Expand Up @@ -84,9 +86,9 @@ private fun RecommendItemLayout(
content = { content() }
)
} else {
androidx.tv.material3.Card(
scale = CardScale.None,
glow = CardDefaults.glow(Glow.None, Glow.None, Glow.None),
TvCard(
scale = TvCardScale.None,
glow = TvCardDefaults.glow(TvGlow.None, TvGlow.None, TvGlow.None),
onClick = onClick,
modifier = modifier,
content = { content() }
Expand Down Expand Up @@ -169,7 +171,7 @@ private fun UnseenContent(spec: Recommend.UnseenSpec) {
)
CompositionLocalProvider(
LocalContentColor provides Color.White,
androidx.tv.material3.LocalContentColor provides Color.White,
TvLocalContentColor provides Color.White,
) {
info()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.tv.material3.LocalContentColor
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.m3u.core.architecture.preferences.hiltPreferences
Expand All @@ -38,6 +35,9 @@ import com.m3u.material.brush.ImmersiveBackgroundBrush
import com.m3u.material.components.IconButton
import com.m3u.material.model.LocalSpacing
import com.m3u.ui.SnackHost
import androidx.tv.material3.LocalContentColor as TvLocalContentColor
import androidx.tv.material3.MaterialTheme as TvMaterialTheme
import androidx.tv.material3.Text as TvText

@Composable
internal fun ImmersiveBackground(
Expand Down Expand Up @@ -93,9 +93,9 @@ internal fun ImmersiveBackground(
.padding(spacing.medium)
.fillMaxWidth()
) {
Text(
TvText(
text = stream.title,
style = MaterialTheme.typography.headlineLarge,
style = TvMaterialTheme.typography.headlineLarge,
fontWeight = FontWeight.ExtraBold,
maxLines = 1
)
Expand All @@ -108,11 +108,11 @@ internal fun ImmersiveBackground(
}

programme?.let {
Text(
TvText(
text = it.readText(),
style = MaterialTheme.typography.headlineMedium,
style = TvMaterialTheme.typography.headlineMedium,
fontWeight = FontWeight.SemiBold,
color = LocalContentColor.current.copy(0.67f),
color = TvLocalContentColor.current.copy(0.67f),
maxLines = 1
)
}
Expand All @@ -130,9 +130,9 @@ internal fun ImmersiveBackground(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(spacing.small),
) {
Text(
TvText(
text = title,
style = MaterialTheme.typography.headlineLarge,
style = TvMaterialTheme.typography.headlineLarge,
fontWeight = FontWeight.ExtraBold,
maxLines = 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.tv.material3.Border
import androidx.tv.material3.Card
import androidx.tv.material3.CardDefaults
import androidx.tv.material3.Glow
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import androidx.tv.material3.Border as TvBorder
import androidx.tv.material3.Card as TvCard
import androidx.tv.material3.CardDefaults as TvCardDefaults
import androidx.tv.material3.Glow as TvGlow
import androidx.tv.material3.MaterialTheme as TvMaterialTheme
import androidx.tv.material3.Text as TvText
import coil.compose.SubcomposeAsyncImage
import coil.request.ImageRequest
import com.m3u.core.architecture.preferences.hiltPreferences
Expand All @@ -54,24 +54,24 @@ internal fun TvStreamItem(
val noPictureMode = preferences.noPictureMode
val isCoverExisted = !stream.cover.isNullOrEmpty()

Card(
TvCard(
onClick = onClick,
onLongClick = onLongClick,
glow = CardDefaults.glow(
Glow(
glow = TvCardDefaults.glow(
TvGlow(
elevationColor = Color.Transparent,
elevation = spacing.small
)
),
scale = CardDefaults.scale(
scale = TvCardDefaults.scale(
scale = 0.95f,
focusedScale = 1.1f
),
border = CardDefaults.border(
if (stream.favourite) Border(
BorderStroke(3.dp, MaterialTheme.colorScheme.border),
border = TvCardDefaults.border(
if (stream.favourite) TvBorder(
BorderStroke(3.dp, TvMaterialTheme.colorScheme.border),
)
else Border.None
else TvBorder.None
),
modifier = Modifier
.thenIf(!noPictureMode) {
Expand All @@ -85,7 +85,7 @@ internal fun TvStreamItem(
modifier = Modifier.fillMaxSize()
) {
if (!isCoverExisted || noPictureMode) {
Text(
TvText(
text = stream.title,
textAlign = TextAlign.Center,
modifier = Modifier
Expand All @@ -112,7 +112,7 @@ internal fun TvStreamItem(
.fillMaxSize()
.padding(spacing.medium)
) {
Text(
TvText(
text = stream.title,
maxLines = 1
)
Expand All @@ -127,7 +127,7 @@ internal fun TvStreamItem(
.fillMaxSize()
.padding(spacing.medium)
) {
Text(
TvText(
text = stream.title,
maxLines = 1
)
Expand Down
Loading

0 comments on commit 7664920

Please sign in to comment.