use of android.graphics.drawable.LayerDrawable in project nmid-headline by miao1007.
the class EditPage method genBackground.
private void genBackground() {
background = new ColorDrawable(DIM_COLOR);
if (backgroundView != null) {
try {
Bitmap bgBm = captureView(backgroundView, backgroundView.getWidth(), backgroundView.getHeight());
bgBm = blur(bgBm, 20, 8);
BitmapDrawable blurBm = new BitmapDrawable(activity.getResources(), bgBm);
background = new LayerDrawable(new Drawable[] { blurBm, background });
} catch (Throwable e) {
e.printStackTrace();
}
}
}
use of android.graphics.drawable.LayerDrawable in project Signal-Android by WhisperSystems.
the class ColorPreference method setColorViewValue.
private static void setColorViewValue(View view, int color, boolean selected) {
if (view instanceof ImageView) {
ImageView imageView = (ImageView) view;
Resources res = imageView.getContext().getResources();
Drawable currentDrawable = imageView.getDrawable();
GradientDrawable colorChoiceDrawable;
if (currentDrawable instanceof GradientDrawable) {
// Reuse drawable
colorChoiceDrawable = (GradientDrawable) currentDrawable;
} else {
colorChoiceDrawable = new GradientDrawable();
colorChoiceDrawable.setShape(GradientDrawable.OVAL);
}
// Set stroke to dark version of color
// int darkenedColor = Color.rgb(
// Color.red(color) * 192 / 256,
// Color.green(color) * 192 / 256,
// Color.blue(color) * 192 / 256);
colorChoiceDrawable.setColor(color);
// colorChoiceDrawable.setStroke((int) TypedValue.applyDimension(
// TypedValue.COMPLEX_UNIT_DIP, 2, res.getDisplayMetrics()), darkenedColor);
Drawable drawable = colorChoiceDrawable;
if (selected) {
BitmapDrawable checkmark = (BitmapDrawable) res.getDrawable(R.drawable.check);
checkmark.setGravity(Gravity.CENTER);
drawable = new LayerDrawable(new Drawable[] { colorChoiceDrawable, checkmark });
}
imageView.setImageDrawable(drawable);
} else if (view instanceof TextView) {
((TextView) view).setTextColor(color);
}
}
use of android.graphics.drawable.LayerDrawable in project remusic by aa112901.
the class AppCompatProgressBarHelper method getTintTarget.
@Nullable
private Drawable getTintTarget(int layerId, boolean shouldFallback) {
Drawable layer = null;
final Drawable d = ((ProgressBar) mView).getProgressDrawable();
if (d != null) {
((ProgressBar) mView).setProgressDrawable(d.mutate());
if (d instanceof LayerDrawable) {
layer = ((LayerDrawable) d).findDrawableByLayerId(layerId);
}
if (shouldFallback && layer == null) {
layer = d;
}
}
return layer;
}
use of android.graphics.drawable.LayerDrawable in project android_frameworks_base by ParanoidAndroid.
the class TabletStatusBar method workAroundBadLayerDrawableOpacity.
@Override
protected void workAroundBadLayerDrawableOpacity(View v) {
Drawable bgd = v.getBackground();
if (!(bgd instanceof LayerDrawable))
return;
LayerDrawable d = (LayerDrawable) bgd;
v.setBackground(null);
d.setOpacity(PixelFormat.TRANSLUCENT);
v.setBackground(d);
}
use of android.graphics.drawable.LayerDrawable in project android_frameworks_base by ResurrectionRemix.
the class ToggleButton method updateReferenceToIndicatorDrawable.
private void updateReferenceToIndicatorDrawable(Drawable backgroundDrawable) {
if (backgroundDrawable instanceof LayerDrawable) {
LayerDrawable layerDrawable = (LayerDrawable) backgroundDrawable;
mIndicatorDrawable = layerDrawable.findDrawableByLayerId(com.android.internal.R.id.toggle);
} else {
mIndicatorDrawable = null;
}
}
Aggregations