From a858e00e4273d0fdf9abb492910ea6a431092734 Mon Sep 17 00:00:00 2001 From: Zech Date: Mon, 6 Nov 2017 20:02:09 +0800 Subject: [PATCH] fix incorrect attrs parse(R.styleable.InsLoadingViewAttr_end_color) and correct typos --- .../com/qintong/library/InsLoadingView.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/library/src/main/java/com/qintong/library/InsLoadingView.java b/library/src/main/java/com/qintong/library/InsLoadingView.java index 4d54d26..55bd353 100755 --- a/library/src/main/java/com/qintong/library/InsLoadingView.java +++ b/library/src/main/java/com/qintong/library/InsLoadingView.java @@ -144,7 +144,7 @@ protected void onDraw(Canvas canvas) { drawCircle(canvas, mTrackPaint); break; case CLICKED: - drawClickedircle(canvas); + drawClickedCircle(canvas); break; } } @@ -209,25 +209,26 @@ public void setImageDrawable(Drawable drawable) { private void init(Context context, AttributeSet attrs) { if (attrs != null) { - praseAttrs(context, attrs); + parseAttrs(context, attrs); } onCreateAnimators(); } - private void praseAttrs(Context context, AttributeSet attrs) { + private void parseAttrs(Context context, AttributeSet attrs) { TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.InsLoadingViewAttr); int startColor = typedArray.getColor(R.styleable.InsLoadingViewAttr_start_color, mStartColor); - int endColor = typedArray.getColor(R.styleable.InsLoadingViewAttr_start_color, mEndColor); + int endColor = typedArray.getColor(R.styleable.InsLoadingViewAttr_end_color, mEndColor); int circleDuration = typedArray.getInt(R.styleable.InsLoadingViewAttr_circle_duration, mCircleDuration); int rotateDuration = typedArray.getInt(R.styleable.InsLoadingViewAttr_rotate_duration, mRotateDuration); int status = typedArray.getInt(R.styleable.InsLoadingViewAttr_status, 0); if (DEBUG) { - Log.d(TAG, "praseAttrs start_color: " + startColor); - Log.d(TAG, "praseAttrs end_color: " + endColor); - Log.d(TAG, "praseAttrs rotate_duration: " + rotateDuration); - Log.d(TAG, "praseAttrs circle_duration: " + circleDuration); - Log.d(TAG, "praseAttrs status: " + status); + Log.d(TAG, "parseAttrs start_color: " + startColor); + Log.d(TAG, "parseAttrs end_color: " + endColor); + Log.d(TAG, "parseAttrs rotate_duration: " + rotateDuration); + Log.d(TAG, "parseAttrs circle_duration: " + circleDuration); + Log.d(TAG, "parseAttrs status: " + status); } + typedArray.recycle(); if (circleDuration != mCircleDuration) { setCircleDuration(circleDuration); } @@ -380,7 +381,7 @@ private void drawCircle(Canvas canvas, Paint paint) { canvas.drawOval(rectF, paint); } - private void drawClickedircle(Canvas canvas) { + private void drawClickedCircle(Canvas canvas) { Paint paintClicked = new Paint(); paintClicked.setColor(sClickedColor); setPaintStroke(paintClicked);