Loading res/values/strings.xml +11 −0 Original line number Diff line number Diff line Loading @@ -5918,4 +5918,15 @@ <!-- Summary Title for saying that the preference is experimental and will evolve over time due to User feedback. [CHAR LIMIT=NONE] --> <string name="experimental_preference">(Experimental)</string> <!-- [CHAR LIMIT=45] Auto-rotate setting title --> <string name="display_auto_rotate_title">When device is rotated</string> <!-- [CHAR LIMIT=70] Rotate when screen is turned option --> <string name="display_auto_rotate_rotate">Rotate the contents of the screen</string> <!-- [CHAR LIMIT=70] Keep the screen in portrait when rotated --> <string name="display_auto_rotate_stay_in_portrait">Stay in portrait view</string> <!-- [CHAR LIMIT=70] Keep the screen in landscape when rotated --> <string name="display_auto_rotate_stay_in_landscape">Stay in landscape view</string> <!-- [CHAR LIMIT=70] Don't rotate when screen is turned option --> <string name="display_auto_rotate_stay_in_current">Stay in current orientation</string> </resources> res/xml/display_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ android:entryValues="@array/entryvalues_font_size" android:dialogTitle="@string/dialog_title_font_size" /> <com.android.settings.notification.DropDownPreference android:key="auto_rotate" android:title="@string/display_auto_rotate_title" /> <PreferenceScreen android:key="wifi_display" android:title="@string/wifi_display_settings_title" Loading src/com/android/settings/DisplaySettings.java +52 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settings; import com.android.internal.view.RotationPolicy; import com.android.settings.notification.DropDownPreference; import com.android.settings.notification.DropDownPreference.Callback; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; Loading @@ -26,6 +29,7 @@ import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; import android.app.Activity; import android.app.ActivityManagerNative; import android.app.Dialog; import android.app.admin.DevicePolicyManager; Loading Loading @@ -65,6 +69,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private static final String KEY_LIFT_TO_WAKE = "lift_to_wake"; private static final String KEY_DOZE = "doze"; private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness"; private static final String KEY_AUTO_ROTATE = "auto_rotate"; private static final int DLG_GLOBAL_CHANGE_WARNING = 1; Loading @@ -81,7 +86,8 @@ public class DisplaySettings extends SettingsPreferenceFragment implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ContentResolver resolver = getActivity().getContentResolver(); final Activity activity = getActivity(); final ContentResolver resolver = activity.getContentResolver(); addPreferencesFromResource(R.xml.display_settings); Loading Loading @@ -111,19 +117,59 @@ public class DisplaySettings extends SettingsPreferenceFragment implements removePreference(KEY_AUTO_BRIGHTNESS); } if (isLiftToWakeAvailable(getActivity())) { if (isLiftToWakeAvailable(activity)) { mLiftToWakePreference = (SwitchPreference) findPreference(KEY_LIFT_TO_WAKE); mLiftToWakePreference.setOnPreferenceChangeListener(this); } else { removePreference(KEY_LIFT_TO_WAKE); } if (isDozeAvailable(getActivity())) { if (isDozeAvailable(activity)) { mDozePreference = (SwitchPreference) findPreference(KEY_DOZE); mDozePreference.setOnPreferenceChangeListener(this); } else { removePreference(KEY_DOZE); } if (RotationPolicy.isRotationLockToggleVisible(activity)) { DropDownPreference rotatePreference = (DropDownPreference) findPreference(KEY_AUTO_ROTATE); rotatePreference.addItem(activity.getString(R.string.display_auto_rotate_rotate), false); int rotateLockedResourceId; // The following block sets the string used when rotation is locked. // If the device locks specifically to portrait or landscape (rather than current // rotation), then we use a different string to include this information. if (allowAllRotations(activity)) { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_current; } else { if (RotationPolicy.getRotationLockOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_portrait; } else { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_landscape; } } rotatePreference.addItem(activity.getString(rotateLockedResourceId), true); rotatePreference.setSelectedItem(RotationPolicy.isRotationLocked(activity) ? 1 : 0); rotatePreference.setCallback(new Callback() { @Override public boolean onItemSelected(int pos, Object value) { RotationPolicy.setRotationLock(activity, (Boolean) value); return true; } }); } else { removePreference(KEY_AUTO_ROTATE); } } private static boolean allowAllRotations(Context context) { return Resources.getSystem().getBoolean( com.android.internal.R.bool.config_allowAllRotations); } private static boolean isLiftToWakeAvailable(Context context) { Loading Loading @@ -382,6 +428,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements if (!isDozeAvailable(context)) { result.add(KEY_DOZE); } if (!RotationPolicy.isRotationLockToggleVisible(context)) { result.add(KEY_AUTO_ROTATE); } return result; } }; Loading Loading
res/values/strings.xml +11 −0 Original line number Diff line number Diff line Loading @@ -5918,4 +5918,15 @@ <!-- Summary Title for saying that the preference is experimental and will evolve over time due to User feedback. [CHAR LIMIT=NONE] --> <string name="experimental_preference">(Experimental)</string> <!-- [CHAR LIMIT=45] Auto-rotate setting title --> <string name="display_auto_rotate_title">When device is rotated</string> <!-- [CHAR LIMIT=70] Rotate when screen is turned option --> <string name="display_auto_rotate_rotate">Rotate the contents of the screen</string> <!-- [CHAR LIMIT=70] Keep the screen in portrait when rotated --> <string name="display_auto_rotate_stay_in_portrait">Stay in portrait view</string> <!-- [CHAR LIMIT=70] Keep the screen in landscape when rotated --> <string name="display_auto_rotate_stay_in_landscape">Stay in landscape view</string> <!-- [CHAR LIMIT=70] Don't rotate when screen is turned option --> <string name="display_auto_rotate_stay_in_current">Stay in current orientation</string> </resources>
res/xml/display_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,10 @@ android:entryValues="@array/entryvalues_font_size" android:dialogTitle="@string/dialog_title_font_size" /> <com.android.settings.notification.DropDownPreference android:key="auto_rotate" android:title="@string/display_auto_rotate_title" /> <PreferenceScreen android:key="wifi_display" android:title="@string/wifi_display_settings_title" Loading
src/com/android/settings/DisplaySettings.java +52 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settings; import com.android.internal.view.RotationPolicy; import com.android.settings.notification.DropDownPreference; import com.android.settings.notification.DropDownPreference.Callback; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; Loading @@ -26,6 +29,7 @@ import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC; import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL; import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT; import android.app.Activity; import android.app.ActivityManagerNative; import android.app.Dialog; import android.app.admin.DevicePolicyManager; Loading Loading @@ -65,6 +69,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements private static final String KEY_LIFT_TO_WAKE = "lift_to_wake"; private static final String KEY_DOZE = "doze"; private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness"; private static final String KEY_AUTO_ROTATE = "auto_rotate"; private static final int DLG_GLOBAL_CHANGE_WARNING = 1; Loading @@ -81,7 +86,8 @@ public class DisplaySettings extends SettingsPreferenceFragment implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ContentResolver resolver = getActivity().getContentResolver(); final Activity activity = getActivity(); final ContentResolver resolver = activity.getContentResolver(); addPreferencesFromResource(R.xml.display_settings); Loading Loading @@ -111,19 +117,59 @@ public class DisplaySettings extends SettingsPreferenceFragment implements removePreference(KEY_AUTO_BRIGHTNESS); } if (isLiftToWakeAvailable(getActivity())) { if (isLiftToWakeAvailable(activity)) { mLiftToWakePreference = (SwitchPreference) findPreference(KEY_LIFT_TO_WAKE); mLiftToWakePreference.setOnPreferenceChangeListener(this); } else { removePreference(KEY_LIFT_TO_WAKE); } if (isDozeAvailable(getActivity())) { if (isDozeAvailable(activity)) { mDozePreference = (SwitchPreference) findPreference(KEY_DOZE); mDozePreference.setOnPreferenceChangeListener(this); } else { removePreference(KEY_DOZE); } if (RotationPolicy.isRotationLockToggleVisible(activity)) { DropDownPreference rotatePreference = (DropDownPreference) findPreference(KEY_AUTO_ROTATE); rotatePreference.addItem(activity.getString(R.string.display_auto_rotate_rotate), false); int rotateLockedResourceId; // The following block sets the string used when rotation is locked. // If the device locks specifically to portrait or landscape (rather than current // rotation), then we use a different string to include this information. if (allowAllRotations(activity)) { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_current; } else { if (RotationPolicy.getRotationLockOrientation(activity) == Configuration.ORIENTATION_PORTRAIT) { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_portrait; } else { rotateLockedResourceId = R.string.display_auto_rotate_stay_in_landscape; } } rotatePreference.addItem(activity.getString(rotateLockedResourceId), true); rotatePreference.setSelectedItem(RotationPolicy.isRotationLocked(activity) ? 1 : 0); rotatePreference.setCallback(new Callback() { @Override public boolean onItemSelected(int pos, Object value) { RotationPolicy.setRotationLock(activity, (Boolean) value); return true; } }); } else { removePreference(KEY_AUTO_ROTATE); } } private static boolean allowAllRotations(Context context) { return Resources.getSystem().getBoolean( com.android.internal.R.bool.config_allowAllRotations); } private static boolean isLiftToWakeAvailable(Context context) { Loading Loading @@ -382,6 +428,9 @@ public class DisplaySettings extends SettingsPreferenceFragment implements if (!isDozeAvailable(context)) { result.add(KEY_DOZE); } if (!RotationPolicy.isRotationLockToggleVisible(context)) { result.add(KEY_AUTO_ROTATE); } return result; } }; Loading