下面列出了android.graphics.drawable.ShapeDrawable.ShaderFactory#android.graphics.Paint.Style 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void init()
{
mBoxSetup = false;
mArcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mArcPaint.setStyle(Style.FILL);
mArcPaint.setColor(Color.rgb(192, 255, 140));
mInnerCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mInnerCirclePaint.setStyle(Style.FILL);
mInnerCirclePaint.setColor(Color.WHITE);
mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTextPaint.setStyle(Style.STROKE);
mTextPaint.setTextAlign(Align.CENTER);
mTextPaint.setColor(Color.BLACK);
mTextPaint.setTextSize(Utils.convertDpToPixel(getResources(), 24f));
mDrawAnimator = ObjectAnimator.ofFloat(this, "phase", mPhase, 1.0f).setDuration(3000);
mDrawAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
mGestureDetector = new GestureDetector(getContext(), this);
}
public LinearGradientFillBitmapTextureAtlasSourceDecorator(final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final IBitmapTextureAtlasSourceDecoratorShape pBitmapTextureAtlasSourceDecoratorShape, final int[] pColors, final float[] pPositions, final LinearGradientDirection pLinearGradientDirection, final TextureAtlasSourceDecoratorOptions pTextureAtlasSourceDecoratorOptions) {
super(pBitmapTextureAtlasSource, pBitmapTextureAtlasSourceDecoratorShape, pTextureAtlasSourceDecoratorOptions);
this.mColors = pColors;
this.mPositions = pPositions;
this.mLinearGradientDirection = pLinearGradientDirection;
this.mPaint.setStyle(Style.FILL);
final int right = pBitmapTextureAtlasSource.getTextureWidth() - 1;
final int bottom = pBitmapTextureAtlasSource.getTextureHeight() - 1;
final float fromX = pLinearGradientDirection.getFromX(right);
final float fromY = pLinearGradientDirection.getFromY(bottom);
final float toX = pLinearGradientDirection.getToX(right);
final float toY = pLinearGradientDirection.getToY(bottom);
this.mPaint.setShader(new LinearGradient(fromX, fromY, toX, toY, pColors, pPositions, TileMode.CLAMP));
}
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans) {
super(viewPortHandler);
this.mTrans = trans;
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
public void drawTextCenter(Canvas canvas, String text, int color, int size,
int min) {
Paint innerPaint = new Paint();
innerPaint.setAntiAlias(true);
innerPaint.setStyle(Style.FILL);
innerPaint.setColor(color);
innerPaint.setTextSize(size);
// int cHeight = canvas.getClipBounds().height();
// int cWidth = canvas.getClipBounds().width();
Rect r = new Rect();
// setTextMatchParent(text,innerPaint,width-strokeWidth*2-25);
innerPaint.setTextAlign(Paint.Align.LEFT);
innerPaint.getTextBounds(text, 0, text.length(), r);
float x = min / 2f - r.width() / 2f - r.left;
float y = min / 2f + r.height() / 2f - r.bottom;
canvas.drawText(text, x, y, innerPaint);
}
private void init(AttributeSet attrs) {
int progressColor = Color.parseColor("#FF4081");
int backgroundColor = Color.parseColor("#BBBBBB");
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.doubleWaySeekBar);
this.mPointerDrawable = a.getDrawable(R.styleable.doubleWaySeekBar_pointerBackground);
this.mHalfDrawableWidth = this.mPointerDrawable.getIntrinsicWidth() / 2;
progressColor = a.getColor(R.styleable.doubleWaySeekBar_progressColor, Color.parseColor("#FF4081"));
backgroundColor = a.getColor(R.styleable.doubleWaySeekBar_backgroundColor, Color.parseColor("#BBBBBB"));
a.recycle();
}
this.mNormalPaint = new Paint();
this.mNormalPaint.setColor(backgroundColor);
this.mPointerPaint = new Paint();
this.mPointerPaint.setColor(SupportMenu.CATEGORY_MASK);
this.mProgressPaint = new Paint();
this.mProgressPaint.setColor(progressColor);
this.mCenterPaint = new Paint();
this.mCenterPaint.setColor(-1);
this.mCenterPaint.setStyle(Style.FILL);
}
public DataRenderer(ChartAnimator animator, ViewPortHandler viewPortHandler) {
super(viewPortHandler);
this.mAnimator = animator;
mRenderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mRenderPaint.setStyle(Style.FILL);
mDrawPaint = new Paint(Paint.DITHER_FLAG);
mValuePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mValuePaint.setColor(Color.rgb(63, 63, 63));
mValuePaint.setTextAlign(Align.CENTER);
mValuePaint.setTextSize(Utils.convertDpToPixel(9f));
mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHighlightPaint.setStyle(Paint.Style.STROKE);
mHighlightPaint.setStrokeWidth(2f);
mHighlightPaint.setColor(Color.rgb(255, 187, 115));
}
private SmoothGraph(final int color, final float width, final float height, final float strokeWidth)
{
this.height = height;
this.width = width;
paintStroke = new Paint();
paintStroke.setColor(color);
paintStroke.setAlpha(204); // 80%
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(strokeWidth);
paintStroke.setStrokeCap(Cap.ROUND);
paintStroke.setStrokeJoin(Join.ROUND);
paintStroke.setAntiAlias(true);
paintFill = new Paint();
paintFill.setColor(color);
paintFill.setAlpha(51); // 20%
paintFill.setStyle(Style.FILL);
paintFill.setAntiAlias(true);
pathStroke = new Path();
pathFill = new Path();
}
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Log.i("zdy", "......" + getWidth() + " " + getHeight());
if (getWidth() != 0) {
int count = this.textArr.length;
Paint p = new Paint();
p.setColor(this.lineColor);
p.setStyle(Style.FILL);
float with = (((float) getWidth()) * 1.0f) / ((float) this.textArr.length);
for (int i = 1; i < count; i++) {
RectF r1 = new RectF();
float nPos = with * ((float) i);
r1.left = nPos - (((float) this.space) / 2.0f);
r1.right = (((float) this.space) / 2.0f) + nPos;
r1.top = (float) (this.lineStroke + 0);
r1.bottom = (float) (getHeight() - this.lineStroke);
canvas.drawRect(r1, p);
}
}
}
protected void drawDebug(Canvas g2, float x, float y, boolean showDepth) {
if (DEBUG) {
Paint st = AjLatexMath.getPaint();
int c = st.getColor();
st.setColor(markForDEBUG);
st.setStyle(Style.FILL_AND_STROKE);
if (markForDEBUG != null) {
g2.drawRect(x, y - height, width, height + depth, st);
}
if (width < 0) {
x += width;
width = -width;
}
g2.drawRect(x, y - height, width, height + depth, st);
if (showDepth) {
st.setColor(Color.RED);
if (depth > 0) {
g2.drawRect(x, y, width, depth, st);
} else if (depth < 0) {
g2.drawRect(x, y + depth, width, -depth, st);
} else {
}
}
st.setColor(c);
}
}
private void init(Context context) {
mContext = context;
DisplayMetrics dm = getResources().getDisplayMetrics();
mScreenW = dm.widthPixels;
mHeadBmp = BitmapFactory.decodeResource(getResources(), R.drawable.load_more_1);
// mScrDistance = mScreenH / 3 - 46;
mHeadW = mHeadBmp.getWidth();
mHeadH = mHeadBmp.getHeight();
mInitLeftPX = mScreenW / 2 - mHeadW;
mInitRightPX = mScreenW / 2 + mHeadW;
mBmpL = mScreenW / 2 - mHeadBmp.getWidth() / 2;
mBmpT = 0;
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);
mPaint.setColor(Color.RED);
mPaint.setStyle(Style.FILL);//设置非填充
mScroller = new Scroller(mContext, new DecelerateInterpolator());
mScroller1 = new Scroller(mContext, new DecelerateInterpolator());
mAniDraw = (AnimationDrawable) mAnimList.getDrawable();
}
public AxisRenderer(ViewPortHandler viewPortHandler, Transformer trans) {
super(viewPortHandler);
this.mTrans = trans;
mAxisLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mGridPaint = new Paint();
mGridPaint.setColor(Color.GRAY);
mGridPaint.setStrokeWidth(1f);
mGridPaint.setStyle(Style.STROKE);
mGridPaint.setAlpha(90);
mAxisLinePaint = new Paint();
mAxisLinePaint.setColor(Color.BLACK);
mAxisLinePaint.setStrokeWidth(1f);
mAxisLinePaint.setStyle(Style.STROKE);
mLimitLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
private boolean drawSoftware(Canvas c, Paint p) {
boolean hasContent = false;
p.setColor(mColorOpaque);
final int alpha = (int) (mColorAlpha * mOpacity + 0.5f);
final float radius = lerp(0, mOuterRadius, mTweenRadius);
if (alpha > 0 && radius > 0) {
final float x = lerp(
mClampedStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
final float y = lerp(
mClampedStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
p.setAlpha(alpha);
p.setStyle(Style.FILL);
c.drawCircle(x, y, radius, p);
hasContent = true;
}
return hasContent;
}
public SquareProgressView(Context context, AttributeSet attrs) {
super(context, attrs);
progressBarPaint = new Paint();
progressBarPaint.setColor(context.getResources().getColor(
android.R.color.holo_green_dark));
progressBarPaint.setStrokeWidth(CalculationUtil.convertDpToPx(
widthInDp, getContext()));
progressBarPaint.setAntiAlias(true);
progressBarPaint.setStyle(Style.STROKE);
outlinePaint = new Paint();
outlinePaint.setColor(context.getResources().getColor(
android.R.color.black));
outlinePaint.setStrokeWidth(1);
outlinePaint.setAntiAlias(true);
outlinePaint.setStyle(Style.STROKE);
textPaint = new Paint();
textPaint.setColor(context.getResources().getColor(
android.R.color.black));
textPaint.setAntiAlias(true);
textPaint.setStyle(Style.STROKE);
}
public SimpleHeader(Context context) {
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setStyle(Style.FILL);
int fontSize = (int) TypedValue
.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, context.getResources()
.getDisplayMetrics());
mPaint.setTextSize(fontSize);
mPaint.setTextAlign(Align.CENTER);
mTextColor = 0xffffffff;
mPointColor = 0xffffffff;
mFontOffset = -(mPaint.getFontMetrics().top + mPaint.getFontMetrics().bottom) / 2;
mHeight = (int) TypedValue
.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 45, context.getResources()
.getDisplayMetrics());
mPointRadius =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2.5f, context.getResources()
.getDisplayMetrics());
mCircleRadius = mPointRadius * 3.5f;
}
public void draw(Canvas g2, float x, float y) {
Paint st = AjLatexMath.getPaint();
Style s = st.getStyle();
float w = st.getStrokeWidth();
st.setStyle(Style.FILL);
st.setStrokeWidth(0);
int c = st.getColor();
if (color != null)
st.setColor(color);
if (speShift == 0) {
g2.drawRect(x, y - height, x + width, y, st);
} else {
g2.drawRect(x, y - height + speShift, x + width, y + speShift, st);
}
st.setColor(c);
st.setStyle(s);
st.setStrokeWidth(w);
}
private void init() {
final Context context = getContext();
final ViewConfiguration configuration = ViewConfiguration.get(context);
mScroller = new Scroller(context, flipInterpolator);
mTouchSlop = configuration.getScaledPagingTouchSlop();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mShadowPaint.setColor(Color.BLACK);
mShadowPaint.setStyle(Style.FILL);
mShadePaint.setColor(Color.BLACK);
mShadePaint.setStyle(Style.FILL);
mShinePaint.setColor(Color.WHITE);
mShinePaint.setStyle(Style.FILL);
}
/**
* Set the properties of the paints we're using to
* draw the progress wheel
*/
private void setupPaints() {
barPaint.setColor(barColor);
barPaint.setAntiAlias(true);
barPaint.setStyle(Style.STROKE);
barPaint.setStrokeWidth(barWidth);
rimPaint.setColor(rimColor);
rimPaint.setAntiAlias(true);
rimPaint.setStyle(Style.STROKE);
rimPaint.setStrokeWidth(rimWidth);
circlePaint.setColor(circleColor);
circlePaint.setAntiAlias(true);
circlePaint.setStyle(Style.FILL);
textPaint.setColor(textColor);
textPaint.setStyle(Style.FILL);
textPaint.setAntiAlias(true);
textPaint.setTextSize(textSize);
contourPaint.setColor(contourColor);
contourPaint.setAntiAlias(true);
contourPaint.setStyle(Style.STROKE);
contourPaint.setStrokeWidth(contourSize);
}
private boolean drawSoftware(Canvas c, Paint p) {
boolean hasContent = false;
p.setColor(mColorOpaque);
final int alpha = (int) (255 * mOpacity + 0.5f);
final float radius = lerp(0, mOuterRadius, mTweenRadius);
if (alpha > 0 && radius > 0) {
final float x = lerp(
mClampedStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
final float y = lerp(
mClampedStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
p.setAlpha(alpha);
p.setStyle(Style.FILL);
c.drawCircle(x, y, radius, p);
hasContent = true;
}
return hasContent;
}
/**
* Set the properties of the paints we're using to
* draw the progress wheel
*/
private void setupPaints() {
if (roundStroke) {
barPaint.setDither(true);
barPaint.setStrokeCap(Paint.Cap.ROUND);
barPaint.setPathEffect(new CornerPathEffect(10) );
}
barPaint.setColor(barColor);
barPaint.setAntiAlias(true);
barPaint.setStyle(Style.STROKE);
barPaint.setStrokeWidth(barWidth);
rimPaint.setColor(rimColor);
rimPaint.setAntiAlias(true);
rimPaint.setStyle(Style.STROKE);
rimPaint.setStrokeWidth(rimWidth);
}
public void draw(Canvas canvas) {
Paint mPaintFill = new Paint();
mPaintFill.setStyle(Style.FILL);
mPaintFill.setColor(stickFillColor);
if (width() >= 2f && width() >= 2 * stickStrokeWidth) {
if (stickStrokeWidth > 0) {
Paint mPaintBorder = new Paint();
mPaintBorder.setStyle(Style.STROKE);
mPaintBorder.setStrokeWidth(stickStrokeWidth);
mPaintBorder.setColor(stickBorderColor);
canvas.drawRect(left + stickStrokeWidth, top + stickStrokeWidth, right - stickStrokeWidth, bottom - stickStrokeWidth, mPaintFill);
canvas.drawRect(left + stickStrokeWidth, top + stickStrokeWidth, right - stickStrokeWidth, bottom - stickStrokeWidth, mPaintBorder);
}else{
canvas.drawRect(left, top, right, bottom, mPaintFill);
}
} else {
canvas.drawLine(left, top, left, bottom, mPaintFill);
}
}
public PieChartRenderer(PieChart chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
mChart = chart;
mHolePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mHolePaint.setColor(Color.WHITE);
mHolePaint.setStyle(Style.FILL);
mTransparentCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mTransparentCirclePaint.setColor(Color.WHITE);
mTransparentCirclePaint.setStyle(Style.FILL);
mTransparentCirclePaint.setAlpha(105);
mCenterTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
mCenterTextPaint.setColor(Color.BLACK);
mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f));
mValuePaint.setTextSize(Utils.convertDpToPixel(13f));
mValuePaint.setColor(Color.WHITE);
mValuePaint.setTextAlign(Align.CENTER);
}
private SimpleGraph(final int color, final long maxNsecs, final float width, final float height, final float strokeWidth)
{
this.maxNsecs = maxNsecs;
// this.width = width;
this.height = height;
nsecWidth = width / maxNsecs;
paintStroke = new Paint();
paintStroke.setColor(color);
paintStroke.setAlpha(204); // 80%
paintStroke.setStyle(Style.STROKE);
paintStroke.setStrokeWidth(strokeWidth);
paintStroke.setStrokeCap(Cap.ROUND);
paintStroke.setStrokeJoin(Join.ROUND);
paintStroke.setAntiAlias(true);
paintFill = new Paint();
paintFill.setColor(color);
paintFill.setAlpha(51); // 20%
paintFill.setStyle(Style.FILL);
paintFill.setAntiAlias(true);
pathStroke = new Path();
pathFill = new Path();
}
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (isInEditMode()) return;
//Load defaults from resources
final Resources res = getResources();
final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
//Retrieve styles attributes
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);
mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
mPaintPageFill.setStyle(Style.FILL);
mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
mPaintStroke.setStyle(Style.STROKE);
mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
mPaintFill.setStyle(Style.FILL);
mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
if (background != null) {
setBackgroundDrawable(background);
}
a.recycle();
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
@Override
protected void onDraw(Canvas canvas) {
switch (mCurrentStatus) {
case STATUS_FINGER_ON:
// Draw the outer circle
mPaint.setStyle(Style.STROKE);
mPaint.setColor(mColorFingerOn);
mPaint.setStrokeWidth(2);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
// Draw inner circle
mPaint.setStyle(Style.FILL);
canvas.drawCircle(mCenterX, mCenterY, mRadius
* mInnerCircleRadiusRate, mPaint);
break;
case STATUS_FINGER_UP:
// Draw the outer circle
mPaint.setColor(mColorFingerUp);
mPaint.setStyle(Style.STROKE);
mPaint.setStrokeWidth(2);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
break;
case STATUS_NO_FINGER:
// Draw the outer circle
mPaint.setStyle(Style.STROKE);
mPaint.setStrokeWidth(2);
mPaint.setColor(mColorNoFingerOutter);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
break;
}
}
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (isInEditMode()) return;
//Load defaults from resources
final Resources res = getResources();
final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color);
final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color);
final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation);
final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color);
final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width);
final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius);
final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered);
final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap);
//Retrieve styles attributes
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);
mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
mPaintPageFill.setStyle(Style.FILL);
mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
mPaintStroke.setStyle(Style.STROKE);
mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
mPaintFill.setStyle(Style.FILL);
mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);
Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
if (background != null) {
setBackgroundDrawable(background);
}
a.recycle();
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
public BubbleChartRenderer(BubbleDataProvider chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
mChart = chart;
mRenderPaint.setStyle(Style.FILL);
mHighlightPaint.setStyle(Style.STROKE);
mHighlightPaint.setStrokeWidth(Utils.convertDpToPixel(1.5f));
}
private void setPaint()
{
pPoint = new Paint();
pPoint.setFlags(Paint.ANTI_ALIAS_FLAG);
pPoint.setAntiAlias(true);
pPoint.setFilterBitmap(true);
pPoint.setColor(Color.BLUE);
pPoint.setStrokeWidth(2);
pPoint.setStyle(Style.FILL_AND_STROKE);
pBaseLine = new Paint();
pBaseLine.setFlags(Paint.ANTI_ALIAS_FLAG);
pBaseLine.setAntiAlias(true);
pBaseLine.setFilterBitmap(true);
pBaseLine.setColor(Color.GRAY);
pBaseLine.setStrokeWidth(3);
pBaseLineD = new Paint();
pBaseLineD.setFlags(Paint.ANTI_ALIAS_FLAG);
pBaseLineD.setAntiAlias(true);
pBaseLineD.setFilterBitmap(true);
pBaseLineD.setColor(0xffcccccc);
pBaseLineD.setStrokeWidth(1);
pBaseLineD.setStyle(Style.STROKE);
pBaseLineD.setPathEffect(new DashPathEffect(new float[] {10,5}, 0));
pMarkText = new Paint();
pMarkText.setFlags(Paint.ANTI_ALIAS_FLAG);
pMarkText.setAntiAlias(true);
pMarkText.setColor(Color.BLACK);
}
public BubbleChartRenderer(BubbleDataProvider chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(animator, viewPortHandler);
mChart = chart;
mRenderPaint.setStyle(Style.FILL);
mHighlightPaint.setStyle(Style.STROKE);
mHighlightPaint.setStrokeWidth(Utils.convertDpToPixel(1.5f));
}
private void setupUnitTextPaint() {
mUnitTextPaint.setStyle(Style.FILL);
mUnitTextPaint.setAntiAlias(true);
if (unitTextTypeface != null) {
mUnitTextPaint.setTypeface(unitTextTypeface);
}
}
public Ring(Callback callback) {
mCallback = callback;
mPaint.setStrokeCap(Paint.Cap.SQUARE);
mPaint.setAntiAlias(true);
mPaint.setStyle(Style.STROKE);
mArrowPaint.setStyle(Style.FILL);
mArrowPaint.setAntiAlias(true);
}