Skip to content

Commit

Permalink
fix(MapUi): deleted a unused var and made the header for the helper f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
Kemin committed Dec 16, 2024
1 parent 8d0328f commit 0f220cf
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions app/src/main/java/com/android/streetworkapp/ui/map/MapUi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ fun MapScreen(
// Handling user MVVM
val currentUser = userViewModel.currentUser.collectAsState().value

val userParkList = userViewModel.parks.collectAsState().value

if (currentUser != null) {
userViewModel.getParksByUid(currentUser.uid)
}
Expand Down Expand Up @@ -253,6 +251,14 @@ fun MarkerInfoWindowContent(park: Park) {
}
}

/**
* Returns a color that is a gradient between two colors based on a fraction.
*
* @param startColor The starting color of the gradient
* @param endColor The ending color of the gradient
* @param fraction A value between 0 and 1 indicating the position between the start and end colors
* @return A Color that represents the gradient at the given fraction
*/
fun gradientColor(startColor: Color, endColor: Color, fraction: Float): Color {
val startR = startColor.red
val startG = startColor.green
Expand All @@ -272,6 +278,12 @@ fun gradientColor(startColor: Color, endColor: Color, fraction: Float): Color {
return Color(r, g, b, a)
}

/**
* Converts a color to its hue value needed for BitMap
*
* @param color The color to be converted
* @return The hue value of the color, in degrees (0-360)
*/
fun colorToHue(color: Color): Float {
// Convert the Color to ARGB values (0-255)
val r = (color.red * 255).toInt()
Expand Down

0 comments on commit 0f220cf

Please sign in to comment.