在Setting里的辅助功能添加横竖屏切换按钮:
diff --git a/device/softwinner/common/packages/TvdSettings/res/xml/accessibility_settings.xml b/device/softwinner/common/packages/TvdSettings/res/xml/accessibility_settings.xml
index 8ee435f..a3d1aad 100644 (file)
--- a/device/softwinner/common/packages/TvdSettings/res/xml/accessibility_settings.xml
+++ b/device/softwinner/common/packages/TvdSettings/res/xml/accessibility_settings.xml
@@ -32,11 +32,11 @@
android:key="screen_magnification_preference_screen"
android:title="@string/accessibility_screen_magnification_title"/>
- <!--CheckBoxPreference
+ <CheckBoxPreference
android:key="rotate_screen"
android:title="@string/rotate_screen_tittle"
android:persistent="false"
- /-->
+ />
<CheckBoxPreference
android:key="toggle_large_text_preference"
android:title="@string/accessibility_toggle_large_text_preference_title"
diff --git a/device/softwinner/common/packages/TvdSettings/src/com/android/settings/AccessibilitySettings.java b/device/softwinner/common/packages/TvdSettings/src/com/android/settings/AccessibilitySettings.java
index 339b2ef..d20f9bb 100644 (file)
--- a/device/softwinner/common/packages/TvdSettings/src/com/android/settings/AccessibilitySettings.java
+++ b/device/softwinner/common/packages/TvdSettings/src/com/android/settings/AccessibilitySettings.java
@@ -174,8 +174,8 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
private PreferenceCategory mServicesCategory;
private PreferenceCategory mSystemsCategory;
-// private final String ROTATE_SCREEN="rotate_screen";
-// private CheckBoxPreference mRotateScreen;
+ private final String ROTATE_SCREEN="rotate_screen";
+ private CheckBoxPreference mRotateScreen;
private CheckBoxPreference mToggleLargeTextPreference;
private CheckBoxPreference mTogglePowerButtonEndsCallPreference;
private CheckBoxPreference mToggleLockScreenRotationPreference;
@@ -193,12 +193,12 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
super.onCreate(icicle);
addPreferencesFromResource(R.xml.accessibility_settings);
initializeAllPreferences();
-// mRotateScreen=(CheckBoxPreference)findPreference(ROTATE_SCREEN);
-// int RotateScreen=Settings.System.getInt(this.getContentResolver(), "rotate_screen", 0);
-// if(RotateScreen==1)
-// mRotateScreen.setChecked(true);
-// else
-// mRotateScreen.setChecked(false);
+ mRotateScreen=(CheckBoxPreference)findPreference(ROTATE_SCREEN);
+ int RotateScreen=Settings.System.getInt(this.getContentResolver(), "rotate_screen", 0);
+ if(RotateScreen==1)
+ mRotateScreen.setChecked(true);
+ else
+ mRotateScreen.setChecked(false);
}
@Override
@@ -239,11 +239,11 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
//add by James
-// if(mRotateScreen==preference)
- // {
-// handleRotateScreen();
-// return true;
-// }
+ if(mRotateScreen==preference)
+ {
+ handleRotateScreen();
+ return true;
+ }
//add by James
if (mToggleLargeTextPreference == preference) {
@@ -288,11 +288,11 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
}
//add by james
-// private void handleRotateScreen(){
-// Settings.System.putInt(getContentResolver(),
-// "rotate_screen",
-// mRotateScreen.isChecked()? 1:0);
-// }
+ private void handleRotateScreen(){
+ Settings.System.putInt(getContentResolver(),
+ "rotate_screen",
+ mRotateScreen.isChecked()? 1:0);
+ }
//add by james
private void handleLockScreenRotationPreferenceClick() {
|