Wednesday, September 16, 2009

Adding a simple progress bar

A progress bar is a visual representation of a Real Number between zero and one or a percentage between 0% and 100%.

Below is a method for drawing a simple progress bar:


/**
* @param g Graphics
* @param x
* @param y
* @param w width
* @param h height
* @param p part between zero and total
* @param t total
*/
void fillProgressBar (Graphics g, int x, int y, int w, int h, int p, int t) {
g.drawRect(x, y, w, h);
// p will receive the pixel width of the proportion: part / total
p = (p * w) / t;
g.fillRect(x, y, p, h);
}

Wednesday, September 9, 2009

Application Sindication

It has been only a week since I shared Books and it got more than one thousand downloads. Of course I am happy with this number, but I was wondering how did these people find out about it? Of course this blog does not have so many readers. I write to a very specific nich.

So I did some search and navigation on GetJar and found out RSS Feeds for application updates. They are organized by platforms and manufacturers.

I began following some of these feeds and found out they are a very interesting way to discover new applications for my cell phone.

Related topics:

Wednesday, September 2, 2009

Books: a new study case

Updated on 31/May/2010. New features on version 1.4

I had some TXT books and wanted to read them on my cell phone.
So I made this application and shared it.

Features:


  • Fullscreen landscape reading with biggest font available.

  • Recent files list, so you do not need to browse for files every time you open the application.

  • Resume reading from the same line you were (with progress bar since version 1.1) - no key pressing just to find the point you were before.

  • Press and hold to fast forward or rewind with increasing speed (since 1.1).

  • Languages: English, Español, Français, Português (since 1.2).

  • Read UTF-8 encoded files (since 1.3).

  • Color verification to guarantee scroll bar is always visible (since 1.3).

  • Presenting error dialog when an unexpected situation occurs (since 1.3).

  • Checking file size before trying to open it (since 1.4).

  • Line number presented on footer during read (since 1.4).

  • Better touch support: go to previous pages (since 1.4).



You can open files using JSR 75 - FileConnection.
When you enter "Open File" screen your cell phone might ask you to grant read access to the application.
With Sony Ericsson I had to grant it only once, at the first execution.
With Nokia it was necessary to grant every folder the application was trying to read.
If some unexpected situation occurs an error dialog will be presented with details.
You can send me these details by email.

The content is shown in landscape/fullscreen mode thanks to Sprite transforms, so MIDP 2 is required.

To use the maximum available space just for text I did not set title nor Commands on main Canvas and treated keyPressed to identify softkeys.

Each file read is kept on a "Recents" screen.
A List where the top most items are the most recent files opened by the application.
I used a simple RecordStore to keep this list of files and where in each file we were reading.

Give it a try and, if you like it, write a nice review. ;)

Related topics: