Code example for Shape

Methods: draw

0
	protected void onDraw(Shape shape, Canvas canvas, Paint paint) {
		canvas.save();
		Rect bounds = canvas.getClipBounds();
		 
		// bottom etched line. 
		if (mBottomEtchedPaint != null) shape.draw(canvas, mBottomEtchedPaint);
		canvas.restore(); canvas.save();	
		 
		// separator. 
		canvas.concat(getSeparatorPaintMatrix(bounds));
		shape.draw(canvas, mSeparatorPaint);
		canvas.restore(); canvas.save();
		 
        // top etched line. 
		canvas.concat(getTopEtchedPaintMatrix(bounds));
		if (mTopEtchedPaint != null) shape.draw(canvas, mTopEtchedPaint);
		canvas.restore(); canvas.save();
		 
		// background. 
		canvas.concat(getBackgroundPaintMatrix(bounds));
		shape.draw(canvas, mBackgroundPaint);
		canvas.restore(); canvas.save();
		 
		// selected. 
		canvas.concat(getSelectedPaintMatrix(bounds));
		if (mSelectedPaint != null) {
			 
			// we'll set the selected color on onDraw event since we don't know drawable height up to here. 
			Shader shader = new LinearGradient(0, 0, 0, canvas.getHeight(), mStartColor, mEndColor, Shader.TileMode.MIRROR);
			mSelectedPaint.setShader(shader);
			 
			shape.draw(canvas, mSelectedPaint);
		} 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE