Skip to content

Instantly share code, notes, and snippets.

@SebastianEngel
Created July 8, 2014 09:58
Show Gist options
  • Save SebastianEngel/1e9b0d857e724aae1686 to your computer and use it in GitHub Desktop.
Save SebastianEngel/1e9b0d857e724aae1686 to your computer and use it in GitHub Desktop.
Methods in DefaultHeaderTransformation adjusted to make the ActionBar-PTR progress bar color styling work again
public void setProgressBarColor(int color) {
if (color != mProgressDrawableColor) {
mProgressDrawableColor = color;
applyProgressBarSettings();
}
}
private void applyProgressBarSettings() {
if (mHeaderProgressBar != null) {
final int strokeWidth = mHeaderProgressBar.getResources()
.getDimensionPixelSize(R.dimen.ptr_progress_bar_stroke_width);
mHeaderProgressBar.setIndeterminateDrawable(
new SmoothProgressDrawable.Builder(mHeaderProgressBar.getContext())
.color(mProgressDrawableColor)
.strokeWidth(strokeWidth)
.build());
ShapeDrawable shape = new ShapeDrawable();
shape.setShape(new RectShape());
shape.getPaint().setColor(mProgressDrawableColor);
ClipDrawable clipDrawable = new ClipDrawable(shape, Gravity.CENTER, ClipDrawable.HORIZONTAL);
mHeaderProgressBar.setProgressDrawable(clipDrawable);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment