use of android.graphics.drawable.GradientDrawable in project loading-dots by EyalBira.
the class LoadingDots method createDotView.
private View createDotView(Context context) {
ImageView dot = new ImageView(context);
dot.setImageResource(R.drawable.loading_dots_dot);
((GradientDrawable) dot.getDrawable()).setColor(mDotsColor);
return dot;
}
use of android.graphics.drawable.GradientDrawable in project BottomNavigation by Ashok-Varma.
the class BottomNavigationHelper method getBadgeDrawable.
static GradientDrawable getBadgeDrawable(BadgeItem badgeItem, Context context) {
GradientDrawable shape = new GradientDrawable();
shape.setShape(GradientDrawable.RECTANGLE);
shape.setCornerRadius(context.getResources().getDimensionPixelSize(R.dimen.badge_corner_radius));
shape.setColor(badgeItem.getBackgroundColor(context));
shape.setStroke(badgeItem.getBorderWidth(), badgeItem.getBorderColor(context));
return shape;
}
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