Java Code Examples for android.content.res.ColorStateList#equals()

The following examples show how to use android.content.res.ColorStateList#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseSlider.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the color of the halo.
 *
 * @see #getHaloTintList()
 * @attr ref com.google.android.material.R.styleable#Slider_haloColor
 */
public void setHaloTintList(@NonNull ColorStateList haloColor) {
  if (haloColor.equals(this.haloColor)) {
    return;
  }

  this.haloColor = haloColor;
  Drawable background = getBackground();
  if (!shouldDrawCompatHalo() && background instanceof RippleDrawable) {
    ((RippleDrawable) background).setColor(haloColor);
    return;
  }

  haloPaint.setColor(getColorForState(haloColor));
  haloPaint.setAlpha(HALO_ALPHA);
  invalidate();
}
 
Example 2
Source File: NodeTextView.java    From oversec with GNU General Public License v3.0 5 votes vote down vote up
private void setCompoundDrawableTintListChecked(ColorStateList ccc) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (!ccc.equals(getCompoundDrawableTintList())) {
            setCompoundDrawableTintList(ccc);
        }
    }
}
 
Example 3
Source File: BaseSlider.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the color of the ticks on the active portion of the track.
 *
 * @see #getTickActiveTintList()
 * @see #setTickTintList(ColorStateList)
 * @attr ref com.google.android.material.R.styleable#Slider_tickColorActive
 */
public void setTickActiveTintList(@NonNull ColorStateList tickColor) {
  if (tickColor.equals(tickColorActive)) {
    return;
  }
  tickColorActive = tickColor;
  activeTicksPaint.setColor(getColorForState(tickColorActive));
  invalidate();
}
 
Example 4
Source File: BaseSlider.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the color of the ticks on the inactive portion of the track.
 *
 * @see #getTickInactiveTintList()
 * @see #setTickTintList(ColorStateList)
 * @attr ref com.google.android.material.R.styleable#Slider_tickColorInactive
 */
public void setTickInactiveTintList(@NonNull ColorStateList tickColor) {
  if (tickColor.equals(tickColorInactive)) {
    return;
  }
  tickColorInactive = tickColor;
  inactiveTicksPaint.setColor(getColorForState(tickColorInactive));
  invalidate();
}
 
Example 5
Source File: BaseSlider.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the color of the active portion of the track.
 *
 * @see #getTrackActiveTintList()
 * @see #setTrackTintList(ColorStateList)
 * @attr ref com.google.android.material.R.styleable#Slider_trackColorActive
 */
public void setTrackActiveTintList(@NonNull ColorStateList trackColor) {
  if (trackColor.equals(trackColorActive)) {
    return;
  }
  trackColorActive = trackColor;
  activeTrackPaint.setColor(getColorForState(trackColorActive));
  invalidate();
}
 
Example 6
Source File: BaseSlider.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the color of the inactive portion of the track.
 *
 * @see #getTrackInactiveTintList()
 * @see #setTrackTintList(ColorStateList)
 * @attr ref com.google.android.material.R.styleable#Slider_trackColorInactive
 */
public void setTrackInactiveTintList(@NonNull ColorStateList trackColor) {
  if (trackColor.equals(trackColorInactive)) {
    return;
  }
  trackColorInactive = trackColor;
  inactiveTrackPaint.setColor(getColorForState(trackColorInactive));
  invalidate();
}