Created
July 22, 2016 08:01
-
-
Save hector6872/6bfaf5285b7fc53d55e517e10a4b02b4 to your computer and use it in GitHub Desktop.
TintedProgressBar
This file contains hidden or 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 class TintedProgressBar extends ProgressBar { | |
public TintedProgressBar(Context context) { | |
this(context, null); | |
} | |
public TintedProgressBar(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
public TintedProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
init(context); | |
} | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public TintedProgressBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { | |
super(context, attrs, defStyleAttr, defStyleRes); | |
init(context); | |
} | |
private void init(Context context) { | |
getIndeterminateDrawable().setColorFilter(ContextCompat.getColor(context, R.color.colorAccent), | |
PorterDuff.Mode.SRC_IN); | |
getProgressDrawable().setColorFilter(ContextCompat.getColor(context, R.color.colorAccent), PorterDuff.Mode.SRC_IN); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment