Wednesday, July 28, 2010

Preparing for 1.0 -- colors galore

Do we need to stick with black background, white text, and blue verse numbers? User feedback says No!

Previously there is a setting to change the brightness of the text - the text stays white (or gray), the background is still black. Many requests say they want white background and black text.

Rather than satisfying individual request, why not allow us to customize the colors as free as we want?

Select color dialog
The above select color dialog is inspired by Adobe Photoshop. It was not easy for me to create that, because I need to understand combining gradient paints and converting between color values. I'm thinking of open sourcing this component soon [Update: now available].

But -- isn't it troublesome to select the colors for each of the background, text, and verse numbers?

Now we have Color Themes. Instead of selecting the colors one by one, we have presets for users to choose. They have names (in Indonesian), but they're just meaningless really.

Color Theme
2 Blackboard
3 Tropic Lush
4 Moss Lake
5 Warm Ash
6 Sweet Orange
Now we are not forced to see black-and-white anymore, but colors! The colors are applied for bookmarks and devotion screens too ^^

Colorful enough?

Saturday, July 17, 2010

Preparing for 1.0 -- new search engine

There is a happy and sad moments recently. Happy because Google has just released Android 2.2, a very cheerful update that speeds up most applications by about 2x. My phone become super fast. Sad because the full-text search powered by SQLite FTS3 does not work anymore.

So I think, while the have-to-make-index-first thing is not so good too, it's better to make another search engine that doesn't use SQLite. Instead, the words are searched by scanning the Bible text and finding substrings. If there are multiple words, the subsequent words are looked for from the earlier result.

Performance was not satisfying - on the first correct attempt it took 2.5 minutes to search one word when running in the emulator (~40 seconds on Nexus One). The slowness I found are in:

  1. Reading of Bible text data which uses custom UTF8 decoder (the internal UTF8 decoder was even slower!)
  2. Call to String#indexOf for each verse
  3. Case-insensitive matching that uses toLowerCase
After the following optimizations, it took only 3 seconds to search a word on Nexus One.
  1. Currently the Bible data is all ASCII, I skip the UTF8 decoder altogether and convert the bytes using String(byte[], int)
  2. Instead of calling it for each verse, I call it for each chapter, if something is found, then the verses are identified.
  3. Because of number 1, I can use simpler methods to convert upper case letters to lower case just by adding 0x20 to all uppercase letters.
The downside of this custom search engine is that it's longer to search (it was < 1 second when using FTS3 engine) and no support for * and quotes. The advantages are no additional space required to store the index, the words need not be exact, and we can filter OT and NT.

Searching for two non-consecutive words

Wednesday, July 14, 2010

Preparing for 1.0 -- improved bookmarks and annotations

Up until the previous version, we can only store bookmarks according to the verse we select. No other information is available, nothing we can type and store. Moreover many users ask about the ability to write notes.

So in this version we added annotations to write notes and ability to give a title to bookmarks.

Bookmark title can be assigned
Annotations
It is quite complicated to handle old bookmarks. When the program is started, it checks if there are bookmarks in the old version, and converts it to the newer format on startup.

Moreover, when there is a bookmark for a verse or there is an annotation assigned to the verse, there will be icons on the right side of the text.

Icons on the right of verse 1
If you notice, the arrows for prev/next chapters have also changed. That icon is made with help of Jaya Satrio Hendrick. I hope you like that new, simpler icons.