use of android.graphics.Paint in project WilliamChart by diogobernardino.
the class StackedCardOne method show.
@Override
public void show(Runnable action) {
super.show(action);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mChart.setOnEntryClickListener(new OnEntryClickListener() {
@SuppressLint("NewApi")
@Override
public void onClick(int setIndex, int entryIndex, Rect rect) {
if (setIndex == 2)
mLegendOneRed.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {
@Override
public void run() {
mLegendOneRed.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
}
});
else if (setIndex == 1) {
mLegendOneYellow.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {
@Override
public void run() {
mLegendOneYellow.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
}
});
} else {
mLegendOneGreen.animate().scaleY(1.3f).scaleX(1.3f).setDuration(100).withEndAction(new Runnable() {
@Override
public void run() {
mLegendOneGreen.animate().scaleY(1.0f).scaleX(1.0f).setDuration(100);
}
});
}
}
});
Paint thresPaint = new Paint();
thresPaint.setColor(Color.parseColor("#dad8d6"));
thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 20 }, 0));
thresPaint.setStyle(Paint.Style.STROKE);
thresPaint.setAntiAlias(true);
thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
BarSet stackBarSet = new BarSet(mLabels, mValuesOne[0]);
stackBarSet.setColor(Color.parseColor("#a1d949"));
mChart.addData(stackBarSet);
stackBarSet = new BarSet(mLabels, mValuesOne[1]);
stackBarSet.setColor(Color.parseColor("#ffcc6a"));
mChart.addData(stackBarSet);
stackBarSet = new BarSet(mLabels, mValuesOne[2]);
stackBarSet.setColor(Color.parseColor("#ff7a57"));
mChart.addData(stackBarSet);
mChart.setBarSpacing(Tools.fromDpToPx(15));
mChart.setRoundCorners(Tools.fromDpToPx(1));
mChart.setXAxis(false).setXLabels(XRenderer.LabelPosition.OUTSIDE).setYAxis(false).setYLabels(YRenderer.LabelPosition.NONE).setValueThreshold(89.f, 89.f, thresPaint);
int[] order = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
mChart.show(new Animation().setOverlap(.5f, order).setEndAction(action));
}
use of android.graphics.Paint in project WilliamChart by diogobernardino.
the class StackedCardTwo method show.
@Override
public void show(Runnable action) {
super.show(action);
BarSet barSet = new BarSet(mLabels, mValues[0]);
barSet.setColor(Color.parseColor("#90ee7e"));
mChart.addData(barSet);
barSet = new BarSet(mLabels, mValues[1]);
barSet.setColor(Color.parseColor("#2b908f"));
mChart.addData(barSet);
Paint gridPaint = new Paint();
gridPaint.setColor(Color.parseColor("#e7e7e7"));
gridPaint.setStyle(Paint.Style.STROKE);
gridPaint.setAntiAlias(true);
gridPaint.setStrokeWidth(Tools.fromDpToPx(.7f));
mChart.setBarSpacing(Tools.fromDpToPx(10));
mChart.setBorderSpacing(0).setStep(1).setGrid(0, 10, gridPaint).setXAxis(false).setYAxis(false).setLabelsFormat(new DecimalFormat("##'M'")).show(new Animation().setDuration(2500).setEasing(new AccelerateInterpolator()).setEndAction(action));
}
use of android.graphics.Paint in project UltimateAndroid by cymcsg.
the class SlidingLayout method dimChildView.
private void dimChildView(View v, float mag, int fadeColor) {
final LayoutParams lp = (LayoutParams) v.getLayoutParams();
if (mag > 0 && fadeColor != 0) {
final int baseAlpha = (fadeColor & 0xff000000) >>> 24;
int imag = (int) (baseAlpha * mag);
int color = imag << 24 | (fadeColor & 0xffffff);
if (lp.dimPaint == null) {
lp.dimPaint = new Paint();
}
lp.dimPaint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_OVER));
if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_HARDWARE) {
ViewCompat.setLayerType(v, ViewCompat.LAYER_TYPE_HARDWARE, lp.dimPaint);
}
invalidateChildRegion(v);
} else if (ViewCompat.getLayerType(v) != ViewCompat.LAYER_TYPE_NONE) {
if (lp.dimPaint != null) {
lp.dimPaint.setColorFilter(null);
}
final DisableLayerRunnable dlr = new DisableLayerRunnable(v);
mPostedRunnables.add(dlr);
ViewCompat.postOnAnimation(this, dlr);
}
}
use of android.graphics.Paint in project MaterialShowcaseView by deano2390.
the class MaterialShowcaseView method onDraw.
/**
* Interesting drawing stuff.
* We draw a block of semi transparent colour to fill the whole screen then we draw of transparency
* to create a circular "viewport" through to the underlying content
*
* @param canvas
*/
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// don't bother drawing if we're not ready
if (!mShouldRender)
return;
// get current dimensions
final int width = getMeasuredWidth();
final int height = getMeasuredHeight();
// don't bother drawing if there is nothing to draw on
if (width <= 0 || height <= 0)
return;
// build a new canvas if needed i.e first pass or new dimensions
if (mBitmap == null || mCanvas == null || mOldHeight != height || mOldWidth != width) {
if (mBitmap != null)
mBitmap.recycle();
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
}
// save our 'old' dimensions
mOldWidth = width;
mOldHeight = height;
// clear canvas
mCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
// draw solid background
mCanvas.drawColor(mMaskColour);
// Prepare eraser Paint if needed
if (mEraser == null) {
mEraser = new Paint();
mEraser.setColor(0xFFFFFFFF);
mEraser.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
mEraser.setFlags(Paint.ANTI_ALIAS_FLAG);
}
// draw (erase) shape
mShape.draw(mCanvas, mEraser, mXPosition, mYPosition, mShapePadding);
// Draw the bitmap on our views canvas.
canvas.drawBitmap(mBitmap, 0, 0, null);
}
use of android.graphics.Paint in project MetaballLoading by dodola.
the class MetaballDebugView method onDraw.
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (circlePaths.size() == 0) {
initMetaballs();
}
final Circle circle1 = circlePaths.get(0);
RectF ball1 = new RectF();
ball1.left = circle1.center[0] - circle1.radius;
ball1.top = circle1.center[1] - circle1.radius;
ball1.right = ball1.left + circle1.radius * 2;
ball1.bottom = ball1.top + circle1.radius * 2;
canvas.drawCircle(ball1.centerX(), ball1.centerY(), circle1.radius, paint);
for (int i = 1; i < circlePaths.size(); i++) {
metaball(canvas, i, 0, mv, handleLenRate, maxDistance);
}
}
Aggregations