Чат, правки
This commit is contained in:
@@ -4,6 +4,8 @@ import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.gestures.detectTransformGestures
|
||||
import androidx.compose.foundation.gestures.rememberTransformableState
|
||||
import androidx.compose.foundation.gestures.transformable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
@@ -18,6 +20,7 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
@@ -60,11 +63,12 @@ fun AppMediaLightbox(
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
if (media.type.startsWith("video")) {
|
||||
val isCurrentPage = pagerState.currentPage == page
|
||||
AppVideoPlayer(
|
||||
url = media.url,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
useController = true,
|
||||
autoPlay = true
|
||||
autoPlay = isCurrentPage // Только если страница активна
|
||||
)
|
||||
} else {
|
||||
var scale by remember { mutableFloatStateOf(1f) }
|
||||
@@ -72,21 +76,10 @@ fun AppMediaLightbox(
|
||||
|
||||
AsyncImage(
|
||||
model = media.url,
|
||||
imageLoader = core.utils.CoilUtils.getGifImageLoader(LocalContext.current),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.pointerInput(Unit) {
|
||||
detectTransformGestures(
|
||||
onGesture = { _, pan, zoom, _ ->
|
||||
scale = (scale * zoom).coerceIn(1f, 5f)
|
||||
if (scale > 1f) {
|
||||
offset += pan
|
||||
} else {
|
||||
offset = androidx.compose.ui.geometry.Offset.Zero
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.graphicsLayer(
|
||||
scaleX = scale,
|
||||
scaleY = scale,
|
||||
|
||||
Reference in New Issue
Block a user