use of android.graphics.drawable.GradientDrawable in project Android-Bootstrap by Bearded-Hen.
the class BootstrapDrawableFactory method bootstrapCircleThumbnail.
static Drawable bootstrapCircleThumbnail(Context context, BootstrapBrand bootstrapBrand, @ColorInt int outerBorderWidth, @ColorInt int bg) {
GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.OVAL);
drawable.setColor(bg);
drawable.setStroke(outerBorderWidth, bootstrapBrand.defaultEdge(context));
return drawable;
}
use of android.graphics.drawable.GradientDrawable in project Android-Bootstrap by Bearded-Hen.
the class BootstrapDrawableFactory method bootstrapAlert.
static Drawable bootstrapAlert(Context context, BootstrapBrand bootstrapBrand) {
GradientDrawable disabledGd = new GradientDrawable();
int strokeWidth = context.getResources().getDimensionPixelSize(R.dimen.bootstrap_alert_stroke_width);
disabledGd.setColor(ColorUtils.increaseOpacityFromInt(context, bootstrapBrand.getColor(), 40));
disabledGd.setCornerRadius(6);
disabledGd.setStroke(strokeWidth, ColorUtils.increaseOpacityFromInt(context, bootstrapBrand.getColor(), 70));
return disabledGd;
}
use of android.graphics.drawable.GradientDrawable in project ActionBarSherlock by JakeWharton.
the class RoundedColourFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mView = new View(getActivity());
GradientDrawable background = (GradientDrawable) getResources().getDrawable(R.drawable.rounded_rect);
background.setColor(mColour);
mView.setBackgroundDrawable(background);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.FILL_PARENT, mWeight);
lp.setMargins(marginLeft, marginTop, marginRight, marginBottom);
mView.setLayoutParams(lp);
}
use of android.graphics.drawable.GradientDrawable in project FlycoDialog_Master by H07000223.
the class CornerUtils method cornerDrawable.
public static Drawable cornerDrawable(final int bgColor, float cornerradius) {
final GradientDrawable bg = new GradientDrawable();
bg.setCornerRadius(cornerradius);
bg.setColor(bgColor);
return bg;
}
use of android.graphics.drawable.GradientDrawable in project FireZenk-s-ProgressBar by FireZenk.
the class FZProgressBar method animation_start.
public synchronized void animation_start(final Mode mode) {
LIMITS_WIDTH = new Integer(limits.getWidth());
basic_one = new Runnable() {
private int i = 0;
@Override
public void run() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(i += ANIMATION_SPACING, BAR_SIZE_H);
bar.setLayoutParams(params);
if (i < LIMITS_WIDTH + 1)
animation.postDelayed(this, ANIMATION_DELAY);
else {
animation.removeCallbacks(this);
animation.postDelayed(basic_two, ANIMATION_DELAY);
}
}
};
basic_two = new Runnable() {
private int i = LIMITS_WIDTH;
private int margin = 0;
@Override
public void run() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(i -= ANIMATION_SPACING, BAR_SIZE_H);
params.leftMargin = margin += ANIMATION_SPACING;
bar.setLayoutParams(params);
if (i > -1)
animation.postDelayed(this, ANIMATION_DELAY);
else {
animation.removeCallbacks(this);
GradientDrawable gd = new GradientDrawable(Orientation.LEFT_RIGHT, COLORS);
gd.setCornerRadius(BAR_CORNER);
bar.setBackgroundDrawable(gd);
animation.postDelayed(basic_three, ANIMATION_DELAY * 10);
}
}
};
basic_three = new Runnable() {
private int i = 0;
private int margin = LIMITS_WIDTH - 1;
@Override
public void run() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(i += ANIMATION_SPACING, BAR_SIZE_H);
params.leftMargin = margin -= ANIMATION_SPACING;
bar.setLayoutParams(params);
if (i < LIMITS_WIDTH + 1)
animation.postDelayed(this, ANIMATION_DELAY);
else {
animation.removeCallbacks(this);
animation.postDelayed(basic_four, ANIMATION_DELAY);
}
}
};
basic_four = new Runnable() {
private int i = LIMITS_WIDTH;
@Override
public void run() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(i -= ANIMATION_SPACING, BAR_SIZE_H);
bar.setLayoutParams(params);
if (i > -1)
animation.postDelayed(this, ANIMATION_DELAY);
else {
animation.removeCallbacks(this);
switch(mode) {
case ONESHOT:
bar.setVisibility(View.INVISIBLE);
break;
case INDETERMINATE:
animation_start(mode);
break;
default:
break;
}
}
}
};
bar.setVisibility(View.VISIBLE);
GradientDrawable gd = new GradientDrawable(Orientation.RIGHT_LEFT, COLORS);
gd.setCornerRadius(BAR_CORNER);
bar.setBackgroundDrawable(gd);
if (mode == Mode.DETERMINATE) {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(bar.getWidth() + ANIMATION_SPACING, BAR_SIZE_H);
bar.setLayoutParams(params);
} else {
animation.post(basic_one);
}
}
Aggregations