package org.altusmetrum.AltosDroid;
-import org.altusmetrum.altoslib_2.*;
+import org.altusmetrum.altoslib_7.*;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.location.Location;
-public class TabLanded extends Fragment implements AltosDroidTab {
- AltosDroid mAltosDroid;
-
+public class TabLanded extends AltosDroidTab {
private TextView mBearingView;
private TextView mDistanceView;
private TextView mTargetLatitudeView;
private TextView mMaxSpeedView;
private TextView mMaxAccelView;
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- mAltosDroid = (AltosDroid) activity;
- mAltosDroid.registerTab(this);
- }
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.tab_landed, container, false);
return v;
}
- @Override
- public void onDestroy() {
- super.onDestroy();
- mAltosDroid.unregisterTab(this);
- mAltosDroid = null;
- }
+ public String tab_name() { return "landed"; }
- public void update_ui(AltosState state, AltosGreatCircle from_receiver, Location receiver) {
+ 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));
- mDistanceView.setText(String.format("%6.0f m", from_receiver.distance));
+ 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, "W", "E"));
+ 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(), "W", "E"));
+ mReceiverLongitudeView.setText(AltosDroid.pos(receiver.getLongitude(), "E", "W"));
}
-
+
if (state != null) {
- mMaxHeightView.setText(String.format("%6.0f m", state.max_height()));
- mMaxAccelView.setText(String.format("%6.0f m/s²", state.max_acceleration()));
- mMaxSpeedView.setText(String.format("%6.0f m/s", state.max_speed()));
+ 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());
}
}
-
}