[TIMOB-25527] ANDROID - Camera picture blob ImageView toImage
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Johnson Joseph |
Assignee | Yordan Banev |
Created | 2017-11-17T12:40:44.000+0000 |
Updated | 2017-11-30T15:27:19.000+0000 |
Description
The Sample Code is here: https://www.dropbox.com/s/j0duneeypnzk3z8/AndroidPictureToImageBug.zip?dl=0
In Android, using Titanium 6.3.0, I cannot toImage an ImageView with an image blob set. I was able to do this in versions prior to 6.3.0. I have attached the sample code.
The end result of the code should be a watermarked camera image. When the toImage() result of the below function is set to the image attribute of an ImageView on the index.xml, the appear appears white or gray with a distorted Label.
function getViewWithLogoOverlay_Android(imgCompressedBlob)
{
//create image with EZSmiles logo
var imgView = Ti.UI.createImageView();
imgView.width = Ti.UI.FILL;
imgView.height = Ti.UI.FILL;
imgView.image = imgCompressedBlob;
imgView.defaultImage = imgCompressedBlob;
imgView.backgroundColor = 'transparent';
imgView.addEventListener("load", function() {
console.log("helllooooo HELLLOOOOO");
});
var imgLogo1 = Ti.UI.createLabel();
imgLogo1.color = "#e2e2e2";
imgLogo1.opacity = .5;
imgLogo1.text = "Powered By";
imgLogo1.font = {
fontFamily: 'Nunito-Regular',
fontSize: 12
};
var imgLogo = Ti.UI.createLabel();
imgLogo.color = "#e2e2e2";
imgLogo.opacity = .5;
imgLogo.text = "EZSmiles";
imgLogo.font = {
fontFamily: 'Nunito-Regular',
fontSize: 24
};
var imgViewColl = Ti.UI.createView();
imgViewColl.width = Ti.UI.SIZE;
imgViewColl.height = Ti.UI.SIZE;
imgViewColl.layout = "vertical";
imgViewColl.left = "10%";
imgViewColl.top = "75%";
imgViewColl.add(imgLogo1);
imgViewColl.add(imgLogo);
var templateView = Ti.UI.createView();
templateView.width = "100%";
templateView.height = "100%";
templateView.add(imgView);
templateView.add(imgViewColl);
return templateView.toImage();
}
[~jjoseph] Hello! Have you had any trouble with the same code on iOS after switching SDK versions ?
No, I don't. It works properly in iOS in 6.3.0
[~jjoseph] Recent changes for layout handling (in 6.2.0) have caused that. It is a conflict between the templateView and ImgView dimensions - both have relative values and templateView does not have a parent to use as a base. Workaround for that would be to set the dimensions of imgView to:
so they are based on the content of the image source. Let me know if that works out for you.
This worked! Thank you for the quick response on this. Very much appreciated.