-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/similar movie screen #102
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 all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33e4a71
Merge remote-tracking branch 'origin/feature/details-top-cast-screen-…
baraa0abd 19d1190
feat: similar movies screen
baraa0abd 6521bd7
fix: string resources
baraa0abd 1cffc99
Merge branch 'develop' into feature/similar-movie-screen
baraa0abd 5ffa736
Refactor/similar-movies-screen
baraa0abd 48cb143
feat: Enhance SimilarMoviesScreen with loading/error states
baraa0abd c3e217d
Refactor: similar movies screen top app bar
baraa0abd 541d976
Merge remote-tracking branch 'origin/develop' into feature/similar-mo…
AmrNasserSaad 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
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
123 changes: 123 additions & 0 deletions
123
...tation/src/main/java/com/madrid/presentation/screens/similarMovies/SimilarMoviesScreen.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,123 @@ | ||
| package com.madrid.presentation.screens.similarMovies | ||
|
|
||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.clickable | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Column | ||
| import androidx.compose.foundation.layout.PaddingValues | ||
| 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.layout.statusBarsPadding | ||
| import androidx.compose.foundation.lazy.grid.GridCells | ||
| import androidx.compose.foundation.lazy.grid.LazyVerticalGrid | ||
| import androidx.compose.foundation.lazy.grid.items | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.collectAsState | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.dp | ||
| import com.madrid.designsystem.AppTheme | ||
| import com.madrid.designsystem.R | ||
| import com.madrid.designsystem.component.MovioText | ||
| import com.madrid.designsystem.component.TopAppBar | ||
| import com.madrid.presentation.composables.movioCards.MovioVerticalCard | ||
| import com.madrid.presentation.screens.searchScreen.viewModel.SearchScreenState | ||
| import com.madrid.presentation.screens.searchScreen.viewModel.SearchViewModel | ||
| import org.koin.androidx.compose.koinViewModel | ||
|
|
||
| @Composable | ||
| fun SimilarMoviesScreen( | ||
| onBackClick: () -> Unit = {}, | ||
| onMovieClick: (SearchScreenState.MovieUiState) -> Unit = {}, | ||
| modifier: Modifier = Modifier, | ||
| viewModel: SearchViewModel = koinViewModel() | ||
| ) { | ||
| val state by viewModel.state.collectAsState() | ||
| var selectedMovieId by remember { mutableStateOf<String?>(null) } | ||
|
|
||
| Column( | ||
| modifier = modifier | ||
| .fillMaxSize() | ||
| .background(AppTheme.colors.surfaceColor.surface) | ||
| .statusBarsPadding() | ||
| ) { | ||
| Box { | ||
| TopAppBar( | ||
| text = stringResource(id = com.madrid.presentation.R.string.selected_similar_movie), | ||
| firstIcon = R.drawable.arrow_left | ||
| ) | ||
| Box( | ||
| modifier = Modifier | ||
| .padding(horizontal = 16.dp, vertical = 12.dp) | ||
| .size(40.dp) | ||
| .clickable { onBackClick() } | ||
| ) | ||
| } | ||
| LazyVerticalGrid( | ||
| modifier = Modifier.fillMaxSize(), | ||
| columns = GridCells.Fixed(3), | ||
| contentPadding = PaddingValues(16.dp), | ||
| horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
| verticalArrangement = Arrangement.spacedBy(12.dp), | ||
| ) { | ||
| items(state.searchUiState.exploreMoreMovies) { movie -> | ||
| MovioVerticalCard( | ||
| description = movie.title, | ||
| movieImage = movie.imageUrl, | ||
| rate = movie.rating, | ||
| width = 101.33.dp, | ||
| height = 136.dp, | ||
| onClick = { | ||
| selectedMovieId = movie.id | ||
| onMovieClick(movie) | ||
| }, | ||
| modifier = Modifier, | ||
| paddingvalue = 0.dp | ||
| ) | ||
| } | ||
| } | ||
| if (state.searchUiState.isLoading) { | ||
| Box( | ||
| Modifier | ||
| .fillMaxWidth() | ||
| .padding(16.dp), | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
| MovioText( | ||
| text = stringResource(id = com.madrid.presentation.R.string.loading), | ||
| color = AppTheme.colors.surfaceColor.onSurface, | ||
| textStyle = AppTheme.textStyle.body.medium14 | ||
| ) | ||
| } | ||
| } | ||
| state.searchUiState.errorMessage?.let { errorMsg -> | ||
| Box(Modifier | ||
| .fillMaxWidth() | ||
| .padding(16.dp), contentAlignment = Alignment.Center) { | ||
| MovioText( | ||
| text = errorMsg, | ||
| color = AppTheme.colors.surfaceColor.outline, | ||
| textStyle = AppTheme.textStyle.body.medium14 | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview(showSystemUi = true, showBackground = true) | ||
| @Composable | ||
| fun SimilarMoviesScreenPreview() { | ||
| SimilarMoviesScreen( | ||
| onBackClick = {}, | ||
| onMovieClick = {} | ||
| ) | ||
| } | ||
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
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 |
|---|---|---|
| @@ -1,32 +1,36 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <string name="continue_as_a_guest">Continue as a guest</string> | ||
| <string name="video_library_video_number">Video</string>"> | ||
| <string name="current_episode">Episode %1$s</string> | ||
| <string name="moive_image" >movie image</string> | ||
| <string name="bold_video_circle" >start movie icon </string> | ||
| <string name="dot" >dot</string> | ||
| <string name="stars_icon_rate" >stars icon rate</string> | ||
| <string name="season">season %1$s</string> | ||
| <string name="episodes">%1$s Episodes</string> | ||
| <string name="of">of %1$s</string> | ||
| <string name="home">Home</string> | ||
| <string name="search">Search</string> | ||
| <string name="library">Library</string> | ||
| <string name="more">More</string> | ||
| <string name="recent_search">Recent Search</string> | ||
| <string name="clear_all">Clear All</string> | ||
| <string name="remove">Remove</string> | ||
| <string name="top_result">Top Result</string> | ||
| <string name="Movies">Movies</string> | ||
| <string name="Series">Series</string> | ||
| <string name="Artists">Artists</string> | ||
| <string name="top_cast">Top Cast</string> | ||
| <string name="search_result_count">SearchResult (%1$s items)</string> | ||
| <string name="Rate_it">Rate it</string> | ||
| <string name="Add_to_list">Add to list</string> | ||
| <string name="Play">Play</string> | ||
| <string name="for_u">For You</string> | ||
| <string name="see_all">See all</string> | ||
| <string name="explore_more">Explore more</string> | ||
| <string name="continue_as_a_guest">Continue as a guest</string> | ||
| <string name="video_library_video_number">Video</string>"> | ||
| <string name="current_episode">Episode %1$s</string> | ||
| <string name="moive_image">movie image</string> | ||
| <string name="bold_video_circle">start movie icon </string> | ||
| <string name="dot">dot</string> | ||
| <string name="stars_icon_rate">stars icon rate</string> | ||
| <string name="season">season %1$s</string> | ||
| <string name="episodes">%1$s Episodes</string> | ||
| <string name="of">of %1$s</string> | ||
| <string name="home">Home</string> | ||
| <string name="search">Search</string> | ||
| <string name="library">Library</string> | ||
| <string name="more">More</string> | ||
| <string name="recent_search">Recent Search</string> | ||
| <string name="clear_all">Clear All</string> | ||
| <string name="remove">Remove</string> | ||
| <string name="top_result">Top Result</string> | ||
| <string name="Movies">Movies</string> | ||
| <string name="Series">Series</string> | ||
| <string name="Artists">Artists</string> | ||
| <string name="search_result_count">SearchResult (%1$s items)</string>// | ||
| <string name="top_cast">Top Cast</string> | ||
| <string name="selected_similar_movie">Similar Movies</string> | ||
| <string name="Rate_it">Rate it</string> | ||
| <string name="Add_to_list">Add to list</string> | ||
| <string name="Play">Play</string> | ||
| <string name="for_u">For You</string> | ||
| <string name="see_all">See all</string> | ||
| <string name="explore_more">Explore more</string> | ||
| <string name="loading">Loading...</string> | ||
|
|
||
|
|
||
| </resources> |
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.