Older blog entries for lucasr (starting at number 268)

Introducing Smoothie

A big part of Pattrn’s UI is about scrolling through lists of images from the cloud. So I spent a quite some time tuning it to ensure that the scrolling experience is as smooth as possible. In the past few weeks, I’ve been working on factoring out this code into a tiny library called Smoothie.

Smoothie provides a simple API to load ListView/GridView items asynchronously, off the UI thread. It does all the obvious things you’d expect—loading items as they become visible, cancelling item requests for recycled views, etc. But it does a bit more than that.

Smoothie is gesture-aware: it will avoid wasting item requests after a fling gesture and enable incremental item loading while you scroll the list with finger down. Furthermore, it supports offscreen item preloading to reduce the number of placeholder-type items as you scroll. Under the hood, Smoothie uses a thread pool executor backed by blocking queue with dynamic priorities. Offscreen item requests will dynamically get higher priority as they become visible on screen while scrolling.

So, how do you use it? It’s easy:

  1. Add an AsyncListView or AsyncGridView to your layout. They only add one extra setter method to their respective parent classes.
  2. Implement an ItemLoader with your app-specific logic for loading and displaying items. You’ll have to override four methods: getItemParams(), loadItem(), loadItemFromMemory(), and displayItem().
  3. Build an ItemManager with your ItemLoader and set it on the target AsyncListView or AsyncGridView.

Think of Smoothie as a slim backbone for your ListView/GridView‘s asynchronous loading. You can easily hook up your own image loading/caching framework in it. For instance. one of the sample apps implements an ItemLoader backed by Android-BitmapCache with a simple fade-in animation to display images.

Besides the API docs in the code, have a look at the sample apps to get a better idea of how to use the library. Keep in mind that the API is not final yet. Feedback is very welcome! Enjoy!

Syndicated 2013-01-06 23:48:43 from lucasr.org

Featured bug #1 in Firefox for Android

Keeping a list of good first bugs for new contributors is a common practice in some large open source projects. e.g. the Mozilla community marks these bugs with “good first bug” and the GNOME folks tag them with “gnome-love” in Bugzilla. The problem with these lists is that they tend to grow very quickly and become overwhelming to go through­—which kind of kills their original purpose of helping new contributors to find a task to get started.

I’d like to start a little experiment. What if we feature only one good first bug every other week? Featured bugs will have an assigned mentor and some initial overview of what has to be done. The effort to decide if you’re up for the task then gets much smaller, right? And if you don’t have time to work on the current featured bug, you can wait for the next one, no problem!

So, here we go: the first featured bug is bug 774309, mentored by Brian Nicholson (bnicholson). This bug is about adding support for Android’s voice search in Firefox. Brian has provided some initial code pointers in the bug. Interested? Just add a comment to the bug to take it. I strongly recommend joining us on IRC (irc.mozilla.org #mobile) to get some support on setting up your development environment.

Syndicated 2012-12-07 19:30:10 from lucasr.org


Tiago Rocha, my brother, has just released his first album, Humanufaturas! Humanufaturas is a delightful album. It’s sophisticated without sounding complicated.

You can download (and listen to) the complete album for free on the website. Spread the word about it! And while at it, why not donate any amount to help the project move forward? Go!

Syndicated 2012-12-05 14:13:26 from lucasr.org

Almost like a phone, more like a tablet

Designing apps for 7-inch devices can be a bit tricky due to the fuzzy nature of this form-factor. The Nexus 7 gave a big boost on the “small tablet” market for Android so it’s important to design your apps with these devices in mind.

What’s is unique about the Nexus 7 form-factor is that it behaves quite differently in each orientation. Yes, the same could be said about 10-inch tablets and phones, of course. But they still generally provide a “lot of space” and “not much space”, respectively, in both landscape and portrait.

On the other hand, the Nexus 7 behaves “almost” like a phone in portrait and “more like” a tablet in landscape. Therefore, UIs for 7-inch devices will likely end up blending elements from both phone and 10-inch tablet layouts.

Click to see full image

For example, in Pattrn, the UI for 7-inch devices blends the flat list of patterns from phones with the sidebar from 10-inch tablets when in portrait mode; while in landscape it uses the sidebar and a two-column grid, which is more like the 10-inch tablet UI. Also, on 7-inch tablets, the search entry is iconified by default in portrait and expanded by default in landscape to maintain visual balance in each orientation.

Click to see full image

Firefox for Android is another example of this blend. Firefox’s UI for 7-inch devices adopts the more powerful toolbar with forward/back buttons from 10-inch tablets but uses the same vertical fly-in tabs tray from phones.

Designing for 7-inch tablets is about finding the perfect blend between the phone and the larger tablet UIs.

Syndicated 2012-11-07 23:10:39 from lucasr.org

Snappier Awesome Screen and Start Page

As part of my effort to make the Firefox for Android smoother, I’ve spent the last week or so improving the performance of the Start Page and the Awesome Screen. So, what’s the issue I’m trying fix here? In one word: latency.

Our telemetry data shows that Firefox for Android is taking several seconds—up to 10!—to show the top sites in the Start Page. This means our users are staring at a blank page for several seconds on startup. We’ve been getting similar reports about the time to show the initial list of sites on the Awesome Screen. Both the Start Page and Awesome Screen use the same frecency query.

After some investigation, it seems that one of the main reasons for the frecency query to be so slow right now is that we fetch images (favicons or thumbnails) in the query itself. i.e. we’re reading lots of binary blobs from the disk as part of the query. This can be very slow on mobile devices—especially with thumbnails which are much larger images than favicons.

To address that, I’ve recently landed patches that change the Start Page and the Awesome Screen to first fetch the list of sites (URL and title) then load their respective images asynchronously. So, how much faster did they get?

The results of my local (non-scientific) benchmarks look very promising! With these patches, the Start Page takes about 33% less time to show top sites and the Awesome Screen takes 36% less time to show the initial list of sites—in a medium-size history and bookmarks database.

The corresponding telemetry data is already trending towards saner performance results but I’ll have to wait for a larger data sample from users on the latest Nightly to see how much we’re actually improving. I’m keen to hear how much difference these patches made on your Nightly experience. Feedback is welcome!

Syndicated 2012-11-05 17:25:02 from lucasr.org

Major Milestone for Pattrn

I started hacking on Pattrn six months ago as a fun learning experiment. Pattrn was first released in the beginning of May. Since then, I’ve been listening very carefully to your feedback and a lot of the features I implemented were in response to your input. So, thank you!

Today, Pattrn reaches a major milestone: it has just been featured in Google Play’s Stack Picks—for both phones and tablets! If you love Pattrn, this is the perfect moment to give it a 5-star rating on Google Play!

What’s next? I’m now working on the next two major features for Pattrn—again, in response to your feedback. Stay tuned!

Syndicated 2012-10-19 21:04:49 from lucasr.org

Smoother Firefox for Android

Click to see full image

Now that Reader Mode has been released in Firefox 16, my main focus for the 18/19 releases will be about making the experience of using Firefox for Android as smooth as possible. I’ll initially focus on three areas: tabs UX, Awesome Screen performance, and page load progress feedback.

This will probably be a continuous effort and it’s unlikely that I’ll be “done” in just one cycle. The goal here is incrementally land changes that have clear user-visible impact. I’ve already landed the first batch of improvements to the tabs UX:

  • The slide animation to show/hide the tabs tray is now much smoother, especially on Android devices with hardware acceleration support (ICS or later).
  • The swipe-to-close gesture on the tabs tray is now much more polished and reliable (see image above).
  • Tabs now slide to fill the gap of removed tabs instead of just snapping to the new positions.
  • We now give more space to the tabs tray so you can see more tabs at once.
  • Tapping anywhere in the main UI (not only the web content area) should close the tabs tray.

These changes together add up to a much better UX already but there’s more coming, stay tuned! This week I’ll be working on ways to make the Awesome Screen feel more responsive. For now, you can see the improvements in the tabs tray in action on our Nightly builds. Feedback is very welcome!

Syndicated 2012-10-16 16:50:43 from lucasr.org

Reader Mode in Firefox Beta for Android

Click to see full image

Yes, Reader Mode is now available on Firefox Beta for Android! Go read my previous blog post about it for an overview of the feature. Brian and I have been working hard to get it in shape for the release and things are now much more solid.

So, what’s new since I announced Reader Mode? Besides tons of bug fixes, there are two things I’d like to highlight. First, we went through a new design iteration that adds a magazine style to the Reader, looks great! Secondly, we’ve made some major performance improvements. Entering Reader Mode is now instantaneous—the way it should be. There some extra major performance improvements and bug fixes to land in Beta soon by the way.

You can help us make Reader Mode even better! It’s simple: install Firefox Beta on your Android phone or tablet and use Reader Mode on your favourite news sites, blogs, etc. Let us know if Reader Mode if offered as expected on readable content (and not offered on pages that are not really articles) and if content is rendered as expected in Reader Mode. Report any issues you find.

I hope you love Reader Mode as much as we do. I can’t wait to get it in the hands of our users in Firefox 16!

Syndicated 2012-09-03 10:55:56 from lucasr.org

Nexus 7

I don’t usually blog about my new gadgets. But sometimes the gadget is so good that is worth doing so. It happened before when I got my Kindle 3 and now the same happened with the Nexus 7. There are plenty of Nexus 7 reviews out there. I just want to share some personal highlights.

Size and ergonomics. I never felt inclined to buy a 10″ tablet. It might work well as a couch device at home but it’s just too big to carry with me to use on the go. So, iPad, Touchpad, Galaxy 10.1, and others were never really an option for me. Furthermore, the current smaller tablet offerings (7″ or 8″) based on Android are just too crappy to even consider.

The Nexus 7 is small enough to carry with me all the time and has the right ergonomics (dimensions, shape, bezel, weight) to use with one and two hands wherever I am (lying on a couch, standing in the train, holding my new born son at 2am, etc). The size is also perfect for casual gaming—something that I had stopped doing for a while. I strongly recommend watching this interview with Matias Duarte in which he explains the rationale behind Nexus 7′s industrial design.

Performance.  The Nexus 7 has chunky specs for the price. Gosh, this is a quad-core Tegra 3 tablet for £199! The combination of performant hardware with the smoothness on Jelly Bean really improves the UX on the device. There’s virtually zero lag on anything you interact with or do in it. Ah, and battery life is great too.

Android. ICS was the first release that I felt like the whole Android thing could actually become something cool. Jelly Bean is yet another big step in the right direction. It brings tweaks to the task switching and launching flow that make a subtle but big difference. As a result, Jelly Bean is the very first Android release that I’m actually enjoying—even with all the little things I still don’t like about it.

The Nexus 7 is a great product due to a combination of factors. It’s a nice piece of hardware for an amazing price that ships the first Android release that you can feel good about. No, Android is not perfect, Google still has work to do to make it amazing. But, for now, Nexus 7 is here and is awesome—Firefox (Beta) and Pattrn run beautifully on it, by the way :-)

Syndicated 2012-08-01 15:05:53 from lucasr.org

Pattrn on Tablets

Yes, that’s right! I’ve just pushed an update featuring a brand new tablet-optimized UI for Pattrn. The tablet UI is designed to give you quick access to all your stuff—favourites, wallpaper history, and saved searches—from a simple and beautiful home screen—works beautifully on the Nexus 7 by the way. This update also features landscape mode on the phone UI.

This is by far the most exciting Pattrn release to date. Big thanks to Arnaud Vallat, Jake Wharton, Michael Novak, and Roman Nurik for giving early feedback on this release.

Love Pattrn? Tell your friends and followers about it and don’t forget to give a 5-star review on Google Play. What are you waiting for? Download and install the best wallpaper app for Android tablets now!

Syndicated 2012-07-24 14:28:04 from lucasr.org

259 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!