-
Notifications
You must be signed in to change notification settings - Fork 58
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
Adds an inner fill to the pointer and the ability to stroke inside the pointer #49
base: master
Are you sure you want to change the base?
Adds an inner fill to the pointer and the ability to stroke inside the pointer #49
Conversation
Updates Gradle Updates project to Java 11 Updates Support Library
Removes redundant label
Renames CircularSeekBarV2.kt to CircularSeekBar.kt
…fy the width. Deprecates less clear name `pointerStrokeWidth` with `pointerWidth`
…nto feature/03-adds-fill-to-pointer � Conflicts: � app/build.gradle � app/src/main/AndroidManifest.xml � build.gradle � circularSeekBar/build.gradle � circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt � gradle/wrapper/gradle-wrapper.properties
Hi, @jonathan-livly , Thanks for the PR. I understand that the changed name may sounds more intuitive. But unless there is a strong reason, we'd prefer to keep the existing APIs. The original design of this name for the "pointerStrokeWidth", is actually based on the entire circle bar perspective. And the name is also matched with other properties such as Regarding the new property you added, the Also if we are adding a new width to the pointer, please do consider the calculation of "pointerHaloPaint", which should display outside the boarder when |
Understandable, I reverted those changes
So the way that I designed the effect was that there is a another circle drawn over the pointer created by I'm not super happy with the names I came up with either, |
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.
Thanks, I see what you mean, added some inline comments for your changes, please check if it make sense.
circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt
Outdated
Show resolved
Hide resolved
circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt
Outdated
Show resolved
Hide resolved
circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt
Outdated
Show resolved
Hide resolved
pointerFillPaint.color = pointerFillColor | ||
pointerFillPaint.style = Paint.Style.FILL_AND_STROKE | ||
pointerFillPaint.strokeWidth = | ||
(pointerStrokeWidth - pointerFillInnerStrokeWidth).coerceAtLeast(0f) |
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.
If we use a concept like "pointerInnerStrokeWidth" or "pointerOverlayStrokeWidth", we could simply apply the pointerInnerStrokeWidth here, and let the developer to do the math, and give developer the flexibility.
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.
So this change I'd like to push back on.
I think that making the developer do the math adds more complexity without any added benefit. The user of the api would only be using the overlay to add a border inside of the pointer. When presented with a design you would be looking at the border width and doing the subtraction isn't difficult but really isn't needed. The use case was actually motivated directly by looking at an XD and knowing the size of the border.
By also giving them the ability to size the pointer overlay directly you introduce the ability to mistakenly use this property instead of the halo if it grows outside the pointer, which isn't possible when defining the border width directly. Currently if the border is increased too much the only downside is that it is no longer visible which will be immediately obvious as a mistake to the developer.
…Paint.Style.STROKE` that caused a visual bug when used in conjuction with `pointerAngle`
Updated per code review and added a comment |
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.
Thanks for the update, looks good overall, just some small questions.
circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt
Show resolved
Hide resolved
pointerOverlayPaint.color = pointerOverlayColor | ||
pointerOverlayPaint.style = Paint.Style.STROKE | ||
pointerOverlayPaint.strokeWidth = | ||
(pointerStrokeWidth - pointerOverlayBorderWidth).coerceAtLeast(0f) |
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.
If we use the concept of "overlay", than the border width of this overlay looks more like it's own width (circle diameter).
So at here we may directly set the pointerOverlayPaint.strokeWidth = pointerOverlayBorderWidth
circularSeekBar/src/main/java/me/tankery/lib/circularseekbar/CircularSeekBar.kt
Show resolved
Hide resolved
Hi! |
Updated. Sorry for being a little slow, our repository is quite a bit ahead so haven't had much time to go back, but we would like to not have to use our fork. Updated per the other code comments. I think we are just thinking about the Ideally the pointer would simply be a circle of a certain width with a border/stroke of a certain width, which is how I believe most designers would be implementing the design specs they are passing off. With that in mind I think its an unnecessary step to make them do the math to determine the size of overlay to get the border they want. With that in mind I think its a minor difference in how we are thinking so if you feel very strongly, its a change I can make but I think it makes the API harder to use, although only very slightly. |
@jonathan-livly I do appreciate the effort you put to improve this library. I understand your current approach would be more easy to apply from a design specs. And I agree that the current naming pattern for this library is not good enough for many cases. But for this specific PR, I would think that naming consistency has a higher priority. As you would see, we currently already have many properties with names like "**Width", such as So if we are adding a new property with the same naming pattern, but the Also if we use the concept of "overlay", we are talking about the white circle in your screenshot right? Then the "width" of this object should be something for the object itself, instead of the "gap width" between the while overlay and the blue pointer. So I would still recommend just setting the And after this PR. Feel free to rename properties to a better understanding pattern. But please do consider that this circular seek bar is built not only for "circle/point" pointers, but also for "arc/sector" pointers. |
Adds an inner fill and the ability to stroke inside the pointer as seen here
This PR is slightly more opinionated with the name changes since it was written as a drop in replacement into our code base since I was unsure if you were still accepting PRs at the time. Deprecated some of the names to make it easier for our team to reason about the code after the updates.
Let me know if you disagree with any of the changes.