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);
}
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);
}
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;
}
}
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;
}
}
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;
}
}
Aggregations