Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): ProgressBar tintColor/trackTintColor ignored as of 10.0.0 #12878

Merged
merged 2 commits into from
Jun 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}
}