OSDN Git Service

Jump to top-level settings when launched from system bar or Settings shortcut.
authorAmith Yamasani <yamasani@google.com>
Mon, 15 Nov 2010 22:45:19 +0000 (14:45 -0800)
committerAmith Yamasani <yamasani@google.com>
Tue, 16 Nov 2010 13:00:28 +0000 (05:00 -0800)
Bug: 3192808

Also switch back to Theme.Holo, as Theme.Holo.Extended is deprecated.

AndroidManifest.xml
src/com/android/settings/Settings.java

index c5e5eb7..38579b6 100644 (file)
@@ -52,7 +52,8 @@
         <activity android:name="Settings"
                 android:label="@string/settings_label_launcher"
                 android:taskAffinity="com.android.settings"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
+                android:launchMode="singleTask"
                 >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -73,7 +74,7 @@
         <!-- Wireless Controls -->
 
         <activity android:name="Settings$WirelessSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/wireless_networks_settings_title"
                 >
             <intent-filter>
@@ -93,7 +94,7 @@
         <!-- Top-level settings -->
 
         <activity android:name="Settings$WifiSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/wifi_settings"
                 android:configChanges="orientation|keyboardHidden"
                 android:clearTaskOnLaunch="true"
         </activity>
 
         <activity android:name="Settings$BluetoothSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/bluetooth_settings_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$TetherSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$VpnSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/vpn_settings_activity_title"
                 android:configChanges="orientation|keyboardHidden"
                 android:clearTaskOnLaunch="true">
         </activity>
 
         <activity android:name="Settings$DateTimeSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/date_and_time" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$LocalePickerActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/language_picker_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$InputMethodAndLanguageSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/language_keyboard_settings_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$InputMethodAndSubtypeEnablerActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/input_methods_and_subtype_enabler_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$UserDictionarySettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/user_dict_settings_titlebar"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$SoundSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/sound_settings"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$DisplaySettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/display_settings"
                 android:clearTaskOnLaunch="true"
                 >
         </activity>
 
         <activity android:name="Settings$DockSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/dock_settings_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$ApplicationSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/applications_settings_header">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$ManageApplicationsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/manageapplications_settings_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
 
         <!-- Provide direct entry into manage apps showing running services. -->
         <activity android:name="Settings$RunningServicesActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/runningservices_settings_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
         <!-- Provide direct entry into manage apps showing running services. -->
         <activity android:name="Settings$StorageUseActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/storageuse_settings_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$SecuritySettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/location_security_settings_title"
                 android:configChanges="orientation|keyboardHidden"
                 android:clearTaskOnLaunch="true">
         </activity>
 
         <activity android:name="Settings$PrivacySettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/privacy_settings_title"
                 android:configChanges="orientation|keyboardHidden"
                 android:clearTaskOnLaunch="true">
         </activity>
 
         <activity android:name="Settings$AccessibilitySettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/accessibility_settings_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$VoiceInputOutputSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/voice_input_output_settings"
                 android:targetActivity="Settings">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$StorageSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/storage_settings_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
         </activity>
 
         <activity android:name="Settings$DevelopmentSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/development_settings_title"
                 android:clearTaskOnLaunch="true">
             <intent-filter>
         </activity>
 
         <activity android:name="Settings$PowerUsageSummaryActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/storage_settings_title">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
         <activity
                 android:name="Settings$ManageAccountsSettingsActivity"
-                android:theme="@android:style/Theme.Holo.Extended"
+                android:theme="@android:style/Theme.Holo"
                 android:label="@string/sync_settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
index 28a0f70..c94a0e1 100644 (file)
@@ -38,6 +38,7 @@ public class Settings extends PreferenceActivity {
 
     private String mFragmentClass;
     private int mTopLevelHeaderId;
+    private Header mFirstHeader;
 
     // TODO: Update Call Settings based on airplane mode state.
 
@@ -52,6 +53,17 @@ public class Settings extends PreferenceActivity {
         highlightHeader();
     }
 
+    @Override
+    public void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+
+        // If it is not launched from history, then reset to top-level
+        if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0
+                && mFirstHeader != null) {
+            switchToHeader(mFirstHeader);
+        }
+    }
+
     private void highlightHeader() {
         if (mTopLevelHeaderId != 0) {
             Integer index = mHeaderIndexMap.get(mTopLevelHeaderId);
@@ -143,6 +155,8 @@ public class Settings extends PreferenceActivity {
             }
             // Increment if the current one wasn't removed by the Utils code.
             if (target.get(i) == header) {
+                // Hold on to the first header, when we need to reset to the top-level
+                if (i == 0) mFirstHeader = header;
                 mHeaderIndexMap.put(id, i);
                 i++;
             }