|
@@ -4,7 +4,6 @@ import android.animation.Animator;
|
|
|
import android.animation.ValueAnimator;
|
|
|
import android.content.Context;
|
|
|
import android.graphics.Canvas;
|
|
|
-import android.graphics.Color;
|
|
|
import android.graphics.LinearGradient;
|
|
|
import android.graphics.Paint;
|
|
|
import android.graphics.RectF;
|
|
@@ -22,14 +21,13 @@ import java.util.List;
|
|
|
public class ScaleLoadingView extends View {
|
|
|
|
|
|
private float mDefaultSize = 0f;
|
|
|
- private int mBarColor = Color.GREEN;
|
|
|
private int startColor = 0;
|
|
|
private int endColor = 0;
|
|
|
private Paint mPaint;
|
|
|
private List<DataBean> mDataBeanList = null;
|
|
|
private int mBarCount = 5;
|
|
|
private float mBarDivideSize = 0f;
|
|
|
- private long mPerBarTime = 300L;
|
|
|
+ private final long mPerBarTime = 300L;
|
|
|
|
|
|
public ScaleLoadingView(Context context, int viewSize, int divideSize, int count, int startColor, int endColor) {
|
|
|
super(context);
|
|
@@ -41,21 +39,9 @@ public class ScaleLoadingView extends View {
|
|
|
initView(context);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
private void initView(Context context) {
|
|
|
-
|
|
|
-
|
|
|
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
|
mPaint.setStyle(Paint.Style.FILL);
|
|
|
-
|
|
|
LinearGradient linearGradient = new LinearGradient(0, 0, 180, 0, startColor, endColor, Shader.TileMode.MIRROR);
|
|
|
mPaint.setShader(linearGradient);
|
|
|
if (mDataBeanList == null) {
|
|
@@ -120,17 +106,8 @@ public class ScaleLoadingView extends View {
|
|
|
@Override
|
|
|
protected void onDetachedFromWindow() {
|
|
|
super.onDetachedFromWindow();
|
|
|
-
|
|
|
if (mDataBeanList != null) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
for (DataBean bean : mDataBeanList) {
|
|
|
if (bean.valueAnimator != null) {
|
|
|
bean.valueAnimator.cancel();
|