summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-09-23 16:08:13 -0400
committerJason Monk <jmonk@google.com>2015-09-23 16:08:13 -0400
commit16a8e8d1028c09abe8b083acf9da70e6d65ebb79 (patch)
tree8a2ed2634e52147274b2cce745d92b434990ddfe /src/com/android
parent3d7c4d57c4bccb63e156ca5aa0fd01732bdc05ac (diff)
downloadpackages_apps_Settings-16a8e8d1028c09abe8b083acf9da70e6d65ebb79.zip
packages_apps_Settings-16a8e8d1028c09abe8b083acf9da70e6d65ebb79.tar.gz
packages_apps_Settings-16a8e8d1028c09abe8b083acf9da70e6d65ebb79.tar.bz2
Make picture color mode less of a feature
- Shun it to developer settings - Hide 'natural' mode - Remove dialog Bug: 24038268 Change-Id: Ibaf363bc06b444f2a361707b98742328fc290cfc
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/settings/ColorModePreference.java50
-rw-r--r--src/com/android/settings/DevelopmentSettings.java23
-rw-r--r--src/com/android/settings/DisplaySettings.java30
3 files changed, 35 insertions, 68 deletions
diff --git a/src/com/android/settings/ColorModePreference.java b/src/com/android/settings/ColorModePreference.java
index e1f00fd..14ffe48 100644
--- a/src/com/android/settings/ColorModePreference.java
+++ b/src/com/android/settings/ColorModePreference.java
@@ -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;
@@ -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;
@@ -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];
@@ -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);
- }
+ 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);
- @Override
- public void onClick(View v) {
- ColorTransformDescription desc = (ColorTransformDescription) v.getTag();
-
- mDisplay.requestColorTransform(desc.transform);
- mCurrentIndex = mDescriptions.indexOf(desc);
+ mDisplay.requestColorTransform(desc.transform);
+ mCurrentIndex = mDescriptions.indexOf(desc);
+ }
- setSummary(desc.title);
- getDialog().dismiss();
+ return true;
}
private static class ColorTransformDescription {
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 4a4c51d..461084f 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -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";
@@ -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
@@ -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) {
@@ -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
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 536a30e..de15d4c 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -79,7 +79,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private static final String KEY_CAMERA_GESTURE = "camera_gesture";
private static final String KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE
= "camera_double_tap_power_gesture";
- private static final String KEY_COLOR_MODE = "color_mode";
private static final int DLG_GLOBAL_CHANGE_WARNING = 1;
@@ -97,8 +96,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
private SwitchPreference mCameraGesturePreference;
private SwitchPreference mCameraDoubleTapPowerGesturePreference;
- private ColorModePreference mColorModePreference;
-
@Override
protected int getMetricsCategory() {
return MetricsLogger.DISPLAY;
@@ -174,13 +171,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
removePreference(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
}
- mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
- mColorModePreference.updateCurrentAndSupported();
- if (mColorModePreference.getTransformsCount() < 2) {
- removePreference(KEY_COLOR_MODE);
- mColorModePreference = null;
- }
-
if (RotationPolicy.isRotationLockToggleVisible(activity)) {
DropDownPreference rotatePreference =
(DropDownPreference) findPreference(KEY_AUTO_ROTATE);
@@ -370,17 +360,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
public void onResume() {
super.onResume();
updateState();
- if (mColorModePreference != null) {
- mColorModePreference.startListening();
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if (mColorModePreference != null) {
- mColorModePreference.stopListening();
- }
}
@Override
@@ -438,10 +417,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
getContentResolver(), CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
mCameraDoubleTapPowerGesturePreference.setChecked(value == 0);
}
-
- if (mColorModePreference != null) {
- mColorModePreference.updateCurrentAndSupported();
- }
}
private void updateScreenSaverSummary() {
@@ -581,11 +556,6 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
if (!isCameraDoubleTapPowerGestureAvailable(context.getResources())) {
result.add(KEY_CAMERA_DOUBLE_TAP_POWER_GESTURE);
}
- ColorModePreference pref = new ColorModePreference(context, null);
- pref.updateCurrentAndSupported();
- if (pref.getTransformsCount() < 2) {
- result.add(KEY_COLOR_MODE);
- }
return result;
}
};