mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +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
bc84a21d29
commit
fea277e034
8 changed files with 18 additions and 76 deletions
|
@ -39,12 +39,12 @@
|
|||
<item>8</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mdnie_negative_entries">
|
||||
<string-array name="mdnie_accessibility_entries" translatable="false">
|
||||
<item>Normal</item>
|
||||
<item>Inverted</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>
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
<!-- 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>
|
||||
</resources>
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2012 The CyanogenMod Project
|
||||
* 2017 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.device;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.support.v7.preference.PreferenceManager;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.lineageos.internal.util.FileUtils;
|
||||
|
||||
public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener {
|
||||
|
||||
private static String FILE = null;
|
||||
|
||||
public mDNIeNegative(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.setOnPreferenceChangeListener(this);
|
||||
FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore mdnie user mode setting from SharedPreferences. (Write to kernel.)
|
||||
* @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);
|
||||
if (!FileUtils.isFileWritable(FILE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
FileUtils.writeLine(FILE, sharedPrefs.getString(Constants.KEY_MDNIE_NEGATIVE, "0"));
|
||||
}
|
||||
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
FileUtils.writeLine(FILE, (String) newValue);
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue