Skip to content
Mikhail Kulesh edited this page Sep 11, 2017 · 14 revisions

How to activate developer mode

Developer mode in the app allows to perform:

  • Automatic tests based on special scripts placed in app/src/main/assets/ta directory.
  • Export documentation from the application into LaTeX format.
  • Export screenshots based on examples placed in app/src/main/assets/examples directory. There are different sets of examples for portrait and landscape orientations.

To activate developer mode, do following:

  • Select main menu "Open source licenses"
  • In the Dialog window, 10x tap on the header "The Apache Commons Mathematics Library" until the toast "Developer mode is activated" appears:
  • Restart the app
  • In the main menu, "Developer options" is now visible

How to creating/editing locales and translating documentation

If you want to translate the app, there are two types of resources to be translated:

  • The file app/src/main/res/values/strings.xml contains the elements of the user interface (in English). It also contains several arrays that shall be handled specially:

    • Not translatable array <string-array name="pref_language_codes"> contains language codes (with region suffix) for all languages that are already presented in the microMathematics. Add you language/region to this array in the basic locale (app/src/main/res/values/strings.xml), do not copy this array into your locale-specific strings.xml.
    • Add the name (in English) of your language in the array pref_language_names
    • The array <string-array name="activity_resources"> and the parameter activity_welcome describe the application documentation, see below.
  • Application documentation consist of:

    • XML-files placed in the app/src/main/assets/doc_<locale> directory. These files are worksheet files in the microMathematics format that contain detailed documentation. Each file represents a chapter of this documentation and can be opened from the application navigation drawer.
    • If you activate the "Developer options" in the main menu, you can export all these chapters including all images in the LaTeX format. The exported files for all languages are stored in the doc directory. To build the documentation, see README.md in this directory.
    • The PDF files built from LaTeX source are currently attached to the release tag
  • The array activity_resources and the parameter activity_welcome in the app/src/main/res/values/strings.xml file contain the links to both XML-files in the corresponding language as well as to PDF files for the corresponding release.

Therefore, there are two strategies to translate the app:

  • The simplest way is to only translate app/src/main/res/values/strings.xml, but leave activity_resources array and parameter activity_welcome in this file unchanged (that means the documentation and “Welcome” page still be in English). This partial translation is not too good, but can be useful in some situations

  • Full translation. In this case, all XML-files placed in the app/src/main/assets/doc_en directory shall be translated first and placed into the new directory app/src/main/assets/doc_<lacale>. To do it, ether use an XML-editor or edit these files directly in the app using any tablet with hardware keyboard. After the documentation files are translated and formatted in the app, they can be exported into LaTeX format and PDF file can be created. After it, app/src/main/res/values/strings.xml can be translated, where activity_resources array will than contain links to the previously translated documentation files.

Development with Linux

Environment variables for console tools

There are two important environment variables necessary when a console is used:

  • Gradle home directory. Gradle uses the directory .gradle in our home directory as the default Gradle user home directory. This directory is huge, sometime is necessary to move it to another mount. To change the Gradle user home directory we can set the environment variable GRADLE_USER_HOME and point it to another directory:
setenv GRADLE_USER_HOME /work/android/gradle
  • Android SDK directory. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable:
setenv ANDROID_HOME /work/android/sdk

Temp directory for SDK manager for Android Studio

In order to be able to download SDK components, the system tmp directory shall not be used for SDK manager since it usually does not have enough capacity. We shall change the location of the temporary directory used by the Java Virtual Machine running Android Studio (and SDK manager). In Android Studio 2.0 or later, select Help -> Edit Custom VM Options. This will create a copy of the installation's vmoptions file in your own configuration directory and open it in the editor. Add the following line and restart:

-Djava.io.tmpdir=<directory>

where is an absolute path to a directory in a partition with enough space. If doesn't exist, it will be created the next time Android Studio is started. For more details, see this

Clone this wiki locally