fix: correct loader above videos (#858)
This commit is contained in:
parent
9201eb3305
commit
927a026a18
@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.Arrangement
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
@ -27,6 +26,8 @@ import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing
|
|||||||
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.VideoPlayer
|
import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.VideoPlayer
|
||||||
import com.github.diegoberaldin.raccoonforlemmy.core.l10n.LocalXmlStrings
|
import com.github.diegoberaldin.raccoonforlemmy.core.l10n.LocalXmlStrings
|
||||||
|
|
||||||
|
private const val DEFAULT_ASPECT_RATIO = 1f
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PostCardVideo(
|
fun PostCardVideo(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@ -71,7 +72,7 @@ fun PostCardVideo(
|
|||||||
var loading by remember { mutableStateOf(true) }
|
var loading by remember { mutableStateOf(true) }
|
||||||
if (shouldBeRendered) {
|
if (shouldBeRendered) {
|
||||||
VideoPlayer(
|
VideoPlayer(
|
||||||
modifier = Modifier.aspectRatio(1f),
|
modifier = Modifier.aspectRatio(DEFAULT_ASPECT_RATIO),
|
||||||
url = url,
|
url = url,
|
||||||
onPlaybackStarted = {
|
onPlaybackStarted = {
|
||||||
loading = false
|
loading = false
|
||||||
@ -79,7 +80,11 @@ fun PostCardVideo(
|
|||||||
)
|
)
|
||||||
if (loading) {
|
if (loading) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize().background(backgroundColor),
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.aspectRatio(DEFAULT_ASPECT_RATIO)
|
||||||
|
.background(backgroundColor),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user