Removed the hard-coded path to the database.

This path can actually differ on different Android devices. Fortunately,
the application is now using on the fly generation, so a path to the
database is no longer required.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>
Fixed a bug where a SharedPreferences object may be accessed while null.

The original implementation did not use any form of null-checking when
accessing that static SharedPreferences object. While it should be set
on launch of the applicaiton, there are no guarantees. Thus, it is much
safer to perform a null check and set the object when necessary.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>
Cleaned up badly formatted comments caused by an IDE formatter.

The comments were split at around colum 80, resulting in many lines
containing only a single word. This commit fixes a lot of that.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>
Optimized the flood-fill algorithm.

Instead of using ArrayLists, which can dynamically allocate memory up to
arbitrary size and cause OOM errors, the algorithm is now using boolean
arrays that are preallocated with the maximum width and height of the
images dimensions. The boolean arrays are multidimensional and default
to false values. When a pixel is to be filled with a color, the
corresponding boolean[x][y] value is set to true.

This is faster than using ArrayLists and ultimately uses much less
heap memory.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>
Merge branch 'feature-optimize' into github
Updated ColorGFX pause to signal an interrupt instead of calling join().

Calling join() blocks the thread that calls it. In this case, the UI
thread was being blocked which is bad and has the potential in resulting
in an ANR. Interrupt is now used to signal the end of a thread's life.
It does not block the thread that calls it.

Signed-off-by: Byron Sanchez <bfs5030@gmail.com>