Daniel Nadeau avatar Daniel Nadeau committed 1113221 Merge

Merged in luixal/holographlibrary (pull request #7)

Fixed ArrayOutOfBounds crash on BarGraph touch event and removed hardcoded '$' char.

Comments (0)

Files changed (2)

Add a comment to this file


Binary file removed.


 import java.util.ArrayList;
-import com.echo.holographlibrary.PieGraph.OnSliceClickedListener;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.Config;
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Path;
-import android.graphics.PixelFormat;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.NinePatchDrawable;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
 import android.view.View;
 public class BarGraph extends View {
                     Rect r2 = new Rect();
-                    this.p.getTextBounds("$"+p.getValue(), 0, 1, r2);
-                    popup.setBounds((int)(((r.left+r.right)/2)-(this.p.measureText("$"+p.getValue())/2))-14, r.top+(r2.top-r2.bottom)-26, (int)(((r.left+r.right)/2)+(this.p.measureText("$"+p.getValue())/2))+14, r.top);
+                    this.p.getTextBounds(String.valueOf(p.getValue()), 0, 1, r2);
+                    popup.setBounds((int)(((r.left+r.right)/2)-(this.p.measureText(String.valueOf(p.getValue()))/2))-14, r.top+(r2.top-r2.bottom)-26, (int)(((r.left+r.right)/2)+(this.p.measureText(String.valueOf(p.getValue()))/2))+14, r.top);
-                    canvas.drawText("$"+p.getValue(), (int)(((r.left+r.right)/2)-(this.p.measureText("$"+p.getValue())/2)), r.top-20, this.p);
+                    canvas.drawText(String.valueOf(p.getValue()), (int)(((r.left+r.right)/2)-(this.p.measureText(String.valueOf(p.getValue()))/2)), r.top-20, this.p);
                 if (indexSelected == count && listener != null) {
                 indexSelected = count;
             } else if (event.getAction() == MotionEvent.ACTION_UP){
                 if (r.contains((int)point.x,(int) point.y) && listener != null){
-                    listener.onClick(indexSelected);
+                    if (indexSelected > -1) listener.onClick(indexSelected);
+                    indexSelected = -1;
-                indexSelected = -1;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.