In the past I have have had issues with accurate calculation of screen
sizes/diagonals from AIR on android with certain devices.
I definiitely recall issues with this on kindle devices where we had a
cutoff of 7 inches for tablet layout vs. phone layout and the actionscript
value was not accurate leading to a phone classification when the device
was 7 inches on the diagonal. The actionscript Capabilities screenDPI value
was wrong and led to a lower diagonal result than was actually the case.

I ended up writing an extension to get the android values for x_dpi and
y_dpi from this android class:
http://developer.android.com/reference/android/util/DisplayMetrics.html:

Once I had these in actionscript, all was well.




Greg Dove
Dove Software Development Ltd
http://greg-dove.com

On Thu, Mar 5, 2015 at 2:21 PM, kevin.godell <[email protected]> wrote:

> Your best option might be to use some css and target the screen diagonal
> size:
>
> @media (-flex-min-device-diagonal: 6in) {
>
>         s|ActionBar s|Group#titleGroup s|Label.title {
>                 fontSize : 40;
>         }
> }
>
> Or maybe you can create a top level variable and calculate the screen
> diagonal when the app is created, and use that value to derive a multiplier
> that you can use to size some objects with properties that are not affected
> by css:
>
> Number(MediaQueryParser.instance.flexDeviceDiagonal)/Capabilities.screenDPI
> gives the diagonal inches of screen. I used mediaqueryparser because it
> will
> have correct size even when debugging on computer.
>
> And yet another option would be to use this screen diagonal size and set
> some custom states like phonePortrait or phabletLandscape to further layout
> control of the content.
>
> Personally, I incorporate these 3 techniques in my current project that is
> designed for android and ios devices, including phone, phablet, and tablet.
>
>
>
> -----
> .
> --
> View this message in context:
> http://apache-flex-users.2333346.n4.nabble.com/Use-styles-for-another-applicationDPI-possible-tp9732p9745.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to