Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified packages/core/platforms/android/widgets-release.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/core/ui/image/image-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export abstract class ImageBase extends View implements ImageDefinition {
);
}
} else if (value instanceof ImageSource) {
// Support binding the imageSource trough the src property
// Support binding the imageSource through the src property

// This will help avoid cleanup on the actual provided image source in case view gets disposed
this.imageSource = new ImageSource(value.getNativeSource());
Expand Down
18 changes: 15 additions & 3 deletions packages/core/ui/image/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,22 @@ function initializeImageLoadedListener() {
return global.__native(this);
}

onImageLoaded(success: boolean): void {
public handlesImageUpdate(): boolean {
return true;
}

onImageLoaded(bitmapOrDrawable: android.graphics.Bitmap | android.graphics.drawable.Drawable): void {
const owner = this.owner;
if (owner) {
owner.imageSource = new ImageSource(bitmapOrDrawable);
owner.isLoading = false;
}
}

public onImageLoadingError(e: java.lang.Exception): void {
const owner = this.owner;
if (owner) {
owner.imageSource = null;
owner.isLoading = false;
}
}
Expand All @@ -45,7 +58,7 @@ function initializeImageLoadedListener() {
}

export class Image extends ImageBase {
nativeViewProtected: org.nativescript.widgets.ImageView;
declare nativeViewProtected: org.nativescript.widgets.ImageView;

public useCache = true;

Expand Down Expand Up @@ -86,7 +99,6 @@ export class Image extends ImageBase {

if (!value) {
imageView.setUri(null, 0, 0, false, false, true);

return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/ui/image/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { SDK_VERSION } from '../../utils/constants';
export * from './image-common';

export class Image extends ImageBase {
nativeViewProtected: UIImageView;
declare nativeViewProtected: UIImageView;
private _imageSourceAffectsLayout = true;
private _templateImageWasCreated: boolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,16 @@

export namespace Worker {
interface IOnImageLoadedListener {
onImageLoaded(success: boolean): void;
handlesImageUpdate(): boolean;
onImageLoaded(bitmapOrDrawable: globalAndroid.graphics.Bitmap | globalAndroid.graphics.drawable.Drawable): void;
onImageLoadingError(e: java.lang.Exception): void;
}

export class OnImageLoadedListener implements IOnImageLoadedListener {
constructor(implementation: IOnImageLoadedListener);
public onImageLoaded(success: boolean): void;
public handlesImageUpdate(): boolean;
public onImageLoaded(bitmapOrDrawable: globalAndroid.graphics.Bitmap | globalAndroid.graphics.drawable.Drawable): void;
public onImageLoadingError(e: java.lang.Exception): void;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,7 @@ public String toDebugString() {
"backgroundBitmap: " + this.backgroundBitmap + "; " +
"backgroundRepeat: " + this.backgroundRepeat + "; " +
"backgroundPosition: " + this.backgroundPosition + "; " +
"backgroundSize: " + this.backgroundSize + "; "
;
"backgroundSize: " + this.backgroundSize + "; ";
}

@Override
Expand All @@ -879,13 +878,13 @@ public void setBitmap(Bitmap value) {
}

@Override
public void setDrawable(Drawable asyncDrawable) {
drawable = asyncDrawable;
public Drawable getDrawable() {
return drawable;
}

@Override
public Drawable getDrawable() {
return drawable;
public void setDrawable(Drawable value) {
drawable = value;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public void setBitmap(Bitmap value) {
}

@Override
public void setDrawable(Drawable asyncDrawable) {
this.setImageDrawable(asyncDrawable);
public void setDrawable(Drawable value) {
this.setImageDrawable(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

public interface BitmapOwner {
void setBitmap(Bitmap value);

void setDrawable(Drawable asyncDrawable);

void setDrawable(Drawable value);
Drawable getDrawable();

}
Loading
Loading