59 lines
1.4 KiB
Java
59 lines
1.4 KiB
Java
|
package com.codigoparallevar.minicards.parts;
|
||
|
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Color;
|
||
|
import android.graphics.Paint;
|
||
|
|
||
|
public class Placeholder implements Part {
|
||
|
private final int _left;
|
||
|
private final int _top;
|
||
|
private final int _right;
|
||
|
private final int _bottom;
|
||
|
|
||
|
public Placeholder(int left, int top, int right, int bottom) {
|
||
|
_left = left;
|
||
|
_top = top;
|
||
|
_right = right;
|
||
|
_bottom = bottom;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getLeft() {
|
||
|
return _left;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getRight() {
|
||
|
return _right;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getTop() {
|
||
|
return _top;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public int getBottom() {
|
||
|
return _bottom;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void draw(Canvas canvas) {
|
||
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||
|
paint.setColor(Color.WHITE);
|
||
|
|
||
|
// Top
|
||
|
canvas.drawLine(_left,_top, _right, _top, paint);
|
||
|
// Bottom
|
||
|
canvas.drawLine(_left, _bottom, _right, _bottom, paint);
|
||
|
// Left
|
||
|
canvas.drawLine(_left, _top, _left, _bottom, paint);
|
||
|
// Right
|
||
|
canvas.drawLine(_right, _top, _right, _bottom, paint);
|
||
|
// Cross, top-left, bottom-right
|
||
|
canvas.drawLine(_left, _top, _right, _bottom, paint);
|
||
|
// Cross, top-right, bottom-left
|
||
|
canvas.drawLine(_right, _top, _left, _bottom, paint);
|
||
|
}
|
||
|
}
|