Skip to content

Conversation

@DRSchlaubi
Copy link

This allows you to give the line different colors in different sections

One example is to highlight some events by coloring the line differently

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the ability to customize the connecting line brush color at the individual event level, enabling different line colors for different sections of the timeline. This provides more granular styling control beyond the global JetLimeStyle.lineBrush setting.

Key Changes:

  • Added optional lineBrush parameter to JetLimeEventStyle that falls back to global style when null
  • Updated event composables to use event-level lineBrush with proper fallback logic
  • Extended API documentation to include the new parameter

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
JetLimeEventStyle.kt Added lineBrush: Brush? property to the style class and imported Brush type
JetLimeEventDefaults.kt Added lineBrush parameter to eventStyle() factory function with documentation
JetLimeEvent.kt Computed event-level lineBrush with fallback and updated all drawLine calls in both vertical and horizontal events
JetLimeExtendedEvent.kt Computed event-level lineBrush with fallback (but implementation is incomplete - see bug comment)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

val pointAnimation: EventPointAnimation?,
val pointStrokeWidth: Dp,
val pointStrokeColor: Color,
val lineBrush: Brush?,
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lineBrush property is not included in the equals() method comparison. This could lead to two JetLimeEventStyle instances being considered equal even when they have different lineBrush values, causing unexpected behavior in collections or when checking equality.

Add the following check before the final return statement:

if (lineBrush != other.lineBrush) return false

Copilot uses AI. Check for mistakes.
val pointAnimation: EventPointAnimation?,
val pointStrokeWidth: Dp,
val pointStrokeColor: Color,
val lineBrush: Brush?,
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lineBrush property is not included in the hashCode() calculation. This breaks the general contract between equals() and hashCode(): objects that are equal must have the same hash code. This could cause issues when using JetLimeEventStyle instances in hash-based collections like HashMap or HashSet.

Add the following line before the return statement in hashCode():

result = 31 * result + (lineBrush?.hashCode() ?: 0)

Copilot uses AI. Check for mistakes.
val pointAnimation: EventPointAnimation?,
val pointStrokeWidth: Dp,
val pointStrokeColor: Color,
val lineBrush: Brush?,
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lineBrush property is missing from the class-level KDoc documentation. The documentation comment at the top of the class (lines 33-45) should include a @property lineBrush entry to describe this new property.

Add the following to the class KDoc:

* @property lineBrush The brush used for drawing the connecting line to the next event, or null to use the default from JetLimeStyle.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 123 to +126
result = 31 * result + pointAnimation.hashCode()
result = 31 * result + pointStrokeWidth.hashCode()
result = 31 * result + pointStrokeColor.hashCode()
result = 31 * result + lineBrush.hashCode()
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential NullPointerException: lineBrush is nullable (Brush?) but .hashCode() is called without null-safety check. This should be lineBrush?.hashCode() ?: 0 to safely handle null values.

Note: The same issue exists with pointAnimation on line 123, which should also be fixed.

Suggested change
result = 31 * result + pointAnimation.hashCode()
result = 31 * result + pointStrokeWidth.hashCode()
result = 31 * result + pointStrokeColor.hashCode()
result = 31 * result + lineBrush.hashCode()
result = 31 * result + (pointAnimation?.hashCode() ?: 0)
result = 31 * result + pointStrokeWidth.hashCode()
result = 31 * result + pointStrokeColor.hashCode()
result = 31 * result + (lineBrush?.hashCode() ?: 0)

Copilot uses AI. Check for mistakes.
* @param pointAnimation The animation for the point, if any.
* @param pointStrokeWidth The stroke width of the point. Defaults to [PointStrokeWidth].
* @param pointStrokeColor The stroke color of the point. Defaults to the primary color from MaterialTheme's color scheme.
* @param lineBrush the [Brush] for drawing the line to the next event
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation for lineBrush parameter should clarify that passing null (the default) will use the lineBrush from the JetLimeStyle. Consider updating to: "The [Brush] for drawing the line to the next event. If null (default), uses the lineBrush from JetLimeStyle."

Suggested change
* @param lineBrush the [Brush] for drawing the line to the next event
* @param lineBrush The [Brush] for drawing the line to the next event. If null (default), uses the `lineBrush` from `JetLimeStyle`.

Copilot uses AI. Check for mistakes.
pointAnimation: EventPointAnimation? = null,
pointStrokeWidth: Dp = PointStrokeWidth,
pointStrokeColor: Color = MaterialTheme.colorScheme.primary,
lineBrush: Brush? = null,
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new lineBrush property lacks test coverage. Consider adding a Compose UI test in JetLimeColumnTest.kt or JetLimeRowTest.kt that verifies the custom lineBrush is applied correctly to events. This would ensure the feature works as intended and prevent regressions.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant