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?

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

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.

Preparing for 1.0 — do we have to be always left-aligned?

Hmm, let’s see, we want to release 1.0, but I feel that something is still need to be polished before 1.0 release. I will show you a portion of Bible text from the latest 0.9 version below. It is taken from Psalms 90. Do you see anything missing?

Psalm 90 in version 0.9

Psalms are supposed to be poetry, nicely written to express similarity, difference, emphasis, and so on. But the display above looks like plain newspaper text with uncertain spacing. It is so… wrong.

Compare that with the same chapter from version 1.0:

Psalm 90 in version 1.0

The bad news is that the indentation data is not readily available. I think we will need to copy it from the Bible book published by Lembaga Alkitab Indonesia (Indonesian Bible Society).

Fortunately with help from Roy Krisnadi, the indentation for the whole Psalms book is complete. He sent me a feedback that he would like to help. I said he could help with the indentation data. He agreed and he sent me the data over several days. Thanks!

In order to store the indentation data, a special markup is needed. I designed it (of course not without flaws) as follows:

  • Verses that contain indentation data starts with @@
  • @0 marks the beginning of non-indented text (“Doa Musa, abdi Allah” above)
  • @1 marks the beginning of single-indented text (“Tuhan, Engkaulah tempat…” above)
  • @2 marks the beginning of double-indented text (“turun-temurun.” above)
  • @8 marks the forced new line (at the end of verse 2 above).
Hence, the text shown in the screenshot is stored as:

@@@0Doa Musa, abdi Allah. @8@1Tuhan, Engkaulah tempat perteduhan kami @2turun-temurun.

@@@1Sebelum gunung-gunung dilahirkan, @2dan bumi dan dunia diperanakkan, bahkan dari selama-lamanya sampai selama-lamanya Engkaulah Allah.@8

@@@1Engkau mengembalikan manusia kepada debu, @2dan berkata: “Kembalilah, hai anak-anak manusia!”

For anyone who wants this data for purposes of developing Bible applications for web, desktop or mobile, you can request it. We have agreed to share this data to others.
For version 1.0, only Psalms has this data. We haven’t managed to input indentation data onto other books that have indentations. If anyone wants to help, please contact me via the comments section below.

Version 0.9 features Section Headings and Devotion

I feel that something is still missing before I can say that the Bible app has a version number of 1.0. What is missing? The iPhone app that har made has section headings for the verses (Indonesian: Judul Perikop).

So I ask him how to get those data. He said that he got that from a Mac program that shows section headings on Indonesian Bible, and he was able to extract the files as HTML files. However I found some typos in the section headings, in fact I saw several times in a while, so I thought I needed to copy them from my physical Bible book.

Turned out that sabda.org has the section headings all listed together! I’m so thankful to sabda.org, they have a very comprehensive resources for Bible especially for Indonesian bible study. I need to create a parser that converts the verse addresses mentioned in the page to the internal addressing used in the app. For example,

Judul: Manusia dan taman Eden
Perikop: Kej 2:8-25 (TB)

is converted to: title=”Manusia dan taman Eden” address=0x000208 (where 0x00 is the book number (0 is Genesis), 0x02 is chapter number, and 0x08 is verse number).

The problem is on the inserting of the section headings into the verse texts. I need a big concentration to write the code to insert them correctly without impacting performance too much. At the end I used two files for the section headings, one is the index where everything will be loaded into memory, and another contains all the texts of the headings.

Section headings shown

Even better, there are parallels, which indicate similar or same stories in different part of the Bible. One example,

Judul: Silsilah Yesus Kristus
Perikop: Mat 1:1-17 (TB)
Paralel: Luk 3:23-38 (TB)

which means the texts in Matthew 1:1-17 is essentially the same story as what is told in Luke 3:23-38. I want to make the parallels appear as links that can be clicked to go directly to the verse.

The parallels are shown, it is clickable to jump directly to the verse

Some fine tuning was applied for the verse address parser to recognize dash sign (which is, if “Mat 26:47-56” is clicked, it will be recognized as “Mat 26:47”).

So 0.9 was released (0.9.1 was shortly after released to fix a strange bug), and I am very happy with this, since most of the Bible app don’t have section headings and parallels. I hope this app is useful for you, to study God’s Word better.

Devotion feature details (0.9)

One of the most requested feature is the ability to display Devotion (in Indonesian it is called “Renungan” or sometimes bahan saat teduh). So many people requested that so I was very much encouraged to add this feature.

This feature is different from other features, in that this requires external support in order to make this work. We need a live web server to handle the request of devotional material, because the material itself changes every day, we cannot store it onto the program.

I decided to support two devotional material, which is Renungan Harian (Indonesian version of Our Daily Bread of RBC Ministries), and Santapan Harian (literally: daily nourishment, of Pancar Pijar Alkitab).

They can be summarized as follows according to my experience:

  • Renungan Harian is focused on showing how to relate daily events with the Scriptures. The Scripture passage is selected in order to give some message about the daily events.
  • Santapan Harian is focused on giving exposition of every chapter on the Bible, sequentially with jumps every few weeks. After exposition, the implications to our daily life is given.
Both can suit readers, although I think the latter is for later stages of Christian spirituality growth.
Like the links above indicate, they are provided by my favorite sabda.org website. I afraid that if there are more and more users use the Bible app, sabda.org will suffer. So I made some kind of proxy cache in my server at kejut.com.

Santapan Harian devotion material

The verse address that is displayed on top of the devotion is clickable to directly jump to the verse.

How if there is no Internet connection when one wants to read the devotion? Every time a material is downloaded, it is checked, whether it is valid or not (because sabda.org only has materials until a specific date in the future), then if it is, will be stored into the local database. When the devotion screen is opened, materials up to 14 days to the future will be downloaded and stored.

When I read the feedbacks, there are many users that are happy with this, and also quite a number users who had problems… however it’s because the proxy cache server is not storing the materials with the correct encoding to the cache database, and it is fixed now!

Finally, searching introduced in 0.8!

A long-awaited feature is coming in 0.8, which is word-searching.

By the way, the comments I received via Android Market and via the feedback menu is very encouraging, that allows me to continue developing the app.

However, implementing the search function is not an easy task. I wonder how to make it fast enough without introducing a big overhead to the apk (downloaded installer) size.

At the end I decided to use the FTS3 (full-text search) that is included in SQLite library which is already built-in to all Android devices. The downside is that I need to create another database for the full-text search to work, and it needs time, too.

So when the user clicks on the search menu, there will be a dialog explaining that he needs to create a file on the SD Card for the index.

For search function, you need an index. Index needs about 9MB on the SD Card, … and so on

The indexing takes a while, on my Nexus One it takes almost 5 minutes to complete (I got an Android device finally, thanks to Google’s developer day where they gave out Nexus One phones).

Creating index… Phase 5: Inserting 1500 of 31102 verses

After indexing, searching for a word takes only a fraction of a second! I’m very happy with this ^^

Searching for “israel” and “Jacob”, words need to be exact but don’t need to be consecutive

A special thanks to the id-android community, where they for the first time become testers of unreleased versions of the Bible app. They made me sure that the app is ready for release ^^

Download rate has increased to about 10 per day, up from 4 a day when 0.5 was released ^^

Direct verse addressing in 0.7

One of the problem I found in 0.6 is that it is very slow to go to different parts of the Bible. You have to select the book from the dropdown menu, type in the chapter number using the on-screen keyboard (or hardware one if you have one), click the verse and type the number again.

So in 0.7 I want to release something very useful (at least for me): just type the verse address, something like “1 pet 3:16” or, even better, “1 pe 3 16”, “1p3 16”, “1p3.16” and other alternatives must also be accepted.

So with God’s grace I managed to write a quite complicated logic to recognize those patterns. At first I wanted to use regular expressions, but I’m afraid that I will get stuck somewhere.

Jumping to John 3:18

Another feature is bookmarks. You can hold on a verse and a popup menu will be displayed. From there you can add bookmark. When you select menu -> Bookmarks, the following appears. The bookmark stores the verse address, a snippet of the verse, and the date it was last added (since duplicates will update the date stamp).

Bookmark screen

Something big is missing: search! How if I remember some verse about Jesus building church on the rock but I don’t remember where it is?

I think that’s another big thing, but I can’t do it for this version. It’s too risky.

Preparing for 0.6 from user feedbacks

I received many feedbacks from both the program interface and my friends when I see them operating the program. There are several things that I learned.

The Go To interface for navigating is too small for fingers! I didn’t know this until I really try it on a device. This is the first time I learned that touch screens needed some special handling. So here is the improved version of the Go To screen. The finger now can touch the chapter and verse numbers easily.

Bigger buttons everywhere!

Then, I changed the text display from a single TextView to ListView items. Surprisingly it is much, much faster to load a new chapter, because only items visible need to be rendered.

Almost useless about screen. The number after the version is the internal versionCode.

A new thing in this version is the brightness of the text that can be selected on Settings. I used this as the basis. Thanks for sharing the code.

Text brightness in percentage of maximum

First update of published app (0.5)

Here is the first update to the published Bible application.

We don’t need the chapter address on the title bar. Instead, I moved it to the bottom, to the button that allows you to move to different parts of the Bible.

Main interface

Simple setting screen. You can change the size of font (just a 7-item selection list), the font (serif/sans/monospace) and to bold the font.

Setting screen

I really want to get some feedback of the program, hence I popup this message every time the program is opened. I got quite a lot of feedbacks which encourage me to develop it more and more.

Feedback popup

The first version and this version lasts for 2+ months in Android Market, getting 252 downloads, so in average there are 4 downloads per day. I am very happy with this ^^