Search in sources :

Example 96 with GradientDrawable

use of android.graphics.drawable.GradientDrawable in project FBReaderJ by geometer.

the class SlideAnimationProvider method drawShadowVertical.

private void drawShadowVertical(Canvas canvas, int top, int bottom, int dX) {
    final GradientDrawable.Orientation orientation = dX > 0 ? GradientDrawable.Orientation.RIGHT_LEFT : GradientDrawable.Orientation.LEFT_RIGHT;
    final int[] colors = new int[] { 0x46000000, 0x00000000 };
    final GradientDrawable gradient = new GradientDrawable(orientation, colors);
    gradient.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    gradient.setDither(true);
    if (dX > 0) {
        gradient.setBounds(dX - 16, top, dX, bottom);
    } else {
        gradient.setBounds(myWidth + dX, top, myWidth + dX + 16, bottom);
    }
    gradient.draw(canvas);
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 97 with GradientDrawable

use of android.graphics.drawable.GradientDrawable in project FBReaderJ by geometer.

the class SlideAnimationProvider method drawShadowHorizontal.

private void drawShadowHorizontal(Canvas canvas, int left, int right, int dY) {
    final GradientDrawable.Orientation orientation = dY > 0 ? GradientDrawable.Orientation.BOTTOM_TOP : GradientDrawable.Orientation.TOP_BOTTOM;
    final int[] colors = new int[] { 0x46000000, 0x00000000 };
    final GradientDrawable gradient = new GradientDrawable(orientation, colors);
    gradient.setGradientType(GradientDrawable.LINEAR_GRADIENT);
    gradient.setDither(true);
    if (dY > 0) {
        gradient.setBounds(left, dY - 16, right, dY);
    } else {
        gradient.setBounds(left, myHeight + dY, right, myHeight + dY + 16);
    }
    gradient.draw(canvas);
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 98 with GradientDrawable

use of android.graphics.drawable.GradientDrawable in project superCleanMaster by joyoyao.

the class RoundCornerProgressBar method setProgressColor.

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public void setProgressColor(int color) {
    progressColor = color;
    int radius = this.radius - padding / 2;
    GradientDrawable gradient = new GradientDrawable();
    gradient.setShape(GradientDrawable.RECTANGLE);
    gradient.setColor(progressColor);
    gradient.setCornerRadii(new float[] { radius, radius, radius, radius, radius, radius, radius, radius });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        layoutProgress.setBackground(gradient);
    } else {
        layoutProgress.setBackgroundDrawable(gradient);
    }
    if (!isProgressBarCreated) {
        isProgressColorSetBeforeDraw = true;
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) GradientDrawable(android.graphics.drawable.GradientDrawable) SuppressLint(android.annotation.SuppressLint)

Example 99 with GradientDrawable

use of android.graphics.drawable.GradientDrawable in project superCleanMaster by joyoyao.

the class TextRoundCornerProgressBar method setBackgroundColor.

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public void setBackgroundColor(int color) {
    backgroundColor = color;
    GradientDrawable gradient = new GradientDrawable();
    gradient.setShape(GradientDrawable.RECTANGLE);
    gradient.setColor(backgroundColor);
    gradient.setCornerRadius(radius);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        layoutBackground.setBackgroundDrawable(gradient);
    } else {
        layoutBackground.setBackground(gradient);
    }
    if (!isProgressBarCreated) {
        isBackgroundColorSetBeforeDraw = true;
    }
}
Also used : GradientDrawable(android.graphics.drawable.GradientDrawable) SuppressLint(android.annotation.SuppressLint)

Example 100 with GradientDrawable

use of android.graphics.drawable.GradientDrawable in project superCleanMaster by joyoyao.

the class IconRoundCornerProgressBar method setProgressColor.

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public void setProgressColor(int color) {
    progressColor = color;
    int radius = this.radius - (padding / 2);
    GradientDrawable gradient = new GradientDrawable();
    gradient.setShape(GradientDrawable.RECTANGLE);
    gradient.setColor(progressColor);
    gradient.setCornerRadii(new float[] { 0, 0, radius, radius, radius, radius, 0, 0 });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        layoutProgress.setBackgroundDrawable(gradient);
    } else {
        layoutProgress.setBackground(gradient);
    }
    if (!isProgressBarCreated) {
        isProgressColorSetBeforeDraw = true;
    }
}
Also used : SuppressLint(android.annotation.SuppressLint) GradientDrawable(android.graphics.drawable.GradientDrawable) SuppressLint(android.annotation.SuppressLint)

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