Older blog entries for lucasr (starting at number 270)

New Blog Design

New year, time for a long overdue design refresh on my blog! The new WordPress theme that I’ve been slowly working on is now live. Here are some quick notes about the making of it.


The main goal of the new design is to bring focus to the content, nothing else. My main source of inspiration was definitely Opoloo’s Squirel Park blog. You’ll notice quite a few similarities in terms of content structure. Other relevant sources: Signal vs. Noise, Simon Foster, and Ian Storm Taylor.


The new theme uses FF Tisa Web Pro, FF Tisa Sans Web Pro, and Futura PT. Tisa has a subtle modern character without getting on the way. I love it. The fonts are served by Typekit. Their Personal plan is not that expensive and I got to choose the fonts from a fairly large library.


My previous WordPress theme had some serious issues: it was full of weird hacks, looked broken on certain browsers, and wasn’t responsive at all. The new theme is based on Bootstrap and adapts the content for different screen sizes nicely. Responsive images are implemented using picturefill. Some DB caching is done on the front page using WordPress’ Transient API. I’m using the Hypercache plugin for an extra performance boost.


I decided to disable comments as part of the switch to the new theme. I usually don’t get a lot of value from them anyway. Also, I don’t feel like spending any time moderating comments anymore. You can always find me on Twitter and Google+ if you got something to add or discuss.

The source code of the new theme is available on Github. Enjoy!

Syndicated 2013-01-25 12:18:18 from Lucas Rocha

Featured bug #2 in Firefox for Android

Before bringing up the next featured bug, it’s probably a good time for a quick update on the state of Firefox for Android’s coding community. Long story short: we have never had as many coding contributors as we have now! Here’s what some of them have been working on.

Sriram Raghuraman implemented a “set wallpaper” context menu option for images in web content. Greg Roodt added mouse wheel scrolling support. Mark Capella fixed a handful of bugs in different parts of our UI. Alex Nagacevschi implemented preliminary support for RTL content in Reader Mode. Ian Patterson fixed some weirdness in how downloaded images are named. Ravisankar Sivasubramaniam fixed  a bug on our input handling when switching tabs. And the list continues!

Want to have your name on this list? Here you go: bug 807990 is our second featured bug. It’s about a small but very useful feature in Reader Mode: adding a double-tap gesture to scroll the article a “screenful” distance. You’ll be mentored by yours truly. I’ve just added some background information to the bug report to get you started. Comment on 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 2013-01-23 21:34:34 from Lucas Rocha

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

261 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!