Skip to content

Commit

Permalink
fix(android): progress bar tintColor/trackTintColor ignored as of 10.0.0
Browse files Browse the repository at this point in the history
Fixes TIMOB-28485
  • Loading branch information
jquick-axway authored and ewanharris committed Jun 15, 2021
1 parent 9624472 commit 5d362b7
Showing 1 changed file with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand All @@ -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)));
}
}

Expand Down Expand Up @@ -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);
}
}

0 comments on commit 5d362b7

Please sign in to comment.