You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
ColorDrawable: add a draw method
we don't use this directly, but it can be called by an app
This commit is contained in:
@@ -1,15 +1,25 @@
|
|||||||
package android.graphics.drawable;
|
package android.graphics.drawable;
|
||||||
|
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
|
||||||
public class ColorDrawable extends Drawable {
|
public class ColorDrawable extends Drawable {
|
||||||
|
|
||||||
private int color;
|
private int color;
|
||||||
|
private Paint paint;
|
||||||
|
|
||||||
public ColorDrawable(int color) {
|
public ColorDrawable(int color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
|
this.paint = new Paint();
|
||||||
|
this.paint.setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Canvas canvas) {
|
||||||
|
canvas.drawRect(getBounds(), paint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user