Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -7034,4 +7034,7 @@ <!-- Name of feature to change color setting for the display [CHAR LIMIT=60] --> <string name="picture_color_mode">Picture color mode</string> <!-- Description of feature to change color setting for the display [CHAR LIMIT=NONE] --> <string name="picture_color_mode_desc">Use sRGB</string> </resources> res/xml/development_prefs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,12 @@ android:summary="@string/runningservices_settings_summary" android:fragment="com.android.settings.applications.RunningServices" /> <com.android.settings.ColorModePreference android:key="color_mode" android:title="@string/picture_color_mode" android:summary="@string/picture_color_mode_desc" android:persistent="false" /> <PreferenceCategory android:key="debug_debugging_category" android:title="@string/debug_debugging_category"> Loading res/xml/display_settings.xml +0 −6 Original line number Diff line number Diff line Loading @@ -104,12 +104,6 @@ android:key="auto_rotate" android:title="@string/display_auto_rotate_title" /> <com.android.settings.ColorModePreference android:key="color_mode" android:title="@string/picture_color_mode" android:persistent="false" settings:keywords="@string/keywords_color_mode" /> <PreferenceScreen android:key="wifi_display" android:title="@string/wifi_display_settings_title" Loading src/com/android/settings/ColorModePreference.java +12 −38 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.hardware.display.DisplayManager.DisplayListener; import android.os.Handler; import android.os.Looper; import android.preference.DialogPreference; import android.preference.SwitchPreference; import android.util.AttributeSet; import android.view.Display; import android.view.Display.ColorTransform; Loading @@ -35,8 +36,7 @@ import android.widget.TextView; import java.util.ArrayList; public class ColorModePreference extends DialogPreference implements OnClickListener, DisplayListener { public class ColorModePreference extends SwitchPreference implements DisplayListener { private DisplayManager mDisplayManager; private Display mDisplay; Loading Loading @@ -91,7 +91,7 @@ public class ColorModePreference extends DialogPreference implements String[] descriptions = resources.getStringArray(R.array.color_mode_descriptions); // Map the resource information describing color transforms. for (int i = 0; i < transforms.length; i++) { if (transforms[i] != -1) { if (transforms[i] != -1 && i != 1 /* Skip Natural for now. */) { ColorTransformDescription desc = new ColorTransformDescription(); desc.colorTransform = transforms[i]; desc.title = titles[i]; Loading Loading @@ -126,46 +126,20 @@ public class ColorModePreference extends DialogPreference implements break; } } if (mCurrentIndex != -1) { setSummary(mDescriptions.get(mCurrentIndex).title); } else { setSummary(null); } } @Override protected View onCreateDialogView() { LayoutInflater inflater = LayoutInflater.from(getContext()); LinearLayout v = (LinearLayout) inflater.inflate(R.layout.radio_list_container, null); for (int i = 0; i < mDescriptions.size(); i++) { View child = inflater.inflate(R.layout.radio_with_summary, v, false); ColorTransformDescription desc = mDescriptions.get(i); child.setTag(desc); ((TextView) child.findViewById(android.R.id.title)).setText(desc.title); ((TextView) child.findViewById(android.R.id.summary)).setText(desc.summary); ((Checkable) child).setChecked(i == mCurrentIndex); child.setClickable(true); child.setOnClickListener(this); v.addView(child); } return v; setChecked(mCurrentIndex == 1); } @Override protected void onPrepareDialogBuilder(Builder builder) { super.onPrepareDialogBuilder(builder); builder.setPositiveButton(null, null); } @Override public void onClick(View v) { ColorTransformDescription desc = (ColorTransformDescription) v.getTag(); protected boolean persistBoolean(boolean value) { // Right now this is a switch, so we only support two modes. if (mDescriptions.size() == 2) { ColorTransformDescription desc = mDescriptions.get(value ? 1 : 0); mDisplay.requestColorTransform(desc.transform); mCurrentIndex = mDescriptions.indexOf(desc); } setSummary(desc.title); getDialog().dismiss(); return true; } private static class ColorTransformDescription { Loading src/com/android/settings/DevelopmentSettings.java +23 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String USB_CONFIGURATION_KEY = "select_usb_configuration"; private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client"; private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; private static final String KEY_COLOR_MODE = "color_mode"; private static final String INACTIVE_APPS_KEY = "inactive_apps"; Loading Loading @@ -253,6 +254,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private SwitchPreference mShowAllANRs; private ColorModePreference mColorModePreference; private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>(); private final ArrayList<SwitchPreference> mResetSwitchPrefs Loading Loading @@ -407,6 +410,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mAllPrefs.add(hdcpChecking); removePreferenceForProduction(hdcpChecking); } mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE); mColorModePreference.updateCurrentAndSupported(); if (mColorModePreference.getTransformsCount() < 2) { removePreference(KEY_COLOR_MODE); mColorModePreference = null; } } private ListPreference addListPreference(String prefKey) { Loading Loading @@ -512,6 +522,19 @@ public class DevelopmentSettings extends SettingsPreferenceFragment setPrefsEnabledState(mLastEnabledState); } mSwitchBar.show(); if (mColorModePreference != null) { mColorModePreference.startListening(); mColorModePreference.updateCurrentAndSupported(); } } @Override public void onPause() { super.onPause(); if (mColorModePreference != null) { mColorModePreference.stopListening(); } } @Override Loading Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -7034,4 +7034,7 @@ <!-- Name of feature to change color setting for the display [CHAR LIMIT=60] --> <string name="picture_color_mode">Picture color mode</string> <!-- Description of feature to change color setting for the display [CHAR LIMIT=NONE] --> <string name="picture_color_mode_desc">Use sRGB</string> </resources>
res/xml/development_prefs.xml +6 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,12 @@ android:summary="@string/runningservices_settings_summary" android:fragment="com.android.settings.applications.RunningServices" /> <com.android.settings.ColorModePreference android:key="color_mode" android:title="@string/picture_color_mode" android:summary="@string/picture_color_mode_desc" android:persistent="false" /> <PreferenceCategory android:key="debug_debugging_category" android:title="@string/debug_debugging_category"> Loading
res/xml/display_settings.xml +0 −6 Original line number Diff line number Diff line Loading @@ -104,12 +104,6 @@ android:key="auto_rotate" android:title="@string/display_auto_rotate_title" /> <com.android.settings.ColorModePreference android:key="color_mode" android:title="@string/picture_color_mode" android:persistent="false" settings:keywords="@string/keywords_color_mode" /> <PreferenceScreen android:key="wifi_display" android:title="@string/wifi_display_settings_title" Loading
src/com/android/settings/ColorModePreference.java +12 −38 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.hardware.display.DisplayManager.DisplayListener; import android.os.Handler; import android.os.Looper; import android.preference.DialogPreference; import android.preference.SwitchPreference; import android.util.AttributeSet; import android.view.Display; import android.view.Display.ColorTransform; Loading @@ -35,8 +36,7 @@ import android.widget.TextView; import java.util.ArrayList; public class ColorModePreference extends DialogPreference implements OnClickListener, DisplayListener { public class ColorModePreference extends SwitchPreference implements DisplayListener { private DisplayManager mDisplayManager; private Display mDisplay; Loading Loading @@ -91,7 +91,7 @@ public class ColorModePreference extends DialogPreference implements String[] descriptions = resources.getStringArray(R.array.color_mode_descriptions); // Map the resource information describing color transforms. for (int i = 0; i < transforms.length; i++) { if (transforms[i] != -1) { if (transforms[i] != -1 && i != 1 /* Skip Natural for now. */) { ColorTransformDescription desc = new ColorTransformDescription(); desc.colorTransform = transforms[i]; desc.title = titles[i]; Loading Loading @@ -126,46 +126,20 @@ public class ColorModePreference extends DialogPreference implements break; } } if (mCurrentIndex != -1) { setSummary(mDescriptions.get(mCurrentIndex).title); } else { setSummary(null); } } @Override protected View onCreateDialogView() { LayoutInflater inflater = LayoutInflater.from(getContext()); LinearLayout v = (LinearLayout) inflater.inflate(R.layout.radio_list_container, null); for (int i = 0; i < mDescriptions.size(); i++) { View child = inflater.inflate(R.layout.radio_with_summary, v, false); ColorTransformDescription desc = mDescriptions.get(i); child.setTag(desc); ((TextView) child.findViewById(android.R.id.title)).setText(desc.title); ((TextView) child.findViewById(android.R.id.summary)).setText(desc.summary); ((Checkable) child).setChecked(i == mCurrentIndex); child.setClickable(true); child.setOnClickListener(this); v.addView(child); } return v; setChecked(mCurrentIndex == 1); } @Override protected void onPrepareDialogBuilder(Builder builder) { super.onPrepareDialogBuilder(builder); builder.setPositiveButton(null, null); } @Override public void onClick(View v) { ColorTransformDescription desc = (ColorTransformDescription) v.getTag(); protected boolean persistBoolean(boolean value) { // Right now this is a switch, so we only support two modes. if (mDescriptions.size() == 2) { ColorTransformDescription desc = mDescriptions.get(value ? 1 : 0); mDisplay.requestColorTransform(desc.transform); mCurrentIndex = mDescriptions.indexOf(desc); } setSummary(desc.title); getDialog().dismiss(); return true; } private static class ColorTransformDescription { Loading
src/com/android/settings/DevelopmentSettings.java +23 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private static final String USB_CONFIGURATION_KEY = "select_usb_configuration"; private static final String WIFI_LEGACY_DHCP_CLIENT_KEY = "legacy_dhcp_client"; private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; private static final String KEY_COLOR_MODE = "color_mode"; private static final String INACTIVE_APPS_KEY = "inactive_apps"; Loading Loading @@ -253,6 +254,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment private SwitchPreference mShowAllANRs; private ColorModePreference mColorModePreference; private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>(); private final ArrayList<SwitchPreference> mResetSwitchPrefs Loading Loading @@ -407,6 +410,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment mAllPrefs.add(hdcpChecking); removePreferenceForProduction(hdcpChecking); } mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE); mColorModePreference.updateCurrentAndSupported(); if (mColorModePreference.getTransformsCount() < 2) { removePreference(KEY_COLOR_MODE); mColorModePreference = null; } } private ListPreference addListPreference(String prefKey) { Loading Loading @@ -512,6 +522,19 @@ public class DevelopmentSettings extends SettingsPreferenceFragment setPrefsEnabledState(mLastEnabledState); } mSwitchBar.show(); if (mColorModePreference != null) { mColorModePreference.startListening(); mColorModePreference.updateCurrentAndSupported(); } } @Override public void onPause() { super.onPause(); if (mColorModePreference != null) { mColorModePreference.stopListening(); } } @Override Loading