[TIMOB-14764] Android: Camera preview not full screen width when using overlay
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-05-28T16:05:13.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | Release 3.3.0 |
Components | Android |
Labels | android, module_media, qe-closed-3.3.0, qe-testadded |
Reporter | Alex Bernier |
Assignee | Pedro Enrique |
Created | 2013-08-06T01:26:53.000+0000 |
Updated | 2014-07-26T04:55:16.000+0000 |
Description
*Problem*
When using an overlay with showCamera, the preview (where you see what the camera sees) doesn't stretch to the whole width of the screen. There is a ~5-10dp black bar on the left and right side of the preview screen.
The overlay view, however, does takes up the entire width of the screen.
*Test case*
Notice the red bar will be the entire width of the screen and the preview will stop short on the left and right.
var win = Ti.UI.createWindow({
backgroundColor : "#FFF"
});
var overlay = Ti.UI.createView({
backgroundColor : "transparent",
height : Ti.UI.FILL,
width : Ti.UI.FILL
});
overlay.add(Ti.UI.createView({
backgroundColor : "red",
height : 20,
width : Ti.UI.FILL
}));
win.addEventListener('click', function() {
Titanium.Media.showCamera({
overlay : overlay,
saveToPhotoGallery : false,
allowEditing : false,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
showControls : false,
autohide : false
});
});
win.open();
This dupe ticket can be closed, apologies: TC-2697
Keeping this one open, closed TC-2697.
Tested on 3.2.0.v20131018154951 with the following code (front and back camera):
black border still visible in both cameras and saved images is stretched
Make sure that we use the entire screen so that there is a better chance of screen matching the camera aspect ratio. Also fixed the logic in finding the optimal preview size by looking for the supported camera size with closest aspect ratio match. https://github.com/appcelerator/titanium_mobile/pull/4815
PR Merged into master
Verified the fix with: OSX: 10.9.2 Xcode: 5.1.1 Appcelerator Studio: 3.2.3.201404162038 SDK: 3.3.0.v20140418162516 acs:1.0.14 alloy:1.3.1 npm:1.3.2 titanium:3.2.3-beta2 titanium-code-processor:1.1.1-alpha Device: Galaxy Nexus 4.1.1