2010-12-28 04:11:10 -05:00
|
|
|
package com.fsck.k9.view;
|
|
|
|
|
|
|
|
import android.graphics.Path;
|
|
|
|
import android.graphics.drawable.ShapeDrawable;
|
|
|
|
import android.graphics.drawable.shapes.PathShape;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public class ColorChip {
|
2010-12-28 04:11:10 -05:00
|
|
|
private static final Path CHIP_PATH = new Path();
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
static {
|
2010-12-28 04:11:10 -05:00
|
|
|
|
2012-09-10 10:40:20 -04:00
|
|
|
CHIP_PATH.addCircle(8,8,8f,Path.Direction.CW);
|
2010-12-28 04:11:10 -05:00
|
|
|
CHIP_PATH.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private ShapeDrawable mDrawable;
|
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public ColorChip(int color) {
|
2011-01-06 11:55:08 -05:00
|
|
|
|
2012-09-10 10:40:20 -04:00
|
|
|
mDrawable = new ShapeDrawable(new PathShape(CHIP_PATH, 16f, 16f));
|
2011-01-06 11:55:08 -05:00
|
|
|
mDrawable.getPaint().setColor(color);
|
2010-12-28 04:11:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
}
|
2011-01-06 11:55:08 -05:00
|
|
|
|
2011-02-06 17:09:48 -05:00
|
|
|
public ShapeDrawable drawable() {
|
2010-12-28 04:11:10 -05:00
|
|
|
|
|
|
|
return mDrawable;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|