Commits

Daniel Nadeau committed fc399b4

Fixes

Comments (0)

Files changed (20)

HoloGraphLibrary/bin/R.txt

 int drawable ic_launcher 0x7f020000
-int drawable popup_nocolor 0x7f020001
+int drawable popup_black 0x7f020001
 int string app_name 0x7f030000
 int style AppBaseTheme 0x7f040000
 int style AppTheme 0x7f040001

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/BarGraph.class

Binary file modified.

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/LineGraph$OnPointClickedListener.class

Binary file modified.

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/LineGraph.class

Binary file modified.

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/PieGraph$OnSliceClickedListener.class

Binary file modified.

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/PieGraph.class

Binary file modified.

HoloGraphLibrary/bin/classes/com/echo/holographlibrary/R$drawable.class

Binary file modified.

HoloGraphLibrary/bin/holographlibrary.jar

Binary file modified.

HoloGraphLibrary/bin/res/drawable-xhdpi/ic_launcher.png

Removed
Old image

HoloGraphLibrary/bin/res/drawable-xhdpi/popup_black.9.png

Added
New image

HoloGraphLibrary/bin/res/drawable-xhdpi/popup_nocolor.9.png

Removed
Old image

HoloGraphLibrary/gen/com/echo/holographlibrary/R.java

     }
     public static final class drawable {
         public static int ic_launcher=0x7f020000;
-        public static int popup_nocolor=0x7f020001;
+        public static int popup_black=0x7f020001;
     }
     public static final class string {
         public static int app_name=0x7f030000;

HoloGraphLibrary/res/drawable-xhdpi/ic_launcher.png

Removed
Old image

HoloGraphLibrary/res/drawable-xhdpi/popup_black.9.png

Added
New image

HoloGraphLibrary/res/drawable-xhdpi/popup_nocolor.9.png

Removed
Old image

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

 			fullImage = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
 			Canvas canvas = new Canvas(fullImage);
 			canvas.drawColor(Color.TRANSPARENT);
-			NinePatchDrawable popup = (NinePatchDrawable)this.getResources().getDrawable(R.drawable.popup_nocolor);
+			NinePatchDrawable popup = (NinePatchDrawable)this.getResources().getDrawable(R.drawable.popup_black);
 			
 			float maxValue = 0;
 			float padding = 7;

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

 import android.graphics.Point;
 import android.graphics.Path.Direction;
 import android.graphics.PixelFormat;
+import android.graphics.PorterDuffXfermode;
 import android.graphics.Region;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 	    getHolder().setFormat(PixelFormat.TRANSPARENT); 
 	    getHolder().addCallback(this); 
 	}
-	
+	public void setMinY(float minY){
+		
+	}
 	public void addLine(Line line) {
 		lines.add(line);
 	}
 			Canvas canvas = new Canvas(fullImage);
 			Paint paint = new Paint();
 			Path path = new Path();
-			float bottomPadding = 2, topPadding = 10;
+			float bottomPadding = 10, topPadding = 10;
 			float sidePadding = 10;
 			float usableHeight = getHeight() - bottomPadding - topPadding;
 			float usableWidth = getWidth() - 2*sidePadding;
 				float minX = getMinX();
 				
 				if (lineCount == lineToFill){
+					paint.setColor(Color.BLACK);
+					paint.setAlpha(30);
+					paint.setStrokeWidth(2);
+					for (int i = 10; i-getWidth() < getHeight(); i = i+20){
+						canvas.drawLine(i, getHeight()-bottomPadding, 0, getHeight()-bottomPadding-i, paint);
+					}
 					
-					Bitmap b = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
-					Canvas c = new Canvas(b);
-					
+					paint = new Paint();
+					paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.CLEAR));
 					for (LinePoint p : line.getPoints()){
 						float yPercent = (p.getY()-minY)/(maxY - minY);
 						float xPercent = (p.getX()-minX)/(maxX - minX);
 							newXPixels = sidePadding + (xPercent*usableWidth);
 							newYPixels = getHeight() - bottomPadding - (usableHeight*yPercent);
 							path.lineTo(newXPixels, newYPixels);
+							Path pa = new Path();
+							pa.moveTo(lastXPixels, lastYPixels);
+							pa.lineTo(newXPixels, newYPixels);
+							pa.lineTo(newXPixels, 0);
+							pa.lineTo(lastXPixels, 0);
+							pa.close();
+							canvas.drawPath(pa, paint);
 							lastXPixels = newXPixels;
 							lastYPixels = newYPixels;
 						}
 						count++;
 					}
-					path.lineTo(newXPixels, getHeight()-bottomPadding);
-					path.lineTo(getWidth(), getHeight()-bottomPadding);
-					path.lineTo(getWidth(), 0);
-					path.lineTo(0, 0);
-					path.lineTo(0, getHeight()-bottomPadding);
-					path.lineTo(firstXPixels, getHeight()-bottomPadding);
-					path.close();
-						
-					paint.setColor(Color.BLACK);
-					paint.setAlpha(30);
-					paint.setStrokeWidth(2);
-					for (int i = 10; i-getWidth() < getHeight(); i = i+20){
-						c.drawLine(i, getHeight()-bottomPadding, 0, getHeight()-bottomPadding-i, paint);
-					}
-					paint.setColor(Color.RED);
-					paint.setAlpha(255);
-					c.drawPath(path, paint);
-	
-					Paint pa = new Paint();
-					pa.setColor(Color.RED); // ARGB for the color, in this case red
-					int removeColor = pa.getColor(); // store this color's int for later use
-					pa.setAlpha(0);
-					pa.setXfermode(new AvoidXfermode(removeColor, 0, AvoidXfermode.Mode.TARGET));
-					// draw transparent on the "brown" pixels
-					c.drawPaint(pa);
 					
-					canvas.drawBitmap(b, 0, 0, null);
+					Path pa = new Path();
+					pa.moveTo(0, getHeight()-bottomPadding);
+					pa.lineTo(sidePadding, getHeight()-bottomPadding);
+					pa.lineTo(sidePadding, 0);
+					pa.lineTo(0, 0);
+					pa.close();
+					canvas.drawPath(pa, paint);
+					
+					pa = new Path();
+					pa.moveTo(getWidth(), getHeight()-bottomPadding);
+					pa.lineTo(getWidth()-sidePadding, getHeight()-bottomPadding);
+					pa.lineTo(getWidth()-sidePadding, 0);
+					pa.lineTo(getWidth(), 0);
+					pa.close();
+					canvas.drawPath(pa, paint);
+					
 				}
 				
 				lineCount++;
 			}
 			
+			paint = new Paint();
+			
 			paint.setColor(Color.BLACK);
 			paint.setAlpha(50);
 			paint.setAntiAlias(true);

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

 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Path;
+import android.graphics.Path.Direction;
 import android.graphics.PixelFormat;
 import android.graphics.Point;
 import android.graphics.RectF;
 import android.graphics.Region;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.MotionEvent;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 				paint.setColor(slice.getColor());
 				paint.setColor(Color.parseColor("#33B5E5"));
 				paint.setAlpha(100);
-				p2.arcTo(new RectF(midX-radius-(padding*2), midY-radius-(padding*2), midX+radius+(padding*2), midY+radius+(padding*2)), currentAngle, currentSweep+padding);
-				p2.arcTo(new RectF(midX-innerRadius+(padding*2), midY-innerRadius+(padding*2), midX+innerRadius-(padding*2), midY+innerRadius-(padding*2)), currentAngle + currentSweep + padding, -(currentSweep + padding));
-				p2.close();
+				
+				if (slices.size() > 1) {
+					p2.arcTo(new RectF(midX-radius-(padding*2), midY-radius-(padding*2), midX+radius+(padding*2), midY+radius+(padding*2)), currentAngle, currentSweep+padding);
+					p2.arcTo(new RectF(midX-innerRadius+(padding*2), midY-innerRadius+(padding*2), midX+innerRadius-(padding*2), midY+innerRadius-(padding*2)), currentAngle + currentSweep + padding, -(currentSweep + padding));
+					p2.close();
+				} else {
+					p2.addCircle(midX, midY, radius+padding, Direction.CW);
+				}
+				
 				canvas.drawPath(p2, paint);
 				paint.setAlpha(255);
 			}
 	    		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;
+	    		
 	    	}
 		    count++;
 	    }
 	}
 	public void setSlices(ArrayList<PieSlice> slices) {
 		this.slices = slices;
+		postInvalidate();
 	}
 	public PieSlice getSlice(int index) {
 		return slices.get(index);
 	}
 	public void addSlice(PieSlice slice) {
 		this.slices.add(slice);
+		postInvalidate();
 	}
 	public void setOnSliceClickedListener(OnSliceClickedListener listener) {
 		this.listener = listener;
 	}
 	public void setThickness(int thickness) {
 		this.thickness = thickness;
+		postInvalidate();
+	}
+	
+	public void removeSlices(){
+		for (int i = slices.size()-1; i >= 0; i--){
+			slices.remove(i);
+		}
+		postInvalidate();
 	}
 
-	public abstract class OnSliceClickedListener {
-		abstract void onClick(int index);
+	public static abstract class OnSliceClickedListener {
+		public abstract void onClick(int index);
 	}
 
 }

HoloGraphLibrarySample/bin/jarlist.cache

 # cache for current jar dependecy. DO NOT EDIT.
 # format is <lastModified> <length> <SHA-1> <path>
 # Encoding is UTF-8
-1361743028088 271754 53307dc2bd2b69fd5533458ee11885f55807de4b C:\Users\Daniel\git\HoloGraphLibrary\HoloGraphLibrary\libs\android-support-v4.jar
-1358998090870 271754 53307dc2bd2b69fd5533458ee11885f55807de4b C:\Users\Daniel\workspace2\HoloGraphLibrarySample\libs\android-support-v4.jar
+1358998090870 271754 53307dc2bd2b69fd5533458ee11885f55807de4b C:\Users\Daniel\git\HoloGraphLibrary\HoloGraphLibrarySample\libs\android-support-v4.jar
+1358998090870 271754 53307dc2bd2b69fd5533458ee11885f55807de4b C:\Users\Daniel\git\HoloGraphLibrary\HoloGraphLibrary\libs\android-support-v4.jar
 1358998090870 271754 53307dc2bd2b69fd5533458ee11885f55807de4b C:\Users\Daniel\workspace2\ActionBarSherlock\libs\android-support-v4.jar

HoloGraphLibrarySample/project.properties

 
 # Project target.
 target=android-17
-android.library.reference.1=..\\..\\git\\HoloGraphLibrary\\HoloGraphLibrary
-android.library.reference.2=../ActionBarSherlock
+android.library.reference.1=../HoloGraphLibrary
+android.library.reference.2=../../../workspace2/ActionBarSherlock