-
Notifications
You must be signed in to change notification settings - Fork 31
Add ability to change lineBrush color on event level #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
lineBrushparameter toJetLimeEventStylethat falls back to global style when null - Updated event composables to use event-level
lineBrushwith 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.
jetlime/src/commonMain/kotlin/com/pushpal/jetlime/JetLimeExtendedEvent.kt
Show resolved
Hide resolved
There was a problem hiding this 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?, |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
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| val pointAnimation: EventPointAnimation?, | ||
| val pointStrokeWidth: Dp, | ||
| val pointStrokeColor: Color, | ||
| val lineBrush: Brush?, |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
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)| val pointAnimation: EventPointAnimation?, | ||
| val pointStrokeWidth: Dp, | ||
| val pointStrokeColor: Color, | ||
| val lineBrush: Brush?, |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
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.There was a problem hiding this 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.
jetlime/src/commonMain/kotlin/com/pushpal/jetlime/JetLimeEventStyle.kt
Outdated
Show resolved
Hide resolved
jetlime/src/commonMain/kotlin/com/pushpal/jetlime/JetLimeEventStyle.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
There was a problem hiding this 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.
| result = 31 * result + pointAnimation.hashCode() | ||
| result = 31 * result + pointStrokeWidth.hashCode() | ||
| result = 31 * result + pointStrokeColor.hashCode() | ||
| result = 31 * result + lineBrush.hashCode() |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
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.
| 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) |
| * @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 |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
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."
| * @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`. |
| pointAnimation: EventPointAnimation? = null, | ||
| pointStrokeWidth: Dp = PointStrokeWidth, | ||
| pointStrokeColor: Color = MaterialTheme.colorScheme.primary, | ||
| lineBrush: Brush? = null, |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
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.
This allows you to give the line different colors in different sections
One example is to highlight some events by coloring the line differently