ao-tools/ao-dbg/ao-dbg
ao-tools/ao-dumplog/ao-dumplog
ao-tools/ao-eeprom/ao-eeprom
+ao-tools/ao-edit-telem/ao-edit-telem
ao-tools/ao-list/ao-list
ao-tools/ao-load/ao-load
ao-tools/ao-postflight/ao-postflight
bin/AltosDroid-release-signed.apk \
bin/AltosDroid-release.apk
-clean: $(GOOGLE_PLAY_SERVICES_LIB)
+clean-local: $(GOOGLE_PLAY_SERVICES_LIB)
ant clean
rm -rf $(EXT_LIBDIR)
rm -f $(DRAWABLES)
else
-clean:
+clean-local:
endif
+clean: clean-local
android:layout_height="0dp"
android:layout_weight="0" />
- <android.support.v4.view.ViewPager
+ <org.altusmetrum.AltosDroid.AltosViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-->
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/map"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- class="com.google.android.gms.maps.SupportMapFragment"/>
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:id="@+id/map"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1">
+
+ </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/distance_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ 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:text=""
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="5dp" >
+
+ <TextView
+ android:id="@+id/bearing_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ 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:text=""
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </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/lat_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/latitude_label" />
+
+ <TextView
+ android:id="@+id/lat_value"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_below="@id/lat_label"
+ android:text=""
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </RelativeLayout>
+
+ <RelativeLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:paddingTop="5dp" >
+
+ <TextView
+ android:id="@+id/lon_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/longitude_label" />
+
+ <TextView
+ android:id="@+id/lon_value"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_below="@id/lon_label"
+ android:text=""
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ </RelativeLayout>
+ </LinearLayout>
+</LinearLayout>
\ No newline at end of file
// Tabs
TabHost mTabHost;
- ViewPager mViewPager;
+ AltosViewPager mViewPager;
TabsAdapter mTabsAdapter;
ArrayList<AltosDroidTab> mTabs = new ArrayList<AltosDroidTab>();
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.setup();
- mViewPager = (ViewPager)findViewById(R.id.pager);
+ mViewPager = (AltosViewPager)findViewById(R.id.pager);
mViewPager.setOffscreenPageLimit(4);
mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);
--- /dev/null
+/*
+ * Copyright © 2013 Mike Beattie <mike@ethernal.org>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.AltosDroid;
+
+import android.content.Context;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class AltosViewPager extends ViewPager {
+
+ public AltosViewPager(Context context) {
+ super(context);
+ }
+
+ public AltosViewPager(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
+ if(v.getClass().getPackage().getName().startsWith("maps.")){
+ return true;
+ }
+ return super.canScroll(v, checkV, dx, x, y);
+ }
+
+}
\ No newline at end of file
package org.altusmetrum.AltosDroid;
-import org.altusmetrum.altoslib_1.AltosState;
+import java.util.Arrays;
+import org.altusmetrum.altoslib_1.*;
+
+import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.SupportMapFragment;
+import com.google.android.gms.maps.model.BitmapDescriptorFactory;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.Marker;
+import com.google.android.gms.maps.model.MarkerOptions;
+import com.google.android.gms.maps.model.Polyline;
+import com.google.android.gms.maps.model.PolylineOptions;
import android.app.Activity;
+import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.TextView;
public class TabMap extends Fragment implements AltosDroidTab {
AltosDroid mAltosDroid;
+ private SupportMapFragment mMapFragment;
private GoogleMap mMap;
+ private boolean mapLoaded = false;
+
+ private Marker mRocketMarker;
+ private Marker mPadMarker;
+ private Polyline mPolyline;
+ private TextView mDistanceView;
+ private TextView mBearingView;
+ private TextView mLatitudeView;
+ private TextView mLongitudeView;
@Override
public void onAttach(Activity activity) {
mAltosDroid.registerTab(this);
}
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mMapFragment = new SupportMapFragment() {
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ setupMap();
+ }
+ };
+
+ }
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
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);
return v;
}
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getChildFragmentManager().beginTransaction().add(R.id.map, mMapFragment).commit();
+ }
+
@Override
public void onDestroyView() {
super.onDestroyView();
//ft.commit();
}
+ private void setupMap() {
+ mMap = mMapFragment.getMap();
+ if (mMap != null) {
+ mMap.setMyLocationEnabled(true);
+ mMap.getUiSettings().setTiltGesturesEnabled(false);
+ mMap.getUiSettings().setZoomControlsEnabled(false);
+ mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.8,-104.7),8));
+
+ mRocketMarker = mMap.addMarker(
+ // From: http://mapicons.nicolasmollet.com/markers/industry/military/missile-2/
+ new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.rocket))
+ .position(new LatLng(0,0))
+ .visible(false)
+ );
+
+ mPadMarker = mMap.addMarker(
+ new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.pad))
+ .position(new LatLng(0,0))
+ .visible(false)
+ );
+
+ mPolyline = mMap.addPolyline(
+ new PolylineOptions().add(new LatLng(0,0), new LatLng(0,0))
+ .width(3)
+ .color(Color.BLUE)
+ .visible(false)
+ );
+
+ mapLoaded = true;
+ }
+ }
+
public void update_ui(AltosState state) {
-// mRangeView.setText(String.format("%6.0f m", state.range));
-// if (state.from_pad != null)
-// mBearingView.setText(String.format("%3.0f°", state.from_pad.bearing));
-// mLatitudeView.setText(pos(state.gps.lat, "N", "S"));
-// mLongitudeView.setText(pos(state.gps.lon, "W", "E"));
+ 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));
+ }
+ mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S"));
+ mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "W", "E"));
+
+ if (mapLoaded) {
+ mRocketMarker.setPosition(new LatLng(state.gps.lat, state.gps.lon));
+ mRocketMarker.setVisible(true);
+
+ mPolyline.setPoints(Arrays.asList(new LatLng(state.pad_lat, state.pad_lon), new LatLng(state.gps.lat, state.gps.lon)));
+ mPolyline.setVisible(true);
+
+ if (state.state == AltosLib.ao_flight_pad) {
+ mPadMarker.setPosition(new LatLng(state.pad_lat, state.pad_lon));
+ mPadMarker.setVisible(true);
+ }
+ }
}
}
[Set android SDK path (default searches in a variety of places)]),
[ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
-echo ANDROID_SDK set to $ANDROID_SDK
-
if test "x$ANDROID_SDK" = "xauto"; then
- AC_MSG_CHECKING([Android SDK files])
+ AC_MSG_CHECKING([Android SDK])
for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
if test "x$ANDROID_SDK" = "xauto"; then
SDK="$sdk"
fi
AC_MSG_RESULT([$ANDROID_SDK])
fi
+if test "x$ANDROID_SDK" != "xno"; then
+ AC_MSG_CHECKING([Android SDK version])
+ SDK_VERSION=`grep -i '^Pkg.Revision=' $ANDROID_SDK/tools/source.properties | cut -f2- -d= | sed s/^r//`
+ SDK_MAJOR_VERSION="`echo $SDK_VERSION | sed 's/[[^0-9]].*//'`"
+ if test "$SDK_MAJOR_VERSION" -lt 17 ; then
+ AC_MSG_NOTICE([SDK version $SDK_VERSION is too old. Need >= r17])
+ ANDROID_SDK=no
+ else
+ AC_MSG_RESULT([$SDK_VERSION])
+ fi
+fi
+if test "x$ANDROID_SDK" != "xno"; then
+ AC_MSG_CHECKING([Android SDK API Level])
+ if test -f "$ANDROID_SDK/platforms/android-10/source.properties"; then
+ API_LEVEL=`sed -ne 's/^AndroidVersion.ApiLevel=//p' $ANDROID_SDK/platforms/android-10/source.properties`
+ if test "$API_LEVEL" = "10"; then
+ AC_MSG_RESULT([$API_LEVEL])
+ else
+ AC_MSG_NOTICE([API Level 10 not installed correctly.])
+ ANDROID_SDK=no
+ fi
+ else
+ AC_MSG_NOTICE([API Level 10 not installed, but is required.])
+ ANDROID_SDK=no
+ fi
+fi
+if test "x$ANDROID_SDK" != "xno"; then
+ AC_MSG_CHECKING([Android SDK required extras])
+ if test -f "$ANDROID_SDK/extras/android/support/source.properties"; then
+ ANDROID_SUPPORT_LIB_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/android/support/source.properties`
+ if test -f "$ANDROID_SDK/extras/google/google_play_services/source.properties"; then
+ GOOGLE_PLAY_SERVICES_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/google/google_play_services/source.properties`
+ AC_MSG_RESULT([$ANDROID_SUPPORT_LIB_NAME, $GOOGLE_PLAY_SERVICES_NAME])
+ else
+ AC_MSG_NOTICE([Google Play Services library not installed.])
+ ANDROID_SDK=no
+ fi
+ else
+ AC_MSG_NOTICE([Android Support Library not installed.])
+ ANDROID_SDK=no
+ fi
+fi
AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])