diff options
author | Keith Packard <keithp@keithp.com> | 2015-06-22 20:43:23 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-06-22 21:04:43 -0700 |
commit | 2b6768ed32d7be444c49caa40d30b520177bb22a (patch) | |
tree | 17cfe8b71acefcd02b8e9b146edc95d2d2da3819 | |
parent | 0f56903774d9e8bb033dfc0af6945e8ddc1d3065 (diff) |
altosdroid: Switch to four tabs (pad/flight/recover/map)
Ascent and descent were almost the same; no reason to have both.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | altosdroid/res/layout/tab_ascent.xml | 299 | ||||
-rw-r--r-- | altosdroid/res/layout/tab_flight.xml (renamed from altosdroid/res/layout/tab_descent.xml) | 52 | ||||
-rw-r--r-- | altosdroid/res/layout/tab_recover.xml (renamed from altosdroid/res/layout/tab_landed.xml) | 0 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java | 18 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java | 3 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java | 101 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java | 106 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabFlight.java | 134 | ||||
-rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java (renamed from altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java) | 6 |
9 files changed, 199 insertions, 520 deletions
diff --git a/altosdroid/res/layout/tab_ascent.xml b/altosdroid/res/layout/tab_ascent.xml deleted file mode 100644 index b21ec426..00000000 --- a/altosdroid/res/layout/tab_ascent.xml +++ /dev/null @@ -1,299 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - 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. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical" > - - <LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_weight="0" - android:baselineAligned="true" - android:orientation="horizontal" - android:paddingTop="5dp" > - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/height_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/height_label" /> - - <TextView - android:id="@+id/height_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/height_label" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/max_height_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/max_height_label" /> - - <TextView - android:id="@+id/max_height_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/max_height_label" - android:text="" - 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:layout_weight="0" - android:baselineAligned="true" - android:orientation="horizontal" - android:paddingTop="5dp" > - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/speed_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/speed_label" /> - - <TextView - android:id="@+id/speed_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/speed_label" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/max_speed_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/max_speed_label" /> - - <TextView - android:id="@+id/max_speed_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/max_speed_label" - android:text="" - 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:layout_weight="0" - android:baselineAligned="true" - android:orientation="horizontal" - android:paddingTop="5dp" > - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/accel_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/accel_label" /> - - <TextView - android:id="@+id/accel_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/accel_label" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" > - - <TextView - android:id="@+id/max_accel_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/max_accel_label" /> - - <TextView - android:id="@+id/max_accel_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/max_accel_label" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - </LinearLayout> - - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - 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/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - 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/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingTop="5dp" > - - <ImageView - android:id="@+id/apogee_redled" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:contentDescription="@string/apogee_voltage_label" - android:src="@drawable/grayled" /> - - <ImageView - android:id="@+id/apogee_greenled" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/apogee_redled" - android:contentDescription="@string/apogee_voltage_label" - android:paddingRight="5dp" - android:src="@drawable/grayled" /> - - <TextView - android:id="@+id/apogee_voltage_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/apogee_greenled" - android:text="@string/apogee_voltage_label" /> - - <TextView - android:id="@+id/apogee_voltage_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/apogee_voltage_label" - android:layout_toRightOf="@id/apogee_greenled" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - - <RelativeLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingTop="5dp" > - - <ImageView - android:id="@+id/main_redled" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:contentDescription="@string/main_voltage_label" - android:src="@drawable/grayled" /> - - <ImageView - android:id="@+id/main_greenled" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/main_redled" - android:contentDescription="@string/main_voltage_label" - android:paddingRight="5dp" - android:src="@drawable/grayled" /> - - <TextView - android:id="@+id/main_voltage_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_toRightOf="@id/main_greenled" - android:text="@string/main_voltage_label" /> - - <TextView - android:id="@+id/main_voltage_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentRight="true" - android:layout_below="@id/main_voltage_label" - android:layout_toRightOf="@id/main_greenled" - android:text="" - android:textAppearance="?android:attr/textAppearanceSmall" /> - </RelativeLayout> - -</LinearLayout>
\ No newline at end of file diff --git a/altosdroid/res/layout/tab_descent.xml b/altosdroid/res/layout/tab_flight.xml index 9e1fc820..4fa026ca 100644 --- a/altosdroid/res/layout/tab_descent.xml +++ b/altosdroid/res/layout/tab_flight.xml @@ -78,6 +78,58 @@ android:layout_height="wrap_content" android:layout_weight="0" android:baselineAligned="true" + android:orientation="horizontal" > + + <RelativeLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" > + + <TextView + android:id="@+id/max_speed_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/max_speed_label" /> + + <TextView + android:id="@+id/max_speed_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_below="@id/max_speed_label" + android:text="" + android:textAppearance="?android:attr/textAppearanceSmall" /> + </RelativeLayout> + + <RelativeLayout + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" > + + <TextView + android:id="@+id/max_height_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/max_height_label" /> + + <TextView + android:id="@+id/max_height_value" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_below="@id/max_height_label" + android:text="" + 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:layout_weight="0" + android:baselineAligned="true" android:orientation="horizontal" android:paddingTop="5dp" > diff --git a/altosdroid/res/layout/tab_landed.xml b/altosdroid/res/layout/tab_recover.xml index f27baa9e..f27baa9e 100644 --- a/altosdroid/res/layout/tab_landed.xml +++ b/altosdroid/res/layout/tab_recover.xml diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index c5da6d0e..6cd9463a 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -399,9 +399,9 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { if (prev_locked != locked) { String currentTab = mTabHost.getCurrentTabTag(); if (locked) { - if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("descent"); + if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("flight"); } else { - if (currentTab.equals("descent")) mTabHost.setCurrentTabByTag("pad"); + if (currentTab.equals("flight")) mTabHost.setCurrentTabByTag("pad"); } } } else { @@ -409,16 +409,13 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { String currentTab = mTabHost.getCurrentTabTag(); switch (state.state) { case AltosLib.ao_flight_boost: - if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("ascent"); - break; - case AltosLib.ao_flight_drogue: - if (currentTab.equals("ascent")) mTabHost.setCurrentTabByTag("descent"); + if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("flight"); break; case AltosLib.ao_flight_landed: - if (currentTab.equals("descent")) mTabHost.setCurrentTabByTag("landed"); + if (currentTab.equals("flight")) mTabHost.setCurrentTabByTag("recover"); break; case AltosLib.ao_flight_stateless: - if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("descent"); + if (currentTab.equals("pad")) mTabHost.setCurrentTabByTag("flight"); break; } } @@ -539,9 +536,8 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager); mTabsAdapter.addTab(mTabHost.newTabSpec("pad").setIndicator(create_tab_view("Pad")), TabPad.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("ascent").setIndicator(create_tab_view("Ascent")), TabAscent.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("descent").setIndicator(create_tab_view("Descent")), TabDescent.class, null); - mTabsAdapter.addTab(mTabHost.newTabSpec("landed").setIndicator(create_tab_view("Landed")), TabLanded.class, null); + mTabsAdapter.addTab(mTabHost.newTabSpec("flight").setIndicator(create_tab_view("Flight")), TabFlight.class, null); + mTabsAdapter.addTab(mTabHost.newTabSpec("recover").setIndicator(create_tab_view("Recover")), TabRecover.class, null); mTabsAdapter.addTab(mTabHost.newTabSpec("map").setIndicator(create_tab_view("Map")), TabMap.class, null); // Display the Version diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java b/altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java index 2f2f74ce..1968edae 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java @@ -163,6 +163,9 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe public void set_zoom_label(String label) { } + public void select_object(AltosLatLon latlon) { + } + public void debug(String format, Object ... arguments) { AltosDebug.debug(format, arguments); } diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java deleted file mode 100644 index afce937f..00000000 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabAscent.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 org.altusmetrum.altoslib_7.*; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; -import android.location.Location; - -public class TabAscent extends AltosDroidTab { - private TextView mHeightView; - private TextView mMaxHeightView; - private TextView mSpeedView; - private TextView mMaxSpeedView; - private TextView mAccelView; - private TextView mMaxAccelView; - private TextView mLatitudeView; - private TextView mLongitudeView; - private TextView mApogeeVoltageView; - private GoNoGoLights mApogeeLights; - private TextView mMainVoltageView; - private GoNoGoLights mMainLights; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.tab_ascent, container, false); - - mHeightView = (TextView) v.findViewById(R.id.height_value); - mMaxHeightView = (TextView) v.findViewById(R.id.max_height_value); - mSpeedView = (TextView) v.findViewById(R.id.speed_value); - mMaxSpeedView = (TextView) v.findViewById(R.id.max_speed_value); - mAccelView = (TextView) v.findViewById(R.id.accel_value); - mMaxAccelView = (TextView) v.findViewById(R.id.max_accel_value); - mLatitudeView = (TextView) v.findViewById(R.id.lat_value); - mLongitudeView = (TextView) v.findViewById(R.id.lon_value); - - mApogeeVoltageView = (TextView) v.findViewById(R.id.apogee_voltage_value); - mApogeeLights = new GoNoGoLights((ImageView) v.findViewById(R.id.apogee_redled), - (ImageView) v.findViewById(R.id.apogee_greenled), - getResources()); - - mMainVoltageView = (TextView) v.findViewById(R.id.main_voltage_value); - mMainLights = new GoNoGoLights((ImageView) v.findViewById(R.id.main_redled), - (ImageView) v.findViewById(R.id.main_greenled), - getResources()); - - return v; - } - - public String tab_name() { - return "ascent"; - } - - public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) { - if (state != null) { - set_value(mHeightView, AltosConvert.height, 6, state.height()); - set_value(mHeightView, AltosConvert.height, 6, state.height()); - set_value(mMaxHeightView, AltosConvert.height, 6, state.max_height()); - set_value(mSpeedView, AltosConvert.speed, 6, state.speed()); - set_value(mMaxSpeedView, AltosConvert.speed, 6, state.max_speed()); - set_value(mAccelView, AltosConvert.accel, 6, state.acceleration()); - set_value(mMaxAccelView, AltosConvert.accel, 6, state.max_acceleration()); - - if (state.gps != null) { - mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); - mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "E", "W")); - } else { - mLatitudeView.setText(""); - mLongitudeView.setText(""); - } - - mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.apogee_voltage)); - mApogeeLights.set(state.apogee_voltage > 3.2, state.apogee_voltage == AltosLib.MISSING); - - mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_voltage)); - mMainLights.set(state.main_voltage > 3.2, state.main_voltage == AltosLib.MISSING); - } - } -} diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java deleted file mode 100644 index 3429ee72..00000000 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabDescent.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 org.altusmetrum.altoslib_7.*; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; -import android.location.Location; - -public class TabDescent extends AltosDroidTab { - private TextView mSpeedView; - private TextView mHeightView; - private TextView mElevationView; - private TextView mRangeView; - private TextView mBearingView; - private TextView mCompassView; - private TextView mDistanceView; - private TextView mLatitudeView; - private TextView mLongitudeView; - private TextView mApogeeVoltageView; - private GoNoGoLights mApogeeLights; - private TextView mMainVoltageView; - private GoNoGoLights mMainLights; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.tab_descent, container, false); - - mSpeedView = (TextView) v.findViewById(R.id.speed_value); - mHeightView = (TextView) v.findViewById(R.id.height_value); - mElevationView = (TextView) v.findViewById(R.id.elevation_value); - mRangeView = (TextView) v.findViewById(R.id.range_value); - mBearingView = (TextView) v.findViewById(R.id.bearing_value); - mCompassView = (TextView) v.findViewById(R.id.compass_value); - mDistanceView = (TextView) v.findViewById(R.id.distance_value); - mLatitudeView = (TextView) v.findViewById(R.id.lat_value); - mLongitudeView = (TextView) v.findViewById(R.id.lon_value); - - mApogeeVoltageView = (TextView) v.findViewById(R.id.apogee_voltage_value); - mApogeeLights = new GoNoGoLights((ImageView) v.findViewById(R.id.apogee_redled), - (ImageView) v.findViewById(R.id.apogee_greenled), - getResources()); - - mMainVoltageView = (TextView) v.findViewById(R.id.main_voltage_value); - mMainLights = new GoNoGoLights((ImageView) v.findViewById(R.id.main_redled), - (ImageView) v.findViewById(R.id.main_greenled), - getResources()); - - return v; - } - - public String tab_name() { return "descent"; } - - public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) { - if (state != null) { - set_value(mSpeedView, AltosConvert.speed, 6, state.speed()); - set_value(mHeightView, AltosConvert.height, 6, state.height()); - if (from_receiver != null) { - mElevationView.setText(AltosDroid.number("%3.0f°", from_receiver.elevation)); - set_value(mRangeView, AltosConvert.distance, 6, from_receiver.range); - mBearingView.setText(AltosDroid.number("%3.0f°", from_receiver.bearing)); - mCompassView.setText(from_receiver.bearing_words(AltosGreatCircle.BEARING_LONG)); - set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); - } else { - mElevationView.setText("<unknown>"); - mRangeView.setText("<unknown>"); - mBearingView.setText("<unknown>"); - mCompassView.setText("<unknown>"); - mDistanceView.setText("<unknown>"); - } - if (state.gps != null) { - mLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); - mLongitudeView.setText(AltosDroid.pos(state.gps.lon, "E", "W")); - } - - mApogeeVoltageView.setText(AltosDroid.number("%4.2f V", state.apogee_voltage)); - mApogeeLights.set(state.apogee_voltage > 3.2, state.apogee_voltage == AltosLib.MISSING); - - mMainVoltageView.setText(AltosDroid.number("%4.2f V", state.main_voltage)); - mMainLights.set(state.main_voltage > 3.2, state.main_voltage == AltosLib.MISSING); - } - } - -} diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabFlight.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabFlight.java new file mode 100644 index 00000000..e1fc737d --- /dev/null +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabFlight.java @@ -0,0 +1,134 @@ +/* + * 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 org.altusmetrum.altoslib_7.*; + +import android.app.Activity; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; +import android.location.Location; + +public class TabFlight extends AltosDroidTab { + private TextView speed_view; + private TextView height_view; + private TextView max_speed_view; + private TextView max_height_view; + private TextView elevation_view; + private TextView range_view; + private TextView bearing_view; + private TextView compass_view; + private TextView distance_view; + private TextView latitude_view; + private TextView longitude_view; + private TextView apogee_voltage_view; + private TextView apogee_voltage_label; + private GoNoGoLights apogee_lights; + private TextView main_voltage_view; + private TextView main_voltage_label; + private GoNoGoLights main_lights; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View v = inflater.inflate(R.layout.tab_flight, container, false); + + speed_view = (TextView) v.findViewById(R.id.speed_value); + height_view = (TextView) v.findViewById(R.id.height_value); + max_speed_view = (TextView) v.findViewById(R.id.max_speed_value); + max_height_view= (TextView) v.findViewById(R.id.max_height_value); + elevation_view = (TextView) v.findViewById(R.id.elevation_value); + range_view = (TextView) v.findViewById(R.id.range_value); + bearing_view = (TextView) v.findViewById(R.id.bearing_value); + compass_view = (TextView) v.findViewById(R.id.compass_value); + distance_view = (TextView) v.findViewById(R.id.distance_value); + latitude_view = (TextView) v.findViewById(R.id.lat_value); + longitude_view = (TextView) v.findViewById(R.id.lon_value); + + apogee_voltage_view = (TextView) v.findViewById(R.id.apogee_voltage_value); + apogee_lights = new GoNoGoLights((ImageView) v.findViewById(R.id.apogee_redled), + (ImageView) v.findViewById(R.id.apogee_greenled), + getResources()); + apogee_voltage_label = (TextView) v.findViewById(R.id.apogee_voltage_label); + + main_voltage_view = (TextView) v.findViewById(R.id.main_voltage_value); + main_lights = new GoNoGoLights((ImageView) v.findViewById(R.id.main_redled), + (ImageView) v.findViewById(R.id.main_greenled), + getResources()); + main_voltage_label = (TextView) v.findViewById(R.id.main_voltage_label); + + return v; + } + + public String tab_name() { return "flight"; } + + public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) { + if (state != null) { + set_value(speed_view, AltosConvert.speed, 6, state.speed()); + set_value(height_view, AltosConvert.height, 6, state.height()); + set_value(max_speed_view, AltosConvert.speed, 6, state.max_speed()); + set_value(max_height_view, AltosConvert.speed, 6, state.max_height()); + if (from_receiver != null) { + elevation_view.setText(AltosDroid.number("%3.0f°", from_receiver.elevation)); + set_value(range_view, AltosConvert.distance, 6, from_receiver.range); + bearing_view.setText(AltosDroid.number("%3.0f°", from_receiver.bearing)); + compass_view.setText(from_receiver.bearing_words(AltosGreatCircle.BEARING_LONG)); + set_value(distance_view, AltosConvert.distance, 6, from_receiver.distance); + } else { + elevation_view.setText("<unknown>"); + range_view.setText("<unknown>"); + bearing_view.setText("<unknown>"); + compass_view.setText("<unknown>"); + distance_view.setText("<unknown>"); + } + if (state.gps != null) { + latitude_view.setText(AltosDroid.pos(state.gps.lat, "N", "S")); + longitude_view.setText(AltosDroid.pos(state.gps.lon, "E", "W")); + } + + if (state.apogee_voltage == AltosLib.MISSING) { + apogee_voltage_view.setVisibility(View.GONE); + apogee_voltage_label.setVisibility(View.GONE); + apogee_lights.hide(); + } else { + apogee_voltage_view.setText(AltosDroid.number("%4.2f V", state.apogee_voltage)); + apogee_voltage_view.setVisibility(View.VISIBLE); + apogee_voltage_label.setVisibility(View.VISIBLE); + apogee_lights.set(state.apogee_voltage > 3.2, state.apogee_voltage == AltosLib.MISSING); + apogee_lights.show(); + } + + if (state.main_voltage == AltosLib.MISSING) { + main_voltage_view.setVisibility(View.GONE); + main_voltage_label.setVisibility(View.GONE); + main_lights.hide(); + } else { + main_voltage_view.setText(AltosDroid.number("%4.2f V", state.main_voltage)); + main_voltage_view.setVisibility(View.VISIBLE); + main_voltage_label.setVisibility(View.VISIBLE); + main_lights.set(state.main_voltage > 3.2, state.main_voltage == AltosLib.MISSING); + main_lights.show(); + } + } + } + +} diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java index dd3f938e..0ab20f5f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java @@ -28,7 +28,7 @@ import android.view.ViewGroup; import android.widget.TextView; import android.location.Location; -public class TabLanded extends AltosDroidTab { +public class TabRecover extends AltosDroidTab { private TextView mBearingView; private TextView mDistanceView; private TextView mTargetLatitudeView; @@ -41,7 +41,7 @@ public class TabLanded extends AltosDroidTab { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.tab_landed, container, false); + View v = inflater.inflate(R.layout.tab_recover, container, false); mBearingView = (TextView) v.findViewById(R.id.bearing_value); mDistanceView = (TextView) v.findViewById(R.id.distance_value); @@ -56,7 +56,7 @@ public class TabLanded extends AltosDroidTab { return v; } - public String tab_name() { return "landed"; } + public String tab_name() { return "recover"; } public void show(TelemetryState telem_state, AltosState state, AltosGreatCircle from_receiver, Location receiver) { if (from_receiver != null) { |