-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add gradient center color in progressView #17
Conversation
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.
Thank you for your contribution!
if (colorGradientCenter == NO_COLOR) { | ||
GradientDrawable( | ||
gradientOrientation, | ||
intArrayOf(colorGradientStart, colorGradientEnd) | ||
).apply { | ||
applyRadius(this) | ||
} | ||
} else { | ||
GradientDrawable( | ||
gradientOrientation, | ||
intArrayOf(colorGradientStart, colorGradientCenter, colorGradientEnd) | ||
).apply { | ||
applyRadius(this) | ||
} | ||
} |
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.
How about this way?
GradientDrawable(
gradientOrientation,
intArrayOf(colorGradientStart, colorGradientCenter, colorGradientEnd)
.filter { it != NO_COLOR }.toIntArray()
).apply {
applyRadius(this)
}
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.
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.
Yes, exactly. So I added colorGradientCenter
on the int array and filtered if the color value is NO_COLOR
on my suggestion. 😄
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.
Oh! I understand what you said, right.
So I refactor it.
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.
Update at commit b7e5050
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.
LGTM! :)
Thanks @Ten-Wang for your contribution! |
Guidelines
I have a request need show 3 gradient color on progress
Types of changes
I add a gradient center.
Preparing a pull request for review
Ensure your change is properly formatted by running:
It is the sample