mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
load image-source from base64 string added + tests
This commit is contained in:
@@ -47,6 +47,14 @@ export class ImageSource implements definition.ImageSource {
|
||||
return this.android != null;
|
||||
}
|
||||
|
||||
public loadFromBase64(source: string): boolean {
|
||||
if (types.isString(source)) {
|
||||
var bytes = android.util.Base64.decode(source, android.util.Base64.DEFAULT);
|
||||
this.android = android.graphics.BitmapFactory.decodeByteArray(bytes, 0, bytes.length)
|
||||
}
|
||||
return this.android != null;
|
||||
}
|
||||
|
||||
public setNativeSource(source: any): boolean {
|
||||
this.android = source;
|
||||
return source != null;
|
||||
|
||||
Reference in New Issue
Block a user