FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow customizing the position of ray start speed by agronick · Pull Request #248 · anastr/SpeedView · GitHub

Allow customizing the position of ray start speed - #248

Open
agronick wants to merge 2 commits into
anastr:masterfrom
agronick:ray_start_speed
Open

Allow customizing the position of ray start speed#248
agronick wants to merge 2 commits into
anastr:masterfrom
agronick:ray_start_speed

Conversation

agronick commented Jan 7, 2024

Copy link
Copy Markdown

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.

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

agronick Jan 7, 2024
edited
Loading

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is kind of hacky but I couldn't find a good way in the attributes API to allow null values.

}

for (i in getStartDegree()..getEndDegree() step degreeBetweenMark) {
val drawWith = if (!rangeCheck.contains(i)) {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

private var withEffects = true

private var degreeBetweenMark = 5
var rayStartSpeed: Float? = null

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The value the ray will be drawn from. This allows the ray to be drawn backwards. null preserves current functionality and draws from startSpeed.

agronick commented Jan 7, 2025

Copy link
Copy Markdown
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL