chrisbanes / Android-BitmapCache

Android-BitmapCache is a specialised cache, for use with Android Bitmap objects.
834 stars 224 forks source link

CacheableBitmapDrawable sets null in detach, should probably just set unused #55

Open arberg opened 8 years ago

arberg commented 8 years ago

I suggest to replace current onDetachFromWindow with

@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    onDrawableUnset(getDrawable());
}

@Override
protected void onDetachedFromWindow() {
    super.onDetachedFromWindow();
    onDrawableSet(getDrawable());
}

I had an issue earlier which caused me to disable using CacheableBitmapDrawable in favor of ImageView. I have now tested again with CacheableBitmapDrawable but could not reproduce problem (probably my usage has changed). However my memory told me the problem probably came from nulling. Hence the above change, which I deem healthy.