Search in sources :

Example 51 with GradientDrawable

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;
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 52 with GradientDrawable

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;
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint)

Example 53 with GradientDrawable

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);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) View(android.view.View) GradientDrawable(android.graphics.drawable.GradientDrawable) LinearLayout(android.widget.LinearLayout)

Example 54 with GradientDrawable

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;
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 55 with GradientDrawable

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);
    }
}
Also used : LinearLayout(android.widget.LinearLayout) GradientDrawable(android.graphics.drawable.GradientDrawable)

Aggregations

GradientDrawable (android.graphics.drawable.GradientDrawable)169 Paint (android.graphics.Paint)19 Drawable (android.graphics.drawable.Drawable)19 StateListDrawable (android.graphics.drawable.StateListDrawable)19 View (android.view.View)19 SuppressLint (android.annotation.SuppressLint)18 TextView (android.widget.TextView)18 LayerDrawable (android.graphics.drawable.LayerDrawable)16 ImageView (android.widget.ImageView)14 LinearLayout (android.widget.LinearLayout)12 TypedArray (android.content.res.TypedArray)8 FrameLayout (android.widget.FrameLayout)6 TimeAnimator (android.animation.TimeAnimator)5 Typeface (android.graphics.Typeface)5 LayoutInflater (android.view.LayoutInflater)5 ViewGroup (android.view.ViewGroup)5 Attributes (com.cengalabs.flatui.Attributes)5 Resources (android.content.res.Resources)4 TextPaint (android.text.TextPaint)4 Button (android.widget.Button)4