Bitmap is cleared only when setUri is called with empty/null uri (#97)

* Bitmap is cleared only when setUri is called with empty/null uri

* update gradle & buildtools versions

* fix gradle plugin version

* rename assembleRelease to assemble task
This commit is contained in:
Hristo Hristov
2017-05-03 14:16:21 +03:00
committed by GitHub
parent 01cece8493
commit 381bc36cd8
4 changed files with 13 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ def computeBuildToolsVersion() {
return buildToolsVersion
}
else {
return "23.0.3"
return "25.0.2"
}
}
@@ -67,6 +67,6 @@ task copyAar << {
}
}
assembleRelease.dependsOn(cleanBuildDir)
copyAar.dependsOn(assembleRelease)
assemble.dependsOn(cleanBuildDir)
copyAar.dependsOn(assemble)
build.dependsOn(copyAar)

View File

@@ -167,6 +167,14 @@ public class ImageView extends android.widget.ImageView implements BitmapOwner {
mDecodeHeight = decodeHeight;
mUseCache = useCache;
mAsync = async;
// Clear current bitmap only if we set empty URI.
// We support settimg bitmap through ImageSource (e.g. Bitmap).
if (uri == null || uri.trim() == "") {
this.setImageBitmap(null);
}
// Begin loading image only if we are attached to window.
if (mAttachedToWindow) {
loadImage();
}
@@ -181,8 +189,6 @@ public class ImageView extends android.widget.ImageView implements BitmapOwner {
if (mUri != null && fetcher != null) {
// Get the Bitmap from cache.
fetcher.loadImage(mUri, this, mDecodeWidth, mDecodeHeight, mUseCache, mAsync, mListener);
} else {
this.setImageBitmap(null);
}
}