Skip to content

Commit

Permalink
Merge pull request #10 from buptfarmer/master
Browse files Browse the repository at this point in the history
[bugfix] new TransitionDrawable memory leak
  • Loading branch information
patrickfav authored Apr 21, 2018
2 parents 50df4ad + af4d284 commit 0348196
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.TransitionDrawable;
import android.os.Build;
import android.os.Handler;
Expand Down Expand Up @@ -287,8 +288,14 @@ public void run() {
if (data.alphaFadeIn) {
//use what is currently in the imageview to fade
Drawable placeholder;
if (imageView.getDrawable() != null) {
placeholder = imageView.getDrawable();
Drawable oldDrawable = imageView.getDrawable();
if (oldDrawable != null) {
if (oldDrawable instanceof LayerDrawable) {
LayerDrawable oldLayerDrawable = (LayerDrawable) oldDrawable;
placeholder = oldLayerDrawable.getDrawable(0);
} else {
placeholder = imageView.getDrawable();
}
} else {
placeholder = new ColorDrawable(Color.parseColor("#00FFFFFF"));
}
Expand Down

0 comments on commit 0348196

Please sign in to comment.