You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Joe Bowser <bo...@gmail.com> on 2012/10/02 23:15:09 UTC

[Android] Preview and one activity too far?

Hey

I'm still hacking on the Camera UI, trying to get it looking better,
and I'm wondering if we should implement Preview.  The easiest way of
doing this on Android is by having a preview activity and allowing the
user to save or cancel, which would send the user back to the Camera
Activity.  The downside of this approach is that we have to add
another activity to the manifest just to view the image that was
produced by the Camera, and this is one more thing that would break
when we introduce the new camera.

How do people feel about implementing a Preview Activity? We could
avoid it, but I think that this would be more code, since we'd have to
hide the Surface View and show the UI underneath somehow.

Any thoughts?

Joe

Re: [Android] Preview and one activity too far?

Posted by Filip Maj <fi...@adobe.com>.
Joe I'm interested in going through what a plugin like that would look
like, gather more use cases for the plugin.xml spec + cli tools

On 10/3/12 7:17 AM, "Andrew Grieve" <ag...@chromium.org> wrote:

>Sounds like a great test of doing things that other plugin developers will
>have to do. If it's painful for us, then it will be more painful for
>third-party plugins. If it's painful for us, we should fix it. Maybe this
>is an example of something that will be made easier with the command line
>tools, but not before?
>
>
>On Tue, Oct 2, 2012 at 5:15 PM, Joe Bowser <bo...@gmail.com> wrote:
>
>> Hey
>>
>> I'm still hacking on the Camera UI, trying to get it looking better,
>> and I'm wondering if we should implement Preview.  The easiest way of
>> doing this on Android is by having a preview activity and allowing the
>> user to save or cancel, which would send the user back to the Camera
>> Activity.  The downside of this approach is that we have to add
>> another activity to the manifest just to view the image that was
>> produced by the Camera, and this is one more thing that would break
>> when we introduce the new camera.
>>
>> How do people feel about implementing a Preview Activity? We could
>> avoid it, but I think that this would be more code, since we'd have to
>> hide the Surface View and show the UI underneath somehow.
>>
>> Any thoughts?
>>
>> Joe
>>


Re: [Android] Preview and one activity too far?

Posted by Andrew Grieve <ag...@chromium.org>.
Sounds like a great test of doing things that other plugin developers will
have to do. If it's painful for us, then it will be more painful for
third-party plugins. If it's painful for us, we should fix it. Maybe this
is an example of something that will be made easier with the command line
tools, but not before?


On Tue, Oct 2, 2012 at 5:15 PM, Joe Bowser <bo...@gmail.com> wrote:

> Hey
>
> I'm still hacking on the Camera UI, trying to get it looking better,
> and I'm wondering if we should implement Preview.  The easiest way of
> doing this on Android is by having a preview activity and allowing the
> user to save or cancel, which would send the user back to the Camera
> Activity.  The downside of this approach is that we have to add
> another activity to the manifest just to view the image that was
> produced by the Camera, and this is one more thing that would break
> when we introduce the new camera.
>
> How do people feel about implementing a Preview Activity? We could
> avoid it, but I think that this would be more code, since we'd have to
> hide the Surface View and show the UI underneath somehow.
>
> Any thoughts?
>
> Joe
>

Re: [Android] Preview and one activity too far?

Posted by Joe Bowser <bo...@gmail.com>.
Hey

I added the code for the Preview.  There's still issues with the
preview looking distorted, and I'm still tweaking it, but we're close
to getting the features matching up with the pre-existing camera.  I
was able to dodge the bullet of creating a 2nd activity by hiding and
showing Android UI elements in Java.  It's something that I remembered
done in the ADK example that Google provided, so I think that's an
acceptable fix.

The code is still here: https://github.com/infil00p/callback-android/tree/camera

I'm going to hold off on coding the layouts so that people don't have
to copy over XML for now, however that's something that I definitely
want to do, since we don't have a solid way of dealing with external
layouts, or at least one that I understand that can avoid collisions.
(i.e. If org.apache.cordova.R has an resource with an ID of 7 and
com.myapp.R has a resource with an ID of 7, which resource wins?)

Joe

On Wed, Oct 3, 2012 at 1:21 PM, Joe Bowser <bo...@gmail.com> wrote:
> On Wed, Oct 3, 2012 at 1:05 PM, Simon MacDonald
> <si...@gmail.com> wrote:
>> I kinda think we need a preview. Here is some new plugins that have
>> just been submitted that do what we are looking to do:
>>
>> https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundCamera
>> https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundGallery
>>
>
> These plugins are REALLY barebones, and look very similar to the
> Camera code that you wrote earlier.  There's no Auto Focus or Zoom on
> these cameras, both of which are currently working on my branch.
>
> https://github.com/infil00p/callback-android/tree/camera
>
> And here's a screenshot from an HTC One X showing that we need assets:
>
> http://www.flickr.com/photos/52655207@N00/8051510525/in/photostream
>
>> One of my other thoughts about this endeavour is that it is a lot more
>> work than we first thought. I don't see this making 2.2.0 as we'll
>> need to test the hell out of it before replacing the current camera.
>>
>
> Agreed. Hacking together a simple camera definitely has some feature
> creep.  There's also the fact that we have to test it across a wide
> range of devices, which we've been doing here, but this is basically
> regular Native Android development at this point.  That being said,
> I'm working on putting Preview in the same activity as the Camera
> because I don't think it needs a 2nd activity, and I don't like the
> extra intent passing after hacking on it earlier.  I'm hoping to get
> the preview working.  After that, we're going to have to deal with
> other state issues, namely what happens when the phone goes to sleep.
>
> Then there's the whole transcribing of the layouts to code so that we
> don't have to get users to pass around another XML layout or do things
> like have scripts add Java includes. (I think our scripts write enough
> Java code already)
>
> Joe

Re: [Android] Preview and one activity too far?

Posted by Joe Bowser <bo...@gmail.com>.
On Wed, Oct 3, 2012 at 1:05 PM, Simon MacDonald
<si...@gmail.com> wrote:
> I kinda think we need a preview. Here is some new plugins that have
> just been submitted that do what we are looking to do:
>
> https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundCamera
> https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundGallery
>

These plugins are REALLY barebones, and look very similar to the
Camera code that you wrote earlier.  There's no Auto Focus or Zoom on
these cameras, both of which are currently working on my branch.

https://github.com/infil00p/callback-android/tree/camera

And here's a screenshot from an HTC One X showing that we need assets:

http://www.flickr.com/photos/52655207@N00/8051510525/in/photostream

> One of my other thoughts about this endeavour is that it is a lot more
> work than we first thought. I don't see this making 2.2.0 as we'll
> need to test the hell out of it before replacing the current camera.
>

Agreed. Hacking together a simple camera definitely has some feature
creep.  There's also the fact that we have to test it across a wide
range of devices, which we've been doing here, but this is basically
regular Native Android development at this point.  That being said,
I'm working on putting Preview in the same activity as the Camera
because I don't think it needs a 2nd activity, and I don't like the
extra intent passing after hacking on it earlier.  I'm hoping to get
the preview working.  After that, we're going to have to deal with
other state issues, namely what happens when the phone goes to sleep.

Then there's the whole transcribing of the layouts to code so that we
don't have to get users to pass around another XML layout or do things
like have scripts add Java includes. (I think our scripts write enough
Java code already)

Joe

Re: [Android] Preview and one activity too far?

Posted by Simon MacDonald <si...@gmail.com>.
I kinda think we need a preview. Here is some new plugins that have
just been submitted that do what we are looking to do:

https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundCamera
https://github.com/phonegap/phonegap-plugins/tree/master/Android/ForegroundGallery

One of my other thoughts about this endeavour is that it is a lot more
work than we first thought. I don't see this making 2.2.0 as we'll
need to test the hell out of it before replacing the current camera.

Simon Mac Donald
http://hi.im/simonmacdonald


On Tue, Oct 2, 2012 at 5:15 PM, Joe Bowser <bo...@gmail.com> wrote:
> Hey
>
> I'm still hacking on the Camera UI, trying to get it looking better,
> and I'm wondering if we should implement Preview.  The easiest way of
> doing this on Android is by having a preview activity and allowing the
> user to save or cancel, which would send the user back to the Camera
> Activity.  The downside of this approach is that we have to add
> another activity to the manifest just to view the image that was
> produced by the Camera, and this is one more thing that would break
> when we introduce the new camera.
>
> How do people feel about implementing a Preview Activity? We could
> avoid it, but I think that this would be more code, since we'd have to
> hide the Surface View and show the UI underneath somehow.
>
> Any thoughts?
>
> Joe