altosdroid: Switch from custom title to standard Holo theme
authorKeith Packard <keithp@keithp.com>
Mon, 1 Jun 2015 06:09:18 +0000 (23:09 -0700)
committerKeith Packard <keithp@keithp.com>
Mon, 1 Jun 2015 06:09:18 +0000 (23:09 -0700)
This gives us the menu button, which is awfully useful on devices
without a hardware version...

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/res/menu/option_menu.xml
altosdroid/res/values/CustomTheme.xml
altosdroid/src/org/altusmetrum/AltosDroid/AltosDroid.java

index 2109ae0..1b3142a 100644 (file)
@@ -22,9 +22,6 @@
     <item android:id="@+id/disconnect"
          android:icon="@android:drawable/ic_notification_clear_all"
          android:title="@string/disconnect_device" />
-    <item android:id="@+id/quit"
-          android:icon="@android:drawable/ic_menu_close_clear_cancel"
-          android:title="@string/quit" />
     <item android:id="@+id/select_freq"
           android:icon="@android:drawable/ic_menu_preferences"
           android:title="@string/select_freq" />
@@ -40,4 +37,7 @@
     <item android:id="@+id/map_type"
          android:icon="@android:drawable/ic_menu_mapmode"
          android:title="@string/map_type" />
+    <item android:id="@+id/quit"
+          android:icon="@android:drawable/ic_menu_close_clear_cancel"
+          android:title="@string/quit" />
 </menu>
index 4daed1f..6c701ea 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <resources>
-  <style name="CustomTheme" parent="android:Theme">
-    <item name="android:windowNoTitle">false</item>
+  <style name="CustomTheme" parent="android:Theme.Holo">
   </style>
 </resources>
index 5be9ba8..293dff7 100644 (file)
@@ -82,9 +82,6 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener {
 
        private BluetoothAdapter mBluetoothAdapter = null;
 
-       // Layout Views
-       private TextView mTitle;
-
        // Flight state values
        private TextView mCallsignView;
        private TextView mRSSIView;
@@ -221,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;
                }
        }
@@ -427,9 +424,7 @@ public class AltosDroid extends FragmentActivity implements AltosUnitsListener {
                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);
@@ -447,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 +