This commit is contained in:
seven332 committed 2015-08-14 00:23:03 +08:00
1 parent 523ff94f71
commit c015d05e77
4 files changed
+31 -15

No files matched your search

@@ -527,7 +527,7 @@ public class GLES20Canvas implements GLCanvas {
float sweepAngle, GLPaint paint) {
float halfLineWidth = paint.getLineWidth() / 2;
fillSector(cx, cy, radiusX + halfLineWidth, radiusY + halfLineWidth, sweepAngle, paint.getColor());
fillSector(cx, cy, radiusX - halfLineWidth, radiusY - halfLineWidth, sweepAngle, paint.getBackgroundColor());
fillOval(cx, cy, radiusX - halfLineWidth, radiusY - halfLineWidth, paint.getBackgroundColor());
}
private void draw(int type, int offset, int count, float x, float y, float width, float height,
@@ -199,7 +199,7 @@ public class ProgressView extends GLView {
int cy = height / 2;
float startAngle = (mTrimStart + mTrimOffset) * 360.0f - 90;
float sweepAngle = Math.max(6.0f, (mTrimEnd - mTrimStart) * 360.0f);
float sweepAngle = Math.max(12.0f, (mTrimEnd - mTrimStart) * 360.0f);
float rotation = mTrimRotation + startAngle;
canvas.save();
@@ -43,7 +43,6 @@ public class Slider extends GLView {
private int mDrawProgress;
private float mDrawPercent;
private int mTargetProgress;
private float mTargetPercent;
private boolean mReverse = false;
@@ -165,7 +164,6 @@ public class Slider extends GLView {
mProgress = progress;
mPercent = MathUtils.delerp(mStart, mEnd, mProgress);
mTargetProgress = progress;
mTargetPercent = mPercent;
startProgressAnimation(mPercent);
if (mListener != null) {
@@ -297,7 +295,6 @@ public class Slider extends GLView {
if (mTargetProgress != progress) {
mTargetProgress = progress;
mTargetPercent = percent;
startProgressAnimation(percent);
}
@@ -24,9 +24,16 @@ public class TextView extends GLView {
text = "";
}
if (!text.equals(mText)) {
int oldMinimumWidth = getSuggestedMinimumWidth();
mText = text;
mIndexes = mTextTexture.getTextIndexes(text);
requestLayout();
if (getSuggestedMinimumWidth() != oldMinimumWidth) {
requestLayout();
} else {
invalidate();
}
}
}
@@ -38,17 +45,29 @@ public class TextView extends GLView {
}
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
int textWidth = 0;
int textHight = 0;
if (mTextTexture != null) {
textWidth = (int) mTextTexture.getTextWidth(mIndexes);
textHight = (int) mTextTexture.getTextHeight();
protected int getSuggestedMinimumWidth() {
if (mTextTexture == null) {
return super.getSuggestedMinimumWidth();
} else {
return Math.max((int) mTextTexture.getTextWidth(mIndexes) + mPaddings.left + mPaddings.right,
super.getSuggestedMinimumWidth());
}
}
setMeasuredSize(getDefaultSize(Math.max(getSuggestedMinimumWidth(), textWidth), widthSpec),
getDefaultSize(Math.max(getSuggestedMinimumHeight(), textHight), heightSpec));
@Override
protected int getSuggestedMinimumHeight() {
if (mTextTexture == null) {
return super.getSuggestedMinimumHeight();
} else {
return Math.max((int) mTextTexture.getTextHeight() + mPaddings.top + mPaddings.bottom,
super.getSuggestedMinimumHeight());
}
}
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
setMeasuredSize(getDefaultSize(getSuggestedMinimumWidth(), widthSpec),
getDefaultSize(getSuggestedMinimumHeight(), heightSpec));
}
@Override