Skip to content

Commit

Permalink
Merge pull request #2 from swapnil1104/animation
Browse files Browse the repository at this point in the history
IndexOutOfBoundException bugfix
  • Loading branch information
swapnil1104 authored Mar 21, 2020
2 parents ace6d24 + edfc6a0 commit 0ab9357
Showing 1 changed file with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
package com.broooapps.graphview;

import android.animation.*;
import android.app.Activity;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.*;
import android.os.Handler;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
import android.graphics.PathMeasure;
import android.graphics.RectF;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.broooapps.graphview.models.GraphData;
import com.broooapps.graphview.models.GraphPoint;
import com.broooapps.graphview.models.PointMap;

import java.lang.ref.WeakReference;
import java.text.DecimalFormat;
import java.util.ArrayList;

Expand Down Expand Up @@ -163,6 +168,8 @@ public void setData(int span, int maxVal, GraphData... graphDataArray) {
this.maxVal = maxVal;
this.xSpan = span;
this.graphDataArray = graphDataArray;
graphGradientPaintsList.clear();
graphStrokePaintsList.clear();

pathArrayList = constructPaths();
length = getLengths();
Expand Down Expand Up @@ -251,7 +258,8 @@ public void onAnimationUpdate(ValueAnimator animation) {
for (int i = 0; i < graphGradientPaintsList.size(); i++) {

if (graphDataArray[i].isAnimateLine()) {
graphGradientPaintsList.get(i).setAlpha((Integer) animation.getAnimatedValue("PROPERTY_ALPHA"));
if (graphGradientPaintsList.get(i) != null)
graphGradientPaintsList.get(i).setAlpha((Integer) animation.getAnimatedValue("PROPERTY_ALPHA"));
graphPointPaintsList.get(i).setAlpha((Integer) animation.getAnimatedValue("PROPERTY_ALPHA"));
}
}
Expand Down

0 comments on commit 0ab9357

Please sign in to comment.