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

Add gradient center color in progressView #17

Merged
merged 2 commits into from
Jul 2, 2021

Conversation

Ten-Wang
Copy link
Contributor

Guidelines

I have a request need show 3 gradient color on progress

Types of changes

I add a gradient center.

  • New feature (non-breaking change which adds functionality)

Preparing a pull request for review

Ensure your change is properly formatted by running:
Screenshot_1624613389
It is the sample

@Ten-Wang Ten-Wang requested a review from skydoves as a code owner June 25, 2021 09:30
Copy link
Owner

@skydoves skydoves left a 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!

Comment on lines 143 to 157
if (colorGradientCenter == NO_COLOR) {
GradientDrawable(
gradientOrientation,
intArrayOf(colorGradientStart, colorGradientEnd)
).apply {
applyRadius(this)
}
} else {
GradientDrawable(
gradientOrientation,
intArrayOf(colorGradientStart, colorGradientCenter, colorGradientEnd)
).apply {
applyRadius(this)
}
}
Copy link
Owner

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)
      }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I want to do like this picture (yellow progress bar), I want add color in gradient center .
image

Copy link
Owner

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. 😄

Copy link
Contributor Author

@Ten-Wang Ten-Wang Jul 2, 2021

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update at commit b7e5050

@skydoves skydoves self-requested a review July 2, 2021 09:48
Copy link
Owner

@skydoves skydoves left a comment

Choose a reason for hiding this comment

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

LGTM! :)

@skydoves
Copy link
Owner

skydoves commented Jul 2, 2021

Thanks @Ten-Wang for your contribution!

@skydoves skydoves merged commit 982805a into skydoves:master Jul 2, 2021
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