Commits

yccheok committed cf17525

Ensure bars are not sharing same instance of path.

Comments (0)

Files changed (1)

HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java

 
 	private ArrayList<Bar> points = new ArrayList<Bar>();
 	private Paint p = new Paint();
-	private Path path = new Path();
 	private Rect r;
 	private boolean showBarText = true;
 	private int indexSelected = -1;
 			
 			r = new Rect();
 			
-			path.reset();
-			
 			int count = 0;
 			for (Bar p : points) {
 				r.set((int)((padding*2)*count + padding + barWidth*count), (int)(getHeight()-bottomPadding-(usableHeight*(p.getValue()/maxValue))), (int)((padding*2)*count + padding + barWidth*(count+1)), (int)(getHeight()-bottomPadding));
 	        	
+				Path path = new Path();
 	        	path.addRect(new RectF(r.left-selectPadding, r.top-selectPadding, r.right+selectPadding, r.bottom+selectPadding), Path.Direction.CW);
 	        	p.setPath(path);
 	        	p.setRegion(new Region(r.left-selectPadding, r.top-selectPadding, r.right+selectPadding, r.bottom+selectPadding));