use of android.graphics.LightingColorFilter in project Carbon by ZieIony.
the class VectorDrawable method setTint.
@Override
public void setTint(int tintColor) {
tint = ColorStateList.valueOf(tintColor);
state.paint.setColorFilter(new LightingColorFilter(0, tint.getColorForState(getState(), tint.getDefaultColor())));
}
use of android.graphics.LightingColorFilter in project Carbon by ZieIony.
the class VectorDrawable method setTintList.
@Override
public void setTintList(ColorStateList tint) {
this.tint = tint;
state.paint.setColorFilter(new LightingColorFilter(0, tint.getColorForState(getState(), tint.getDefaultColor())));
}
use of android.graphics.LightingColorFilter in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibratorIntensity method onBindDialogView.
@Override
protected void onBindDialogView(final View view) {
super.onBindDialogView(view);
mSeekBar = (SeekBar) view.findViewById(com.android.internal.R.id.seekbar);
mValueText = (TextView) view.findViewById(R.id.value);
mWarningText = (TextView) view.findViewById(R.id.warning_text);
// Read the current value in case user wants to dismiss his changes
final CMHardwareManager hardware = CMHardwareManager.getInstance(getContext());
mOriginalValue = hardware.getVibratorIntensity();
mWarningValue = hardware.getVibratorWarningIntensity();
mMinValue = hardware.getVibratorMinIntensity();
mMaxValue = hardware.getVibratorMaxIntensity();
mDefaultValue = hardware.getVibratorDefaultIntensity();
final String message = getContext().getResources().getString(R.string.vibrator_intensity_dialog_warning, intensityToPercent(mMinValue, mMaxValue, mWarningValue));
mWarningText.setText(message);
if (mWarningValue <= 0) {
mWarningText.setVisibility(View.GONE);
}
final Drawable progressDrawable = mSeekBar.getProgressDrawable();
if (progressDrawable instanceof LayerDrawable) {
LayerDrawable ld = (LayerDrawable) progressDrawable;
mProgressDrawable = ld.findDrawableByLayerId(android.R.id.progress);
}
mProgressThumb = mSeekBar.getThumb();
mRedFilter = new LightingColorFilter(Color.BLACK, getContext().getResources().getColor(android.R.color.holo_red_light));
mSeekBar.setOnSeekBarChangeListener(this);
mSeekBar.setMax(mMaxValue - mMinValue);
mSeekBar.setProgress(mOriginalValue - mMinValue);
}
use of android.graphics.LightingColorFilter in project Shuttle by timusus.
the class DrawableUtils method getColoredStateListDrawable.
/**
* Returns a {@link FilterableStateListDrawable}, coloring the passed in
* drawable according to the theme and the passed in highlight color
*
* @param baseDrawableResId the drawable to use
* @return an {@link FilterableStateListDrawable}, coloring the passed in
* drawable according to the theme and the passed in highlight color
*/
public static Drawable getColoredStateListDrawable(Context context, int baseDrawableResId) {
Drawable baseDrawable = context.getResources().getDrawable(baseDrawableResId);
Drawable highlightDrawable = baseDrawable.getConstantState().newDrawable();
int baseColor;
if ((ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_DARK) || (ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_SOLID_DARK) || (ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_SOLID_BLACK)) {
baseColor = context.getResources().getColor(R.color.drawable_base_color_dark);
} else {
baseColor = context.getResources().getColor(R.color.drawable_base_color_light);
}
ColorFilter baseColorFilter = new LightingColorFilter(baseColor, 0);
ColorFilter highlightColorFilter = new LightingColorFilter(ColorUtils.getAccentColor(), 0);
FilterableStateListDrawable filterableStateListDrawable = new FilterableStateListDrawable();
filterableStateListDrawable.addState(new int[] { android.R.attr.state_pressed }, baseDrawable, highlightColorFilter);
filterableStateListDrawable.addState(StateSet.WILD_CARD, highlightDrawable, baseColorFilter);
return filterableStateListDrawable;
}
use of android.graphics.LightingColorFilter in project Shuttle by timusus.
the class DrawableUtils method themeLightOrDark.
/**
* Sets a drawable to the appropriate base color(light or dark) according to the theme
*
* @param drawable the drawable to theme
* @return a colored drawable
*/
public static Drawable themeLightOrDark(Context context, Drawable drawable) {
int baseColor;
if ((ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_DARK) || (ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_SOLID_DARK) || (ThemeUtils.getInstance().themeType == ThemeUtils.ThemeType.TYPE_SOLID_BLACK)) {
baseColor = context.getResources().getColor(R.color.drawable_base_color_dark);
} else {
baseColor = context.getResources().getColor(R.color.drawable_base_color_light);
}
ColorFilter baseColorFilter = new LightingColorFilter(baseColor, 0);
drawable.setColorFilter(baseColorFilter);
return drawable;
}
Aggregations