Skip to content

Commit

Permalink
颜色添加0判断
Browse files Browse the repository at this point in the history
  • Loading branch information
pichsy committed Feb 26, 2021
1 parent 0583f1e commit d44661c
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1060,17 +1060,23 @@ public void setBackgroundColor(int offColor, int onColor) {
}

public void setThumbColor(int thumbColor, int thumbCheckedColor, int thumbPressedColor, int thumbUnEnabledColor) {
this.thumbColor = thumbColor;
this.thumbPressedColor = thumbPressedColor;
this.thumbCheckedColor = thumbCheckedColor;
this.thumbUnEnabledColor = thumbUnEnabledColor;
thumbColorStateList = new XGradientHelper.ColorStateListBuilder()
.setUnSateColor(thumbColor)
if (thumbColor > 0) {
this.thumbColor = thumbColor;
}
if (thumbPressedColor > 0) {
this.thumbPressedColor = thumbPressedColor;
}
if (thumbCheckedColor > 0) {
this.thumbCheckedColor = thumbCheckedColor;
}
if (thumbUnEnabledColor > 0) {
this.thumbUnEnabledColor = thumbUnEnabledColor;
}
thumbColorStateList = new XGradientHelper.ColorStateListBuilder().setUnSateColor(thumbColor)
.addPressedColor(thumbPressedColor)
.addCheckedColor(thumbCheckedColor)
.addUnEnabledColor(thumbUnEnabledColor)
.build();
// mCurrThumbColor = thumbColorStateList.getDefaultColor();
invalidate();
}
}

0 comments on commit d44661c

Please sign in to comment.