load image-source from base64 string added + tests

This commit is contained in:
Vladimir Enchev
2015-05-12 14:20:23 +03:00
parent f0abe66396
commit 97cfeb541c
5 changed files with 66 additions and 1 deletions

View File

@@ -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;