mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-10-31 23:37:35 +00:00
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
This commit is contained in:
parent
d9b32260a3
commit
c41b85cf57
8 changed files with 32 additions and 28 deletions
|
@ -38,12 +38,12 @@
|
|||
<item>7</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mdnie_negative_entries" translatable="false">
|
||||
<item>@string/mdnie_inverse_normal</item>
|
||||
<item>@string/mdnie_inverse_inverse</item>
|
||||
<string-array name="mdnie_accessibility_entries" translatable="false">
|
||||
<item>@string/mdnie_accessibility_normal</item>
|
||||
<item>@string/mdnie_accessibility_inverse</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mdnie_negative_entries_values" translatable="false">
|
||||
<string-array name="mdnie_accessibility_entries_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
|
||||
<!-- MDNIE -->
|
||||
<string name="mdnie_scenario_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/scenario"</string>
|
||||
<string name="mdnie_negative_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/negative"</string>
|
||||
<string name="mdnie_accessibility_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/negative"</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
<!-- mDNIe -->
|
||||
<string name="mdnie_scenario_title_head">Scenario</string>
|
||||
<string name="mdnie_scenario_summary_head">Set the mDNIe scenario</string>
|
||||
<string name="mdnie_negative_title_head">Negative mode</string>
|
||||
<string name="mdnie_negative_summary_head">Enable/disable inverted colors</string>
|
||||
<string name="mdnie_accessibility_title_head">Accessibility mode</string>
|
||||
<string name="mdnie_accessibility_summary_head">Set the mDNIe accessibility mode</string>
|
||||
|
||||
<!-- Scenario names -->
|
||||
<string name="mdnie_scenario_ui">LineageOS (default)</string>
|
||||
|
@ -42,9 +42,13 @@
|
|||
<string name="mdnie_scenario_email">E-mail</string>
|
||||
<string name="mdnie_scenario_tdmb">Digital television</string>
|
||||
|
||||
<!-- Inverse mode names -->
|
||||
<string name="mdnie_inverse_normal">Normal</string>
|
||||
<string name="mdnie_inverse_inverse">Inverted</string>
|
||||
<!-- Accessibility mode names -->
|
||||
<string name="mdnie_accessibility_normal">Normal</string>
|
||||
<string name="mdnie_accessibility_inverse">Inverted</string>
|
||||
<string name="mdnie_accessibility_color_blind">Color blind</string>
|
||||
<string name="mdnie_accessibility_screen_curtain">Screen curtain</string>
|
||||
<string name="mdnie_accessibility_grayscale">Gray</string>
|
||||
<string name="mdnie_accessibility_gray_negative">Gray inverted</string>
|
||||
|
||||
<!-- DO NOT TRANSLATE Empty summary for dynamic preferences -->
|
||||
<string name="summary_empty" translatable="false"></string>
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
android:entryValues="@array/mdnie_scenario_entries_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<!-- mDNIe Negative mode -->
|
||||
<org.lineageos.settings.device.mDNIeNegative
|
||||
android:key="mdnie_negative"
|
||||
android:title="@string/mdnie_negative_title_head"
|
||||
android:summary="@string/mdnie_negative_summary_head"
|
||||
android:entries="@array/mdnie_negative_entries"
|
||||
android:entryValues="@array/mdnie_negative_entries_values"
|
||||
<!-- mDNIe Accessibility mode -->
|
||||
<org.lineageos.settings.device.mDNIeAccessibility
|
||||
android:key="mdnie_accessibility"
|
||||
android:title="@string/mdnie_accessibility_title_head"
|
||||
android:summary="@string/mdnie_accessibility_summary_head"
|
||||
android:entries="@array/mdnie_accessibility_entries"
|
||||
android:entryValues="@array/mdnie_accessibility_entries_values"
|
||||
android:defaultValue="0" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -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) {
|
Loading…
Reference in a new issue