Skip to content

Commit 4b9a808

Browse files
committed
chore: android remove deprecated methods
1 parent 88487a2 commit 4b9a808

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/image.android.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,16 @@ export class Img extends ImageBase {
500500
if (src) {
501501
let drawable: android.graphics.drawable.BitmapDrawable;
502502
if (src instanceof ImageSource) {
503-
drawable = new android.graphics.drawable.BitmapDrawable(src.android as android.graphics.Bitmap);
503+
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), src.android as android.graphics.Bitmap);
504504
this.updateViewSize(src.android);
505505
} else if (isFontIconURI(src as string)) {
506+
506507
const fontIconCode = (src as string).split('//')[1];
507508
if (fontIconCode !== undefined) {
508509
// support sync mode only
509510
const font = this.style.fontInternal;
510511
const color = this.style.color;
511-
drawable = new android.graphics.drawable.BitmapDrawable(ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android as android.graphics.Bitmap);
512+
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
512513
}
513514
}
514515
if (drawable) {
@@ -779,13 +780,13 @@ export class Img extends ImageBase {
779780
if (typeof path === 'string') {
780781
if (isFileOrResourcePath(path)) {
781782
if (path.indexOf(RESOURCE_PREFIX) === 0) {
782-
drawable = this.getDrawableFromResource(path);
783+
return this.getDrawableFromResource(path); // number!
783784
} else {
784785
drawable = this.getDrawableFromLocalFile(path);
785786
}
786787
}
787788
} else {
788-
drawable = new android.graphics.drawable.BitmapDrawable(path.android);
789+
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), path.android);
789790
}
790791

791792
return drawable;

0 commit comments

Comments
 (0)