diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt index cd774e6eb..409e90088 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/VideoView.kt @@ -28,8 +28,6 @@ import android.net.Uri import android.os.Build import android.util.Log import android.view.View -import android.view.ViewGroup -import android.widget.FrameLayout import androidx.annotation.OptIn import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.core.LinearEasing @@ -752,26 +750,23 @@ private fun RenderVideoPlayer( modifier = videoModifier, factory = { context: Context -> PlayerView(context).apply { - clipToOutline = true player = controller - layoutParams = - FrameLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT, - ) setShowBuffering(PlayerView.SHOW_BUFFERING_ALWAYS) setBackgroundColor(Color.Transparent.toArgb()) setShutterBackgroundColor(Color.Transparent.toArgb()) + controllerAutoShow = false useController = showControls thumbData?.thumb?.let { defaultArtwork = it } hideController() + resizeMode = if (isFiniteHeight) { AspectRatioFrameLayout.RESIZE_MODE_FIT } else { AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH } + if (showControls) { onDialog?.let { innerOnDialog -> setFullscreenButtonClickListener { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 8394b3199..4b06ffa2f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -207,18 +207,13 @@ fun ZoomableContentView( @Composable fun GalleryContentView( content: BaseMediaContent, - roundedCorner: Boolean, - isFiniteHeight: Boolean, accountViewModel: AccountViewModel, ) { when (content) { is MediaUrlImage -> SensitivityWarning(content.contentWarning != null, accountViewModel) { TwoSecondController(content) { controllerVisible -> - val mainImageModifier = Modifier.fillMaxWidth() - val loadedImageModifier = if (roundedCorner) MaterialTheme.colorScheme.imageModifier else Modifier.fillMaxWidth() - - UrlImageView(content, ContentScale.Crop, mainImageModifier, loadedImageModifier, controllerVisible, accountViewModel = accountViewModel) + UrlImageView(content, ContentScale.Crop, Modifier.fillMaxSize(), Modifier.fillMaxSize(), controllerVisible, accountViewModel = accountViewModel) } } is MediaUrlVideo -> @@ -233,7 +228,7 @@ fun GalleryContentView( authorName = content.authorName, dimensions = Dimension(1, 1), // fit video in 1:1 ratio blurhash = content.blurhash, - isFiniteHeight = isFiniteHeight, + isFiniteHeight = false, nostrUriCallback = content.uri, accountViewModel = accountViewModel, alwaysShowVideo = true, @@ -243,10 +238,7 @@ fun GalleryContentView( } is MediaLocalImage -> TwoSecondController(content) { controllerVisible -> - val mainImageModifier = Modifier.fillMaxWidth() - val loadedImageModifier = if (roundedCorner) MaterialTheme.colorScheme.imageModifier else Modifier.fillMaxWidth() - - LocalImageView(content, ContentScale.Crop, mainImageModifier, loadedImageModifier, controllerVisible, accountViewModel = accountViewModel) + LocalImageView(content, ContentScale.Crop, Modifier.fillMaxSize(), Modifier.fillMaxSize(), controllerVisible, accountViewModel = accountViewModel) } is MediaLocalVideo -> content.localFile?.let { @@ -258,7 +250,7 @@ fun GalleryContentView( artworkUri = content.artworkUri, authorName = content.authorName, borderModifier = MaterialTheme.colorScheme.videoGalleryModifier, - isFiniteHeight = isFiniteHeight, + isFiniteHeight = false, nostrUriCallback = content.uri, accountViewModel = accountViewModel, ) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileGallery.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileGallery.kt index 658790b9c..436e8cb78 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileGallery.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileGallery.kt @@ -24,10 +24,10 @@ import androidx.compose.animation.core.tween import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyGridState @@ -72,8 +72,8 @@ import com.vitorpamplona.amethyst.ui.screen.FeedViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.mockAccountViewModel import com.vitorpamplona.amethyst.ui.theme.FeedPadding -import com.vitorpamplona.amethyst.ui.theme.HalfPadding import com.vitorpamplona.amethyst.ui.theme.QuoteBorder +import com.vitorpamplona.amethyst.ui.theme.Size5dp import com.vitorpamplona.quartz.events.PictureEvent import com.vitorpamplona.quartz.events.ProfileGalleryEntryEvent import com.vitorpamplona.quartz.events.VideoEvent @@ -133,15 +133,13 @@ private fun GalleryFeedLoaded( state = listState, ) { itemsIndexed(items.list, key = { _, item -> item.idHex }) { _, item -> - Row(Modifier.fillMaxWidth().animateItemPlacement()) { - GalleryCardCompose( - baseNote = item, - routeForLastRead = routeForLastRead, - modifier = HalfPadding, - accountViewModel = accountViewModel, - nav = nav, - ) - } + GalleryCardCompose( + baseNote = item, + routeForLastRead = routeForLastRead, + modifier = Modifier.fillMaxSize().animateItem().padding(Size5dp), + accountViewModel = accountViewModel, + nav = nav, + ) } } } @@ -390,8 +388,6 @@ fun InnerRenderGalleryThumb( if (content != null) { GalleryContentView( content = content, - roundedCorner = false, - isFiniteHeight = false, accountViewModel = accountViewModel, ) } else {