Moving compatibilty mode option to spare parts

This commit is contained in:
Mitsuru Oshima
2009-07-20 15:52:48 -07:00
parent 89f0e50a4c
commit afd6be73fc
3 changed files with 34 additions and 5 deletions

View File

@@ -64,4 +64,11 @@
<string name="summary_off_maps_compass">Compass is not displayed in Maps</string> <string name="summary_off_maps_compass">Compass is not displayed in Maps</string>
<string name="development_settings_show_maps_compass_text">Show compass in Maps</string> <string name="development_settings_show_maps_compass_text">Show compass in Maps</string>
<!-- Sound & display settings screen, compatibility mode check box label -->
<string name="compatibility_mode_title">Compatibility Mode</string>
<!-- Sound & display settings screen, compatibility mode option summary text when check box is selected -->
<string name="compatibility_mode_summary_on">Run older apps in Compatibility mode. This require rebooting. </string>
<!-- Sound & display settings screen, compatibility mode option summary text when check box is clear -->
<string name="compatibility_mode_summary_off">Run older apps in Compatibility mode. This require rebooting. </string>
</resources> </resources>

View File

@@ -94,6 +94,12 @@
android:summaryOn="@string/summary_on_haptic_feedback" android:summaryOn="@string/summary_on_haptic_feedback"
android:summaryOff="@string/summary_off_haptic_feedback"/> android:summaryOff="@string/summary_off_haptic_feedback"/>
<CheckBoxPreference
android:key="compatibility_mode"
android:title="@string/compatibility_mode_title"
android:summaryOn="@string/compatibility_mode_summary_on"
android:summaryOff="@string/compatibility_mode_summary_off" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@@ -58,7 +58,8 @@ public class SpareParts extends PreferenceActivity
private static final String FONT_SIZE_PREF = "font_size"; private static final String FONT_SIZE_PREF = "font_size";
private static final String END_BUTTON_PREF = "end_button"; private static final String END_BUTTON_PREF = "end_button";
private static final String MAPS_COMPASS_PREF = "maps_compass"; private static final String MAPS_COMPASS_PREF = "maps_compass";
private static final String KEY_COMPATIBILITY_MODE = "compatibility_mode";
private final Configuration mCurConfig = new Configuration(); private final Configuration mCurConfig = new Configuration();
private ListPreference mWindowAnimationsPref; private ListPreference mWindowAnimationsPref;
@@ -68,7 +69,8 @@ public class SpareParts extends PreferenceActivity
private ListPreference mFontSizePref; private ListPreference mFontSizePref;
private ListPreference mEndButtonPref; private ListPreference mEndButtonPref;
private CheckBoxPreference mShowMapsCompassPref; private CheckBoxPreference mShowMapsCompassPref;
private CheckBoxPreference mCompatibilityMode;
private IWindowManager mWindowManager; private IWindowManager mWindowManager;
public static boolean updatePreferenceToSpecificActivityOrRemove(Context context, public static boolean updatePreferenceToSpecificActivityOrRemove(Context context,
@@ -124,7 +126,11 @@ public class SpareParts extends PreferenceActivity
mEndButtonPref = (ListPreference) prefSet.findPreference(END_BUTTON_PREF); mEndButtonPref = (ListPreference) prefSet.findPreference(END_BUTTON_PREF);
mEndButtonPref.setOnPreferenceChangeListener(this); mEndButtonPref.setOnPreferenceChangeListener(this);
mShowMapsCompassPref = (CheckBoxPreference) prefSet.findPreference(MAPS_COMPASS_PREF); mShowMapsCompassPref = (CheckBoxPreference) prefSet.findPreference(MAPS_COMPASS_PREF);
mCompatibilityMode = (CheckBoxPreference) findPreference(KEY_COMPATIBILITY_MODE);
mCompatibilityMode.setPersistent(false);
mCompatibilityMode.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.COMPATIBILITY_MODE, 1) != 0);
mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
final PreferenceGroup parentPreference = getPreferenceScreen(); final PreferenceGroup parentPreference = getPreferenceScreen();
@@ -165,11 +171,21 @@ public class SpareParts extends PreferenceActivity
} else if (preference == mEndButtonPref) { } else if (preference == mEndButtonPref) {
writeEndButtonPreference(objValue); writeEndButtonPreference(objValue);
} }
// always let the preference setting proceed. // always let the preference setting proceed.
return true; return true;
} }
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference == mCompatibilityMode) {
Settings.System.putInt(getContentResolver(),
Settings.System.COMPATIBILITY_MODE,
mCompatibilityMode.isChecked() ? 1 : 0);
return true;
}
return false;
}
public void writeAnimationPreference(int which, Object objValue) { public void writeAnimationPreference(int which, Object objValue) {
try { try {
float val = Float.parseFloat(objValue.toString()); float val = Float.parseFloat(objValue.toString());