-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/movie actor background card #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a41d76
feat: add actor and movie background composables
baraa0abd 668ed78
Merge branch 'feature/similar-movie-screen' into feature/movie-actor-…
baraa0abd 5ee29b9
Refactor: Delete ActorOverlay composable
baraa0abd 12370b1
feat: Enhance MoviePosterDetailScreen for actor display
baraa0abd 9bd65f1
feat: ActorOverlay composable
baraa0abd a03d684
Merge branch 'develop' into feature/movie-actor-background-card
baraa0abd af3cbb7
Refactor: Replace AsyncImage with FilteredImage for improved image lo…
baraa0abd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...ion/src/main/java/com/madrid/presentation/composables/movieActorBackround/ActorOverlay.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package com.madrid.presentation.composables.movieActorBackround | ||
|
|
||
| import androidx.compose.foundation.border | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.BoxScope | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.draw.shadow | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.unit.dp | ||
| import coil.compose.AsyncImage | ||
| import coil.request.ImageRequest | ||
|
|
||
| @Composable | ||
| fun BoxScope.ActorOverlay(actorImageUrl: String, borderColor: Color) { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(120.dp) | ||
| .align(Alignment.Center) | ||
| .shadow(8.dp, CircleShape, clip = false) | ||
| .clip(CircleShape) | ||
| .border(4.dp, borderColor.copy(alpha = 0.7f), CircleShape) | ||
| ) { | ||
| AsyncImage( | ||
| model = ImageRequest.Builder(LocalContext.current) | ||
| .data(actorImageUrl) | ||
| .crossfade(true) | ||
| .build(), | ||
| contentDescription = null, | ||
| contentScale = ContentScale.Crop, | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .clip(CircleShape) | ||
| ) | ||
| } | ||
| } | ||
47 changes: 47 additions & 0 deletions
47
...in/java/com/madrid/presentation/composables/movieActorBackround/BlurredBackgroundImage.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.madrid.presentation.composables.movieActorBackround | ||
|
|
||
| import android.os.Build | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.blur | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
| import coil.compose.AsyncImage | ||
| import coil.request.ImageRequest | ||
|
|
||
| @Composable | ||
| fun BlurredBackgroundImage( | ||
| posterImageUrl: String, | ||
| blurRadius: Dp = 16.dp | ||
| ) { | ||
| val context = LocalContext.current | ||
| Box(Modifier.fillMaxSize()) { | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
| AsyncImage( | ||
| model = ImageRequest.Builder(context) | ||
| .data(posterImageUrl) | ||
| .crossfade(true) | ||
| .build(), | ||
| contentDescription = null, | ||
| contentScale = ContentScale.Crop, | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .blur(blurRadius) | ||
| ) | ||
| } else { | ||
| AsyncImage( | ||
| model = ImageRequest.Builder(context) | ||
| .data(posterImageUrl) | ||
| .crossfade(true) | ||
| .build(), | ||
| contentDescription = null, | ||
| contentScale = ContentScale.Crop, | ||
| modifier = Modifier.fillMaxSize() | ||
| ) | ||
| } | ||
| } | ||
| } |
81 changes: 81 additions & 0 deletions
81
...n/java/com/madrid/presentation/composables/movieActorBackround/MoviePosterDetailScreen.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| package com.madrid.presentation.composables.movieActorBackround | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.layout.fillMaxWidth | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.size | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
|
|
||
| @Composable | ||
| fun MoviePosterDetailScreen( | ||
| ImageUrl: String, | ||
| modifier: Modifier = Modifier, | ||
| isActor: Boolean = false | ||
| ) { | ||
| val overlay = Color(0xCC181828) | ||
| Box( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .background(Color.Black) | ||
| ) { | ||
| Box( | ||
| modifier = Modifier | ||
| .fillMaxWidth() | ||
| .height(372.dp) | ||
| .align(Alignment.TopCenter) | ||
| ) { | ||
| BlurredBackgroundImage(ImageUrl) | ||
| Box( | ||
| Modifier | ||
| .matchParentSize() | ||
| .background(overlay) | ||
| ) | ||
| if (isActor) { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(120.dp) | ||
| .align(Alignment.Center) | ||
| .clip(CircleShape) | ||
| .background(Color.Black.copy(alpha = 0.7f)) | ||
| ) { | ||
| ActorOverlay( | ||
| actorImageUrl = ImageUrl, | ||
| borderColor = Color.White | ||
| ) | ||
| } | ||
| } else { | ||
| Box( | ||
| modifier = Modifier | ||
| .size(width = 200.dp, height = 260.dp) | ||
| .align(Alignment.Center) | ||
| .clip(RoundedCornerShape(12.dp)) | ||
| .background(Color.Black.copy(alpha = 0.7f)) | ||
| ) { | ||
| PosterCard( | ||
| posterImageUrl = ImageUrl, | ||
| modifier = Modifier.fillMaxSize() | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showBackground = true) | ||
| @Composable | ||
| fun MoviePosterDetailScreenPreview() { | ||
| MoviePosterDetailScreen( | ||
| ImageUrl = "https://image.tmdb.org/t/p/original/bOGkgRGdhrBYJSLpXaxhXVstddV.jpg" | ||
| ) | ||
| } | ||
|
|
40 changes: 40 additions & 0 deletions
40
...ation/src/main/java/com/madrid/presentation/composables/movieActorBackround/PosterCard.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package com.madrid.presentation.composables.movieActorBackround | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.foundation.shape.RoundedCornerShape | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.draw.shadow | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.platform.LocalContext | ||
| import androidx.compose.ui.unit.dp | ||
| import coil.compose.AsyncImage | ||
| import coil.request.ImageRequest | ||
| import coil.transform.RoundedCornersTransformation | ||
|
|
||
| @Composable | ||
| fun PosterCard(posterImageUrl: String, modifier: Modifier = Modifier) { | ||
| Box( | ||
| modifier = modifier | ||
| .clip(RoundedCornerShape(12.dp)) | ||
| .background(Color.Black.copy(alpha = 0.7f)) | ||
| .shadow(16.dp, RoundedCornerShape(12.dp), clip = false) | ||
| ) { | ||
| AsyncImage( | ||
| model = ImageRequest.Builder(LocalContext.current) | ||
| .data(posterImageUrl) | ||
| .crossfade(true) | ||
| .transformations(RoundedCornersTransformation(12f)) | ||
| .build(), | ||
| contentDescription = null, | ||
| contentScale = ContentScale.Crop, | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
| .clip(RoundedCornerShape(12.dp)) | ||
| ) | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.