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

Custom color with ActionBar-PullToRefresh #38

Closed
pierrre opened this issue Jun 16, 2014 · 12 comments
Closed

Custom color with ActionBar-PullToRefresh #38

pierrre opened this issue Jun 16, 2014 · 12 comments

Comments

@pierrre
Copy link

pierrre commented Jun 16, 2014

ActionBar-PullToRefresh is deprecated (https://github.com/chrisbanes/ActionBar-PullToRefresh) but I have a problem with the progress bar color.

The custom color doesn't work since v0.9.9 (default blue). It was ok with v0.9.3.

ActionBar-PullToRefresh changes the color with this code:
https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/library/src/main/java/uk/co/senab/actionbarpulltorefresh/library/DefaultHeaderTransformer.java#L375-L384

The dependency for SmoothProgressBar has changed between v0.9.9 and v0.9.3:
chrisbanes/ActionBar-PullToRefresh@8312bcd

Can you help me?

@SebastianEngel
Copy link

I'm interested as well.

@pierrre
Copy link
Author

pierrre commented Jun 18, 2014

Do you have the same problem?

@SebastianEngel
Copy link

Yes

@castorflex
Copy link
Owner

This issue should be opened in the ActionBar-PullToRefresh project.
You can either use the xml styles or set the color in java.

See this sample for xml => https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/samples%2Fstock%2Fsrc%2Fmain%2Fres%2Fvalues%2Fstyles.xml

In java, try the setProgressBarColor method => https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/library/src/main/java/uk/co/senab/actionbarpulltorefresh/library/DefaultHeaderTransformer.java#L229

Hope this will help you both.

@SebastianEngel
Copy link

This is how I did it already before when all worked just fine. After just updating the dependency to ActionBar-PullToRefresh (0.9.3 -> 0.9.9) it doesn't work anymore. setProgressBarColor(int) seems to influence only the bar that appears when you pull down, but not the progress bar animation.

So ActionBar-PullToRefresh updated its dependency to SmoothProgressBar to 0.4 from 0.2 i think. Do you remember what could have changed in SPB in this version diff that could be the reason for that.
If nothing, then maybe we really have to look for the changes in ActionBar-PullToRefresh.

@SebastianEngel
Copy link

I was just digging into the commit history of ActionBar-PullToRefresh. Reverting the following diffs, made it working again (progress bar color is set):

chrisbanes/ActionBar-PullToRefresh@82154c7#diff-2e76f7a3838388ea1aa4137e97fdef01R232

chrisbanes/ActionBar-PullToRefresh@82154c7#diff-2e76f7a3838388ea1aa4137e97fdef01L369

@castorflex As those changes are merged in from your fork (see commit c443760 in APTR), could you please have a look at it and confirm if reverting those two diffs in ActionBar-PullToRefresh would be fine?

@castorflex
Copy link
Owner

I made this PR to let devs to use styles for SmoothProgressBars in AB-PTR. It was working well at this time. May be you can share some code?

@SebastianEngel
Copy link

Sorry for the late reply. Been at Google I/O and on vacations ;)

So these are the methods which I changed in DefaultHeaderTransformer:
https://gist.github.com/SebastianEngel/1e9b0d857e724aae1686

@SebastianEngel
Copy link

I was talking to Chris Banes recently about ActionBar-PullToRefresh and I decided to continue it with the community at the following fork: https://github.com/SebastianEngel/ActionBar-PullToRefresh/

I updated the projects dependency to smoothprogressbar to 0.5.+, applied my fix for this issue and deployed a snapshot. Please try it out and let me know what you think and if anything else should go into a release.

To use the snapshot add the snapshot repository to your list of repositories like this:
maven { url 'https://oss.sonatype.org/content/groups/public' }

Then define the dependency like this:
compile 'com.github.sebastianengel.actionbarpulltorefresh:library:1.0.0-SNAPSHOT@aar'

@castorflex
Copy link
Owner

Can you share a sample that doesn't work? I just tested the old commit and it seems perfect using ((DefaultHeaderTransformer)mPullToRefreshLayout.getHeaderTransformer()).setProgressBarColor(color);.

@SebastianEngel
Copy link

While building a showcase project I think I found the real problem. Before I was always only using the "ptrProgressBarColor" attribute. And this always worked fine. Since the last release of ActionBar-PullToRefresh this only tinted the bar that is shown while swiping down, not the SmoothProgressBar. The solution is to use "ptrSmoothProgressBarStyle" additionally and define "spb_color" in it. So all good, I will revert my commit. Thanks

@castorflex
Copy link
Owner

Yeah :)

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

No branches or pull requests

3 participants