Skip to content

Commit

Permalink
fix: remove haze.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jan 13, 2024
1 parent 1203c63 commit 66b6099
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package com.m3u.features.playlist.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.BrokenImage
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp
import androidx.tv.material3.Card
import androidx.tv.material3.Icon
import androidx.tv.material3.Text
import coil.compose.AsyncImage
import coil.compose.SubcomposeAsyncImage
import com.m3u.data.database.model.Stream
import com.m3u.material.model.LocalSpacing

Expand Down Expand Up @@ -43,10 +48,28 @@ internal fun TvStreamItem(
maxLines = 1
)
} else {
AsyncImage(
SubcomposeAsyncImage(
model = stream.cover,
contentScale = ContentScale.Crop,
contentDescription = stream.title,
error = {
Column(
verticalArrangement = Arrangement.SpaceAround,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.fillMaxSize()
.padding(spacing.medium)
) {
Text(
text = stream.title,
maxLines = 1
)
Icon(
imageVector = Icons.Rounded.BrokenImage,
contentDescription = null
)
}
},
modifier = Modifier.fillMaxSize()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -42,7 +41,6 @@ import androidx.compose.ui.unit.dp
import androidx.tv.foundation.lazy.list.TvLazyColumn
import androidx.tv.foundation.lazy.list.TvLazyRow
import androidx.tv.foundation.lazy.list.items
import androidx.tv.material3.Card
import androidx.tv.material3.DrawerValue
import androidx.tv.material3.Icon
import androidx.tv.material3.ImmersiveList
Expand Down Expand Up @@ -91,8 +89,8 @@ internal fun TvPlaylistScreenImpl(
val helper = LocalHelper.current
val spacing = LocalSpacing.current
val focusRequester = remember { FocusRequester() }

val maxBrowserHeight = 180.dp
val multiCatalogs = channels.size > 1
val maxBrowserHeight = if (multiCatalogs) 256.dp else 180.dp

val drawerState = rememberDrawerState(DrawerValue.Closed)

Expand Down Expand Up @@ -302,33 +300,18 @@ internal fun TvPlaylistScreenImpl(
)
) {
items(channels) { channel ->
if (multiCatalogs) {
Text(
text = channel.title,
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier.padding(spacing.medium)
)
}
val streams = channel.streams
TvLazyRow(
horizontalArrangement = Arrangement.spacedBy(spacing.medium),
contentPadding = PaddingValues(horizontal = spacing.medium)
) {
if (channels.size > 1) {
item {
Card(
onClick = {},
onLongClick = {},
modifier = Modifier
.height(128.dp)
.aspectRatio(4 / 3f)
) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize()
) {
Text(
text = channel.title,
style = MaterialTheme.typography.displayMedium
)
}
}
}
}

items(
count = streams.size,
key = { i -> streams[i].id },
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ parser-m3u = "1.3.0"
servlet = "3.1.0"
jetty = "9.3.14.v20161028"
nanohttpd = "2.3.1"
haze = "0.4.1"
kaml = "0.55.0"
jupnp = "2.7.1"
symbol-processing-api = "1.9.21-1.0.16"
Expand Down Expand Up @@ -144,7 +143,6 @@ jetty-servlet = { group = "org.eclipse.jetty", name = "jetty-servlet", version.r
jetty-client = { group = "org.eclipse.jetty", name = "jetty-client", version.ref = "jetty" }

nanohttpd = { group = "org.nanohttpd", name = "nanohttpd", version.ref = "nanohttpd" }
haze = { group = "dev.chrisbanes.haze", name = "haze-jetpack-compose", version.ref = "haze" }

jupnp = { group = "org.jupnp", name = "org.jupnp", version.ref = "jupnp" }
jupnp-support = { group = "org.jupnp", name = "org.jupnp.support", version.ref = "jupnp" }
Expand Down
1 change: 0 additions & 1 deletion material/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dependencies {
api(libs.io.coil.kt.coil.compose)

implementation(libs.com.airbnb.android.lottie.compose)
api(libs.haze)

api(libs.kotlinx.collections.immutable)

Expand Down

0 comments on commit 66b6099

Please sign in to comment.