List of usage examples for android.widget CheckedTextView getCheckMarkDrawable
public Drawable getCheckMarkDrawable()
From source file:com.mobicage.rogerthat.util.ui.UIUtils.java
public static void setColors(int color, View... views) { if (Build.VERSION.SDK_INT >= 27) { return;/*from w ww. jav a 2s . c o m*/ } for (View view : views) { if (view instanceof CheckBox) { CheckBox checkbox = (CheckBox) view; CompoundButtonCompat.setButtonTintList(checkbox, ColorStateList.valueOf(color)); } else if (view instanceof FloatingActionButton) { //noinspection RedundantCast ((FloatingActionButton) view).setBackgroundTintList(ColorStateList.valueOf(color)); } else if (view instanceof Button || view instanceof ImageButton) { Drawable background = view.getBackground(); if (background != null) { background.setColorFilter(color, PorterDuff.Mode.SRC_IN); } } else if (view instanceof TextInputLayout) { UIUtils.colorTextInputLayout((TextInputLayout) view, color); // TODO: EditText's who are a child of TextInputLayout their line isn't colored correctly } else if (view instanceof EditText) { EditText editText = (EditText) view; editText.setHighlightColor(color); // When selecting text editText.setHintTextColor(color); // Text for the hint message // Line under the textfield Drawable background = editText.getBackground(); if (background != null) { DrawableCompat.setTint(background, color); editText.setBackground(background); } UIUtils.setCursorColor(editText, color); } else if (view instanceof CheckedTextView) { CheckedTextView ctv = (CheckedTextView) view; Drawable d = ctv.getCheckMarkDrawable(); d.setColorFilter(color, PorterDuff.Mode.SRC_IN); } else if (view instanceof TextView) { ((TextView) view).setLinkTextColor(color); } else if (view instanceof SeekBar) { SeekBar sb = (SeekBar) view; Drawable progress = sb.getProgressDrawable(); if (progress != null) { progress.setColorFilter(color, PorterDuff.Mode.SRC_IN); } Drawable thumb = sb.getThumb(); if (thumb != null) { thumb.setColorFilter(color, PorterDuff.Mode.SRC_IN); } } else if (view instanceof ProgressBar) { ((ProgressBar) view).getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN); } else { L.d("Not coloring view: " + view.toString()); } } }