Switch from GPLv2 to GPLv2+
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / TabRecover.java
index 0ab20f5f6c8f9890f3e09fe65cde17cf5a502522..97a35c9eb4a044ca9f1903f9394586725c48a409 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +18,7 @@
 
 package org.altusmetrum.AltosDroid;
 
-import org.altusmetrum.altoslib_7.*;
+import org.altusmetrum.altoslib_11.*;
 
 import android.app.Activity;
 import android.os.Bundle;
@@ -30,6 +31,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 +46,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);
@@ -56,12 +59,17 @@ public class TabRecover extends AltosDroidTab {
                return v;
        }
 
-       public String tab_name() { return "recover"; }
+       public String tab_name() { return AltosDroid.tab_recover_name; }
 
        public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) {
                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"));