diff options
| author | Keith Packard <keithp@keithp.com> | 2015-06-23 21:35:43 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2015-06-23 21:42:35 -0700 |
| commit | 56146cd379e1319b7adcf8e22cdda55f771e11be (patch) | |
| tree | 6417550c523318e3792167a947367bfd57a606c6 /altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java | |
| parent | 60b8bea12edb954e6140a92c8412364c9581e3c2 (diff) | |
altosdroid: Show direction to target in recover tab
This takes the bearing to target and current direction of motion (from
the Android API) and computes a turn amount and displays that so you
don't have to know which way is north when walking towards the rocket.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java')
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java index 0ab20f5f..cb394dbe 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java @@ -30,6 +30,7 @@ import android.location.Location; public class TabRecover extends AltosDroidTab { private TextView mBearingView; + private TextView mDirectionView; private TextView mDistanceView; private TextView mTargetLatitudeView; private TextView mTargetLongitudeView; @@ -44,6 +45,7 @@ public class TabRecover extends AltosDroidTab { View v = inflater.inflate(R.layout.tab_recover, container, false); mBearingView = (TextView) v.findViewById(R.id.bearing_value); + mDirectionView = (TextView) v.findViewById(R.id.direction_value); mDistanceView = (TextView) v.findViewById(R.id.distance_value); mTargetLatitudeView = (TextView) v.findViewById(R.id.target_lat_value); mTargetLongitudeView = (TextView) v.findViewById(R.id.target_lon_value); @@ -62,6 +64,11 @@ public class TabRecover extends AltosDroidTab { if (from_receiver != null) { mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); + String direction = AltosDroid.direction(from_receiver, receiver); + if (direction == null) + mDirectionView.setText(""); + else + mDirectionView.setText(direction); } if (state != null && state.gps != null) { mTargetLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); |
