X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FTabMap.java;h=de74420fb4af475e3e8f733d99a83d488a0c17bd;hb=57c1320962ad08d52e89d39bd5852f8d228dd872;hp=9c39e105d68781018ce4d29a0eede3c1a443a556;hpb=a959c1926048d1b96a06aa291131afd7c8e771c7;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java index 9c39e105..de74420f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java @@ -20,7 +20,7 @@ package org.altusmetrum.AltosDroid; import java.util.*; import java.io.*; -import org.altusmetrum.altoslib_7.*; +import org.altusmetrum.altoslib_10.*; import android.app.Activity; import android.graphics.*; @@ -37,6 +37,7 @@ public class TabMap extends AltosDroidTab { AltosLatLon here; private TextView mDistanceView; + private TextView mBearingLabel; private TextView mBearingView; private TextView mTargetLatitudeView; private TextView mTargetLongitudeView; @@ -57,29 +58,22 @@ public class TabMap extends AltosDroidTab { super.onCreate(savedInstanceState); } - private void make_offline_map() { - } - - private void make_online_map() { - map_online = new AltosMapOnline(view.getContext()); - map_online.onCreateView(altos_droid.map_type); - } - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.tab_map, container, false); int map_source = AltosDroidPreferences.map_source(); mDistanceView = (TextView)view.findViewById(R.id.distance_value); + mBearingLabel = (TextView)view.findViewById(R.id.bearing_label); mBearingView = (TextView)view.findViewById(R.id.bearing_value); mTargetLatitudeView = (TextView)view.findViewById(R.id.target_lat_value); mTargetLongitudeView = (TextView)view.findViewById(R.id.target_lon_value); mReceiverLatitudeView = (TextView)view.findViewById(R.id.receiver_lat_value); mReceiverLongitudeView = (TextView)view.findViewById(R.id.receiver_lon_value); map_offline = (AltosMapOffline)view.findViewById(R.id.map_offline); - map_offline.onCreateView(altos_droid.map_type); + map_offline.onCreateView(altos_droid); map_online = new AltosMapOnline(view.getContext()); - map_online.onCreateView(altos_droid.map_type); + map_online.onCreateView(altos_droid); set_map_source(AltosDroidPreferences.map_source()); return view; } @@ -96,7 +90,7 @@ public class TabMap extends AltosDroidTab { super.onDestroyView(); } - public String tab_name() { return "map"; } + public String tab_name() { return AltosDroid.tab_map_name; } private void center(double lat, double lon, double accuracy) { if (map_offline != null) @@ -107,8 +101,19 @@ public class TabMap extends AltosDroidTab { 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)); + String direction = AltosDroid.direction(from_receiver, receiver); + if (direction != null) { + mBearingLabel.setText("Direction"); + mBearingView.setText(direction); + } else { + mBearingLabel.setText("Bearing"); + mBearingView.setText(String.format("%3.0f°", from_receiver.bearing)); + } set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); + } else { + mBearingLabel.setText("Bearing"); + mBearingView.setText(""); + set_value(mDistanceView, AltosConvert.distance, 6, AltosLib.MISSING); } if (state != null) {