Skip to content

Commit

Permalink
Merge pull request #58 from gabrielbmoro/feature/57-space-between-car…
Browse files Browse the repository at this point in the history
…ousels--wishlist-ins

Feature/57 space between carousels  wishlist ins
  • Loading branch information
gabrielbmoro committed Aug 2, 2023
2 parents 3705c6c + 7bfc82b commit fdd7f71
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 14 deletions.
Binary file modified img/teaser.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fun MovieDBNavHost(
MovieScreen(navController, viewModel)
}

composable(route = NavigationItem.FavoriteMovies.route) {
composable(route = NavigationItem.WishList.route) {
val viewModel = koinViewModel<WishlistViewModel>()
WishlistScreen(navController, viewModel)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ sealed class NavigationItem(
route = ScreenRoutesBuilder.MOVIES_ROUTE
)

object FavoriteMovies : NavigationItemTab(
object WishList : NavigationItemTab(
icon = R.drawable.ic_stars,
title = R.string.favorite,
route = ScreenRoutesBuilder.FAVORITE_MOVIES_ROUTE
title = R.string.wishlist,
route = ScreenRoutesBuilder.WISHLIST_ROUTE
)

data class DetailsScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object ScreenRoutesBuilder {
const val DETAILED_MOVIE_ARGUMENT_KEY = "targetMovie"

private const val HOME_SCREEN_ROUTE = "home"
const val FAVORITE_MOVIES_ROUTE = "$HOME_SCREEN_ROUTE/favoriteMovies"
const val WISHLIST_ROUTE = "$HOME_SCREEN_ROUTE/favoriteMovies"
const val MOVIES_ROUTE = "$HOME_SCREEN_ROUTE/moviesRoute"

fun detailedMovieRoute(movie: Movie): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ fun AppToolbar(
)
},
navigationIcon = navigationIcon,
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primaryContainer
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.gabrielbmoro.moviedb.ui.common.navigation.NavigationItem
fun MovieBottomNavigationBar(navController: NavController, scrollToTop: (() -> Unit)) {
val items = listOf(
NavigationItem.Movies,
NavigationItem.FavoriteMovies
NavigationItem.WishList
)

NavigationBar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import coil.compose.AsyncImage
import coil.request.ImageRequest
import com.gabrielbmoro.moviedb.R

@Composable
Expand All @@ -18,8 +20,14 @@ fun MovieImage(
) {

if (imageUrl != null) {
val context = LocalContext.current
val imageRequest = ImageRequest.Builder(context)
.placeholder(R.drawable.ic_movie)
.data(imageUrl)
.build()

AsyncImage(
model = imageUrl,
model = imageRequest,
contentScale = contentScale,
alignment = Alignment.TopCenter,
contentDescription = contentDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ fun MovieList(
LazyColumn(
state = lazyListState,
modifier = modifier.background(MaterialTheme.colorScheme.background),
contentPadding = PaddingValues(top = 16.dp, bottom = 120.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
verticalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(vertical = 8.dp)
) {
items(
count = moviesList.size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.paging.LoadState
import androidx.paging.PagingData
import androidx.paging.compose.collectAsLazyPagingItems
Expand All @@ -43,7 +44,9 @@ fun MoviesCarousel(

Text(
text = content.sectionTitle,
style = MaterialTheme.typography.headlineMedium
style = MaterialTheme.typography.titleMedium.copy(
fontSize = 18.sp
)
)

Spacer(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gabrielbmoro.moviedb.ui.screens.movies

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -40,7 +42,6 @@ fun MovieScreen(

val coroutineScope = rememberCoroutineScope()


val onSelectMovie: ((Movie) -> Unit) = { movie ->
navController.navigate(
NavigationItem.DetailsScreen(movie).route
Expand Down Expand Up @@ -73,7 +74,9 @@ fun MovieScreen(
},
modifier = Modifier
.fillMaxSize()
.align(Alignment.TopCenter)
.align(Alignment.TopCenter),
contentPadding = PaddingValues(vertical = 8.dp),
verticalArrangement = Arrangement.spacedBy(18.dp, alignment = Alignment.Top)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ fun WishlistScreen(

ScreenScaffold(
showTopBar = true,
appBarTitle = stringResource(id = R.string.favorite_movies_screen_title),
appBarTitle = stringResource(id = R.string.wishlist),
navController = navController,
scrollToTop = {
coroutineScope.launch {
lazyListState.scrollToItem(0, 0)
}
}
},
) {
when {
uiState.value.isLoading -> {
Expand Down
1 change: 1 addition & 0 deletions src/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<string name="upcoming">Up coming</string>
<string name="movies">Movies</string>
<string name="favorite">Favorite</string>
<string name="wishlist">Wishlist</string>
<string name="release_date">Release Date:</string>
<string name="expand">Expand</string>
<string name="hide">Hide</string>
Expand Down

0 comments on commit fdd7f71

Please sign in to comment.