Search in sources :

Example 1 with LightingColorFilter

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())));
}
Also used : LightingColorFilter(android.graphics.LightingColorFilter)

Example 2 with LightingColorFilter

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())));
}
Also used : LightingColorFilter(android.graphics.LightingColorFilter)

Example 3 with LightingColorFilter

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);
}
Also used : LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) LightingColorFilter(android.graphics.LightingColorFilter) CMHardwareManager(cyanogenmod.hardware.CMHardwareManager)

Example 4 with LightingColorFilter

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;
}
Also used : FilterableStateListDrawable(com.simplecity.amp_library.ui.views.FilterableStateListDrawable) ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) LayerDrawable(android.graphics.drawable.LayerDrawable) FilterableStateListDrawable(com.simplecity.amp_library.ui.views.FilterableStateListDrawable) Drawable(android.graphics.drawable.Drawable) LightingColorFilter(android.graphics.LightingColorFilter)

Example 5 with LightingColorFilter

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;
}
Also used : ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) LightingColorFilter(android.graphics.LightingColorFilter)

Aggregations

LightingColorFilter (android.graphics.LightingColorFilter)42 ColorFilter (android.graphics.ColorFilter)24 Drawable (android.graphics.drawable.Drawable)19 LayerDrawable (android.graphics.drawable.LayerDrawable)15 FilterableStateListDrawable (com.simplecity.amp_library.ui.views.FilterableStateListDrawable)14 View (android.view.View)9 ImageView (android.widget.ImageView)7 TextView (android.widget.TextView)7 Canvas (android.graphics.Canvas)5 Bitmap (android.graphics.Bitmap)4 Intent (android.content.Intent)3 AdapterView (android.widget.AdapterView)3 Animator (android.animation.Animator)2 AnimatorListener (android.animation.Animator.AnimatorListener)2 ArgbEvaluator (android.animation.ArgbEvaluator)2 ValueAnimator (android.animation.ValueAnimator)2 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)2 SharedPreferences (android.content.SharedPreferences)2 Paint (android.graphics.Paint)2 Handler (android.os.Handler)2