+ }
+
+ static String pos(double p, String pos, String neg) {
+ String h = pos;
+ if (p == AltosLib.MISSING)
+ return "";
+ if (p < 0) {
+ h = neg;
+ p = -p;
+ }
+ int deg = (int) Math.floor(p);
+ double min = (p - Math.floor(p)) * 60.0;
+ return String.format("%d°%9.4f\" %s", deg, min, h);
+ }
+
+ static String number(String format, double value) {
+ if (value == AltosLib.MISSING)
+ return "";
+ return String.format(format, value);
+ }
+
+ static String integer(String format, int value) {
+ if (value == AltosLib.MISSING)
+ return "";
+ return String.format(format, value);
+ }
+
+ private View create_tab_view(String label) {
+ LayoutInflater inflater = (LayoutInflater) this.getLayoutInflater();
+ View tab_view = inflater.inflate(R.layout.tab_layout, null);
+ TextView text_view = (TextView) tab_view.findViewById (R.id.tabLabel);
+ text_view.setText(label);
+ return tab_view;
+ }
+
+ public void set_map_source() {
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ AltosDebug.init(this);
+ AltosDebug.debug("+++ ON CREATE +++");
+
+ // Initialise preferences
+ AltosDroidPreferences.init(this);
+
+ fm = getSupportFragmentManager();
+
+ // Set up the window layout
+ setContentView(R.layout.altosdroid);
+
+ // Create the Tabs and ViewPager
+ mTabHost = (TabHost)findViewById(android.R.id.tabhost);
+ mTabHost.setup();
+
+ mViewPager = (AltosViewPager)findViewById(R.id.pager);
+ mViewPager.setOffscreenPageLimit(4);
+
+ 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("map").setIndicator(create_tab_view("Map")), TabMap.class, null);
+ mTabsAdapter.addTab(mTabHost.newTabSpec("offmap").setIndicator(create_tab_view("OffMap")), TabMapOffline.class, null);
+
+ // Display the Version
+ mVersion = (TextView) findViewById(R.id.version);
+ mVersion.setText("Version: " + BuildInfo.version +
+ " Built: " + BuildInfo.builddate + " " + BuildInfo.buildtime + " " + BuildInfo.buildtz +
+ " (" + BuildInfo.branch + "-" + BuildInfo.commitnum + "-" + BuildInfo.commithash + ")");
+
+ mCallsignView = (TextView) findViewById(R.id.callsign_value);
+ mRSSIView = (TextView) findViewById(R.id.rssi_value);
+ mSerialView = (TextView) findViewById(R.id.serial_value);
+ mFlightView = (TextView) findViewById(R.id.flight_value);
+ mStateLayout = (RelativeLayout) findViewById(R.id.state_container);
+ mStateView = (TextView) findViewById(R.id.state_value);
+ mAgeView = (TextView) findViewById(R.id.age_value);
+ mAgeNewColor = mAgeView.getTextColors().getDefaultColor();
+ mAgeOldColor = getResources().getColor(R.color.old_color);
+ }