durka / HallMonitor

clean room Galaxy S4 View Cover driver
Apache License 2.0
45 stars 21 forks source link

Add camera control #19

Closed Wallace0 closed 10 years ago

Wallace0 commented 10 years ago

I want to implement a basic camera capability for whilst the cover is closed - press a button to get an image preview showing in the windowed area, then press another button to take a photo. I've created a new 'camera' branch for this.

habeIchVergessen commented 10 years ago

i included your camera stuff to the TestInput repository (read here).

durka commented 10 years ago

This works well. Except for two things:

Wallace0 commented 10 years ago

Yep, I agree about the preview window - I think we could get away with sizing it a bit beyond the window space, as it's mainly the centre of the view that you are interested in.

And yep, I just pilfered someone else's code for the saving location (http://stackoverflow.com/questions/9853351/building-my-own-camera-application-automatically-capture-the-image) - we can definitely look to tweak that.

Otherwise, it also isn't saving the images the right way up so that needs addressing, and I introduced a bug with the media player control along the way so that also needs looking into. I should get a chance on the 2nd to have another look, but feel free to sort the above out before then! :0)

Happy New Year!! :0)

durka commented 10 years ago

Happy new year! I dove in and ended up rearranging more than I meant to -- I put the layout into XML and moved the actual taking of the picture into CameraPreview. I'm still stumped as to how to get the photos showing up at the beginning of the Gallery as if they were new camera photos. For me, they show up at the end of the Gallery since the filename is different.

durka commented 10 years ago

You're right, there's some weird bug with saving the photo - Android has some strange ideas about the orientation.

Wallace0 commented 10 years ago

Managed to get the photos to the right end of the gallery - needed to add date metadata to them. I've also switched it to a better auto focus mode, and downsized the preview so it has a decent aspect ratio. Pictures are taken the right way up if you have the phone in portrait orientation - I've not managed to get it to work correctly with landscape orientation (yet!).

durka commented 10 years ago

The problem is that rotation is disabled on DefaultActivity, so orientation changes are not received and getRotation() will always return 0.

durka commented 10 years ago

Fixed using OrientationEventListener.

Edit: um, except that viewing the resulting image crashes the Gallery... that's a new one... Edit 2: don't save images with orientation greater than 360!

durka commented 10 years ago

Gallery bug reported.