diff options
| author | Keith Packard <keithp@keithp.com> | 2014-08-17 20:48:23 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2014-08-17 20:48:23 -0700 |
| commit | 59dfe661fcb504f390d9726378c676f2b5b005f3 (patch) | |
| tree | 3b04fce1f5365ba7f98768dcaa3b29bfbb0afcb4 /altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java | |
| parent | b1f1844aa514893228080704da3b3ccf855bda1e (diff) | |
altosdroid: Skip updating hidden UI elements
Instead of updating everything in the UI, only update the visible UI
elements to save a bunch of computation.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java')
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java index 47e41d59..16427d8b 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java @@ -28,7 +28,7 @@ import android.view.ViewGroup; import android.widget.TextView; import android.location.Location; -public class TabLanded extends Fragment implements AltosDroidTab { +public class TabLanded extends AltosDroidTab { AltosDroid mAltosDroid; private TextView mBearingView; @@ -73,7 +73,9 @@ public class TabLanded extends Fragment implements AltosDroidTab { mAltosDroid = null; } - public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) { + public String tab_name() { return "landed"; } + + public void show(AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (from_receiver != null) { mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); mDistanceView.setText(String.format("%6.0f m", from_receiver.distance)); @@ -87,12 +89,11 @@ public class TabLanded extends Fragment implements AltosDroidTab { mReceiverLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S")); mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "W", "E")); } - + if (state != null) { mMaxHeightView.setText(String.format("%6.0f m", state.max_height())); mMaxAccelView.setText(String.format("%6.0f m/s²", state.max_acceleration())); mMaxSpeedView.setText(String.format("%6.0f m/s", state.max_speed())); } } - } |
