Skip to content

Commit

Permalink
Merge pull request #306 from mstevetodd/master
Browse files Browse the repository at this point in the history
try to avoid a few reported crashes, bumping version to 2.21.61 for Beta
  • Loading branch information
mstevetodd authored Aug 1, 2018
2 parents 56aff0b + c75834e commit ad3f839
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="jmri.enginedriver"
android:versionCode="60"
android:versionName="2.21.60" android:installLocation="auto">
android:versionCode="61"
android:versionName="2.21.61" android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Expand Down
2 changes: 2 additions & 0 deletions assets/about_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ <h1>Engine Driver Throttle for Android</h1>
<p><b>Latest changes for this version include:</b></p>
<ul>
<li>remove turnout hardware list, WiThrottle Server changing to handle numeric-only</li>
<li>changes to EngineDriver icon</li>
<li>German translations by Al Babinsky and Daniel Sieber</li>
<li>prevent crashes reported to Play Store</li>
</ul>
<p><em><a
href="https://raw.githubusercontent.com/JMRI/EngineDriver/master/changelog-and-todo-list.txt"
Expand Down
5 changes: 3 additions & 2 deletions changelog-and-todo-list.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
**Version 2.21
* remove turnout hardware list, WiThrottle Server changed to also handle numeric-only
* changes to EngineDriver icon
* prevent crashes reported to Play Store
**Version 2.20
* Fix for Gamepad functions F10 and above
* monochrome icon for the notification bar
Expand Down Expand Up @@ -403,7 +405,6 @@
* turnouts
* TODO: add turnouts to list as used, when no list available
* TODO: combine loco control and turnout control in one page
* TODO: list available "system" based on items in use, maybe with dropdown on Turnout
* TODO: pref to sort by system name vs. user name
* TODO: use PTT titles for Turnouts/Turnout
* connection
Expand All @@ -420,6 +421,7 @@
* TODO: check for error on send and do something with it
* TODO: redo hard-coded 29 in function arrays (29 is hard-coded in WiT side, so no rush)
* throttle:
* TODO: manually create roster entries (function labels) and store on device
* TODO: if nS is lead of ED consist, MT-nS loses track of "other" loco (test with a "partial steal")
* TODO: clear loco buttons on reconnect attempt until actual MT+ received
* TODO: make Stop "sticky" and ignore slider unless direction is selected
Expand All @@ -436,7 +438,6 @@
* TODO: disconnect connections made by roster stuff
* TODO: add close button and roster image to details dialog
* TODO: simplify select_loco by removing handler
* TODO: manually create roster entries and store on device
* TODO: for "auto" handle the Digitrax numbering, i.e. 1-128 is short
* TODO: allow user to delete individual recents (long-press?)
* preferences:
Expand Down
6 changes: 3 additions & 3 deletions src/jmri/enginedriver/threaded_application.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class threaded_application extends Application {
String[] rt_user_names;
String[] rt_states;
HashMap<String, String> rt_state_names; //if not set, routes are not allowed
HashMap<String, String> roster_entries; //roster sent by WiThrottle
LinkedHashMap<String, String> roster_entries; //roster sent by WiThrottle
LinkedHashMap<String, String> consist_entries;
private static DownloadRosterTask dlRosterTask = null;
private static DownloadMetaTask dlMetadataTask = null;
Expand Down Expand Up @@ -1019,7 +1019,7 @@ private void process_roster_function_string(String response_str, int whichThrott
// RL2]\[NS2591}|{2591}|{L]\[NS4805}|{4805}|{L
private void process_roster_list(String response_str) {
//clear the global variable
roster_entries = new HashMap<>();
roster_entries = new LinkedHashMap<>();

String[] ta = splitByString(response_str, "]\\["); //initial separation
//initialize app arrays (skipping first)
Expand Down Expand Up @@ -2066,7 +2066,7 @@ private void initShared() {

consist_entries = new LinkedHashMap<>();
roster = null;
roster_entries = null;
roster_entries = new LinkedHashMap<>();
metadata = null;
doFinish = false;
turnouts_list_position = 0;
Expand Down
13 changes: 7 additions & 6 deletions src/jmri/enginedriver/throttle.java
Original file line number Diff line number Diff line change
Expand Up @@ -1703,8 +1703,8 @@ void applySpeedRelatedOptions(int whichThrottle) {

void enable_disable_buttons(int whichThrottle, boolean forceDisable) {
boolean newEnabledState = false;
if (!forceDisable) {
newEnabledState = mainapp.consists[whichThrottle].isActive(); // set false if lead loco is not assigned
if (!forceDisable && (whichThrottle < mainapp.consists.length)) { // avoid index crash, but may simply push to next line
newEnabledState = mainapp.consists[whichThrottle].isActive(); // set false if lead loco is not assigned
}
bFwds[whichThrottle].setEnabled(newEnabledState);
bRevs[whichThrottle].setEnabled(newEnabledState);
Expand Down Expand Up @@ -3805,13 +3805,12 @@ public void onPageFinished(WebView view, String url) {
for (int throttleIndex = 0; throttleIndex < mainapp.maxThrottles; throttleIndex++) {
changeTimers[throttleIndex] = new ChangeDelay(throttleIndex);
}

// tone generator for feedback sounds
try {
tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION,
preferences.getIntPrefValue(prefs,"prefGamePadFeedbackVolume", getApplicationContext().getResources().getString(R.string.prefGamePadFeedbackVolumeDefaultValue)));
} catch (RuntimeException e) {
Log.d("Engine_Driver", "new ToneGenerateor failed. Runtime Exception, OS " + android.os.Build.VERSION.SDK_INT + " Message: " + e);
Log.e("Engine_Driver", "new ToneGenerator failed. Runtime Exception, OS " + android.os.Build.VERSION.SDK_INT + " Message: " + e);
}
// set GamePad Support
setGamepadKeys();
Expand Down Expand Up @@ -4120,7 +4119,9 @@ void set_function_labels_and_listeners_for_view(int whichThrottle) {
// while we are using it (causing issues during button update below)
function_labels_temp = mainapp.function_labels_default;
if (!prefAlwaysUseDefaultFunctionLabels) {
if (mainapp.function_labels[whichThrottle] != null && mainapp.function_labels[whichThrottle].size() > 0) {
if (mainapp.function_labels != null
&& mainapp.function_labels[whichThrottle] != null
&& mainapp.function_labels[whichThrottle].size() > 0) {
function_labels_temp = new LinkedHashMap<>(mainapp.function_labels[whichThrottle]);
} else {
if (!mainapp.consists[whichThrottle].isLeadFromRoster()) {
Expand Down Expand Up @@ -4528,7 +4529,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
tg = new ToneGenerator(AudioManager.STREAM_NOTIFICATION,
preferences.getIntPrefValue(prefs, "prefGamePadFeedbackVolume", getApplicationContext().getResources().getString(R.string.prefGamePadFeedbackVolumeDefaultValue)));
} catch (RuntimeException e) {
Log.d("Engine_Driver", "new ToneGenerateor failed. Runtime Exception, OS " + android.os.Build.VERSION.SDK_INT + " Message: " + e);
Log.e("Engine_Driver", "new ToneGenerator failed. Runtime Exception, OS " + android.os.Build.VERSION.SDK_INT + " Message: " + e);
}
}
// update GamePad Support
Expand Down

0 comments on commit ad3f839

Please sign in to comment.