Skip to content
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

Draws Labels inside the circles #8

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

jibbo
Copy link

@jibbo jibbo commented Nov 12, 2019

This PR enables to write the labels inside the circles instead of below.
This is especially useful when a user needs to draw different numbers, such as the example below:

Before:
Screenshot 2019-11-12 at 11 19 57

After:
Screenshot 2019-11-12 at 11 13 54

Note that this can be used to write inside the circles labels like "A", "B" or "C", thus giving a bit more flexibility to the library.

Let me know if you don't like something and I'll fix it or if something isn't clear.

Thanks a lot.

@params-ing
Copy link
Owner

params-ing commented Nov 12, 2019 via email

/**
* A boolean which decides if labels should be written inside
*/

var drawLabels: Boolean by OnValidateProp(false){
Copy link
Owner

@params-ing params-ing Nov 17, 2019

Choose a reason for hiding this comment

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

Actually I see you are reusing the old variable drawLabels for new functionality.
This might make sense, but on a newer version people already using the library would get unexpected views & might be confused.
Can you instead create a new variable drawStatusInsideCircle & keep the old one as it is

textPaintLabel.getTextBounds(text, 0, text.length, measuringRect)
statusItemText = LabelItemText(text, textPaintLabel, circleItem.center.x, circleItem.center.y - measuringRect.exactCenterY())
drawLabels -> {
val text: String = statusData[pos].text
Copy link
Owner

Choose a reason for hiding this comment

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

statusData[pos].text, this might crash, can you please place a safety check

@@ -18,7 +18,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:stepCount="5"
app:currentCount="4"
app:drawLabels="true"
app:drawLabels="false"
app:drawCount="true"
Copy link
Owner

Choose a reason for hiding this comment

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

Also can you check if status data is longer like
"ABCD" does it exceed the circle or looks okay.
Actually it does, so we might have to handle it
Screen Shot 2019-11-17 at 5 29 01 PM

@jibbo
Copy link
Author

jibbo commented Nov 18, 2019

Thanks for the review, I'll try to do make these changes next weekend.

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.

2 participants