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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations