A combination of the answer by @VallyN (who gave me the deciding help for this) and more recherche:
mProgressDialog = new ProgressDialog(MainActivity.this) {
@Override
protected void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ProgressBar bar = (ProgressBar) findViewById(android.R.id.progress);
bar.getProgressDrawable().setColorFilter(0xFF22C819 /*XXX FIXME getColor(R.color.colorAccent)*/, android.graphics.PorterDuff.Mode.SRC_IN);
bar.getIndeterminateDrawable().setColorFilter(0xFF22C819 /*XXX FIXME getColor(R.color.colorAccent)*/, android.graphics.PorterDuff.Mode.SRC_IN);
}
};
This sets the progress bar colour to the desired value independent of whether it’s rendered as indeterminate or 0‥100 (the app in question uses both, first indeterminate until it’s known how much data to download).
The only thing I haven’t yet been able to figure out is how to actually get one of the colours from colors.xml
to be used there, instead of the 0xAARRGGBB
notation. Edits welcome!