Methods in DefaultHeaderTransformation adjusted to make the ActionBar-PTR progress bar color styling work again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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