Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Development

Petabyte Studios edited this page Oct 30, 2019 · 16 revisions

Setting up the Workspace

To build and tinker with Heb12 Mobile, you will need to download and install Android Studio.

Next, you must download the source code: git clone https://github.com/heb12/heb12-mobile

Finally, launch Android Studio, click File > Open. Double-click the folder which you cloned Heb12 Mobile into.

Modifying

There are 2 main parts of Heb12 Mobile, one is the main Bible interface, which was created in HTML5. The other part, which was written in Java, loads the HTML5 files into a webview and also uses has a Javascript interface.

The Javascript Interface

The Javascript interface acts as a bridge between the JavaScript and the Java code. Using the Javascript interface is pretty simple. The following JavaScript code would make a toast (small feedback message) from the javascript.js file:

interface.exec("toast", "Hello, World!");

The first parameter defines the action, and the second parameter is the data string. Below are some more examples that make use of the Javascript interface.

interface.exec("copy", "String to be copied to clipboard"); // Copies a string to the clipboard

interface.exec("share", "Share me!"); // Allows user to share text with others

interface.exec("other", "close"); // Closes the app

interface.exec("write", "Hello, World!"); // Write to the config file. Warning: Updating config file contents may cause the app to crash.

interface.exec("makefile test.txt", "Hello World"); /// Creates a file in the translation directory on the SD card.

The Main JavaScript File

The main JavaScript is where most of the functionality is. It's a pretty big file, (700+ lines) but it's pretty well commented so it shouldn't be too hard to modify.

The file can be found at heb12-mobile/app/src/main/assets/javascript.js.

The notify() function was separated into its own file so that it would be easier to edit.

Other JavaScript Files

Other than the main JavaScript file, there are 6 other files that are important. The bibleGenerator.js file has the code that was used to generate bible.js, which is a file containing every book and how many chapters are in it. I decided not to use any JavaScript libraries because that would be a bottleneck to the already huge app.

Downloadable Translations

All the downloadable translations is a fork of gitlab.com/MasterOfTheTiger/openbibles. The json files have been converted into JavaScript files so the app can easily read them. The fork is located here: https://github.com/pufflegamerz/openbibles.

After downloading the file, the makefile part of the interface.exec function is triggered and translation file is created in the /translations directory on the SD card.