UnAngelo blog

…se io fossi un angelo
Subscribe

Thinking Like a Web Designer

September 13, 2011 By: Tim Bray Category: 1

[This post is by Roman Nurik, who is passionate about icons, with input from me and a bunch of the Framework engineers. —Tim Bray]

The number of people working on mobile apps, and specifically Android, is growing fast. Since modern mobile software-development is a relatively new profession, the community is growing by sucking in experts from related domains, one being web design and development.

It turns out that familiarity with web UI development, particularly using modern HTML5 techniques, can be a great primer for Android UI development. The Android framework and SDK have many analogues to tools and techniques in the Web repertoire of HTML, CSS, and JavaScript.

In this blog post, we’ll walk through a few web development features and look for matches in the world of Android UI development.

Device resolutions and physical sizes

One of the most important aspects of both Android UI design and web design is support for multiple screen resolutions and physical sizes. Just as your web app needs to work on any physical display and inside any size browser window, your native app needs to run on a variety of form factors, ranging from 2.5” phones to 10” tablets to (possibly) 50” TVs.

Let’s look at some ways in which CSS and Android allow for flexible and adaptive layouts.

Providing custom layouts for different resolutions

CSS3 media queries allow developers to include additional stylesheets to target different viewport and screen configurations. For example, developers can provide additional style rules or override existing styles for mobile devices. Although the markup (layout hierarchy) remains the same, CSS3 has several sophisticated techniques for completely transforming the placement of elements with different stylesheets.

Android has long offered a similar mechanism in resource directory qualifiers. This extends to many different types of resources (layouts, images or ‘drawables’, styles, dimensions, etc). Thus you can customize the view hierarchy as well as styling depending on device form factor, A base set of layouts for handsets can be extended for tablets by placing additional layouts in res/layout-xlarge or res/layout-sw600dp (smallest width 600 density-independent pixels) directories. Note that the latter syntax requires Android 3.2 or later.

Below is a CSS3 example of how one could hide a ‘left pane’ on smaller devices and show it on screens at least 600 pixels wide:

#leftPane {
  display: none;
}

@media screen and (min-device-width:600px) {
  #leftPane {
    display: block;
  }
}

The same could be accomplished on Android using multiple layout directories:

res/layout/foo.xml:

<FrameLayout>
  <!-- a single pane -->
  <View android:id="main_pane">
</FrameLayout>

res/layout-sw600dp/foo.xml:

<LinearLayout android:orientation="horizontal">
  <!-- two panes -->
  <View android:id="left_pane">
  <View android:id="main_pane">
</LinearLayout>

As a side note, if you plan on creating multi-pane layouts, consider using fragments, which help break up your screens into modular chunks of both layout and code.

There are also other neat ways of using resource directory qualifiers. For example, you could create values/dimens.xml and values-sw600dp/dimens.xml files specifying different font sizes for body text, and reference those values in your layouts by setting android:textSize="@dimen/my_body_text_size". The same could be done for margins, line spacing, or other dimensions to help manage whitespace on larger devices.

‘Holy grail’ layouts

Web developers have long dreamt of an easy way to build a ‘holy grail’ 5-pane layout (header/footer + 3 vertical columns). There are a variety of pre-CSS3 tricks including position:fixed, float:left, negative margins, and so on, to build such layouts but CSS3 introduced the flexible box module, which simplifies this tremendously.

Figure: An archetypal “holy grail” layout

It turns out that grail is pretty holy for Android tablet apps, too, and in particular for tablets held sideways in landscape mode. A good approach involves the use of LinearLayout, one of the simplest and most popular of the Android layouts.

LinearLayout has this neat way to stretch its children to fit the remaining space, or to distribute available space to certain children, using the android:layout_weight attribute. If a LinearLayout has two children with a fixed size, and another child with a nonzero layout_weight, that other child view will stretch to fill the remaining available space. For more on layout_weight and other ways to make layouts more efficient (like switching from nested LinearLayouts to RelativeLayout), check out Layout Tricks: Creating Efficient Layouts.

Let’s take a look at some example code for implementing such a ‘holy grail’ layout on Android and on the web:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- top pane -->
    <View android:id="@+id/top_pane"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

    <LinearLayout android:id="@+id/middle_container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">

        <!-- left pane -->
        <View id="@+id/left_pane"
            android:layout_width="300dp"
            android:layout_height="match_parent" />

        <!-- center pane -->
        <View id="@+id/center_pane"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1" />

        <!-- right pane -->
        <View id="@+id/right_pane"
            android:layout_width="300dp"
            android:layout_height="match_parent" />

    </LinearLayout>

    <!-- bottom pane -->
    <View android:id="@+id/bottom_pane"
        android:layout_width="match_parent"
        android:layout_height="50dp" />

</LinearLayout>

Note: Android tablet apps in landscape will generally show an action bar as the top pane and will usually have neither a right nor bottom pane. Also note that the action bar layout is automatically provided by the framework as of Android 3.0, and thus you don’t need to worry about positioning it.

And here’s an example implementation using the CSS3 flexible box model; notice the similarities:

<style>
  html, body { margin: 0; height: 100%; }

  #container {
    height: 100%;
    display: -webkit-box; /* like LinearLayout */
    display:    -moz-box;
    -webkit-box-orient: vertical; /* like android:orientation */
       -moz-box-orient: vertical;
  }

  #top, #bottom { height: 50px; }

  #middle {
    -webkit-box-flex: 1; /* like android:layout_weight */
       -moz-box-flex: 1;
    display: -webkit-box;
    -webkit-box-orient: horizontal;
       -moz-box-orient: horizontal;
  }

  #left, #right { width: 300px; }

  #center {
    -webkit-box-flex: 1;
       -moz-box-flex: 1;
  }
</style>

<div id="container">
  <div id="top"></div>
  <div id="middle">
    <div id="left"></div>
    <div id="center"></div>
    <div id="right"></div>
  </div>
  <div id="bottom"></div>
</div>

Layered content

In CSS, with position:absolute, you can overlay your UI elements. On Android, you can use FrameLayout to achieve this. The child views in a frame layout are laid out on top of each other, with optional layout_gravity attributes indicating alignment with the parent frame layout.

Below is a contrived example of a FrameLayout with three children.

Figure: Example FrameLayout with three children (2 with top-left and 1 bottom-right alignment)

Figure: Isometric view of the example FrameLayout and its children.

The code for this example is as follows:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="300dp"
    android:layout_height="200dp">

    <!-- bottom-most child, with bottom-right alignment -->
    <View android:layout_gravity="bottom|right"
        android:layout_width="100dp"
        android:layout_height="150dp" />

    <!-- middle child, with top-left alignment -->
    <View android:layout_gravity="top|left"
        android:layout_width="200dp"
        android:layout_height="175dp" />

    <!-- top-most child, with top-left alignment →
    <!-- also stretched to fill vertically -->
    <View android:layout_gravity="top|left"
        android:layout_width="100dp"
        android:layout_height="match_parent" />

</FrameLayout>

Scrollable content

HTML, by default, flows in reading order and scrolls vertically. When content extends beyond the bottom of the browser, scrollbars automatically appear. Content panes can also be made individually scrollable using overflow:scroll or overflow:auto.

Android screen content isn’t scrollable by default. However, many content Views such as ListView and EditText offer scrolling, and any layout can be made scrollable by wrapping it in a ScrollView or HorizontalScrollView.

It’s also possible to add custom scrolling to views by using methods like View.scrollTo and helpers like Scroller in response to touch events. And for horizontal, snap-to-page-bounds scrolling, one can use the excellent new ViewPager class in the support library.

Below is an example of a ScrollView containing a single TextView child and the code needed to implement something like this.

Figure: A TextView inside a ScrollView, scrolled about half way.


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- the scrollable content -->
    <TextView android:layout_gravity="bottom|right"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="32dp"
        android:textSize="48sp"
        android:text="The\nquick\nbrown\nfox\njumps\nover..." />

</ScrollView>

Custom layouts

Sometimes the positioning and layout behaviors you can achieve with CSS aren’t enough to achieve your desired layout. In those cases, developers fall back on JavaScript coupled with absolute positioning to place and size elements as needed.

Programmatically defined layouts are also possible on Android. In fact, they’re sometimes the most elegant and/or performant way of implementing a unique or otherwise tricky layout. Not happy with nesting LinearLayouts for implementing a 2x3 grid of navigation icons? Just extend ViewGroup and implement your own layout logic! (see an example DashboardLayout here). All the built-in layouts such as LinearLayout, FrameLayout, and RelativeLayout are implemented this way, so there generally aren’t the same performance implications with custom layouts as there are with scripted layout on the web.

Device densities

Web designers have long dealt with the reality that display densities vary, and that there wasn’t much they could do about it. This meant that for a long time web page graphics and UI elements had different physical sizes across different displays. Your 100px wide logo could be 1” wide on a desktop monitor or ¾” on a netbook. This was mostly OK, given that (a) pointing devices such as mice offered generally good precision in interacting with such elements and (b) browsers allowed visually-impaired users to zoom pages arbitrarily.

However, on touch-enabled mobile devices, designers really need to begin thinking about physical screen size, rather than resolution in pixels. A 100px wide button on a 120dpi (low density) device is ~0.9” wide while on a 320dpi (extra-high density) screen it’s only ~0.3” wide. You need to avoid the fat-finger problem, where a crowded space of small touch targets coupled with an imprecise pointing tool (your finger) leads to accidental touches. The Android framework tries really hard to take your layout and scale elements up or down as necessary to work around device-density differences and get a usable result on a wide range of them. This includes the browser, which scales a 160px <img> at 100% browser zoom up to 240px on a 240dpi screen, such that its physical width is always 1”.

Developers can achieve finer-grained control over this browser scaling by providing custom stylesheets and images for different densities, using CSS3 media query filters such as -webkit-max-device-pixel-ratio and <meta> viewport arguments such as target-densitydpi=device-dpi. For an in-depth discussion on how to tame this mobile browser behavior see this blog post: Pixel-perfect Android web UIs.

For native Android apps, developers can use resource directory qualifiers to provide different images per density (such as drawable-hdpi and drawable-mdpi). In addition, Android offers a special dimension unit called ‘density independent pixels’ (dp) which can (and should!) be used in layout definitions to offset the density factors and create UI elements that have consistent physical sizes across screens with different densities.

Features you don’t have out of the box

There are a few features that web designers and developers rely on that aren’t currently available in the Android UI toolkit.

Developers can defer to user-driven browser zooming and two-dimensional panning for content that is too small or too large for its viewport, respectively. Android doesn’t currently provide an out-of-the-box mechanism for two-dimensional layout zooming and panning, but with some extra legwork using existing APIs, these interactions are possible. However, zooming and panning an entire UI is not a good experience on mobile, and is generally more appropriate for individual content views such as lists, photos, and maps.

Additionally, vector graphics (generally implemented with SVG) are gaining in popularity on the Web for a number of reasons: the need for resolution independence, accessibility and ‘indexability’ for text-heavy graphics, tooling for programmatic graphic generation, etc. Although you can’t currently drop an SVG into an Android app and have the framework render it for you, Android’s version of WebKit supports SVG as of Android 3.0. As an alternative, you can use the very robust Canvas drawing methods, similar to HTML5’s canvas APIs, to render vector graphics. There are also community projects such as svg-android that support rendering a subset of the SVG spec.

Conclusion

Web developers have a number of different tools for frontend layout and styling at their disposal, and there are analogues for almost all of these in the world of Android UI engineering. If you’re wondering about analogues to other web- or CSS-isms, start a conversation out there in the Android community; you’ll find you’re not alone.

Oil Rush is now available in the Software Center!

August 30, 2011 By: John Pugh Category: Uncategorized

Unigine Corp has made their Oil Rush game available in the Ubuntu Software Center for pre-order. Oil Rush is a Naval Strategy game and is currently in beta.

According to the press release from Unigine, Oil Rush is a real-time naval strategy game based on group control. In Oil Rush players build up defenses and upgrade oil platforms. Players progress through the game by capturing enemy platforms and oil rigs.

http://www.youtube.com/watch?v=0aA_9E7n5ro

Oil Rush is powered by Unigine Engine, a multi-platform real-time 3D engine which unleashes the ultimate power for creating interactive virtual worlds.

Unigine Corp is a international company focused on top-notch real-time 3D technologies with its development studio located in Tomsk, Russia. For more than 6 years, the company delivers Unigine engine, a real-time 3D solution, that allows software developers to create not only games, but also interactive visualization, simulation and virtual reality systems.

Pick up your copy of Oil Rush from the Ubuntu Software Center today!

If you want your game or application included in the Ubuntu Software Center, visit the Ubuntu Developer Portal and submit your application today!

Facebook Messenger For iPhone And Android | eWEEK Europe UK

August 10, 2011 By: (author unknown) Category: google

Shared by ianus
...otro messenger...

Facebook has launched a new messaging application for Apple’s iPhone and Google’s Android smartphones, a program that extends Facebook Messages from the desktop and adds some of the functionality from group chat specialist Beluga.

Available free for download in the United States and Canada from Apple’s App Store and Google’s Android Market, Facebook Messenger lets users send messages, including relevant context such as their location and photos, to contacts and small groups of Facebook users from their iPhone or Android smartphone. Other than to say “Coming Soon”, Messenger has no release date set for the UK.

KDE Moving and Resizing for Windows XP, 2K, 2003, Windows 7, and Vista. Move and resize Windows windows just like Linux Windows! ESSENTIAL!

May 27, 2011 By: (author unknown) Category: 1, linux

Shared by ianus
por fin!!!!

Move and resize Windows windows just like Linux Windows!

An essential add-on for XP, 2K, 2003, Windows Server and Windows 7. Yeah, okay, and Vista!

Here is a page about my KDE Mover-Sizer. Okay, it's not entirely mine, not even mostly, but I've added enough code to call it mine, and it's too damn essential to not have a page of its own somewhere, so here it is..

What does it do?

KDE Mover-Sizer is a background application that emulates the behaviour of KDE, which is a rather good Linux desktop environment. Actually, Gnome and other Linux window managers also do it these days, but that wouldn't make for such a funky name. Essentially, you hold down the Alt key, and Left-click to move a window, Right-click to resize it; and from anywhere inside the window. That's it. And once you use it for a few minutes, you'll wonder how you ever lived without it.

The utility itself is coded with AutoHotKey, originally a fork of AutoIt, and highly useful in its own right. The original script (which I snaffled from the AutoHotKey forum, the best of many similar scripts) did all the above, but was missing something essential, that is; window snapping. So I added that, and gave them it back.

The window snapping is important for at least two reasons; 1) it enables you to place a window, as if by magic, exactly at the edge of your desktop. If, like me, you like to keep your main document windows in the centre of your screen, and leave lots of folder windows open up and down the sides of your desktop (I have a widescreen monitor now, which makes this even more effective) then you will find it invaluable. And 2) it enables you to resize the window from the edge of your screen. This is easier to do than to explain, though I'm going to attempt that anyway, with a couple of how-to style tips..
 

Cool Tricks..

I've gotten into a couple of habits thanks to the KDE Mover-Sizer. The first is a quick one-two action where I first Alt-Left-click a window and throw it roughly into place (off the edge of the screen), and then do a single Alt-Right-click to snap it back into perfect view. I've already had a week-off with all the time this good habit has saved me.

The new version can also snap directly to the edge during regular Alt-Left-Click moving - so long as you are within the snap distance, it will lock against the edge of your desktop.

The second habit of one of resizing windows from the edge. First, I get them there, as in tip 1, then I grab a corner (anywhere in the quadrant is fine) with an Alt-Right-click, and drag-resize them while the two opposite edges (one of which is bang up against the edge of the desktop) stay put. This isn't so much a time saver, as a sanity saver. I'm very particular about the amount of white space that shows in folder windows, and it they don't look right, I couldn't leave them open. Leaving them open is what saves time.

Another thing I've started doing, is sliding windows up and down the edge of my desktop by Alt-Left-click+drag. The snap keeps them from moving left and right - it's like they are on rails! Very handy. And remember, it works on windows behind windows, too, and without bringing them to the front.

A Bright Idea: Android Open Accessories

May 19, 2011 By: Tim Bray Category: 1, google

[This post is by Justin Mattson, an Android Developer Advocate, and Erik Gilling, an engineer on the Android systems team. — Tim Bray]

Android’s USB port has in the past been curiously inaccessible to programmers. Last week at Google I/O we announced the Android Open Accessory APIs for Android. These APIs allow USB accessories to connect to Android devices running Android 3.1 or Android 2.3.4 without special licensing or fees. The new “accessory mode” does not require the Android device to support USB Host mode. This post will concentrate on accessory mode, but we also announced USB Host mode APIs for devices with hardware capable of supporting it.

To understand why having a USB port is not sufficient to support accessories let’s quickly look at how USB works. USB is an asymmetric protocol in that one participant acts as a USB Host and all other participants are USB Devices. In the PC world, a laptop or desktop acts as Host and your printer, mouse, webcam, etc., is the USB Device. The USB Host has two important tasks. The first is to be the bus master and control which device sends data at what times. The second key task is to provide power, since USB is a powered bus.

The problem with supporting accessories on Android in the traditional way is that relatively few devices support Host mode. Android’s answer is to turn the normal USB relationship on its head. In accessory mode the Android phone or tablet acts as the USB Device and the accessory acts as the USB Host. This means that the accessory is the bus master and provides power.

Establishing the Connection

Building an Open Accessory is simple as long as you include a USB host and can provide power to the Android device. The accessory needs to implement a simple handshake to establish a bi-directional connection with an app running on the Android device.

The handshake starts when the accessory detects that a device has been connected to it. The Android device will identify itself with the VID/PID that is appropriate based on the manufacturer and model of the device. The accessory then sends a control transaction to the Android device asking if it supports accessory mode.

Once the accessory confirms the Android device supports accessory mode, it sends a series of strings to the Android device using control transactions. These strings allow the Android device to identify compatible applications as well as provide a URL that Android will use if a suitable app is not found. Next the accessory sends a control transaction to the Android device telling it to enter accessory mode.

The Android device then drops off the bus and reappears with a new VID/PID combination. The new VID/PID corresponds to a device in accessory mode, which is Google’s VID 0x18D1, and PID 0x2D01 or 0x2D00. Once an appropriate application is started on the Android side, the accessory can now communicate with it using the first Bulk IN and Bulk OUT endpoints.

The protocol is easy to implement on your accessory. If you’re using the ADK or other USB Host Shield compatible Arduino you can use the AndroidAccessory library to implement the protocol. The ADK is one easy way to get started with accessory mode, but any accessory that has the required hardware and speaks the protocol described here and laid out in detail in the documentation can function as an Android Open Accessory.

Communicating with the Accessory

After the low-level USB connection is negotiated between the Android device and the accessory, control is handed over to an Android application. Any Android application can register to handle communication with any USB accessory. Here is how that would be declared in your AndroidManifest.xml:

<activity android:name=".UsbAccessoryActivity" android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
    </intent-filter>

    <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
               android:resource="@xml/accessory_filter" />
</activity>

Here's how you define the accessories the Activity supports:

<resources>
    <usb-accessory manufacturer="Acme, Inc" model="Whiz Banger" version="7.0" />
</resources>

The Android system signals that an accessory is available by issuing an Intent and then the user is presented with a dialog asking what application should be opened. The accessory-mode protocol allows the accessory to specify a URL to present to the user if no application is found which knows how communicate with it. This URL could point to an application in Android Market designed for use with the accessory.

After the application opens it uses the Android Open Accessory APIs in the SDK to communicate with the accessory. This allows the opening of a single FileInputStream and single FileOutputStream to send and receive arbitrary data. The protocol that the application and accessory use is then up to them to define.

Here’s some basic example code you could use to open streams connected to the accessory:

public class UsbAccessoryActivity extends Activity {
    private FileInputStream mInput;
    private FileOutputStream mOutput;

    private void openAccessory() {
        UsbManager manager = UsbManager.getInstance(this);
        UsbAccessory accessory = UsbManager.getAccessory(getIntent());

        ParcelFileDescriptor fd = manager.openAccessory(accessory);

        if (fd != null) {
            mInput = new FileInputStream(fd);
            mOutput = new FileOutputStream(fd);
        } else {
            // Oh noes, the accessory didn’t open!
        }
    }
}

Future Directions

There are a few ideas we have for the future. One issue we would like to address is the “power problem”. It’s a bit odd for something like a pedometer to provide power to your Nexus S while it’s downloading today’s walking data. We’re investigating ways that we could have the USB Host provide just the bus mastering capabilities, but not power. Storing and listening to music on a phone seems like a popular thing to do so naturally we’d like to support audio over USB. Finally, figuring out a way for phones to support common input devices would allow for users to be more productive. All of these features are exciting and we hope will be supported by a future version of Android.

Accessory mode opens up Android to a world of new possibilities filled with lots of new friends to talk to. We can’t wait to see what people come up with. The docs and samples are online; have at it!

[Android/USB graphic by Roman Nurik.]

Steel Storm: Burning Retribution in Ubuntu

May 17, 2011 By: Steve George Category: 1

Looking for some arcade fun and action? Well then head over to the Ubuntu Software Center and grab a copy of Steel Storm: Burning Retribution?

It’s a fantastic top-down arcade shooter where you battle against numerous invading aliens in a hovercraft. The Kot-in-action team just released the new episode called Burning Retribution, and it’s available in the Software Center now for 9.99 USD – that’s 10% off the normal price.

The new episode has 25 campaign missions as you fight to defend your planet against alien invaders. With more destructive weapons, more bosses, a new sound track and more things to blow up – in other words a whole pile of carnage and fun! If that’s not enough there’s an online mode and you can also create your own missions with a collaborative mission editor.

Here’s the teaser video:

There’s a hands-on review on OMG Ubuntu and don’t forget to add your own review in the Software Center for every Ubuntu user to see. So, hurry on over to the Software Center where you can buy it for 10% off the normal price for the next week!

Dropbox Mobile: Less Secure Than Dropbox Desktop | Mike Cardwell, Online

March 10, 2011 By: (author unknown) Category: 1

Shared by ianus
Link para conseguir un poco más de espacio al darse de alta! ;)
http://db.tt/BUU1bV9
I know some of the people who read this blog use Dropbox. Those of you who don't, should look it up; it's a really simple cross platform app for syncing files between machines, sharing files and folders with other people, or simply providing near real-time automatic online backups with revision control.

Out of curiosity, I fired up tcpdump on my router to have a look at the traffic my Android phone's Dropbox client was transferring during usage. To my surprise, I noticed that all file metadata was sent in the clear.

Unity and uTouch

October 14, 2010 By: Gerry Carr Category: 1

One of the most exciting things about the Ubuntu 10.10 release has been the delivery of the Unity ‘shell’ in Ubuntu Netbook Edition. For the uninitiated,  this delivers a very different user experience to that in the main desktop edition. For a start the icons of the most popular applications are permanently featured on the left-hand side of the screen. This borrows more from the smartphone interfaces but is adapted for use on, in this case, netbooks. So there remains a workspace where users still have sufficient room to watch video, edit photos, create documents, play games, read the web, write emails – all of the usual tasks we use a computer for, day to day.

Everything is optimised however for the more limited screen space. It is sub-optimal for instance to simply port an interface from the full-screen world, shrink it and expect it to be a great experience. Unity does away with the bottom bar for example that Windows, Ubuntu and Mac users will be used to. This is actually a radical step, but in my experience at least, it takes no time at all to forget that there ever was a bottom bar. The result is considerably more ‘vertical space’ for to use  – again maximising the useful area on limited screen sizes.

One of the coolest things though is one that will be experienced by the fewest people at this point – touch. Unity is fully touch-enabled – those big icons are screaming out to have a digit poked at them. But as ever, the boys in the lab, or in this case Duncan McGregor‘s  multi-touch team have gone a step further and created a multi-touch ‘gesture’ library. This allows finger combinations to do groovy things like expand and reduce windows, pull up multiple windows in one workspace, and call up the ‘dash’ automatically. These are in 10.10. In 11.04 we will see a lot more.

Because there are a very limited number of touch-enabled devices out there at present, we thought we would create a video to show some of the features. You can see it below. It has turned out rather nicely even with the clumsy paws.

Gerry Carr, Platform Marketing, Canonical

Multi-touch Support Lands in Maverick

August 16, 2010 By: Duncan McGreggor Category: 1, linux

Canonical is pleased to announce the release of uTouch 1.0, Ubuntu’s multi-touch and gesture stack. With Ubuntu 10.10 (the Maverick Meerkat), users and developers will have an end-to-end touch-screen framework — from the kernel all the way through to applications. Our multi-touch team has worked closely with the Linux kernel and X.org communities to improve drivers, add support for missing features, and participate in the touch advances being made in open source world. To complete the stack, we’ve created an open source gesture recognition engine and defined a gesture API that provides a means for applications to obtain and use gesture events from the uTouch gesture engine.

Our multi-touch work began in Ubuntu 10.04 LTS, when we worked to get additional touch hardware supported in the Linux kernel, particularly the Dell XT2, HP tx2 tablets and the Lenovo T410s laptops. With that in place, and active development in X well under way, we reviewed our options for gesture recognition in Linux. The Maverick cycle has seen us produce several prototypes for gesture recognition software and the Ubuntu archives now include the results of that effort.

The world’s expectations of software experience are being raised by advances in mobile computing. We are bringing that revolution to the Linux desktop: for window management and applications. Though our work at the application level has only just started, we are certain that multi-touch and gestures will be central to the way we use Linux applications in future.

The success of touch in applications depends on several key factors:

  • toolkit integration of gesture APIs
  • touch support for legacy applications
  • designing new applications for finger-based interactions

Work has begun on all three fronts in Ubuntu, and we expect it to remain an area of active interest over the next few releases up to 12.04 LTS.

Ubuntu is the fruit of collaboration across the huge Ubuntu community, and also the amazing work of many other communities that form around individual projects and initiatives like Debian. The uTouch framework enables work to begin across many of those communities to make touch a first-class interaction model in open source desktop and mobile software.

Existing contributions in other projects have provided fertile ground for uTouch. To name just a few:

  • Stéphane Chatty at ENAC has lead much multi-touch hardware support in the kernel
  • Peter Hutterer at Red Hat defined multi-pointer X and proposed a multi-touch protocol for a future version of X
  • Carlos Garnacho of the GNOME community has done multi-touch work in X and GTK

We’re look forward to continued collaboration, ensuring that Linux remains the preferred platform for people building cutting-edge devices and software.

Canonical is working with manufacturers of touch-enabled products and those of their underlying technology in order to bring innovations in user experience to a broader audience. Our aim is to bring the natural, tactile experience of the world to the desktop, window manager, and applications you value — all the software that you depend upon to get things done and have fun. Touch will be part of the Ubuntu Netbook, Desktop and Light products from 10.10 and beyond.

Powering Chrome to Phone with Android Cloud to Device Messaging

August 11, 2010 By: Tim Bray Category: google

[This post is by Dave Burke, who's an Engineering Manager 80% of the time. — Tim Bray]

Android Cloud to Device Messaging (C2DM) was launched recently as part of Android 2.2. C2DM enables third-party developers to push lightweight data messages to the phone. C2DM created a nice opportunity for us to pull together different Google developer tools to create a simple but useful application to enable users to push links and other information from their desktop / laptop to their phone. The result was Chrome to Phone - a 20-percent time project at Google.

Chrome to Phone comprises a Chrome Extension, an Android Application, and a Google AppEngine server. All of the code is open sourced and serves as a nice example of how to use C2DM.

The message flow in Chrome to Phone is fairly typical of a push service:

  1. The Android Application registers with the C2DM service and gets a device registration ID for the user. It sends this registration ID along with the user's account name to the AppEngine server.

  2. The AppEngine server authenticates the user account and stores the mapping from account name to device registration ID.

  3. The Chrome Extension accesses the URL and page title for the current tab, and POSTs it to the AppEngine server.

  4. The AppEngine server authenticates the user and looks up the corresponding device registration ID for the user account name. It then HTTP POSTs the URL and title to Google's C2DM servers, which subsequently route the message to the device, resulting in an Intent broadcast.

  5. The Android application is woken by its Intent receiver. The Android application then routes the URL to the appropriate application via a new Intent (e.g. browser, dialer, or Google Maps).

An interesting design choice in this application was to send the payload (URL and title) as part of the push message. A hash of the URL is used as a collapse_key to prevent multiple button presses resulting in duplicate intents. In principle the whole URL could have been used, but the hash is shorter and avoids unnecessarily exposing payload data. An alternative approach (and indeed the preferred one for larger payloads) is to use the push message service as a tickle to wake up the application, which would subsequently fetch the payload out-of-band, e.g. over HTTP.

The code for Chrome to Phone is online. Both the AppEngine and Android Application include a reusable package called com.google.android.c2dm that handles the lower-level C2DM interactions (e.g. configuration, task queues for resilience, etc).

Chrome to Phone is useful, but maybe it’s most interesting as an example of how to use Android C2DM.