X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosDroid.java;h=293dff7f2f70732163187cf8aadab75330ad71f8;hp=97373ab8da30e70b9890438022e7c5c9a1b501c1;hb=a533ea525620f194fd89fedad043659bb433d71b;hpb=85013045ca505096064aaf45c312b158d0263d2a diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java index 97373ab8..293dff7f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java @@ -76,13 +76,12 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { public static final int REQUEST_PRELOAD_MAPS = 3; public static final int REQUEST_MAP_TYPE = 4; + public int map_type = AltosMap.maptype_hybrid; + public static FragmentManager fm; private BluetoothAdapter mBluetoothAdapter = null; - // Layout Views - private TextView mTitle; - // Flight state values private TextView mCallsignView; private TextView mRSSIView; @@ -219,20 +218,20 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { if (telemetry_state.telemetry_rate != AltosLib.ao_telemetry_rate_38400) str = str.concat(String.format(" %d bps", AltosLib.ao_telemetry_rate_values[telemetry_state.telemetry_rate])); - mTitle.setText(str); + setTitle(str); } else { - mTitle.setText(R.string.title_connected_to); + setTitle(R.string.title_connected_to); } break; case TelemetryState.CONNECT_CONNECTING: if (telemetry_state.address != null) - mTitle.setText(String.format("Connecting to %s...", telemetry_state.address.name)); + setTitle(String.format("Connecting to %s...", telemetry_state.address.name)); else - mTitle.setText("Connecting to something..."); + setTitle("Connecting to something..."); break; case TelemetryState.CONNECT_DISCONNECTED: case TelemetryState.CONNECT_NONE: - mTitle.setText(R.string.title_not_connected); + setTitle(R.string.title_not_connected); break; } } @@ -419,14 +418,13 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + AltosDebug.init(this); AltosDebug.debug("+++ ON CREATE +++"); fm = getSupportFragmentManager(); // Set up the window layout - requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.altosdroid); - getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); // Create the Tabs and ViewPager mTabHost = (TabHost)findViewById(android.R.id.tabhost); @@ -444,11 +442,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { 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); - // Set up the custom title - mTitle = (TextView) findViewById(R.id.title_left_text); - mTitle.setText(R.string.app_name); - mTitle = (TextView) findViewById(R.id.title_right_text); - // Display the Version mVersion = (TextView) findViewById(R.id.version); mVersion.setText("Version: " + BuildInfo.version + @@ -676,12 +669,13 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener { } private void set_map_type(Intent data) { - int mode = data.getIntExtra(MapTypeActivity.EXTRA_MAP_TYPE, -1); + int type = data.getIntExtra(MapTypeActivity.EXTRA_MAP_TYPE, -1); - AltosDebug.debug("intent set_map_type %d\n", mode); - if (mode != -1) { + AltosDebug.debug("intent set_map_type %d\n", type); + if (type != -1) { + map_type = type; for (AltosDroidTab mTab : mTabs) - mTab.set_map_type(mode); + mTab.set_map_type(map_type); } }