Theming the Ribbon Screen icon

This will allow you to use multiple icon sets for different platforms. When retrieving the preferred icon set descriptor, there will be several checks and fallbacks. The order of the checks and results are as follows:

  1. [preferredIconWidth]x[preferredIconHeight]
  2. "47x47" (if exists and the preferred width and height are >= to 47)
  3. "36x36" (if exists and the preferred width and height are >= to 36)
  4. "default" (if exists)
  5. The first available icon set (if the list is not empty)
  6. null (oops)

Directions

  1. Place the icons into your theme directory
  2. Remove the icon element (if it exists) from the entry point in the pom.xml
    • Update
      You may just want to default to a specific icon since the theme icons will not be used until your application is running... which can be a problem if you do not have it set to load at startup
    • <icon>img/icon.png</icon>
  3. Update your theme xml
    • <application>
          <name>Bridge</name>
          <icon-sets>
              <icon-set name="default">
                  <normal>icon-36.png</normal>
                  <rollover>iconr-36.png</rollover>
              </icon-set>
              <icon-set name="47x47">
                  <normal>icon-47.png</normal>
                  <rollover>iconr-47.png</rollover>
              </icon-set>
              <icon-set name="80x80">
                  <normal>icon-80.png</normal>
                  <rollover>iconr-80.png</rollover>
              </icon-set>
          </icon-sets>
      </application>
  4. Update your Application.java
    • Update
      This has been moved to ManagedUiApplication.lifecycleInitialize(). Existing applications already override this method and set the icons, so if you choose to use this, then you will have to alter your Application.java still. Except all you will have to do is call super.lifecycleInitialize() or remove the method override.
      ThemeDescriptor themeDescriptor = getThemeManager().getThemeDescriptor( null );
      IconSetDescriptor iconSetDescriptor = themeDescriptor.getApplication().getPreferredIconSetDescriptor();
      
      String imagePath = "/theme/" + themeDescriptor.getId() + "/";
      String normalImage = imagePath + iconSetDescriptor.getNormal();
      String rolloverlImage = imagePath + iconSetDescriptor.getRollover();
      
      MobileDevice.instance().setIcons( getClass(), normalImage, rolloverlImage );

Labels

theme theme Delete
blackberry blackberry Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© 2011 Metova, Inc.