Skip to content

Commit

Permalink
support for API 14+
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpopli1891 committed Jun 10, 2016
1 parent 5ad571a commit f2432fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion InkPageIndicator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
buildToolsVersion "23.0.1"

defaultConfig {
minSdkVersion 16
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@
import android.graphics.RectF;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPager;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
import android.support.v4.view.animation.FastOutSlowInInterpolator;

import java.util.Arrays;


Expand Down Expand Up @@ -608,7 +610,7 @@ public void onAnimationUpdate(ValueAnimator valueAnimator) {
// todo avoid autoboxing
selectedDotX = (Float) valueAnimator.getAnimatedValue();
retreatAnimation.startIfNecessary(selectedDotX);
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
}
});
moveSelected.addListener(new AnimatorListenerAdapter() {
Expand Down Expand Up @@ -642,18 +644,20 @@ private void setJoiningFraction(int leftDot, float fraction) {
}

joiningFractions[leftDot] = fraction;
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(this);
;
}
}

private void clearJoiningFractions() {
Arrays.fill(joiningFractions, 0f);
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(this);
}

private void setDotRevealFraction(int dot, float fraction) {
dotRevealFractions[dot] = fraction;
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(this);
;
}

private void cancelJoiningAnimations() {
Expand Down Expand Up @@ -726,7 +730,7 @@ public PendingRetreatAnimator(int was, int now, int steps, StartPredicate predic
public void onAnimationUpdate(ValueAnimator valueAnimator) {
// todo avoid autoboxing
retreatingJoinX1 = (Float) valueAnimator.getAnimatedValue();
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
// start any reveal animations if we've passed them
for (PendingRevealAnimator pendingReveal : revealAnimations) {
pendingReveal.startIfNecessary(retreatingJoinX1);
Expand All @@ -746,7 +750,7 @@ public void onAnimationUpdate(ValueAnimator valueAnimator) {
public void onAnimationUpdate(ValueAnimator valueAnimator) {
// todo avoid autoboxing
retreatingJoinX2 = (Float) valueAnimator.getAnimatedValue();
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
// start any reveal animations if we've passed them
for (PendingRevealAnimator pendingReveal : revealAnimations) {
pendingReveal.startIfNecessary(retreatingJoinX2);
Expand All @@ -766,14 +770,14 @@ public void onAnimationStart(Animator animation) {
}
retreatingJoinX1 = initialX1;
retreatingJoinX2 = initialX2;
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
}

@Override
public void onAnimationEnd(Animator animation) {
retreatingJoinX1 = INVALID_FRACTION;
retreatingJoinX2 = INVALID_FRACTION;
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
}
});
}
Expand Down Expand Up @@ -804,7 +808,7 @@ public void onAnimationUpdate(ValueAnimator valueAnimator) {
@Override
public void onAnimationEnd(Animator animation) {
setDotRevealFraction(PendingRevealAnimator.this.dot, 0f);
postInvalidateOnAnimation();
ViewCompat.postInvalidateOnAnimation(InkPageIndicator.this);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.pixelcan.ipidemo"
minSdkVersion 16
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand Down

0 comments on commit f2432fe

Please sign in to comment.