altosdroid: Show our position in the map tab. Squeeze to fit phones
authorKeith Packard <keithp@keithp.com>
Sat, 13 Apr 2013 18:39:14 +0000 (11:39 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 13 Apr 2013 18:39:14 +0000 (11:39 -0700)
Shrink everything to fit on phones, then add phone location to the map tab

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/res/layout/altosdroid.xml
altosdroid/res/layout/tab_ascent.xml
altosdroid/res/layout/tab_descent.xml
altosdroid/res/layout/tab_landed.xml
altosdroid/res/layout/tab_map.xml
altosdroid/res/layout/tab_pad.xml
altosdroid/res/values/strings.xml
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java
altosdroid/src/org/altusmetrum/AltosDroid/TabMap.java
altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java

index b653aa2e68fa35cf6571c47c9179d97d51a7f35b..71b7ad054bc95dd05dfaa7e6e29572656554f38b 100644 (file)
@@ -47,7 +47,7 @@
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/callsign_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
@@ -67,7 +67,7 @@
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/serial_label"
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
@@ -87,7 +87,7 @@
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/flight_label"
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/state_label"
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/rssi_label"
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_below="@+id/age_label"
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
        </LinearLayout>
 
index 555da7f2ac406042f8aed4d2bd82dcdba867022e..d2d721e197c8323cbadeda4634979edc675dddb7 100644 (file)
@@ -47,7 +47,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/height_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
@@ -68,7 +68,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/max_height_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
        </LinearLayout>
 
@@ -99,7 +99,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/speed_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/max_speed_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
        </LinearLayout>
 
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/accel_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/max_accel_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
        </LinearLayout>
 
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lat_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lon_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/apogee_voltage_label"
                        android:layout_toRightOf="@id/apogee_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/main_voltage_label"
                        android:layout_toRightOf="@id/main_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
 </LinearLayout>
\ No newline at end of file
index 5f11a999f8b929606a9a9077b8e4ea2159a04baf..56e8a00a64a55b3924b1ae4d35a5585fc62c5b1f 100644 (file)
@@ -46,7 +46,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/speed_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
@@ -67,7 +67,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/height_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
        </LinearLayout>
@@ -99,7 +99,7 @@
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/elevation_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/range_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
        </LinearLayout>
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/bearing_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/compass_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
        </LinearLayout>
                                android:layout_alignParentRight="true"
                                android:layout_below="@id/distance_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <TextView
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lat_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lon_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/apogee_voltage_label"
                        android:layout_toRightOf="@id/apogee_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/main_voltage_label"
                        android:layout_toRightOf="@id/main_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
 </LinearLayout>
index 18b1c566977fb02cfac2437e994732088c883e12..9008700f65ce8dbac6c4133f7b55e59c7f2ee726 100644 (file)
@@ -37,7 +37,7 @@
                        android:layout_alignParentRight="true"
                        android:layout_below="@+id/bearing_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
@@ -58,7 +58,7 @@
                        android:layout_alignParentRight="true"
                        android:layout_below="@+id/distance_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
@@ -79,7 +79,7 @@
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lat_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/lon_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/max_height_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/max_speed_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_alignParentRight="true"
                        android:layout_below="@id/max_accel_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
 </LinearLayout>
\ No newline at end of file
index 233d2a0d313ad0f1ca95a3a76fbb3fd73a2aa872..f611ae481b423bb821f364d351f6fcec98c994d8 100644 (file)
                                android:id="@+id/distance_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
+                               android:paddingRight="4dp"
                                android:text="@string/distance_label" />
 
                        <TextView
                                android:id="@+id/distance_value"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:layout_alignParentRight="true"
-                               android:layout_below="@+id/distance_label"
+                               android:layout_toRightOf="@+id/distance_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                                android:id="@+id/bearing_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
+                               android:paddingRight="4dp"
                                android:text="@string/bearing_label" />
 
                        <TextView
                                android:id="@+id/bearing_value"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:layout_alignParentRight="true"
-                               android:layout_below="@+id/bearing_label"
+                               android:layout_toRightOf="@+id/bearing_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
        </LinearLayout>
                        android:paddingTop="5dp" >
 
                        <TextView
-                               android:id="@+id/lat_label"
+                               android:id="@+id/target_lat_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:text="@string/latitude_label" />
+                               android:paddingRight="4dp"
+                               android:text="@string/target_latitude_label" />
 
                        <TextView
-                               android:id="@+id/lat_value"
+                               android:id="@+id/target_lat_value"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:layout_alignParentRight="true"
-                               android:layout_below="@id/lat_label"
+                               android:layout_toRightOf="@id/target_lat_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
 
                <RelativeLayout
                        android:paddingTop="5dp" >
 
                        <TextView
-                               android:id="@+id/lon_label"
+                               android:id="@+id/target_lon_label"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:text="@string/longitude_label" />
+                               android:paddingRight="4dp"
+                               android:text="@string/target_longitude_label" />
 
                        <TextView
-                               android:id="@+id/lon_value"
+                               android:id="@+id/target_lon_value"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
-                               android:layout_alignParentRight="true"
-                               android:layout_below="@id/lon_label"
+                               android:layout_toRightOf="@id/target_lon_label"
                                android:text=""
-                               android:textAppearance="?android:attr/textAppearanceMedium" />
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
+               </RelativeLayout>
+       </LinearLayout>
+
+       <LinearLayout
+               xmlns:android="http://schemas.android.com/apk/res/android"
+               android:layout_width="fill_parent"
+               android:layout_height="wrap_content"
+               android:baselineAligned="true"
+               android:orientation="horizontal" >
+
+               <RelativeLayout
+                       android:layout_width="0dp"
+                       android:layout_height="wrap_content"
+                       android:layout_weight="1"
+                       android:paddingTop="5dp" >
+
+                       <TextView
+                               android:id="@+id/receiver_lat_label"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:paddingRight="4dp"
+                               android:text="@string/receiver_latitude_label" />
+
+                       <TextView
+                               android:id="@+id/receiver_lat_value"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:layout_toRightOf="@id/receiver_lat_label"
+                               android:text=""
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
+               </RelativeLayout>
+
+               <RelativeLayout
+                       android:layout_width="0dp"
+                       android:layout_height="wrap_content"
+                       android:layout_weight="1"
+                       android:paddingTop="5dp" >
+
+                       <TextView
+                               android:id="@+id/receiver_lon_label"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:paddingRight="4dp"
+                               android:text="@string/receiver_longitude_label" />
+
+                       <TextView
+                               android:id="@+id/receiver_lon_value"
+                               android:layout_width="wrap_content"
+                               android:layout_height="wrap_content"
+                               android:layout_toRightOf="@id/receiver_lon_label"
+                               android:text=""
+                               android:textAppearance="?android:attr/textAppearanceSmall" />
                </RelativeLayout>
        </LinearLayout>
 </LinearLayout>
\ No newline at end of file
index b8ca1a442a791f5f5176dca79fb94bf939f116c7..a21f9bbbb05b271631c8d5c115ab725165937e79 100644 (file)
@@ -55,7 +55,7 @@
                        android:layout_below="@id/battery_voltage_label"
                        android:layout_toRightOf="@id/battery_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
@@ -93,7 +93,7 @@
                        android:layout_below="@id/apogee_voltage_label"
                        android:layout_toRightOf="@id/apogee_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/main_voltage_label"
                        android:layout_toRightOf="@id/main_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/logging_label"
                        android:layout_toRightOf="@id/logging_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/gps_locked_label"
                        android:layout_toRightOf="@id/gps_locked_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:layout_below="@id/gps_ready_label"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:id="@+id/pad_lat_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
+                       android.paddingRight="4dp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_lat_label" />
 
                        android:id="@+id/pad_lat_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:layout_below="@id/pad_lat_label"
-                       android:layout_toRightOf="@id/gps_ready_greenled"
+                       android:layout_toRightOf="@id/pad_lat_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:id="@+id/pad_lon_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
+                       android.paddingRight="4dp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_lon_label" />
 
                        android:id="@+id/pad_lon_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:layout_below="@id/pad_lon_label"
-                       android:layout_toRightOf="@id/gps_ready_greenled"
+                       android:layout_toRightOf="@id/pad_lon_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
        <RelativeLayout
                        android:id="@+id/pad_alt_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
+                       android.paddingRight="4dp"
                        android:layout_toRightOf="@id/gps_ready_greenled"
                        android:text="@string/pad_alt_label" />
 
                        android:id="@+id/pad_alt_value"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
-                       android:layout_below="@id/pad_alt_label"
-                       android:layout_toRightOf="@id/gps_ready_greenled"
+                       android:layout_toRightOf="@id/pad_alt_label"
                        android:text=""
-                       android:textAppearance="?android:attr/textAppearanceMedium" />
+                       android:textAppearance="?android:attr/textAppearanceSmall" />
        </RelativeLayout>
 
 </LinearLayout>
\ No newline at end of file
index 639611c20053711007bca29fbc1d0d8fd3c22d77..90da617b2ffe9af6e29e49e5f476ebe600415a79 100644 (file)
        <string name="gps_ready_label">GPS Ready</string>
        <string name="latitude_label">Latitude</string>
        <string name="longitude_label">Longitude</string>
-       <string name="pad_lat_label">Pad Latitude</string>
-       <string name="pad_lon_label">Pad Longitude</string>
-       <string name="pad_alt_label">Pad Altitude</string>
+       <string name="target_latitude_label">Tar Lat</string>
+       <string name="target_longitude_label">Tar Lon</string>
+       <string name="receiver_latitude_label">My Lat</string>
+       <string name="receiver_longitude_label">My Lon</string>
+       <string name="pad_lat_label">Pad Lat</string>
+       <string name="pad_lon_label">Pad Lon</string>
+       <string name="pad_alt_label">Pad Alt</string>
 
 </resources>
index cf4227cae7895e8c713e16ee45207a177ed3b766..3715c3f9600a4d1d06b55c5f0efb08e3f81173de 100644 (file)
@@ -271,7 +271,7 @@ public class AltosDroid extends FragmentActivity {
                }
                int deg = (int) Math.floor(p);
                double min = (p - Math.floor(p)) * 60.0;
-               return String.format("%d° %9.6f\" %s", deg, min, h);
+               return String.format("%d°%9.4f\" %s", deg, min, h);
        }
 
        @Override
@@ -312,6 +312,8 @@ public class AltosDroid extends FragmentActivity {
                mTabsAdapter.addTab(mTabHost.newTabSpec("landed").setIndicator("Landed"), TabLanded.class, null);
                mTabsAdapter.addTab(mTabHost.newTabSpec("map").setIndicator("Map"), TabMap.class, null);
 
+               for (int i = 0; i < 5; i++)
+                       mTabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 45;
 
                // Set up the custom title
                mTitle = (TextView) findViewById(R.id.title_left_text);
index 0a208fa8227c5fdb19473839fd130e671f83cd70..29696dbf3dcd636675534044e48000f200ddb4c1 100644 (file)
@@ -55,8 +55,10 @@ public class TabMap extends Fragment implements AltosDroidTab {
 
        private TextView mDistanceView;
        private TextView mBearingView;
-       private TextView mLatitudeView;
-       private TextView mLongitudeView;
+       private TextView mTargetLatitudeView;
+       private TextView mTargetLongitudeView;
+       private TextView mReceiverLatitudeView;
+       private TextView mReceiverLongitudeView;
 
        @Override
        public void onAttach(Activity activity) {
@@ -84,8 +86,10 @@ public class TabMap extends Fragment implements AltosDroidTab {
                View v = inflater.inflate(R.layout.tab_map, container, false);
                mDistanceView  = (TextView)v.findViewById(R.id.distance_value);
                mBearingView   = (TextView)v.findViewById(R.id.bearing_value);
-               mLatitudeView  = (TextView)v.findViewById(R.id.lat_value);
-               mLongitudeView = (TextView)v.findViewById(R.id.lon_value);
+               mTargetLatitudeView  = (TextView)v.findViewById(R.id.target_lat_value);
+               mTargetLongitudeView = (TextView)v.findViewById(R.id.target_lon_value);
+               mReceiverLatitudeView  = (TextView)v.findViewById(R.id.receiver_lat_value);
+               mReceiverLongitudeView = (TextView)v.findViewById(R.id.receiver_lon_value);
                return v;
        }
 
@@ -146,8 +150,13 @@ public class TabMap extends Fragment implements AltosDroidTab {
                        mBearingView.setText(String.format("%3.0f°", state.from_pad.bearing));
                }
                if (state.gps != null) {
-                       mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S"));
-                       mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E"));
+                       mTargetLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S"));
+                       mTargetLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E"));
+               }
+
+               if (receiver != null) {
+                       mReceiverLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S"));
+                       mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "W", "E"));
                }
 
                if (mapLoaded) {
index 0ddfdfc3ad50c6ed281cac7a05b5910dd43546a7..f1304a95298f3d645e10eb13419e90ba9d993a07 100644 (file)
@@ -245,6 +245,9 @@ public class TelemetryService extends Service {
        }
 
        private void startAltosBluetooth() {
+               if (device == null) {
+                       return;
+               }
                if (mAltosBluetooth == null) {
                        if (D) Log.d(TAG, String.format("startAltosBluetooth(): Connecting to %s (%s)", device.getName(), device.getAddress()));
                        mAltosBluetooth = new AltosBluetooth(device, mHandler);
@@ -274,6 +277,8 @@ public class TelemetryService extends Service {
 
        private void connected() {
                try {
+                       if (mAltosBluetooth == null)
+                               throw new InterruptedException("no bluetooth");
                        mConfigData = mAltosBluetooth.config_data();
                } catch (InterruptedException e) {
                } catch (TimeoutException e) {