@@ -24,6 +24,7 @@ Licensed to the Apache Software Foundation (ASF) under one
24
24
import android .content .Context ;
25
25
import android .content .DialogInterface ;
26
26
import android .content .res .Configuration ;
27
+ import android .content .res .ColorStateList ;
27
28
import android .graphics .Color ;
28
29
import android .graphics .drawable .ColorDrawable ;
29
30
import android .os .Handler ;
@@ -366,6 +367,27 @@ public void onCancel(DialogInterface dialog) {
366
367
RelativeLayout .LayoutParams layoutParams = new RelativeLayout .LayoutParams (LayoutParams .WRAP_CONTENT , LayoutParams .WRAP_CONTENT );
367
368
layoutParams .addRule (RelativeLayout .CENTER_IN_PARENT , RelativeLayout .TRUE );
368
369
progressBar .setLayoutParams (layoutParams );
370
+
371
+ if (android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .LOLLIPOP ) {
372
+ String colorName = preferences .getString ("SplashScreenSpinnerColor" , null );
373
+ if (colorName != null ){
374
+ int [][] states = new int [][] {
375
+ new int [] { android .R .attr .state_enabled }, // enabled
376
+ new int [] {-android .R .attr .state_enabled }, // disabled
377
+ new int [] {-android .R .attr .state_checked }, // unchecked
378
+ new int [] { android .R .attr .state_pressed } // pressed
379
+ };
380
+ int progressBarColor = Color .parseColor (colorName );
381
+ int [] colors = new int [] {
382
+ progressBarColor ,
383
+ progressBarColor ,
384
+ progressBarColor ,
385
+ progressBarColor
386
+ };
387
+ ColorStateList colorStateList = new ColorStateList (states , colors );
388
+ progressBar .setIndeterminateTintList (colorStateList );
389
+ }
390
+ }
369
391
370
392
centeredLayout .addView (progressBar );
371
393
0 commit comments