Allow customizing the position of ray start speed#248
Open
agronick wants to merge 2 commits intoanastr:masterfrom
Open
Allow customizing the position of ray start speed#248agronick wants to merge 2 commits intoanastr:masterfrom
agronick wants to merge 2 commits intoanastr:masterfrom
Conversation
agronick
commented
Jan 7, 2024
| withEffects = a.getBoolean(R.styleable.RaySpeedometer_sv_withEffects, withEffects) | ||
| rayStartSpeed = | ||
| a.getFloat(R.styleable.RaySpeedometer_sv_rayStartSpeed, Float.NEGATIVE_INFINITY).let { | ||
| if (it == Float.NEGATIVE_INFINITY) null else it |
Author
There was a problem hiding this comment.
This is kind of hacky but I couldn't find a good way in the attributes API to allow null values.
agronick
commented
Jan 7, 2024
| } | ||
|
|
||
| for (i in getStartDegree()..getEndDegree() step degreeBetweenMark) { | ||
| val drawWith = if (!rangeCheck.contains(i)) { |
Author
There was a problem hiding this comment.
This part I tried to clean up. These lines seemed to be present in both parts of the conditional
canvas.drawPath(markPath, rayMarkPaint)
canvas.rotate(degreeBetweenMark.toFloat(), size * .5f, size * .5f)
i += degreeBetweenMark
The only thing that really looked to be changing was the paint.
agronick
commented
Jan 10, 2024
| private var withEffects = true | ||
|
|
||
| private var degreeBetweenMark = 5 | ||
| var rayStartSpeed: Float? = null |
Author
There was a problem hiding this comment.
The value the ray will be drawn from. This allows the ray to be drawn backwards. null preserves current functionality and draws from startSpeed.
Author
|
@anastr have you had a chance to look at this? It has been a year. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of my users had commented that they didn't like that the ray speedometer drew from the beginning of the gauge instead of at 0. This looked strange especially when it was an arbitrary negative number. I added an option to set a start value. I left the current functionality but you can now set
app:sv_rayStartSpeed="0"to draw from 0 and it will draw backwards if the value is less than 0.You can see how it looks when starting from 0 instead of the minimum value.
