FirebaseExtended / mlkit-material-android

ML Kit Showcase App with Material Design
Apache License 2.0
491 stars 143 forks source link

The camera is not full screen on Pixel 2 #11

Closed bembem1011 closed 5 years ago

bembem1011 commented 5 years ago
Screen Shot 2019-06-19 at 9 54 13 AM

The camera is not full screen on Pixel 2.

thatfiredev commented 5 years ago

~@bembem1011 I don't think the camera was supposed to be full screen. It's also not full screen on my device. You're probably confused because the demo gifs are showing it full screen, but I believe the gifs were cropped since they only serve for demonstration purposes.~

Update: I misunderstood the issue. I thought you were talking about the status and navigation bars being visible. I hadn't noticed the black bar on the side.

zhouyiself commented 5 years ago

Thanks for the report!

Black bar on the right side is because the aspect ratio (h/w) of camera ration is larger than the screen one and we force it to be fitted into screen. Committed a change to make it always match screen width. https://github.com/firebase/mlkit-material-android/commit/3ae5250df62635bd77be15c2fc7496e8280d38dc

Downside of this strategy is a small portion of camera preview will be invisible to user, but it's supposed to a rare case (common one is the opposite, i.e. camera aspect ratio is smaller) and makes UI look prettier and more symmetric.

lucazin commented 4 years ago

@zhouyiself can you help me ? i cant remove the white space in the bottom of camera.

That white space is for result fragment..and i didnt use it.

nochill-lp commented 4 years ago

@lucazin In order to remove the whitespaces you should make a change in CameraSource file not CameraSourcePreview.

In selectedSizePair method you should get the highest resolution preview, not the one which is in the range from MIN_CAMERA_PREVIEW_WIDTH to MAX_CAMERA_PREVIEW_WIDTH.

I change that if method to continue looping when previewsize.width is smallest than selectedPair.preview.width