incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Brooks <mich...@michaelbrooks.ca>
Subject Re: [PROPOSAL] Orientation Interface
Date Mon, 24 Oct 2011 20:27:51 GMT
Jesse,

I like the proposal.

I am curious if we should represent the `supportedOrientations` as an object
instead of array. However, I can't think of many advantages of using an
object over an array.

Should we consider namespacing orientation under PhoneGap as
`PhoneGap.orientation`? Then the support orientations would be represented
as `PhoneGap.orientation.supports = [0, 180];`. I can see more orientation
settings emerging in the future. For example, future devices may have a
fluid orientation (rotate an image to always be upright, regardless of how
you hold the device). Namespacing orientation would allow us to add this
option more cleanly.

Looks good,
Michael

On Mon, Oct 24, 2011 at 12:22 PM, Jesse <purplecabbage@gmail.com> wrote:

> This proposal is intended to be a discussion, so if you have strong
> feelings
> about anything here, or any recommendations or corrections, this thread
> should be the outlet for that.  Upon reaching some general consensus, and
> having the concept sit with everyone for a bit, we will put it to a vote.
>
> The proposal (in brief):
> Add a JavaScript interface to allow developers to specify at runtime what
> orientations they allow.
>
> A simple use-case :
>
> - an app with 2 views, managed by manipulating the DOM, and showing/hiding
> elements
>
> View 1 is a list of flickr images with a thumbnail, title, date + author
> info.
> This view should not re-orient and should always be displayed in portrait.
> Selecting an item shows View2.
>
> View 2 is an image view of the selected image
> User should be allowed to freely re-orient the device to their pleasing,
> for
> viewing the picture.
> Clicking a close button returns the user to View1
>
>
> The current implementation:
>
> - all major CallBack devices support orientation, but the method that you
> use to specify which orientation your app will allow are different.
> - supported orientations are uniformly mapped on devices to 0,-90,90,180
> - orientations are a build time setting, and there is no way to change what
> you support at runtime.
>
>
> iOS
> ----
>
>  - plist specifies supported orientations
>
> Android
> ----
>
>  - manifest.xml specifies
> <application>
>    <activity android:configChanges="orientation|keyboardHidden"> ...
> </application>
>
> BB WebWorks
> ----
>
> <autoOrients>false</autoOrients>
> <aspectRatio>landscape</aspectRatio>
>
> WP7
> ----
>
> <phone:PhoneApplicationPage
>  SupportedOrientations="Portrait" Orientation="Portrait"
>  ... ></phone:PhoneApplicationPage>
>
> The proposal (in detail):
>
> 1. All devices should support a runtime getter/setter on the static JS
> PhoneGap object.
> 2. The 'property' should be called supportedOrientations and should be an
> array of integer values.
> ex.
>    // allow the device to orient to Portrait or PortraitUpsidedown
>    PhoneGap.supportedOrientations = [0,180];
>
> 3. Orientation events should NOT be sent when the device is moved to an
> unsupported orientation.
> 4. supportedOrientations should be considered to be in order of preference.
> 5. setting supportedOrientations to a value that would preclude the current
> physical device orientation should trigger an immediate orientation change
> and subsequent change event.
> ex.
>    // Device is currently in landscape left
>    PhoneGap.supportedOrientations = [0,180];
>    // result : Native view reorients to Portrait and triggers orientation
> change event.
>
>
>
> Cheers,
>   Jesse
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message