From c41b85cf57d436c69f9ebda39022ecf205fa284a Mon Sep 17 00:00:00 2001 From: Paul Keith Date: Wed, 21 Feb 2018 21:40:51 +0100 Subject: [PATCH] AdvancedDisplay: Rename Negative to Accessibility * Samsung now supports many more modes than just inverted colors * Add strings for these extra modes while we're at it Change-Id: If2a469c994658d521d98b91adec1a19badb8092f --- AdvancedDisplay/res/values/arrays.xml | 8 ++++---- AdvancedDisplay/res/values/config.xml | 2 +- AdvancedDisplay/res/values/strings.xml | 14 +++++++++----- AdvancedDisplay/res/xml/screen_preferences.xml | 14 +++++++------- .../settings/device/AdvancedDisplayFragment.java | 8 ++++---- .../settings/device/BootCompletedReceiver.java | 2 +- .../org/lineageos/settings/device/Constants.java | 2 +- ...{mDNIeNegative.java => mDNIeAccessibility.java} | 10 +++++----- 8 files changed, 32 insertions(+), 28 deletions(-) rename AdvancedDisplay/src/org/lineageos/settings/device/{mDNIeNegative.java => mDNIeAccessibility.java} (83%) diff --git a/AdvancedDisplay/res/values/arrays.xml b/AdvancedDisplay/res/values/arrays.xml index 2e2eeb3..ccdcd62 100644 --- a/AdvancedDisplay/res/values/arrays.xml +++ b/AdvancedDisplay/res/values/arrays.xml @@ -38,12 +38,12 @@ 7 - - @string/mdnie_inverse_normal - @string/mdnie_inverse_inverse + + @string/mdnie_accessibility_normal + @string/mdnie_accessibility_inverse - + 0 1 diff --git a/AdvancedDisplay/res/values/config.xml b/AdvancedDisplay/res/values/config.xml index 1bb5c1a..b20c248 100644 --- a/AdvancedDisplay/res/values/config.xml +++ b/AdvancedDisplay/res/values/config.xml @@ -20,6 +20,6 @@ "/sys/class/mdnie/mdnie/scenario" - "/sys/class/mdnie/mdnie/negative" + "/sys/class/mdnie/mdnie/negative" diff --git a/AdvancedDisplay/res/values/strings.xml b/AdvancedDisplay/res/values/strings.xml index 57ee1c4..ca4b5f1 100644 --- a/AdvancedDisplay/res/values/strings.xml +++ b/AdvancedDisplay/res/values/strings.xml @@ -25,8 +25,8 @@ Scenario Set the mDNIe scenario - Negative mode - Enable/disable inverted colors + Accessibility mode + Set the mDNIe accessibility mode LineageOS (default) @@ -42,9 +42,13 @@ E-mail Digital television - - Normal - Inverted + + Normal + Inverted + Color blind + Screen curtain + Gray + Gray inverted diff --git a/AdvancedDisplay/res/xml/screen_preferences.xml b/AdvancedDisplay/res/xml/screen_preferences.xml index 492f5a4..5fb1ab9 100644 --- a/AdvancedDisplay/res/xml/screen_preferences.xml +++ b/AdvancedDisplay/res/xml/screen_preferences.xml @@ -14,13 +14,13 @@ android:entryValues="@array/mdnie_scenario_entries_values" android:defaultValue="0" /> - - + diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java index 7046e30..c27e456 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java @@ -28,7 +28,7 @@ import org.lineageos.internal.util.FileUtils; public class AdvancedDisplayFragment extends PreferenceFragment { private mDNIeScenario mmDNIeScenario; - private mDNIeNegative mmDNIeNegative; + private mDNIeAccessibility mmDNIeAccessibility; @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @@ -43,9 +43,9 @@ public class AdvancedDisplayFragment extends PreferenceFragment { mmDNIeScenario.setEnabled( FileUtils.isFileWritable(res.getString(R.string.mdnie_scenario_sysfs_file))); - mmDNIeNegative = (mDNIeNegative) findPreference(Constants.KEY_MDNIE_NEGATIVE); - mmDNIeNegative.setEnabled( - FileUtils.isFileWritable(res.getString(R.string.mdnie_negative_sysfs_file))); + mmDNIeAccessibility = (mDNIeAccessibility) findPreference(Constants.KEY_MDNIE_ACCESSIBILITY); + mmDNIeAccessibility.setEnabled( + FileUtils.isFileWritable(res.getString(R.string.mdnie_accessibility_sysfs_file))); } @Override diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/BootCompletedReceiver.java b/AdvancedDisplay/src/org/lineageos/settings/device/BootCompletedReceiver.java index 36a4270..9ab84cf 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/BootCompletedReceiver.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/BootCompletedReceiver.java @@ -26,6 +26,6 @@ public class BootCompletedReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { mDNIeScenario.restore(context); - mDNIeNegative.restore(context); + mDNIeAccessibility.restore(context); } } diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/Constants.java b/AdvancedDisplay/src/org/lineageos/settings/device/Constants.java index 372cf50..56949ff 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/Constants.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/Constants.java @@ -18,5 +18,5 @@ package org.lineageos.settings.device; public class Constants { static final String KEY_MDNIE_SCENARIO = "mdnie_scenario"; - static final String KEY_MDNIE_NEGATIVE = "mdnie_negative"; + static final String KEY_MDNIE_ACCESSIBILITY = "mdnie_accessibility"; } diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/mDNIeNegative.java b/AdvancedDisplay/src/org/lineageos/settings/device/mDNIeAccessibility.java similarity index 83% rename from AdvancedDisplay/src/org/lineageos/settings/device/mDNIeNegative.java rename to AdvancedDisplay/src/org/lineageos/settings/device/mDNIeAccessibility.java index 25d4199..2d931d1 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/mDNIeNegative.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/mDNIeAccessibility.java @@ -27,14 +27,14 @@ import android.util.AttributeSet; import org.lineageos.internal.util.FileUtils; -public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener { +public class mDNIeAccessibility extends ListPreference implements OnPreferenceChangeListener { private static String FILE = null; - public mDNIeNegative(Context context, AttributeSet attrs) { + public mDNIeAccessibility(Context context, AttributeSet attrs) { super(context, attrs); this.setOnPreferenceChangeListener(this); - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + FILE = context.getResources().getString(R.string.mdnie_accessibility_sysfs_file); } /** @@ -42,13 +42,13 @@ public class mDNIeNegative extends ListPreference implements OnPreferenceChangeL * @param context The context to read the SharedPreferences from */ public static void restore(Context context) { - FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + FILE = context.getResources().getString(R.string.mdnie_accessibility_sysfs_file); if (!FileUtils.isFileWritable(FILE)) { return; } SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - FileUtils.writeLine(FILE, sharedPrefs.getString(Constants.KEY_MDNIE_NEGATIVE, "0")); + FileUtils.writeLine(FILE, sharedPrefs.getString(Constants.KEY_MDNIE_ACCESSIBILITY, "0")); } public boolean onPreferenceChange(Preference preference, Object newValue) {