You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Frank Dahmen <fr...@dahmenia.de> on 2014/02/06 23:02:43 UTC

extend RuntimeDPIProvider

Hi,

when extending mx.core.RuntimeDPIProvider and overriding
public function get runtimeDPI():Number

it seems that is has to return one of the DPIClassification constants,
any other number than 120,160,240,320,480,640 is ignored

is that true?

the thing is that the htc one max is reporting 480
but it is 373 (from the specs)

isn't it possible to return exact that number in runtimeprovider?

thanks

Re: extend RuntimeDPIProvider

Posted by Frank Dahmen <fr...@dahmenia.de>.
it is set to 240 (screenDPI of my device)
it also looks good on other devices like a samsung note tablet and a 
very old samsung ixyzxyz phone e.g.

it is just the new device of my customer (for now...)
but i will try to return 320 as runtimeDPI on that device
( just found a good class to identify the device by the way: 
https://github.com/funky-monkey/Android-Native-Device-Info)

and than try to adjust the components which have fixed pixel sizes a bit


Am 07.02.2014 00:21, schrieb Justin Mclean:
> Hi,
>
> What is applicationDPI set to? In my experience I found it best not to set this but with seeing you application or it's code it's hard to know what advice to give.
>
> Justin


Re: extend RuntimeDPIProvider

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

What is applicationDPI set to? In my experience I found it best not to set this but with seeing you application or it's code it's hard to know what advice to give.

Justin

Re: extend RuntimeDPIProvider

Posted by Frank Dahmen <fr...@dahmenia.de>.
hi,

this is what I'm doing
but as the real dpi is 373 i have to return 320 for that device (instead 
of 480, which would be without own provider)

but still 373 and 320 is a not to small difference


Am 06.02.2014 23:59, schrieb Justin Mclean:
> Hi,
>
> One way around this issue is to provide you own runtime DPI provider. [1] Just make sure it returns one of the known DPI buckets.
>
> Justin
>
> 1. http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c682e5a9412cf5976c17-8000.html#WS19f279b149e7481c-2a25e9b212d622ff5e8-8000


Re: extend RuntimeDPIProvider

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

One way around this issue is to provide you own runtime DPI provider. [1] Just make sure it returns one of the known DPI buckets.

Justin

1. http://help.adobe.com/en_US/flex/mobileapps/WS19f279b149e7481c682e5a9412cf5976c17-8000.html#WS19f279b149e7481c-2a25e9b212d622ff5e8-8000

Re: extend RuntimeDPIProvider

Posted by Frank Dahmen <fr...@dahmenia.de>.
Ok, thanks, this is what i thought.

too bad that 373 is far away from 320 and 480
as the App has an applicationDPI set (no fluid layout etc.)

is there any other option than to adjust everything for that device (as 
it's the main customers one)?




Am 06.02.2014 23:42, schrieb Justin Mclean:
> Hi,
>
> Capabillities.screenDPI should be a number close to the actually DPI (but some devices it may be wrong) not one of the dpi buckets.
>
> The runtimeDPI method MUST return one of the DPI buckets not the actual dpii or all sort of odd things can occur.
>
> Justin
>


Re: extend RuntimeDPIProvider

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Capabillities.screenDPI should be a number close to the actually DPI (but some devices it may be wrong) not one of the dpi buckets.

The runtimeDPI method MUST return one of the DPI buckets not the actual dpii or all sort of odd things can occur.

Justin


Re: extend RuntimeDPIProvider

Posted by Frank Dahmen <fr...@dahmenia.de>.
the htc one max is reporting 480 as Capabillities.screenDPI
but pixel density is 373ppi (as read in the web)
it's not my device but a customer's one

on my own device the Capabillities.screenDPI reports 240 which is correct
but to test, when i return a random number like 532 from
public function get runtimeDPI():Number

nothing changes, but when i set it e.g. to 640 (which is one of the 
constants) the layout changes dramatically

is it possible that "non-constant" values are ignored when scaling?




Am 06.02.2014 23:15, schrieb Lee Burrows:
> Hi
>
> The runtimeDPIProvider rounds the true DPI number up/down so it 
> matches one of 120,160...640
>
> However, if your device is 373 (and not a typo), i would expect the 
> result to be 320, not 480 (as 320 is closest to the true value).
>
> You could override the class to return the true value, but the Flex 
> framework relies on these discrete dpi values for determining the 
> skins/css styles to use, so you may get unexpected results by allowing 
> any value to be returned.
>
>
>
> On 06/02/2014 22:02, Frank Dahmen wrote:
>> Hi,
>>
>> when extending mx.core.RuntimeDPIProvider and overriding
>> public function get runtimeDPI():Number
>>
>> it seems that is has to return one of the DPIClassification constants,
>> any other number than 120,160,240,320,480,640 is ignored
>>
>> is that true?
>>
>> the thing is that the htc one max is reporting 480
>> but it is 373 (from the specs)
>>
>> isn't it possible to return exact that number in runtimeprovider?
>>
>> thanks
>>
>
>


Re: extend RuntimeDPIProvider

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Capabilities.screenDPI is passed to  classifyDPI  to work out what DPI bucket you are in. I check if Capabilities.screenDPI  is returning what you expect. I expect 373 to be placed in the 320 bucket.

    mx_internal static function classifyDPI(dpi:Number):Number
    {
	if (dpi <= 140)
		return DPIClassification.DPI_120;
		
        if (dpi <= 200)
            return DPIClassification.DPI_160;
        
        if (dpi <= 280)
            return DPIClassification.DPI_240;
		
	if (dpi <= 400)
		return DPIClassification.DPI_320;
		
	if (dpi <= 560)
		return DPIClassification.DPI_480;
        
        return DPIClassification.DPI_640;
    }

Thanks,
Justin

Re: extend RuntimeDPIProvider

Posted by Lee Burrows <su...@leeburrows.com>.
Hi

The runtimeDPIProvider rounds the true DPI number up/down so it matches 
one of 120,160...640

However, if your device is 373 (and not a typo), i would expect the 
result to be 320, not 480 (as 320 is closest to the true value).

You could override the class to return the true value, but the Flex 
framework relies on these discrete dpi values for determining the 
skins/css styles to use, so you may get unexpected results by allowing 
any value to be returned.



On 06/02/2014 22:02, Frank Dahmen wrote:
> Hi,
>
> when extending mx.core.RuntimeDPIProvider and overriding
> public function get runtimeDPI():Number
>
> it seems that is has to return one of the DPIClassification constants,
> any other number than 120,160,240,320,480,640 is ignored
>
> is that true?
>
> the thing is that the htc one max is reporting 480
> but it is 373 (from the specs)
>
> isn't it possible to return exact that number in runtimeprovider?
>
> thanks
>


-- 
Lee Burrows
ActionScripter