»
S
I
D
E
B
A
R
«
Using The Sidebar In Your Apps
12 January 2010 by Joshua Jonah

Hi my name is Joshua, I am a boxee and all around Python developer who will now be contributing to gonzee.tv. I have a background in web application and social networking development, but I’m also a huge HTPC nut. Boxee is the perfect middle ground. I hope my articles help you out in times of need.

Without further ado…

The sidebar is used in the factory boxee sections. It’s on the side and lets you sort, filter, and otherwise manipulate the list in the factory boxee sections.

Boxee Movies section with sidebar visible</code>

The sidebar would be a great place to put things like preferences, sorting, and less used items within an app. The information is out of the way, but still in a comfortable place that is consistent throughout the boxee interface.

I’ve been wanting to use this in my own apps to really pull the experience together, so I started tearing apart the boxee skins. There are many “classes” and other things in the boxee skin files that you can use in your own apps to save code and increase consistency. I would recommend any developer to take a look.

I’ve recovered the base code required to have the sidebar working on your app:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<control type="group" id="9000">
    <include>BrowseListsAnimation</include> # This is required for some reason.
 
    # Put your main app xml here.
    #
    # For example a list:
    <control type="list" id="600">
        <description>Media items</description>
        <posx>40</posx>
        <posy>160</posy>
        <width>600</width>
        <height>520</height>
        <onleft>8000</onleft> # Notice pushing left activates the sidebar from this list.
        <onright>-</onright>
        <onup>200</onup>
        <ondown>-</ondown>
        <scrolltime>200</scrolltime>
        <pagecontrol>-</pagecontrol>
        <orientation>vertical</orientation>
        <itemlayout width="600" height="60">
            <control type="label">
                <posx>0</posx>
                <posy>0</posy>
                <width>560</width>
                <height>40</height>
                <font>font28</font>
                <align>left</align>
                <label>$INFO[ListItem.Label]</label>
                <textcolor>grey</textcolor>
            </control>
        </itemlayout>
        <focusedlayout width="1280" height="60">
            <control type="label">
                <posx>0</posx>
                <posy>0</posy>
                <width>560</width>
                <height>40</height>
                <font>font28</font>
                <align>left</align>
                <scroll>true</scroll>
                <scrollspeed>30</scrollspeed>
                <label>$INFO[ListItem.Label]</label>
                <textcolor>white</textcolor>
            </control>
        </focusedlayout>
    </control>
</control>
 
<control type="group" id="8000"> # This is the sidebar
    <include>BrowseLeftMenuAnimation</include>   # Required for some reason.
    <include>BrowseLeftMenuBackground</include>  # This includes everything to draw the
                                                 # background of the sidebar
    <control type="grouplist">                   # A grouplist is a good idea so that if
        <include>BrowseLeftMenu</include>        # there's too many controls, it can scroll.
        <control type="label" id="402">
            <include>BrowseLeftMenuTitle</include>      # <- there are some 'classes' I found
            <label>[UPPERCASE]Available Feeds[/UPPERCASE]</label>
        </control>
 
        # Include whatever you want on the sidebar here.
        # Make sure to add "<onright>9000</onright>" to the elements so you can get back to
        # your app.
 
    </control>
</control>

Make sure to remove all of the comments before trying this code, the boxee XML parser doesn’t like python comments (#).

This will get you an empty window with a sidebar on the left.

Enjoy.

Building Your First App: Animation
12 November 2009 by Rob Spectre
This entry is part 8 of 9 in the series Building Your First App

We’re almost there with the penultimate step in building your first Boxee application. In the last installment, we finished the construction of the application by finishing the metadata box. In this step, we’ll do our last round of polish before we’re ready for the best step of all – release!

Animation is the crucial last polish that can really make your application shine and is super easy to add. For our app, we are going to add a nice theater-light style fade in for the active elements of our interface while the application loads. This can be accomplished by applying an animation element to our list container and metadata box. Let’s take a look at what that element looks like:

1
2
3
<animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
   <effect type="fade" start="100" end="20" time="200"/>
</animation>

In this element we are doing two things – setting a condition and setting an effect. The condition is set with the animation element telling Boxee to render the animation when certain criteria are met. In this case, we are defining the condition as the visibility of Boxee’s default “loading clock” animation.

We then define what kind of animation with the effect element. Here we put the attributes of how we would like this animation to behave.

type
There are many animation effects available within Boxee; the type attribute defines which one we want. As mentioned before, we are using a “fade” animation for our first app.

start / end
The start and end attributes have deceiving names for their function in a fade animation. For this effect, start and end are the values we are setting for opacity at the beginning and end of the animation. So if we input the values “100″ and “20,” we are telling Boxee to render a fade effect that changes the interface object’s opacity from 100% (fully solid) to 20% (nearly transparent).

time
The time attribute defines the interval of the animation in milliseconds. With “200″ as our value, we are telling Boxee to fade the interface object from 100% to 20% in 0.2 seconds.

With our animation element defined, we need to just add it to the controls we wish to fade. Adding an animation is as simple as including the animation element to the control we wish to animate. First we’ll start with the image control that provides the background of the list container.

1
2
3
4
5
6
7
8
9
10
<control type="image">
	<animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
	   <effect type="fade" start="100" end="20" time="200"/>
	</animation>
	<posx>60</posx>
	<posy>230</posy>
	<width>502</width>
	<height>416</height>
	<texture>list.png</texture>
</control>

Now when we start our application, we can see that while Boxee loads our RSS feed, the list container background does a neat theater fade. To give the entire app that same polished look we will need to add the effect also to the metadata box’s image control, the list container, and the group control containing our metadata objects.

Here’s our final main.xml now fully animated:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0"?>
   <window type="window" id="14000">
   <defaultcontrol always="true">100</defaultcontrol>
   <allowoverlay>no</allowoverlay>
   <controls>
      <control type="group">
          <control type="image">
             <posx>0</posx>
             <posy>0</posy>
             <width>1280</width>
             <height>720</height>
             <texture>bg.png</texture>
          </control>
          <control type="image">
             <animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
	         <effect type="fade" start="100" end="20" time="200"/>
	     </animation>
             <posx>60</posx>
             <posy>230</posy>
             <width>502</width>
             <height>416</height>
             <texture>list.png</texture>
         </control>
         <control type="image">
             <animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
	         <effect type="fade" start="100" end="20" time="200"/>
	     </animation>
             <posx>630</posx>
             <posy>255</posy>
             <width>574</width>
             <height>355</height>
             <texture>details.png</texture>
          </control>
          <control type="list" id="100">
           <animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
	       <effect type="fade" start="100" end="20" time="200"/>
	   </animation>
	   <posx>60</posx>
	   <posy>230</posy>
	   <width>502</width>
	   <height>416</height>
	   <orientation>vertical</orientation>
	   <itemlayout width="502" height="65">
	    <control type="label">
		<posx>0</posx>
		<posy>0</posy>
		<width>502</width>
		<height>62</height>
		<font>font40</font>
		<align>left</align>
		<aligny>center</aligny>
		<label>$INFO[ListItem.Label]</label>
		<textcolor>white</textcolor>
	    </control>
	    </itemlayout>
	    <focusedlayout width="502" height="65">
	       <control type="image">
		   <posx>0</posx>
		   <posy>0</posy>
		   <width>502</width>
		   <height>65</height>
		   <texture>white.png</texture>
		   <colordiffuse>DD171717</colordiffuse>
	       </control>
	       <control type="label">
		   <visible>!Control.HasFocus(100)</visible>
		   <posx>0</posx>
		   <posy>0</posy>
		   <width>502</width>
		   <height>62</height>
		   <font>font40</font>
		   <align>left</align>
		   <aligny>center</aligny>
		   <label>$INFO[ListItem.Label]</label>
		   <textcolor>white</textcolor>
		   <selectedcolor>DD171717</selectedcolor>
	       </control>
	       <control type="label">
		   <visible>!Control.HasFocus(100)</visible>   
		   <posx>0</posx>
		   <posy>0</posy>
		   <width>502</width>
		   <height>62</height>
		   <font>font40</font>
		   <align>left</align>
		   <aligny>center</aligny>
		   <label>$INFO[ListItem.Label]</label>
		   <textcolor>white</textcolor>
		   <selectedcolor>DD171717</selectedcolor>
		   <scroll>true</scroll>
		   <scrollspeed>30</scrollspeed>
	       </control>
	    </focusedlayout>
	    <content type="url" url="rss://yourdomain.com/yourfeed.rss">
	    </content>
	</control>
        <control type="group">
           <animation type="Conditional" condition="Window.IsVisible(DialogProgress.xml)">
	      <effect type="fade" start="100" end="20" time="200"/>
           </animation>
           <control type="image">
              <visible>true</visible>
              <posx>635</posx>
              <posy>265</posy>
              <width>560</width>
              <height>230</height>
              <texture>$INFO[Container(100).ListItem.Thumb]</texture>
           </control>
           <control type="label">
              <visible>true</visible>
              <posx>635</posx>
              <posy>500</posy>
              <width>560</width>
              <height>115</height>
              <font>light23</font>
              <align>left</align>
              <aligny>center</aligny>
              <label>[B]Description:[/B] $INFO[Container(100).ListItem.property(description)]</label>
              <background>grey</background>
              <textcolor>white</textcolor>
              <wrapmultiline>true</wrapmultiline>
           </control>
         </control>
      </control>
   </controls>
</window>

For more information on animating your Boxee app, refer to this excellent guide for Xbox Media Center.

Only one step left – release!

»  Substance: WordPress   »  Style: Ahren Ahimsa
© 2009, all rights reserved.