altosdroid: Update distance/bearing on map tab
authorKeith Packard <keithp@keithp.com>
Sat, 20 Apr 2013 22:16:50 +0000 (17:16 -0500)
committerKeith Packard <keithp@keithp.com>
Sat, 20 Apr 2013 22:16:50 +0000 (17:16 -0500)
Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/res/layout/tab_pad.xml
altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java

index 00d5ea12ddadec61b2fdde2a719d1176672effeb..e8f759eb85f45d784322334240ddc4750a862d77 100644 (file)
        <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
-               android:paddingLeft="69dp"
-               android:paddingTop="5dp" >
+               android:paddingLeft="69dp">
 
                <TextView
                        android:id="@+id/pad_lat_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android.paddingRight="4dp"
+                       android:width="100sp"
+                       android.paddingRight="10sp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_lat_label" />
 
        <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
-               android:paddingLeft="69dp"
-               android:paddingTop="5dp" >
+               android:paddingLeft="69dp">
 
                <TextView
                        android:id="@+id/pad_lon_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android.paddingRight="4dp"
+                       android:width="100sp"
+                       android.paddingRight="10sp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_lon_label" />
 
        <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
-               android:paddingLeft="69dp"
-               android:paddingTop="5dp" >
+               android:paddingLeft="69dp">
 
                <TextView
                        android:id="@+id/pad_alt_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android.paddingRight="4dp"
+                       android:width="100sp"
+                       android.paddingRight="10sp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_alt_label" />
 
index 66669ad04208c15787775b209292e346324743c1..3fb695a234612e6cb9291a50eeafd0ebb79db4ff 100644 (file)
@@ -152,11 +152,12 @@ public class TabMap extends Fragment implements AltosDroidTab {
                }
        }
        public void update_ui(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));
+               }
+
                if (state != null) {
-                       if (state.from_pad != null) {
-                               mDistanceView.setText(String.format("%6.0f m", state.from_pad.distance));
-                               mBearingView.setText(String.format("%3.0f°", state.from_pad.bearing));
-                       }
                        if (mapLoaded) {
                                if (state.gps != null) {
                                        mRocketMarker.setPosition(new LatLng(state.gps.lat, state.gps.lon));