movisens/AndroidCognitiveTestBattery — pull request #2 by philippwiesemann (2014-07-13 18:57:43+00:00)
Title: Fix PVT not working and ignoring parameters 

PVT used a new Thread for executing a Runnable which should also modify
Views. This caused a CalledFromWrongThreadException because a View must
only be modified from Activity's UI thread. As this new Thread was only
used to execute the Runnable once this was fixed by simply replacing it
with posting it to the Handler which already executes remaining anyway.
The synchronized statement in run() was kept although it is unnecessary
to allow easier refactoring later.

PVT ignored the two parameters passed with starting Intent and therefore
only used the default parameters. The fault was method fillInt() of base
class CognitiveActivity. The method actually read parameters but did not
return them to the caller. It was written as it would be possible to set
variables outside the method by assigning input parameters. In Java this
is not possible. Therefore the read parameters were never forwarded. The
problem was fixed by adding a return type to the method. Input parameter
is used as a default value if no parameter was found. The fix is somehow
backward compatible if everything is compiled again. Because of modified
method signatures it will not work if linking dynamically. But it may be
ignored here. The input type was therefore also changed to avoid boxing.

Also fixed same problem in locally unused fillBoolean() for consistency.

PVT used static variables for keeping input parameters. This may work in
most cases but is actually unpredictable. It is because static variables
are kept as long as an application process is running. Starting Activity
again means that the old values are reused. Starting an Activity without
input parameters therefore might not use defaults but some values of the
last start which may be different. Fixed by removing the static keyword.