From: Keith Packard Date: Tue, 23 Jun 2015 03:43:23 +0000 (-0700) Subject: altosdroid: Switch to four tabs (pad/flight/recover/map) X-Git-Tag: 1.6.0.3~13 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=2b6768ed32d7be444c49caa40d30b520177bb22a 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 --- 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/altosdroid/res/layout/tab_descent.xml b/altosdroid/res/layout/tab_descent.xml deleted file mode 100644 index 9e1fc820..00000000 --- a/altosdroid/res/layout/tab_descent.xml +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/altosdroid/res/layout/tab_flight.xml b/altosdroid/res/layout/tab_flight.xml new file mode 100644 index 00000000..4fa026ca --- /dev/null +++ b/altosdroid/res/layout/tab_flight.xml @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/altosdroid/res/layout/tab_landed.xml b/altosdroid/res/layout/tab_landed.xml deleted file mode 100644 index f27baa9e..00000000 --- a/altosdroid/res/layout/tab_landed.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/altosdroid/res/layout/tab_recover.xml b/altosdroid/res/layout/tab_recover.xml new file mode 100644 index 00000000..f27baa9e --- /dev/null +++ b/altosdroid/res/layout/tab_recover.xml @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 - * - * 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 - * - * 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(""); - mRangeView.setText(""); - mBearingView.setText(""); - mCompassView.setText(""); - mDistanceView.setText(""); - } - 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 + * + * 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(""); + range_view.setText(""); + bearing_view.setText(""); + compass_view.setText(""); + distance_view.setText(""); + } + 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/TabLanded.java deleted file mode 100644 index dd3f938e..00000000 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabLanded.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright © 2013 Mike Beattie - * - * 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.TextView; -import android.location.Location; - -public class TabLanded extends AltosDroidTab { - private TextView mBearingView; - private TextView mDistanceView; - private TextView mTargetLatitudeView; - private TextView mTargetLongitudeView; - private TextView mReceiverLatitudeView; - private TextView mReceiverLongitudeView; - private TextView mMaxHeightView; - private TextView mMaxSpeedView; - private TextView mMaxAccelView; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.tab_landed, container, false); - - mBearingView = (TextView) v.findViewById(R.id.bearing_value); - mDistanceView = (TextView) v.findViewById(R.id.distance_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); - mMaxHeightView = (TextView) v.findViewById(R.id.max_height_value); - mMaxSpeedView = (TextView) v.findViewById(R.id.max_speed_value); - mMaxAccelView = (TextView) v.findViewById(R.id.max_accel_value); - - return v; - } - - public String tab_name() { return "landed"; } - - 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)); - set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); - } - if (state != null && state.gps != null) { - mTargetLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); - mTargetLongitudeView.setText(AltosDroid.pos(state.gps.lon, "E", "W")); - } - - if (receiver != null) { - mReceiverLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S")); - mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "E", "W")); - } - - if (state != null) { - set_value(mMaxHeightView, AltosConvert.height, 6, state.max_height()); - set_value(mMaxAccelView, AltosConvert.accel, 6, state.max_acceleration()); - set_value(mMaxSpeedView, AltosConvert.speed, 6, state.max_speed()); - } - } -} diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java new file mode 100644 index 00000000..0ab20f5f --- /dev/null +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabRecover.java @@ -0,0 +1,82 @@ +/* + * Copyright © 2013 Mike Beattie + * + * 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.TextView; +import android.location.Location; + +public class TabRecover extends AltosDroidTab { + private TextView mBearingView; + private TextView mDistanceView; + private TextView mTargetLatitudeView; + private TextView mTargetLongitudeView; + private TextView mReceiverLatitudeView; + private TextView mReceiverLongitudeView; + private TextView mMaxHeightView; + private TextView mMaxSpeedView; + private TextView mMaxAccelView; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + 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); + 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); + mMaxHeightView = (TextView) v.findViewById(R.id.max_height_value); + mMaxSpeedView = (TextView) v.findViewById(R.id.max_speed_value); + mMaxAccelView = (TextView) v.findViewById(R.id.max_accel_value); + + return v; + } + + public String tab_name() { return "recover"; } + + 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)); + set_value(mDistanceView, AltosConvert.distance, 6, from_receiver.distance); + } + if (state != null && state.gps != null) { + mTargetLatitudeView.setText(AltosDroid.pos(state.gps.lat, "N", "S")); + mTargetLongitudeView.setText(AltosDroid.pos(state.gps.lon, "E", "W")); + } + + if (receiver != null) { + mReceiverLatitudeView.setText(AltosDroid.pos(receiver.getLatitude(), "N", "S")); + mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "E", "W")); + } + + if (state != null) { + set_value(mMaxHeightView, AltosConvert.height, 6, state.max_height()); + set_value(mMaxAccelView, AltosConvert.accel, 6, state.max_acceleration()); + set_value(mMaxSpeedView, AltosConvert.speed, 6, state.max_speed()); + } + } +}