XML button layout tutorial

Basic XML scheme

A basic button layout has the following XML elements and attributes:

<buttonslayout>
 <pages>
  <page orientation="portrait" buttons_per_row="4">
   <buttons>
    <button label="Button 1">COMMAND1</button>
    <button label="Button 2">COMMAND2</button>
    ...
   </buttons>
  </page>
  <page orientation="landscape" buttons_per_row="8">
   <buttons>
    <button label="Button 1">COMMAND1</button>
    <button label="Button 2">COMMAND2</button>
    ...
   </buttons>
  </page>
 </pages>
</buttonslayout>

Pages in “portrait” or “landscape” orientation can be added as much as you like in any order.

Optional <page> attributes

The following attributes can be added to a page element:

  • Attribute name: Give the page a name with e.g. name=”Media”.
  • Attribute buttonheight_scale: Floating point scale factor which defines the height of the buttons in relation to the width (the button width depends on your display size and the mandatory buttons_per_row attribut). Can be in the range of 0.1 .. 10. Default value is 0.7.

Optional <button> attributes

The following attributes can be added to a button element:

  • Attribute seperator: Boolean value (true/false) to add a horizontal seperator before this button.
  • Attribute newrow: Boolean value (true/false) to let this button start a new row in the layout.
  • Attribute skip: Integer value to define how many button elements are left empty before this one in the current row.
  • Attribute span: Integer value to set the horizontal span of the button.
  • Attribute comment: Attach a comment to the button.
  • Attribute iconid: Show the icon with the corresponding ID instead of the text label.
  • Attribute style: Give the button a different style, the following styles are available: “dark” (the default style), “light” and “red”

Command definition

For definition of commands please refer to the official Denon® control protocol description.

Command chaining

Commands can be chained by using the underscore character like this:

<button label="Button 1">COMMAND1_COMMAND2_COMMAND3</button>

A single undescore introduces a pause of 250ms between the commands. You can define the time span of the pause by using multiple underscore characters. Each consecutive underscore doubles the time span. In the following example the time between COMMAND1 and COMMAND2 is 500ms (2 underscore characters) and between COMMAND2 and COMMAND3 1s (3 underscore characters):

<button label="Button 1">COMMAND1__COMMAND2___COMMAND3</button>

To get a better understanding of the overall XML layout definition take a look at the XML code of the built-in default layout

Icon ID table

The following table shows the mapping of icon IDs to the set of icons currently available (from standard android action bar icon pack).

Value Icon
0 No icon
1 Fast forward
2 Skip next
3 Pause
4 Play
5 Skip previous
6 Repeat
7 Rewind
8 Shuffle
9 Stop
10 Star (Favorites)
11 Accept
12 Back
13 Cancel
14 Cursor down
15 Arrow right
16 Cursor left
17 Arrow left
18 Cursor right
19 Cursor up
20 Mute off
21 Mute on

2 comments

  1. Soooo Buddy, where is the section where it talks about how you import your custom XML layout because i have deleted all pages i did not need and kept the default written basically the same and when i go to import and navigate to select the file it wont let me use the XML file, so if there is some other thing i have to do it would be nice to know what the heck i have to do…..

    1. what is the message after you hit import. The xml parser checks the xml structure and gives an error message…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: