[jitsi-dev] [PATCH] Android implementation of ResourceManagementService


#1

Hi,

I'm sending a patch that implements Android version of
ResourceManagementService. It takes advantage of automatic Android's image
resolving mechanism. It's intention is to map path requests to Android
drawables, so that each time best image size will be selected basing on
user's screen size/resolution.

The mapping is defined in file /src/resources/images/image_path.properties

Example mapping:

resources/images/protocol/sip/sip16x16.png=sip_logo
resources/images/protocol/sip/sip32x32.png=sip_logo
resources/images/protocol/sip/sip48x48.png=sip_logo
resources/images/protocol/sip/sip64x64.png=sip_logo

In this example requests for different icon sizes will be redirected to
Android drawable "sip_logo" which will be picked from one of folders:
res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi and so on.

androidResourcesManager.patch (15.4 KB)

···

--
Chaeers,
Pawel


#2

Hi,

I've added implementation for other resource types and changed the
architecture a little bit.

Here's how it works now:

Strings - requests are redirected to the strings defined in "strings.xml"
file, but in case the string is not found it will try to look for strings
defined in default string resources.

Dots in keys are replaced with "_", as they can not be used for string
names in "strings.xml". For exmaple the string for key "service.gui.CLOSE"
should be declared as:
<string name="service_gui_CLOSE">Close<string>

Requests for other locales are redirected to corresponding folders as it's
defined in Android localization mechanism.

Colors - mapped directly to those defined in /res/values/colors.xml

Sounds - are stored in res/raw folder. The mappings are read from the
sounds.properties or other SoundPack's provided. Properties should point to
sound file names without the extension. For example:
BUSY=busy (points to /res/raw/busy.wav)

Images - images work the same as sounds except they are stored in drawable
folders.

For parts of Jitsi source that directly refer to image paths it will map
the requests to the drawable Android application resource names, so that we
can take advantage of built-in image size resolving mechanism. The mapping
must be specified in file /src/resources/images/image_path.properties.

Sample entries:
resources/images/protocol/sip/sip16x16.png=sip_logo
resources/images/protocol/sip/sip32x32.png=sip_logo
resources/images/protocol/sip/sip48x48.png=sip_logo
resources/images/protocol/sip/sip64x64.png=sip_logo

I treat this as a temporary hack to make the presence statuses work with
jitsi code base, but I think the requests for paths that are not returned
by the resource service should be removed. It would be better if they would
ask the manager for images by keys like "protocol.sip.icon16".

androidResourcesManager.patch (70.5 KB)

res.zip (133 KB)

···

2013/2/25 Paweł Domas <paweldomas@gmail.com>

Hi,

I'm sending a patch that implements Android version of
ResourceManagementService. It takes advantage of automatic Android's image
resolving mechanism. It's intention is to map path requests to Android
drawables, so that each time best image size will be selected basing on
user's screen size/resolution.

The mapping is defined in file /src/resources/images/image_path.properties

Example mapping:

resources/images/protocol/sip/sip16x16.png=sip_logo
resources/images/protocol/sip/sip32x32.png=sip_logo
resources/images/protocol/sip/sip48x48.png=sip_logo
resources/images/protocol/sip/sip64x64.png=sip_logo

In this example requests for different icon sizes will be redirected to
Android drawable "sip_logo" which will be picked from one of folders:
res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi and so on.

--
Chaeers,
Pawel

--
Regards,
Pawel


#3

Hi Pawel,

Thanks for the patch! It's now committed and ack-ed!

This was an important part of the android implementation base and I'm very happy that we now have it. Are you going to send the presence status patch with regards to this new resource implementation?

Cheers,
Yana

···

On Mar 1, 2013, at 11:31 AM, Paweł Domas <paweldomas@gmail.com> wrote:

Hi,

I've added implementation for other resource types and changed the architecture a little bit.

Here's how it works now:

Strings - requests are redirected to the strings defined in "strings.xml" file, but in case the string is not found it will try to look for strings defined in default string resources.

Dots in keys are replaced with "_", as they can not be used for string names in "strings.xml". For exmaple the string for key "service.gui.CLOSE" should be declared as:
<string name="service_gui_CLOSE">Close<string>

Requests for other locales are redirected to corresponding folders as it's defined in Android localization mechanism.

Colors - mapped directly to those defined in /res/values/colors.xml

Sounds - are stored in res/raw folder. The mappings are read from the sounds.properties or other SoundPack's provided. Properties should point to sound file names without the extension. For example:
BUSY=busy (points to /res/raw/busy.wav)

Images - images work the same as sounds except they are stored in drawable folders.

For parts of Jitsi source that directly refer to image paths it will map the requests to the drawable Android application resource names, so that we can take advantage of built-in image size resolving mechanism. The mapping must be specified in file /src/resources/images/image_path.properties.

Sample entries:
resources/images/protocol/sip/sip16x16.png=sip_logo
resources/images/protocol/sip/sip32x32.png=sip_logo
resources/images/protocol/sip/sip48x48.png=sip_logo
resources/images/protocol/sip/sip64x64.png=sip_logo

I treat this as a temporary hack to make the presence statuses work with jitsi code base, but I think the requests for paths that are not returned by the resource service should be removed. It would be better if they would ask the manager for images by keys like "protocol.sip.icon16".

2013/2/25 Paweł Domas <paweldomas@gmail.com>
Hi,

I'm sending a patch that implements Android version of ResourceManagementService. It takes advantage of automatic Android's image resolving mechanism. It's intention is to map path requests to Android drawables, so that each time best image size will be selected basing on user's screen size/resolution.

The mapping is defined in file /src/resources/images/image_path.properties

Example mapping:

resources/images/protocol/sip/sip16x16.png=sip_logo
resources/images/protocol/sip/sip32x32.png=sip_logo
resources/images/protocol/sip/sip48x48.png=sip_logo
resources/images/protocol/sip/sip64x64.png=sip_logo

In this example requests for different icon sizes will be redirected to Android drawable "sip_logo" which will be picked from one of folders: res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi and so on.

--
Chaeers,
Pawel

--
Regards,
Pawel
<androidResourcesManager.patch><res.zip>

.


#4

Hi Yana,

Thanks ! I'll prepare the update for presence status and send it later
today.

Hi Pawel,

Thanks for the patch! It's now committed and ack-ed!

This was an important part of the android implementation base and I'm

very happy that we now have it. Are you going to send the presence status
patch with regards to this new resource implementation?

Cheers,
Yana

> Hi,
>
> I've added implementation for other resource types and changed the

architecture a little bit.

>
> Here's how it works now:
>
> Strings - requests are redirected to the strings defined in

"strings.xml" file, but in case the string is not found it will try to look
for strings defined in default string resources.

>
> Dots in keys are replaced with "_", as they can not be used for string

names in "strings.xml". For exmaple the string for key "service.gui.CLOSE"
should be declared as:

> <string name="service_gui_CLOSE">Close<string>
>
> Requests for other locales are redirected to corresponding folders as

it's defined in Android localization mechanism.

>
> Colors - mapped directly to those defined in /res/values/colors.xml
>
> Sounds - are stored in res/raw folder. The mappings are read from the

sounds.properties or other SoundPack's provided. Properties should point to
sound file names without the extension. For example:

> BUSY=busy (points to /res/raw/busy.wav)
>
> Images - images work the same as sounds except they are stored in

drawable folders.

>
> For parts of Jitsi source that directly refer to image paths it will

map the requests to the drawable Android application resource names, so
that we can take advantage of built-in image size resolving mechanism. The
mapping must be specified in file
/src/resources/images/image_path.properties.

>
> Sample entries:
> resources/images/protocol/sip/sip16x16.png=sip_logo
> resources/images/protocol/sip/sip32x32.png=sip_logo
> resources/images/protocol/sip/sip48x48.png=sip_logo
> resources/images/protocol/sip/sip64x64.png=sip_logo
>
> I treat this as a temporary hack to make the presence statuses work

with jitsi code base, but I think the requests for paths that are not
returned by the resource service should be removed. It would be better if
they would ask the manager for images by keys like "protocol.sip.icon16".

>
>
> Hi,
>
> I'm sending a patch that implements Android version of

ResourceManagementService. It takes advantage of automatic Android's image
resolving mechanism. It's intention is to map path requests to Android
drawables, so that each time best image size will be selected basing on
user's screen size/resolution.

>
> The mapping is defined in file

/src/resources/images/image_path.properties

>
> Example mapping:
>
> resources/images/protocol/sip/sip16x16.png=sip_logo
> resources/images/protocol/sip/sip32x32.png=sip_logo
> resources/images/protocol/sip/sip48x48.png=sip_logo
> resources/images/protocol/sip/sip64x64.png=sip_logo
>
> In this example requests for different icon sizes will be redirected to

Android drawable "sip_logo" which will be picked from one of folders:
res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi and so on.

···

2013/3/6 Yana Stamcheva <yana@jitsi.org>

On Mar 1, 2013, at 11:31 AM, Paweł Domas <paweldomas@gmail.com> wrote:
> 2013/2/25 Paweł Domas <paweldomas@gmail.com>
>
>
> --
> Chaeers,
> Pawel
>
> --
> Regards,
> Pawel
> <androidResourcesManager.patch><res.zip>

--
Regards,
Pawel