mozilla-b2g/gaia — pull request #5338 by davidflanagan (2012-09-27 22:25:23+00:00)
Title: Dominickuo music new mediadb

This is @dominickuo's patch to the music app that he asked me to review.

But there was a merge conflict, so I've fixed the conflict in my own branch and am putting it up in a new pull request with a few changes of my own.

Commit 1 is the original

Commit 2 fixes the merge conflict

Commit 3 restores the "no songs" overlay when no music files are found

Commit 4 changes the localization code a bit, based on a conversation I had with Kaze

Commit 5 is the important one, explained below.

The main purpose of commit 1 was to upgrade the music app to use the new version of the mediadb library. The scanning logic has changed. The old version send all file changes detected during scanning in one or two big batches. The new version batches changes, but may send multiple batches. The music app was assuming it would only get one or two batches and was just rebuilding the UI when it got a change event. But with the new version of the library, if you copied lots of new songs to the sdcard and launched, you'd get a lot of change events, which would rebuild the UI over and over again on the first startup after adding files.

This is the only issue that would have gotten the original pull request a r- review. I've fixed it so it ignores change events while scanning and only rebuilds the UI when the scan ends, and only if any changes were detected during the scan.