switch (msg.what) {
case MSG_STATE:
- AltosDebug.debug("MSG_STATE");
if (msg.obj == null) {
AltosDebug.debug("telemetry_state null!");
return;
ad.update_state((TelemetryState) msg.obj);
break;
case MSG_UPDATE_AGE:
- AltosDebug.debug("MSG_UPDATE_AGE");
ad.update_age();
break;
}
for (AltosDroidTab mTab : mTabs)
mTab.update_ui(telem_state, state, from_receiver, location, mTab == mTabsAdapter.currentItem());
- if (state != null && mAltosVoice != null)
- mAltosVoice.tell(state, from_receiver);
+ if (mAltosVoice != null)
+ mAltosVoice.tell(telem_state, state, from_receiver, location, (AltosDroidTab) mTabsAdapter.currentItem());
saved_state = state;
}
public void onStop() {
super.onStop();
AltosDebug.debug("-- ON STOP --");
-
- doUnbindService();
- if (mAltosVoice != null) {
- mAltosVoice.stop();
- mAltosVoice = null;
- }
}
@Override
super.onDestroy();
AltosDebug.debug("--- ON DESTROY ---");
- if (mAltosVoice != null) mAltosVoice.stop();
+ doUnbindService();
+ if (mAltosVoice != null) {
+ mAltosVoice.stop();
+ mAltosVoice = null;
+ }
stop_timer();
}
static String direction(AltosGreatCircle from_receiver,
Location receiver) {
+ if (from_receiver == null)
+ return null;
+
+ if (receiver == null)
+ return null;
+
if (!receiver.hasBearing())
return null;
else if (iheading < -179 || 179 < iheading)
return "backwards";
else if (iheading < 0)
- return String.format("left %d", -iheading);
+ return String.format("left %d°", -iheading);
else
- return String.format("right %d", iheading);
+ return String.format("right %d°", iheading);
}
}