Skip to content

Commit

Permalink
Update project
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbel committed Nov 2, 2023
1 parent 219bc58 commit ed978aa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ fun AuthLinksBox(
text = stringResource(R.string.auth_terms_of_use),
modifier = Modifier
.padding(vertical = 16.dp)
.clickableWithoutRipple {
onTermsOfUseClick()
},
.clickableWithoutRipple { onTermsOfUseClick() },
maxLines = 1,
style = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.primary
Expand All @@ -68,9 +66,7 @@ fun AuthLinksBox(
text = stringResource(R.string.auth_privacy_policy),
modifier = Modifier
.padding(vertical = 16.dp)
.clickableWithoutRipple {
onPrivacyPolicyClick()
},
.clickableWithoutRipple { onPrivacyPolicyClick() },
maxLines = 1,
style = MaterialTheme.typography.bodyMedium.copy(
color = MaterialTheme.colorScheme.primary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ internal fun AuthScreenContent(
top.linkTo(toolbar.bottom, 8.dp)
end.linkTo(parent.end, 16.dp)
}
.clickableWithoutRipple {
openUrl(resultContract, toolbarColor, TMDB_URL)
},
.clickableWithoutRipple { openUrl(resultContract, toolbarColor, TMDB_URL) },
tint = MaterialTheme.colorScheme.onPrimaryContainer
)

Expand Down Expand Up @@ -246,9 +244,7 @@ internal fun AuthScreenContent(
exit = fadeOut()
) {
TextButton(
onClick = {
openUrl(resultContract, toolbarColor, TMDB_RESET_PASSWORD)
}
onClick = { openUrl(resultContract, toolbarColor, TMDB_RESET_PASSWORD) }
) {
Text(
text = stringResource(R.string.auth_reset_password)
Expand All @@ -270,9 +266,7 @@ internal fun AuthScreenContent(
exit = fadeOut()
) {
TextButton(
onClick = {
openUrl(resultContract, toolbarColor, TMDB_REGISTER)
}
onClick = { openUrl(resultContract, toolbarColor, TMDB_REGISTER) }
) {
Text(
text = stringResource(R.string.auth_sign_up)
Expand Down Expand Up @@ -350,12 +344,8 @@ internal fun AuthScreenContent(
}*/

AuthLinksBox(
onTermsOfUseClick = {
openUrl(resultContract, toolbarColor, TMDB_TERMS_OF_USE)
},
onPrivacyPolicyClick = {
openUrl(resultContract, toolbarColor, TMDB_PRIVACY_POLICY)
},
onTermsOfUseClick = { openUrl(resultContract, toolbarColor, TMDB_TERMS_OF_USE) },
onPrivacyPolicyClick = { openUrl(resultContract, toolbarColor, TMDB_PRIVACY_POLICY) },
modifier = Modifier
.constrainAs(linksBox) {
width = Dimension.fillToConstraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,42 +62,29 @@ fun DetailsContent(
.build()
}

val imageModifier: Modifier = if (placeholder) {
Modifier
AsyncImage(
model = imageRequest,
contentDescription = null,
modifier = Modifier
.constrainAs(image) {
width = Dimension.fillToConstraints
height = Dimension.value(220.dp)
start.linkTo(parent.start, 16.dp)
top.linkTo(parent.top, 16.dp)
end.linkTo(parent.end, 16.dp)
}
.clip(MaterialTheme.shapes.small)
.placeholder(
visible = true,
visible = placeholder,
color = MaterialTheme.colorScheme.inversePrimary,
shape = MaterialTheme.shapes.small,
highlight = PlaceholderHighlight.fade()
)
} else {
Modifier
.constrainAs(image) {
width = Dimension.fillToConstraints
height = Dimension.value(220.dp)
start.linkTo(parent.start, 16.dp)
top.linkTo(parent.top, 16.dp)
end.linkTo(parent.end, 16.dp)
}
.clip(MaterialTheme.shapes.small)
.clickable {
if (!isNoImageVisible) {
if (!placeholder && !isNoImageVisible) {
onNavigateToGallery(movie.movieId)
}
}
}

AsyncImage(
model = imageRequest,
contentDescription = null,
modifier = imageModifier,
},
onState = { state ->
isNoImageVisible = movie.isNotEmpty && state.isErrorOrEmpty
},
Expand Down Expand Up @@ -125,8 +112,9 @@ fun DetailsContent(
)
}

val titleModifier: Modifier = if (placeholder) {
Modifier
Text(
text = movie.title,
modifier = Modifier
.constrainAs(title) {
width = Dimension.fillToConstraints
height = Dimension.wrapContent
Expand All @@ -135,34 +123,21 @@ fun DetailsContent(
end.linkTo(parent.end, 16.dp)
}
.placeholder(
visible = true,
visible = placeholder,
color = MaterialTheme.colorScheme.inversePrimary,
shape = MaterialTheme.shapes.small,
highlight = PlaceholderHighlight.fade()
)
} else {
Modifier
.constrainAs(title) {
width = Dimension.fillToConstraints
height = Dimension.wrapContent
start.linkTo(parent.start, 16.dp)
top.linkTo(image.bottom, 8.dp)
end.linkTo(parent.end, 16.dp)
}
}

Text(
text = movie.title,
modifier = titleModifier,
),
overflow = TextOverflow.Ellipsis,
maxLines = 3,
style = MaterialTheme.typography.titleLarge.copy(
color = MaterialTheme.colorScheme.onPrimaryContainer
)
)

val overviewModifier: Modifier = if (placeholder) {
Modifier
Text(
text = movie.overview,
modifier = Modifier
.constrainAs(overview) {
width = Dimension.fillToConstraints
height = Dimension.wrapContent
Expand All @@ -171,25 +146,11 @@ fun DetailsContent(
end.linkTo(parent.end, 16.dp)
}
.placeholder(
visible = true,
visible = placeholder,
color = MaterialTheme.colorScheme.inversePrimary,
shape = MaterialTheme.shapes.small,
highlight = PlaceholderHighlight.fade()
)
} else {
Modifier
.constrainAs(overview) {
width = Dimension.fillToConstraints
height = Dimension.wrapContent
start.linkTo(parent.start, 16.dp)
top.linkTo(title.bottom, 8.dp)
end.linkTo(parent.end, 16.dp)
}
}

Text(
text = movie.overview,
modifier = overviewModifier,
),
overflow = TextOverflow.Ellipsis,
maxLines = 10,
style = MaterialTheme.typography.bodyMedium.copy(
Expand Down

0 comments on commit ed978aa

Please sign in to comment.