X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosDroid.java;h=5ce6f81069eae5bb7222f9d4c447ce211d8b28e1;hp=93af2fdcd6ac69d0e56530d2ef6ac877bd728cca;hb=3cd8ff18a7546c1e251747ba26240cb130003ef1;hpb=192bc28fbe2a8613d0b42e4fb3f7674a1a50abc7 diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index 93af2fdc..5ce6f810 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -205,13 +205,11 @@ public class AltosDroid extends FragmentActivity { void set_location(Location location) { saved_location = location; - if (saved_state != null) { - update_ui(saved_state); - } + update_ui(saved_state); } void update_ui(AltosState state) { - if (saved_state != null) { + if (state != null && saved_state != null) { if (saved_state.state != state.state) { String currentTab = mTabHost.getCurrentTabTag(); switch (state.state) { @@ -231,7 +229,7 @@ public class AltosDroid extends FragmentActivity { AltosGreatCircle from_receiver = null; - if (saved_location != null && state.gps != null && state.gps.locked) { + if (state != null && saved_location != null && state.gps != null && state.gps.locked) { double altitude = 0; if (saved_location.hasAltitude()) altitude = saved_location.getAltitude(); @@ -243,16 +241,19 @@ public class AltosDroid extends FragmentActivity { state.gps.alt); } - mCallsignView.setText(state.data.callsign); - mSerialView.setText(String.format("%d", state.data.serial)); - mFlightView.setText(String.format("%d", state.data.flight)); - mStateView.setText(state.data.state()); - mRSSIView.setText(String.format("%d", state.data.rssi)); + if (state != null) { + mCallsignView.setText(state.data.callsign); + mSerialView.setText(String.format("%d", state.data.serial)); + mFlightView.setText(String.format("%d", state.data.flight)); + mStateView.setText(state.data.state()); + mRSSIView.setText(String.format("%d", state.data.rssi)); + } for (AltosDroidTab mTab : mTabs) mTab.update_ui(state, from_receiver, saved_location); - mAltosVoice.tell(state); + if (state != null) + mAltosVoice.tell(state); } private void onTimerTick() {