Search in sources :

Example 56 with GradientDrawable

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

Example 57 with GradientDrawable

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

Example 58 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 59 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 60 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)163 Paint (android.graphics.Paint)19 Drawable (android.graphics.drawable.Drawable)19 StateListDrawable (android.graphics.drawable.StateListDrawable)19 SuppressLint (android.annotation.SuppressLint)18 View (android.view.View)18 TextView (android.widget.TextView)18 LayerDrawable (android.graphics.drawable.LayerDrawable)15 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