X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosDroid.java;h=3a5026ee80cd80e03b84120af82cde25e998a3d4;hb=b64ab2a8a25b0c22443bc77829c7f35b4f1c2455;hp=c2a6cb29a972a142b425ccf34eabd39292b3adcf;hpb=a761b34ed8fc64435f5a49623f4a5c55e2dda33a;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index c2a6cb29..3a5026ee 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -133,7 +133,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { switch (msg.what) { case MSG_STATE: - AltosDebug.debug("MSG_STATE"); if (msg.obj == null) { AltosDebug.debug("telemetry_state null!"); return; @@ -141,7 +140,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { ad.update_state((TelemetryState) msg.obj); break; case MSG_UPDATE_AGE: - AltosDebug.debug("MSG_UPDATE_AGE"); ad.update_age(); break; } @@ -466,8 +464,8 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { 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; } @@ -691,12 +689,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { public void onStop() { super.onStop(); AltosDebug.debug("-- ON STOP --"); - - doUnbindService(); - if (mAltosVoice != null) { - mAltosVoice.stop(); - mAltosVoice = null; - } } @Override @@ -704,7 +696,11 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { super.onDestroy(); AltosDebug.debug("--- ON DESTROY ---"); - if (mAltosVoice != null) mAltosVoice.stop(); + doUnbindService(); + if (mAltosVoice != null) { + mAltosVoice.stop(); + mAltosVoice = null; + } stop_timer(); } @@ -998,6 +994,12 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { static String direction(AltosGreatCircle from_receiver, Location receiver) { + if (from_receiver == null) + return null; + + if (receiver == null) + return null; + if (!receiver.hasBearing()) return null; @@ -1016,8 +1018,8 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { 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); } }