Skip to content

Commit

Permalink
Apply style formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Aug 5, 2024
1 parent d7fac13 commit 1cff27a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fun PodcasterNavGraph(
onEpisodeClick = { episodeId, podcastArtworkUrl -> navController.navigate(Destinations.EpisodeDetailsLibraryGraph(episodeId, podcastArtworkUrl)) },
onNavigateUp = navController::navigateUpOnce,
contentPadding = contentPadding,
excludedWindowInsets = excludedWindowInsets
excludedWindowInsets = excludedWindowInsets,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ fun EpisodeDetailsScreen(
is EpisodeDetailsUIEvent.PauseDownloading -> appState.pauseDownloading(event.episodeId)
is EpisodeDetailsUIEvent.AddEpisodeToQueue -> appState.addToQueue(event.episode)
is EpisodeDetailsUIEvent.RemoveEpisodeFromQueue -> appState.removeFromQueue(event.episodeId)
is EpisodeDetailsUIEvent.ToggleEpisodeFavoriteStatus -> { viewModel.toggleFavoriteStatus(event.isFavorite) }
is EpisodeDetailsUIEvent.ToggleEpisodeFavoriteStatus -> {
viewModel.toggleFavoriteStatus(event.isFavorite)
}
is EpisodeDetailsUIEvent.ErrorPlayingStatusConsumed -> appState.consumeErrorPlayingStatus()
}
},
Expand Down Expand Up @@ -351,7 +353,7 @@ private fun EpisodeDetails(
Spacer(modifier = Modifier.width(8.dp))
FavoriteButton(
isFavorite = episode.isFavourite,
onToggle = onToggleFavoriteStatus
onToggle = onToggleFavoriteStatus,
)
}
val styledDescription = rememberHtmlToAnnotatedString(episode.description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ fun LibraryScreen(
LibraryDestinationEntry(
label = strings.downloads_label,
icon = Icons.Outlined.FileDownload,
onClick = onDownloadsClick
onClick = onDownloadsClick,
)
HorizontalDivider(modifier = Modifier.padding(horizontal = 8.dp))
LibraryDestinationEntry(
label = strings.favorites_label,
icon = Icons.Outlined.Favorite,
onClick = onFavoritesClick
onClick = onFavoritesClick,
)
HorizontalDivider(modifier = Modifier.padding(horizontal = 8.dp))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun mapToEpisode(
podcastTitle,
isCompleted,
progressInSec,
isFavourite
isFavourite,
)
}

Expand Down Expand Up @@ -150,6 +150,6 @@ fun Episode.toEpisodeEntity(): EpisodeEntity {
podcastTitle,
isCompleted,
progressInSec,
isFavourite
isFavourite,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,21 @@ fun FavoriteButton(
containerColor = Color.Transparent,
contentColor = contentColor,
checkedContainerColor = Color.Transparent,
checkedContentColor = contentColor
checkedContentColor = contentColor,
),
border = null,
modifier = modifier
modifier = modifier,
) {
var showSparkles by remember { mutableStateOf(false) }
val animatedFillFraction by animateFloatAsState(
targetValue = if (isFavorite) 0f else 1f,
animationSpec = tween(durationMillis = 2_000, easing = EaseOutQuart),
finishedListener = {
if (isFavorite)
if (isFavorite) {
showSparkles = true
}
},
label = "HeartFillAnimation"
label = "HeartFillAnimation",
)
val sparkleAlphaAnimation = remember { Animatable(1f) }
val sparkleTranslationAnimation = remember { Animatable(1f) }
Expand All @@ -90,8 +91,8 @@ fun FavoriteButton(
val pathSize = getBounds().size
val matrix = Matrix()
matrix.postScale(
(size.width * 0.6f / pathSize.width) ,
(size.height * 0.6f / pathSize.height)
(size.width * 0.6f / pathSize.width),
(size.height * 0.6f / pathSize.height),
)
matrix.postTranslate(-(pathSize.width * 0.25f), -(pathSize.height * 0.25f))
this.asAndroidPath().transform(matrix)
Expand All @@ -102,7 +103,7 @@ fun FavoriteButton(
clipPath(heartPath) {
drawRect(
color = contentColor,
topLeft = Offset(x = 0f, animatedFillFraction * size.height)
topLeft = Offset(x = 0f, animatedFillFraction * size.height),
)
}
}
Expand All @@ -114,18 +115,18 @@ fun FavoriteButton(
val endRadius = radius * 0.7f
val startPos = Offset(
cos(theta) * startRadius,
sin(theta) * startRadius
sin(theta) * startRadius,
)
val endPos = Offset(
cos(theta) * endRadius,
sin(theta) * endRadius
sin(theta) * endRadius,
)
drawLine(
color = contentColor,
strokeWidth = 2f,
start = center + (startPos * sparkleTranslationAnimation.value),
end = center + (endPos * sparkleTranslationAnimation.value),
alpha = sparkleAlphaAnimation.value
alpha = sparkleAlphaAnimation.value,
)
}
}
Expand All @@ -144,7 +145,7 @@ fun FavoriteButtonPreview(
var isFavorite by remember { mutableStateOf(false) }
FavoriteButton(
isFavorite = isFavorite,
onToggle = { isFavorite = it }
onToggle = { isFavorite = it },
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ val EnStrings = PodcasterStrings(
import_corrupted_file_error = "File may be corrupted! process failed.",
import_unknown_error = "Sorry, Something went wrong",
favorites_label = "Favorites",
favorites_empty_list = "You have no favorite episodes. start adding some to your favorites and they will show up here"
favorites_empty_list = "You have no favorite episodes. start adding some to your favorites and they will show up here",
)

0 comments on commit 1cff27a

Please sign in to comment.