summaryrefslogtreecommitdiffstats
path: root/DeviceSettings
diff options
context:
space:
mode:
Diffstat (limited to 'DeviceSettings')
-rw-r--r--DeviceSettings/res/values/config.xml6
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java12
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java11
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java12
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java12
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java12
6 files changed, 41 insertions, 24 deletions
diff --git a/DeviceSettings/res/values/config.xml b/DeviceSettings/res/values/config.xml
index 5fdb6ac..5e4be8f 100644
--- a/DeviceSettings/res/values/config.xml
+++ b/DeviceSettings/res/values/config.xml
@@ -49,4 +49,10 @@
<!-- Touchkey -->
<bool name="has_touchkey">true</bool>
+ <!-- MDNIE -->
+ <string name="mdnie_cabc_sysfs_file" translatable="false">"/sys/class/lcd/panel/power_reduce"</string>
+ <string name="mdnie_scenario_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/scenario"</string>
+ <string name="mdnie_mode_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/mode"</string>
+ <string name="mdnie_negative_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/negative"</string>
+
</resources>
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java b/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java
index af247d8..9e0ab7c 100644
--- a/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java
@@ -26,15 +26,16 @@ import android.util.AttributeSet;
public class CABC extends CheckBoxPreference implements OnPreferenceChangeListener {
+ private static String FILE = null;
+
public CABC(Context context, AttributeSet attrs) {
super(context, attrs);
this.setOnPreferenceChangeListener(this);
+ FILE = context.getResources().getString(R.string.mdnie_cabc_sysfs_file);
}
- private static final String FILE = "/sys/class/lcd/panel/power_reduce";
-
- public static boolean isSupported() {
- return Utils.fileExists(FILE);
+ public static boolean isSupported(String filePath) {
+ return Utils.fileExists(filePath);
}
/**
@@ -42,7 +43,8 @@ public class CABC extends CheckBoxPreference implements OnPreferenceChangeListen
* @param context The context to read the SharedPreferences from
*/
public static void restore(Context context) {
- if (!isSupported()) {
+ FILE = context.getResources().getString(R.string.mdnie_cabc_sysfs_file);
+ if (!isSupported(FILE)) {
return;
}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java
index f5c33b5..e7e1b33 100644
--- a/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java
@@ -42,6 +42,7 @@ public class ScreenFragmentActivity extends PreferenceFragment {
private mDNIeNegative mmDNIeNegative;
private LedFade mLedFade;
private CheckBoxPreference mTouchKey;
+ private TouchkeyTimeout mTouchKeyTimeout;
private static boolean sSPenSupported;
private static boolean sTouchkeySupport;
@@ -80,10 +81,12 @@ public class ScreenFragmentActivity extends PreferenceFragment {
mTouchKey = (CheckBoxPreference)preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_LIGHT);
mTouchKey.setEnabled(sTouchkeySupport);
+ mTouchKeyTimeout = (TouchkeyTimeout)preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT);
+
if (mTouchKey.isChecked() && mTouchKey.isEnabled()) {
- preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(true);
+ mTouchKeyTimeout.setEnabled(mTouchKeyTimeout.isSupported());
} else {
- preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(false);
+ mTouchKeyTimeout.setEnabled(false);
}
/* S-Pen */
@@ -106,11 +109,11 @@ public class ScreenFragmentActivity extends PreferenceFragment {
if (((CheckBoxPreference)preference).isChecked()) {
Utils.writeValue(FILE_TOUCHKEY_DISABLE, "0");
Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "1");
- preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(true);
+ mTouchKeyTimeout.setEnabled(mTouchKeyTimeout.isSupported());
} else {
Utils.writeValue(FILE_TOUCHKEY_DISABLE, "1");
Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "2");
- preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(false);
+ mTouchKeyTimeout.setEnabled(false);
}
}
return true;
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java
index 7969637..2e473e6 100644
--- a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java
@@ -27,15 +27,16 @@ import android.preference.PreferenceManager;
public class mDNIeMode extends ListPreference implements OnPreferenceChangeListener {
+ private static String FILE = null;
+
public mDNIeMode(Context context, AttributeSet attrs) {
super(context, attrs);
this.setOnPreferenceChangeListener(this);
+ FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file);
}
- private static final String FILE = "/sys/class/mdnie/mdnie/mode";
-
- public static boolean isSupported() {
- return Utils.fileExists(FILE);
+ public static boolean isSupported(String filePath) {
+ return Utils.fileExists(filePath);
}
/**
@@ -43,7 +44,8 @@ public class mDNIeMode extends ListPreference implements OnPreferenceChangeListe
* @param context The context to read the SharedPreferences from
*/
public static void restore(Context context) {
- if (!isSupported()) {
+ FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file);
+ if (!isSupported(FILE)) {
return;
}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java
index c2ccc7b..3851c85 100644
--- a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java
@@ -27,15 +27,16 @@ import android.preference.PreferenceManager;
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);
}
- private static final String FILE = "/sys/class/mdnie/mdnie/negative";
-
- public static boolean isSupported() {
- return Utils.fileExists(FILE);
+ public static boolean isSupported(String filePath) {
+ return Utils.fileExists(filePath);
}
/**
@@ -43,7 +44,8 @@ public class mDNIeNegative extends ListPreference implements OnPreferenceChangeL
* @param context The context to read the SharedPreferences from
*/
public static void restore(Context context) {
- if (!isSupported()) {
+ FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file);
+ if (!isSupported(FILE)) {
return;
}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java
index a9c935a..2a852a3 100644
--- a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java
@@ -27,15 +27,16 @@ import android.preference.PreferenceManager;
public class mDNIeScenario extends ListPreference implements OnPreferenceChangeListener {
+ private static String FILE = null;
+
public mDNIeScenario(Context context, AttributeSet attrs) {
super(context,attrs);
this.setOnPreferenceChangeListener(this);
+ FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file);
}
- private static final String FILE = "/sys/class/mdnie/mdnie/scenario";
-
- public static boolean isSupported() {
- return Utils.fileExists(FILE);
+ public static boolean isSupported(String filePath) {
+ return Utils.fileExists(filePath);
}
/**
@@ -43,7 +44,8 @@ public class mDNIeScenario extends ListPreference implements OnPreferenceChangeL
* @param context The context to read the SharedPreferences from
*/
public static void restore(Context context) {
- if (!isSupported()) {
+ FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file);
+ if (!isSupported(FILE)) {
return;
}