mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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:
@@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.1.2'
|
||||
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
|
||||
|
||||
@@ -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)
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user