Skip to content

Commit

Permalink
Merge pull request #233 from enviroCar/bugfix-0.9.1
Browse files Browse the repository at this point in the history
Bugfix 0.9.1 release
  • Loading branch information
matthesrieke committed May 8, 2014
2 parents 7773c8b + ca70b4b commit 1273df9
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 12 deletions.
6 changes: 3 additions & 3 deletions org.envirocar.app/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.envirocar.app"
android:versionCode="21"
android:versionName="0.9.0">
android:versionCode="22"
android:versionName="0.9.1">

<uses-sdk
android:minSdkVersion="10"
Expand Down Expand Up @@ -92,4 +92,4 @@
</activity>
</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,13 @@ public void onDestroy() {
logger.info("onDestroy. hash="+System.identityHashCode(this));
super.onDestroy();

getActivity().unregisterReceiver(receiver);
try {
getActivity().unregisterReceiver(receiver);
}
catch (IllegalArgumentException e) {
logger.warn(e.getMessage(), e);
logger.warn("Reconsider the Receiver registration lifecycle!");
}
if (preferences != null) {
preferences.unregisterOnSharedPreferenceChangeListener(preferenceListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,27 @@ private void updateUsabilityOfMenuItems() {

@Override
public void run() {
Menu theMenu = menu;

if (theMenu == null) {
return;
}

if (dbAdapter.getAllLocalTracks().size() > 0) {
menu.findItem(R.id.menu_delete_all).setEnabled(true);
menu.findItem(R.id.menu_upload).setEnabled(UserManager.instance().isLoggedIn());
setItemEnabled(theMenu.findItem(R.id.menu_delete_all), true);
setItemEnabled(theMenu.findItem(R.id.menu_upload), UserManager.instance().isLoggedIn());
} else {
menu.findItem(R.id.menu_upload).setEnabled(false);
menu.findItem(R.id.menu_delete_all).setEnabled(false);
setItemEnabled(theMenu.findItem(R.id.menu_upload), false);
setItemEnabled(theMenu.findItem(R.id.menu_delete_all), false);
}
}

private void setItemEnabled(com.actionbarsherlock.view.MenuItem item,
boolean b) {
if (item != null) {
item.setEnabled(b);
}
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,11 @@ protected void onDestroy() {

this.unregisterReceiver(bluetoothStateReceiver);
this.unregisterReceiver(deviceDiscoveryStateReceiver);
this.unregisterReceiver(errorInformationReceiver);

this.unregisterReceiver(serviceStateReceiver);

this.unregisterReceiver(errorInformationReceiver);

if (remainingTimeHandler != null) {
remainingTimeHandler.removeCallbacks(remainingTimeThread);
discoveryTargetTime = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ public void run() {
break;

} catch (IOException e) {
logger.warn("Exception on bluetooth connection. Trying the fallback... : "+e.getMessage(), e);
//try the fallback
try {
if (running) {
Expand All @@ -186,7 +187,7 @@ public void run() {
break;
}
} catch (FallbackException e1) {
logger.warn("Could not initialize FallbackBluetoothSocket classes.", e);
logger.warn("Could not initialize FallbackBluetoothSocket classes: "+e1.getMessage(), e1);
} catch (InterruptedException e1) {
logger.warn(e1.getMessage(), e1);
} catch (IOException e1) {
Expand Down Expand Up @@ -224,7 +225,7 @@ private boolean selectSocket() {
bluetoothSocket = new NativeBluetoothSocket(tmp);
return true;
} catch (IOException e) {
logger.warn(e.getMessage() ,e);
logger.warn(e.getMessage(), e);
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,19 @@ private void updateConnectionState() {
}

private void determineProtocol(String protocolInt) {
int prot = Integer.parseInt(protocolInt);
if (protocolInt == null || protocolInt.trim().isEmpty()) {
return;
}

int prot;
try {
prot = Integer.parseInt(protocolInt);
}
catch (NumberFormatException e) {
logger.warn("NFE: "+e.getMessage());
return;
}

switch (prot) {
case 1:
protocol = Protocol.CAN11500;
Expand Down

0 comments on commit 1273df9

Please sign in to comment.