pushpalroy / JetLime

A Kotlin Multiplatform library to display a timeline view. 🍋
https://jetlime.pushpalroy.com
MIT License
461 stars 24 forks source link

Add ability to set color for a custom icon and set circle background for it. #29

Closed Monabr closed 7 months ago

Monabr commented 7 months ago

Please make it possible.

image

pushpalroy commented 7 months ago

@Monabr Have you checked the custom function of the EventPointType?

It accepts a Painter, where you can pass the icon.

https://pushpalroy.github.io/JetLime/jetlime/com.pushpal.jetlime/-event-point-type/-companion/index.html#-2135258840%2FFunctions%2F-1761194290

pushpalroy commented 7 months ago

You can also find an example in the code: https://github.com/pushpalroy/JetLime/blob/58d485969983030206af38b15ecd68c27400ef46/app/src/main/java/com/pushpal/jetlime/ui/timelines/CustomizedVerticalTimeLine.kt#L79

Monabr commented 7 months ago

Painter cannot paint with color by itself. There is also no background for the icon. Painter only uses icons from resources, but cannot colorize them.

pushpalroy commented 7 months ago

Right. So you are looking to add a tint to your icon? And also a background in case your icon is transparent itself?

pushpalroy commented 7 months ago

Will be adding support for this in the next release.

SteliosPapamichail commented 7 months ago

@pushpalroy I could attempt to take this task on if you want :) I believe there are solutions using the painter or converting their image to a bitmap and then applying a tint but providing it directly would be much easier for end users.

pushpalroy commented 7 months ago

Hello @SteliosPapamichail,

Thank you for your interest in contributing to this project! I'm currently in the process of developing an enhanced method for integrating icons within the timeline, aimed at streamlining the existing implementation. If you have any ideas or suggestions on this front, I would be very keen to hear them. Your input could be incredibly valuable in refining this feature for our end users.

pushpalroy commented 7 months ago

The support for this has been added to the latest release 2.2.0.

You will now be able to pass an optional tint color for the custom icon. Also the pointColor will now act as the background for the custom icon painter. Also, there was an issue with the custom icon animation which was fixed.

Refer: https://pushpalroy.github.io/JetLime/jetlime/com.pushpal.jetlime/-event-point-type/-companion/index.html#246472581%2FFunctions%2F-1761194290

Thanks again for using this library and providing feedback!

custom