mozilla-b2g/gaia — pull request #8409 by janjongboom (2013-03-01 17:16:08+00:00)
Title: Bug 846306 - Image shouldn't be displayed before loaded + perf fix

Fix for [#846306](https://bugzilla.mozilla.org/show_bug.cgi?id=846306)

At the moment you can see that the image is being loaded in the detail screen. In the bug report I considered two options to fix this, either hide the image until loaded or show the thumbnail and render when done. I've spend some time on the second approach and the problem here is that:

1. Setting the thumb is fine
2. Loading a 4 MB large image on the DOM will flicker the element, thus not making it smooth in the emulator
3. On the Unagi this takes even longer, so it doesn't seem like a viable option

So I've gone with the first approach, the image will only be displayed when loaded completely. Additionally I added a progress indicator when the image is being loaded. When working on this I saw that the scan indicator is also active in the detail view which doesn't make a lot of sense. I made that indicator hidden on detail views (also effects).

A second thing I found out is that, while a SD card is being scanned, having a detail view open is very intensive. This is because `showFile` is being called every time a new image has been processed. On my small SD card this caused the function being invoked a couple hundred times. I changed the call so that we only process this when the left or right image is actually affected by the changed index. Less CPU ticks yay.