Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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