From 5d362b768fc4ee758aded9e99ac32a805853cfdb Mon Sep 17 00:00:00 2001 From: Joshua Quick Date: Wed, 9 Jun 2021 17:46:44 -0700 Subject: [PATCH] fix(android): progress bar tintColor/trackTintColor ignored as of 10.0.0 Fixes TIMOB-28485 --- .../titanium/ui/widget/TiUIProgressBar.java | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIProgressBar.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIProgressBar.java index daeb9c17878..883b7c24c8f 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIProgressBar.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIProgressBar.java @@ -6,7 +6,6 @@ */ package ti.modules.titanium.ui.widget; -import android.content.res.ColorStateList; import android.view.Gravity; import android.widget.LinearLayout; import com.google.android.material.progressindicator.LinearProgressIndicator; @@ -66,10 +65,10 @@ public void processProperties(KrollDict d) handleSetMessageColor(color); } if (d.containsKey(TiC.PROPERTY_TINT_COLOR)) { - handleSetTintColor(TiConvert.toColor(d, TiC.PROPERTY_TINT_COLOR)); + this.progress.setIndicatorColor(TiConvert.toColor(d, TiC.PROPERTY_TINT_COLOR)); } if (d.containsKey(TiC.PROPERTY_TRACK_TINT_COLOR)) { - handleSetTrackTintColor(TiConvert.toColor(d, TiC.PROPERTY_TRACK_TINT_COLOR)); + this.progress.setTrackColor(TiConvert.toColor(d, TiC.PROPERTY_TRACK_TINT_COLOR)); } updateProgress(); } @@ -90,11 +89,9 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP final int color = TiConvert.toColor(TiConvert.toString(newValue)); handleSetMessageColor(color); } else if (key.equals(TiC.PROPERTY_TINT_COLOR)) { - int tintColor = TiConvert.toColor(TiConvert.toString(newValue)); - handleSetTintColor(tintColor); + this.progress.setIndicatorColor(TiConvert.toColor(TiConvert.toString(newValue))); } else if (key.equals(TiC.PROPERTY_TRACK_TINT_COLOR)) { - int trackTintColor = TiConvert.toColor(TiConvert.toString(newValue)); - handleSetTrackTintColor(trackTintColor); + this.progress.setTrackColor(TiConvert.toColor(TiConvert.toString(newValue))); } } @@ -149,16 +146,4 @@ protected void handleSetMessageColor(int color) { label.setTextColor(color); } - - protected void handleSetTintColor(int color) - { - ColorStateList singleColorStateList = ColorStateList.valueOf(color); - progress.setProgressTintList(singleColorStateList); - } - - protected void handleSetTrackTintColor(int color) - { - ColorStateList singleColorStateList = ColorStateList.valueOf(color); - progress.setProgressBackgroundTintList(singleColorStateList); - } }