Skip to content

Commit

Permalink
Merged in MAW016/holographlibrary (pull request Androguide#10)
Browse files Browse the repository at this point in the history
Workaround of text positioning and usable space calc fix
  • Loading branch information
D4N14L committed Nov 18, 2013
2 parents cb1ebc9 + 3efc8f1 commit b7e49db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void onDraw(Canvas ca) {
this.mPaint.setTextSize(VALUE_FONT_SIZE * mContext.getResources().getDisplayMetrics().scaledDensity);
Rect r3 = new Rect();
this.mPaint.getTextBounds("$", 0, 1, r3);
usableHeight = getHeight()-bottomPadding-Math.abs(r3.top-r3.bottom)*2;
usableHeight = getHeight()-bottomPadding-Math.abs(r3.top-r3.bottom)-24 * mContext.getResources().getDisplayMetrics().density;
} else {
usableHeight = getHeight()-bottomPadding;
}
Expand Down Expand Up @@ -159,7 +159,8 @@ public void onDraw(Canvas ca) {
int boundRight = (int)(((mRectangle.left+mRectangle.right)/2)+(this.mPaint.measureText(bar.getValueString())/2)+10 * mContext.getResources().getDisplayMetrics().density);
popup.setBounds(boundLeft, boundTop, boundRight, mRectangle.top);
popup.draw(canvas);
canvas.drawText(bar.getValueString(), (int)(((mRectangle.left+mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString()))/2), mRectangle.top-VALUE_FONT_SIZE * mContext.getResources().getDisplayMetrics().scaledDensity/2, this.mPaint);

canvas.drawText(bar.getValueString(), (int)(((mRectangle.left+mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString()))/2), mRectangle.top-(mRectangle.top - boundTop)/2f+(float)Math.abs(r2.top-r2.bottom)/2f*0.7f, this.mPaint);
}
if (mIndexSelected == count && mListener != null) {
this.mPaint.setColor(Color.parseColor("#33B5E5"));
Expand Down

0 comments on commit b7e49db

Please sign in to comment.