Custom graphics on Android

To replace the built-in graphics on the DME 4.x client for Android with graphics of your own, you need to create the following folders in the directory specified in the Local data directory field. This path is specified in the Server tab > Server configuration > Data > Data storage directories. See Data.

/whitelabel/android/drawable-ldpi/ - for low-resolution images - at least 426dp x 320dp

/whitelabel/android/drawable-mdpi/ - for medium-resolution images - at least 470dp x 320dp

/whitelabel/android/drawable-hdpi/ - for high-resolution images - at least 640dp x 480dp

/whitelabel/android/drawable-xhdpi/ - for extra high-resolution images - at least 960dp x 720dp

For instance, if the path specified in the Local data directory field is /usr/local/jboss-4.3.0.GA/server/base/filestore/, then you must open a terminal and create the following folder for low-resolution images:

/usr/local/jboss-4.3.0.GA/server/base/filestore/whitelabel/android/drawable-ldpi/

-and so on. Note that you must not change the value of the Local data directory field - the value in this field is for your information only so you know where to create the graphics folders.

Different Android devices have different screen resolutions. The screen resolution of a device can usually be found on the manufacturer's homepage, but this is not always the case. We recommend that you create graphics matching all resolutions. The DME client will automatically pick the one that fits each device.

In each of the directories specified above, place images with the following names:

background_desktop.9.png - Desktop and Login screen background in portrait mode

background_desktop_landscape.9.png - Desktop and Login screen background in landscape mode

background_swipe.9.png - Unlock pattern (Swipe) screen (portrait mode only)

The Google Android specifications require that you use png graphics, which are formatted using a so-called 9-patch process. This is a mechanism that allows the Android OS to stretch and shrink the image without distorting it. The result of this process is a .9.png file. To create a 9-patch file, you draw straight, 1-pixel, black lines where Android is allowed to stretch the image, and save the file as <filename>.9.png. An explanation of the process can be found on the Internet, for instance here: http://radleymarx.com/blog/simple-guide-to-9-patch/. Google has a tool for doing this included in the Android SDK: http://developer.android.com/tools/help/draw9patch.html.

What size should the images be? The 9-patch mechanism will automatically scale the images according to your specifications. Some areas can be stretched, and some areas will be padded. In principle, you can create just one image which you use for all screen resolutions and screen sizes, and place the image in each of the folders mentioned above. However, for greater flexibility you can create a different image per screen resolution. A description of screen resolutions and the dp unit can be found in the Android developer's guide.

When you have created the .9.png files, they must be compiled. The built-in graphics in DME are already compiled; custom graphics must be pre-compiled as well before they can be used in an Android application. To compile the images, we recommend that you use pngMagic by CuriousTech, which is freely available on the Internet. Instructions can be found at their website. We have compiled a small guide to using the pngMagic tool - see the next section.

Once the graphics have been created, patch-9 converted, and compiled, place them in their respective folders. The Android client will check for these graphics when the user logs in (but max. once a day).

Next topic

Using pngMagic