Skip to content

Commit

Permalink
Merge pull request #92 from Hitta/canvas-restore-android-m-api-23-fix
Browse files Browse the repository at this point in the history
Avoid calling canvas.restore on Android M
  • Loading branch information
traex committed Feb 24, 2016
2 parents 241a8d0 + 82cf00e commit df5f9e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/src/main/java/com/andexert/library/RippleView.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.support.annotation.ColorRes;
import android.util.AttributeSet;
Expand Down Expand Up @@ -164,7 +165,11 @@ public void draw(Canvas canvas) {
timer = 0;
durationEmpty = -1;
timerEmpty = 0;
canvas.restore();
// There is problem on Android M where canvas.restore() seems to be called automatically
// For now, don't call canvas.restore() manually on Android M (API 23)
if(Build.VERSION.SDK_INT != 23) {

This comment has been minimized.

Copy link
@jqyp324

jqyp324 Feb 17, 2017

if(Build.VERSION.SDK_INT < 23){
......
}

canvas.restore();
}
invalidate();
if (onCompletionListener != null) onCompletionListener.onComplete(this);
return;
Expand Down

15 comments on commit df5f9e4

@ben-j69
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you make a 1.4 release with this change? It is a major improvment.

@zenkhas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for this release. Just ran into same problem.

@QiluXie
Copy link

@QiluXie QiluXie commented on df5f9e4 Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm waiting for this release too, having the same crash issue

@Dosssik
Copy link

@Dosssik Dosssik commented on df5f9e4 Oct 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this fix. Waiting for release

@mohit-funongo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release

@feng612266
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release

@Jeromeer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@guangzq
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@teddywilson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@thousant
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@thousant
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue...waitint for fix,android os 6.0.1+,upper version23 call mCanvas.save(); before mCanvas.restore();

@ThinkingInMe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@jqyp324
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdk int 25 is crash too

@pavlepavlov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for this fix in release +1

@muhallan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me too, looking for this release. how do I incorporate this in the existing library?

Please sign in to comment.