Search in sources :

Example 16 with LightingColorFilter

use of android.graphics.LightingColorFilter in project Shuttle by timusus.

the class DrawableUtils method getBlackBitmap.

/**
     * Takes a drawable resource and turns it black
     *
     * @param baseDrawableResId the resource id of the drawable to theme
     * @return a themed {@link android.graphics.drawable.Drawable}
     */
public static Bitmap getBlackBitmap(Context context, int baseDrawableResId) {
    Drawable baseDrawable = context.getResources().getDrawable(baseDrawableResId).getConstantState().newDrawable();
    ColorFilter colorFilter = new LightingColorFilter(context.getResources().getColor(R.color.black), 0);
    baseDrawable.mutate().setColorFilter(colorFilter);
    Bitmap bitmap = Bitmap.createBitmap(baseDrawable.getIntrinsicWidth(), baseDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    baseDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    baseDrawable.draw(canvas);
    return bitmap;
}
Also used : Bitmap(android.graphics.Bitmap) ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) Canvas(android.graphics.Canvas) LayerDrawable(android.graphics.drawable.LayerDrawable) FilterableStateListDrawable(com.simplecity.amp_library.ui.views.FilterableStateListDrawable) Drawable(android.graphics.drawable.Drawable) LightingColorFilter(android.graphics.LightingColorFilter)

Example 17 with LightingColorFilter

use of android.graphics.LightingColorFilter in project Shuttle by timusus.

the class DrawableUtils method getColoredDrawable.

/**
     * Takes a drawable and applies the current theme highlight color to it
     *
     * @param baseDrawable the drawable to theme
     * @return a themed {@link android.graphics.drawable.Drawable}
     */
public static Drawable getColoredDrawable(Context context, Drawable baseDrawable) {
    if (baseDrawable == null) {
        return null;
    }
    baseDrawable = baseDrawable.getConstantState().newDrawable();
    ColorFilter highlightColorFilter = new LightingColorFilter(ColorUtils.getPrimaryColor(), 0);
    baseDrawable.mutate().setColorFilter(highlightColorFilter);
    return baseDrawable;
}
Also used : ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) LightingColorFilter(android.graphics.LightingColorFilter)

Example 18 with LightingColorFilter

use of android.graphics.LightingColorFilter in project Shuttle by timusus.

the class DrawableUtils method getColoredAccentFABDrawable.

/**
     * Takes a drawable and applies the current theme accent color to it
     *
     * @param baseDrawable the drawable to theme
     * @return a themed {@link android.graphics.drawable.Drawable}
     */
public static Drawable getColoredAccentFABDrawable(Context context, Drawable baseDrawable) {
    if (baseDrawable == null) {
        return null;
    }
    baseDrawable = baseDrawable.getConstantState().newDrawable();
    ColorFilter highlightColorFilter = new LightingColorFilter(ColorUtils.getFloatingActionIconColor(context), 0);
    baseDrawable.mutate().setColorFilter(highlightColorFilter);
    return baseDrawable;
}
Also used : ColorFilter(android.graphics.ColorFilter) LightingColorFilter(android.graphics.LightingColorFilter) LightingColorFilter(android.graphics.LightingColorFilter)

Example 19 with LightingColorFilter

use of android.graphics.LightingColorFilter in project Shuttle by timusus.

the class BreadcrumbView method createItemDivider.

/**
     * Creates a new path divider
     *
     * @return View divider icon
     */
private ImageView createItemDivider() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ImageView imageView = (ImageView) inflater.inflate(R.layout.breadcrumb_item_divider, this.mBreadcrumbBar, false);
    imageView.setColorFilter(new LightingColorFilter(mTextColor, 0));
    return imageView;
}
Also used : LayoutInflater(android.view.LayoutInflater) LightingColorFilter(android.graphics.LightingColorFilter) ImageView(android.widget.ImageView)

Example 20 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)

Aggregations

LightingColorFilter (android.graphics.LightingColorFilter)32 ColorFilter (android.graphics.ColorFilter)20 Drawable (android.graphics.drawable.Drawable)18 LayerDrawable (android.graphics.drawable.LayerDrawable)17 FilterableStateListDrawable (com.simplecity.amp_library.ui.views.FilterableStateListDrawable)16 ImageView (android.widget.ImageView)5 View (android.view.View)4 Canvas (android.graphics.Canvas)3 TextView (android.widget.TextView)3 Bitmap (android.graphics.Bitmap)2 SearchView (android.support.v7.widget.SearchView)2 LayoutInflater (android.view.LayoutInflater)2 AdapterView (android.widget.AdapterView)2 ListView (android.widget.ListView)2 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 Rect (android.graphics.Rect)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 NinePatchDrawable (android.graphics.drawable.NinePatchDrawable)1 RecyclerView (android.support.v7.widget.RecyclerView)1