use of android.graphics.drawable.ShapeDrawable in project material-hijri-calendarview by eltohamy.
the class DayView method generateCircleDrawable.
private static Drawable generateCircleDrawable(final int color) {
ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
drawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width, int height) {
return new LinearGradient(0, 0, 0, 0, color, color, Shader.TileMode.REPEAT);
}
});
return drawable;
}
use of android.graphics.drawable.ShapeDrawable in project wigle-wifi-wardriving by wiglenet.
the class DefaultClusterRenderer method makeClusterBackground.
private LayerDrawable makeClusterBackground() {
mColoredCircleBackground = new ShapeDrawable(new OvalShape());
ShapeDrawable outline = new ShapeDrawable(new OvalShape());
// Transparent white.
outline.getPaint().setColor(0x80ffffff);
LayerDrawable background = new LayerDrawable(new Drawable[] { outline, mColoredCircleBackground });
int strokeWidth = (int) (mDensity * 3);
background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth);
return background;
}
use of android.graphics.drawable.ShapeDrawable in project android by testpress.
the class ExploreSpinnerAdapter method setUpNormalDropdownView.
private void setUpNormalDropdownView(int position, TextView textView) {
textView.setText(getTitle(position));
ShapeDrawable colorDrawable = (ShapeDrawable) textView.getCompoundDrawables()[2];
int color = getColor(position);
if (color == 0) {
if (colorDrawable != null) {
textView.setCompoundDrawables(null, null, null, null);
}
} else {
if (mDotSize == 0) {
mDotSize = resources.getDimensionPixelSize(R.dimen.tag_color_dot_size);
}
if (colorDrawable == null) {
colorDrawable = new ShapeDrawable(new OvalShape());
colorDrawable.setIntrinsicWidth(mDotSize);
colorDrawable.setIntrinsicHeight(mDotSize);
colorDrawable.getPaint().setStyle(Paint.Style.FILL);
textView.setCompoundDrawablesWithIntrinsicBounds(null, null, colorDrawable, null);
}
colorDrawable.getPaint().setColor(color);
}
}
use of android.graphics.drawable.ShapeDrawable in project Osmand by osmandapp.
the class WaypointDialogHelper method getCustomDividers.
private List<Drawable> getCustomDividers(Context ctx, List<Object> points, boolean nightMode) {
int color = ContextCompat.getColor(ctx, nightMode ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light);
Shape fullDividerShape = new ListDividerShape(color, 0);
Shape halfDividerShape = new ListDividerShape(color, AndroidUtils.dpToPx(ctx, 56f));
Shape headerDividerShape = new ListDividerShape(color, AndroidUtils.dpToPx(ctx, 16f));
final ShapeDrawable fullDivider = new ShapeDrawable(fullDividerShape);
final ShapeDrawable halfDivider = new ShapeDrawable(halfDividerShape);
final ShapeDrawable headerDivider = new ShapeDrawable(headerDividerShape);
int divHeight = AndroidUtils.dpToPx(ctx, 1f);
fullDivider.setIntrinsicHeight(divHeight);
halfDivider.setIntrinsicHeight(divHeight);
headerDivider.setIntrinsicHeight(divHeight);
List<Drawable> res = new ArrayList<>();
for (int i = 0; i < points.size(); i++) {
Object obj = points.get(i);
Object objNext = i + 1 < points.size() ? points.get(i + 1) : null;
if (objNext == null) {
break;
}
boolean labelView = (obj instanceof Integer);
boolean bottomDividerViewNext = (objNext instanceof Boolean) && !((Boolean) objNext);
boolean locationPoint = (obj instanceof LocationPointWrapper);
boolean locationPointNext = (objNext instanceof LocationPointWrapper);
Drawable d = null;
if (locationPointNext) {
d = locationPoint ? halfDivider : fullDivider;
} else if (objNext instanceof RadiusItem && labelView) {
d = headerDivider;
} else if (locationPoint && !bottomDividerViewNext) {
d = fullDivider;
}
res.add(d);
}
return res;
}
use of android.graphics.drawable.ShapeDrawable in project android_packages_apps_OmniGears by omnirom.
the class ColorSelectPreference method createRectShape.
private static ShapeDrawable createRectShape(int width, int height, int color) {
ShapeDrawable shape = new ShapeDrawable(new RectShape());
shape.setIntrinsicHeight(height);
shape.setIntrinsicWidth(width);
shape.getPaint().setColor(color);
return shape;
}
Aggregations