summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXpLoDWilD <xplodgui@gmail.com>2012-05-01 01:53:55 +0200
committerXpLoDWilD <xplodgui@gmail.com>2012-05-01 01:53:55 +0200
commitcac2ee8f89c83c25039bc73ed817bc7b8c994f7e (patch)
treea7885d1146556b621d155a4404cc6b4c5c757ebd
parent4638ae1ab2f3cb8c04793e12fccd6b4ef36ccf80 (diff)
downloaddevice_samsung_n7000-cac2ee8f89c83c25039bc73ed817bc7b8c994f7e.zip
device_samsung_n7000-cac2ee8f89c83c25039bc73ed817bc7b8c994f7e.tar.gz
device_samsung_n7000-cac2ee8f89c83c25039bc73ed817bc7b8c994f7e.tar.bz2
Add DeviceSettings
-rw-r--r--DeviceSettings/Android.mk15
-rw-r--r--DeviceSettings/AndroidManifest.xml30
-rwxr-xr-xDeviceSettings/res/drawable/ic_launcher_cmdevicesettings.pngbin0 -> 8207 bytes
-rwxr-xr-xDeviceSettings/res/layout/top.xml5
-rw-r--r--DeviceSettings/res/values-de/arrays.xml51
-rw-r--r--DeviceSettings/res/values-de/strings.xml35
-rw-r--r--DeviceSettings/res/values-es/arrays.xml51
-rw-r--r--DeviceSettings/res/values-es/strings.xml34
-rw-r--r--DeviceSettings/res/values-fi/arrays.xml51
-rw-r--r--DeviceSettings/res/values-fi/strings.xml35
-rw-r--r--DeviceSettings/res/values-fr/arrays.xml51
-rw-r--r--DeviceSettings/res/values-fr/strings.xml34
-rw-r--r--DeviceSettings/res/values-hu/arrays.xml51
-rw-r--r--DeviceSettings/res/values-hu/strings.xml35
-rw-r--r--DeviceSettings/res/values/arrays.xml99
-rw-r--r--DeviceSettings/res/values/strings.xml35
-rw-r--r--DeviceSettings/res/xml/mdnie_preferences.xml64
-rw-r--r--DeviceSettings/res/xml/radio_preferences.xml12
-rw-r--r--DeviceSettings/res/xml/sensors_preferences.xml30
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java155
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/Hspa.java67
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/PanelGamma.java60
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java66
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/SensorsFragmentActivity.java93
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java34
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/TouchscreenSensitivity.java59
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java79
-rwxr-xr-xDeviceSettings/src/com/cyanogenmod/settings/device/mDNIeFragmentActivity.java57
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java59
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java59
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeOutdoor.java58
-rw-r--r--DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java59
32 files changed, 1623 insertions, 0 deletions
diff --git a/DeviceSettings/Android.mk b/DeviceSettings/Android.mk
new file mode 100644
index 0000000..faaddf0
--- /dev/null
+++ b/DeviceSettings/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := GalaxyNoteSettings
+LOCAL_CERTIFICATE := platform
+
+include $(BUILD_PACKAGE)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/DeviceSettings/AndroidManifest.xml b/DeviceSettings/AndroidManifest.xml
new file mode 100644
index 0000000..d658983
--- /dev/null
+++ b/DeviceSettings/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.cyanogenmod.settings.device"
+ android:sharedUserId="android.uid.system" >
+
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
+
+ <application android:label="@string/app_name">
+ <activity
+ android:name="com.cyanogenmod.settings.device.DeviceSettings"
+ android:icon="@drawable/ic_launcher_cmdevicesettings"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="com.cyanogenmod.action.LAUNCH_DEVICE_SETTINGS" />
+ <action android:name="android.intent.action.MAIN" />
+ </intent-filter>
+ </activity>
+
+ <receiver android:name=".Startup">
+ <intent-filter android:priority="100">
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
+ </receiver>
+
+ <activity android:name=".mDNIeFragmentActivity" />
+ <activity android:name=".RadioFragmentActivity" />
+
+ </application>
+</manifest>
diff --git a/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png b/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png
new file mode 100755
index 0000000..66de9c3
--- /dev/null
+++ b/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png
Binary files differ
diff --git a/DeviceSettings/res/layout/top.xml b/DeviceSettings/res/layout/top.xml
new file mode 100755
index 0000000..744b568
--- /dev/null
+++ b/DeviceSettings/res/layout/top.xml
@@ -0,0 +1,5 @@
+<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/viewPager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
diff --git a/DeviceSettings/res/values-de/arrays.xml b/DeviceSettings/res/values-de/arrays.xml
new file mode 100644
index 0000000..982125b
--- /dev/null
+++ b/DeviceSettings/res/values-de/arrays.xml
@@ -0,0 +1,51 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Kamera (Standard)</item>
+ <item>Video</item>
+ <item>Video warm</item>
+ <item>Video kalt</item>
+ <item>UI</item>
+ <item>Navigation</item>
+ <item>Gallerie</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Standard</item>
+ <item>Dynamisch</item>
+ <item>Natürlich</item>
+ <item>Film</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Normal</item>
+ <item>Invertiert</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Deaktiviert</item>
+ <item>Aktiviert</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Standard)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Standard)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="hspa_entries">
+ <item>Nur UMTS</item>
+ <item>Nur HSDPA</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values-de/strings.xml b/DeviceSettings/res/values-de/strings.xml
new file mode 100644
index 0000000..cf1e922
--- /dev/null
+++ b/DeviceSettings/res/values-de/strings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Galaxy Note Einstellungen</string>
+
+ <string name="screen_colors_title">Farben</string>
+ <string name="category_mdnie_title">Bildschirm</string>
+ <string name="mdnie_scenario_title_head">Szenario</string>
+ <string name="mdnie_scenario_summary_head">Wähle das mDNIe Szenario</string>
+ <string name="mdnie_mode_title_head">Modus</string>
+ <string name="mdnie_mode_summary_head">Wähle den mDNIe Modus</string>
+ <string name="mdnie_negative_title_head">Negativ Modus</string>
+ <string name="mdnie_negative_summary_head">Aktiviert/Deaktiviert negierte Farben</string>
+ <string name="mdnie_outdoor_title_head">Outdoor Modus</string>
+ <string name="mdnie_outdoor_summary_head">Aktiviert/Deaktiviert den Outdoor Modus</string>
+ <string name="panel_gamma_title_head">Gamma Einstellung</string>
+ <string name="panel_gamma_summary_head">Setzt den Gamma Wert</string>
+
+ <string name="touchscreen_subcat_title">Touchscreen</string>
+ <string name="touchscreen_sensitivity_title_head">Sensitivität</string>
+ <string name="touchscreen_sensitivity_summary_head">Setzt die Touchpanel Sensitivität</string>
+
+ <string name="category_sensors_title">Sensoren</string>
+ <string name="gyro_subcat_title">Gyroskop</string>
+ <string name="use_gyro_calibration_title_head">Kalibierungsdaten</string>
+ <string name="use_gyro_calibration_summary_head">Benutze Kalibrierungswerte. Bitte nach Aktivierung eine Kalibrierung durchführen!</string>
+ <string name="calibrate_gyro_title_head">Kalibrieren</string>
+ <string name="calibrate_gyro_summary_head">Lege dein Telefon auf einen geraden Untergrund und starte die Kalibrierung.</string>
+ <string name="touchkey_subcat_title">Touch-Tasten</string>
+ <string name="touchkey_light_title_head">Aktiviere Tastenbeleuchtung</string>
+ <string name="touchkey_light_summary_head">Tasten leuchten auf während der Birdschirm aktiv ist</string>
+
+ <string name="category_radio_title">Mobilfunk</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">Aktiviert HSDPA/HSUPA</string>
+</resources>
diff --git a/DeviceSettings/res/values-es/arrays.xml b/DeviceSettings/res/values-es/arrays.xml
new file mode 100644
index 0000000..3bc45b7
--- /dev/null
+++ b/DeviceSettings/res/values-es/arrays.xml
@@ -0,0 +1,51 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="hspa_entries">
+ <item>Solo UMTS</item>
+ <item>solo HSDPA</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Cámara (Predeterminado)</item>
+ <item>Video</item>
+ <item>Video Cálido</item>
+ <item>Video Frío</item>
+ <item>UI</item>
+ <item>Navegación</item>
+ <item>Galería</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Estándar (Predeterminado)</item>
+ <item>Dinámico</item>
+ <item>Natural</item>
+ <item>Película</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Normal</item>
+ <item>Invertido</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Desactivado (Predeterminado)</item>
+ <item>Activado</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Predeterminado)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Predeterminado)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values-es/strings.xml b/DeviceSettings/res/values-es/strings.xml
new file mode 100644
index 0000000..95d05ca
--- /dev/null
+++ b/DeviceSettings/res/values-es/strings.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Ajustes de Galaxy Note</string>
+
+ <string name="category_radio_title">Radio</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">Activar HSDPA/HSUPA</string>
+
+ <string name="category_mdnie_title">Pantalla</string>
+ <string name="screen_colors_title">Colores</string>
+ <string name="mdnie_scenario_title_head">Escenario</string>
+ <string name="mdnie_scenario_summary_head">Establecer el escenario mDNIe</string>
+ <string name="mdnie_mode_title_head">Modo</string>
+ <string name="mdnie_mode_summary_head">Establecer el modo mDNIe</string>
+ <string name="mdnie_negative_title_head">Modo Negativo</string>
+ <string name="mdnie_negative_summary_head">Activar/Desactivar los colores invertidos</string>
+ <string name="mdnie_outdoor_title_head">Modo Exterior</string>
+ <string name="mdnie_outdoor_summary_head">Activar/Desactivar el modo exterior</string>
+ <string name="panel_gamma_title_head">Gamma</string>
+ <string name="panel_gamma_summary_head">Establecer el valor gamma de la pantalla</string>
+ <string name="touchscreen_subcat_title">Pantalla Táctil</string>
+ <string name="touchscreen_sensitivity_title_head">Sensibilidad táctil</string>
+ <string name="touchscreen_sensitivity_summary_head">Establecer la sensibilidad táctil de la pantalla</string>
+
+ <string name="category_sensors_title">Sensores</string>
+ <string name="gyro_subcat_title">Giroscopio</string>
+ <string name="use_gyro_calibration_title_head">Usar datos de calibración</string>
+ <string name="use_gyro_calibration_summary_head">Usar los datos de calibración del giroscopio. ¡Calibrar despues de activar!</string>
+ <string name="calibrate_gyro_title_head">Calibrar</string>
+ <string name="calibrate_gyro_summary_head">Poner el dispositivo de una superficie plana y pulsar para calibrar</string>
+ <string name="touchkey_subcat_title">Botones Táctiles</string>
+ <string name="touchkey_light_title_head">Activar iluminación</string>
+ <string name="touchkey_light_summary_head">Iluminar los botones táctiles al encender la pantalla</string>
+</resources>
diff --git a/DeviceSettings/res/values-fi/arrays.xml b/DeviceSettings/res/values-fi/arrays.xml
new file mode 100644
index 0000000..eeebd7a
--- /dev/null
+++ b/DeviceSettings/res/values-fi/arrays.xml
@@ -0,0 +1,51 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Kamera (Oletus)</item>
+ <item>Video</item>
+ <item>Video(Lämmin)</item>
+ <item>Video(Kylmä)</item>
+ <item>Käyttöliittymä</item>
+ <item>Navigointi</item>
+ <item>Galleria</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Standardi (Oletus)</item>
+ <item>Dynaaminen</item>
+ <item>Luonnollinen</item>
+ <item>Elokuva</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Normaali</item>
+ <item>Käänteinen</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Pois päältä (Oletus)</item>
+ <item>Päällä</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Oletus)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Oletus)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="hspa_entries">
+ <item>Vain UMTS</item>
+ <item>Vain HSDPA</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values-fi/strings.xml b/DeviceSettings/res/values-fi/strings.xml
new file mode 100644
index 0000000..188371d
--- /dev/null
+++ b/DeviceSettings/res/values-fi/strings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Galaxy Note-asetukset</string>
+
+ <string name="screen_colors_title">Värit</string>
+ <string name="category_mdnie_title">Näyttö</string>
+ <string name="mdnie_scenario_title_head">Skenaario</string>
+ <string name="mdnie_scenario_summary_head">Vaihda mDNIe-skenaario</string>
+ <string name="mdnie_mode_title_head">Tila</string>
+ <string name="mdnie_mode_summary_head">Vaihda mDNIe-tila</string>
+ <string name="mdnie_negative_title_head">Negatiivi-tila</string>
+ <string name="mdnie_negative_summary_head">Käytä käänteisiä värejä</string>
+ <string name="mdnie_outdoor_title_head">Ulkoilma-tila</string>
+ <string name="mdnie_outdoor_summary_head">Ota ulkoilma-tila käyttöön</string>
+ <string name="panel_gamma_title_head">Näytön gamma</string>
+ <string name="panel_gamma_summary_head">Säädä näytön gamma-arvo</string>
+
+ <string name="touchscreen_subcat_title">Kosketusnäyttö</string>
+ <string name="touchscreen_sensitivity_title_head">Kosketuksen herkkyys</string>
+ <string name="touchscreen_sensitivity_summary_head">Säädä näytön herkkyyttä</string>
+
+ <string name="category_sensors_title">Sensorit</string>
+ <string name="gyro_subcat_title">Gyroskooppi</string>
+ <string name="use_gyro_calibration_title_head">Käytä kalibrointitietoja</string>
+ <string name="use_gyro_calibration_summary_head">Käytä gyroskoopin kalibrointiarvoja. Kalibroi merkattuasi tämän!</string>
+ <string name="calibrate_gyro_title_head">Kalibroi</string>
+ <string name="calibrate_gyro_summary_head">Aseta puhelin tasaiselle alustalle ja paina tätä kalibroidaksesi</string>
+ <string name="touchkey_subcat_title">Kosketusnäppäin</string>
+ <string name="touchkey_light_title_head">Ota näppäinvalot käyttöön</string>
+ <string name="touchkey_light_summary_head">Valot syttyvät kun näyttö on päällä</string>
+
+ <string name="category_radio_title">Radio</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">Ota HSDPA/HSUPA käyttöön</string>
+</resources>
diff --git a/DeviceSettings/res/values-fr/arrays.xml b/DeviceSettings/res/values-fr/arrays.xml
new file mode 100644
index 0000000..124f531
--- /dev/null
+++ b/DeviceSettings/res/values-fr/arrays.xml
@@ -0,0 +1,51 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Caméra (Par défaut)</item>
+ <item>Vidéo</item>
+ <item>Vidéo (chaud)</item>
+ <item>Video (froid)</item>
+ <item>UI</item>
+ <item>Navigation</item>
+ <item>Gallerie</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Standard (Par défaut)</item>
+ <item>Dynamique</item>
+ <item>Naturel</item>
+ <item>Vidéo</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Normal</item>
+ <item>Inversé</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Inactif (Par défaut)</item>
+ <item>Actif</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Par défaut)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Par défaut)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="hspa_entries">
+ <item>UMTS seulement</item>
+ <item>HSDPA seulement</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values-fr/strings.xml b/DeviceSettings/res/values-fr/strings.xml
new file mode 100644
index 0000000..c11f8cf
--- /dev/null
+++ b/DeviceSettings/res/values-fr/strings.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Paramètres GalaxyNote</string>
+
+ <string name="category_mdnie_title">Ecran</string>
+ <string name="screen_colors_title">Couleurs</string>
+ <string name="mdnie_scenario_title_head">Scénario</string>
+ <string name="mdnie_scenario_summary_head">Définit le scénario mDNIe</string>
+ <string name="mdnie_mode_title_head">Mode</string>
+ <string name="mdnie_mode_summary_head">Définit le mode mDNIe</string>
+ <string name="mdnie_negative_title_head">Mode négatif</string>
+ <string name="mdnie_negative_summary_head">Active/désactive les couleurs inversées</string>
+ <string name="mdnie_outdoor_title_head">Mode extérieur</string>
+ <string name="mdnie_outdoor_summary_head">Active/désactive le mode extérieur</string>
+ <string name="panel_gamma_title_head">Gamma écran</string>
+ <string name="panel_gamma_summary_head">Définit la valeur de gamma de l\'écran</string>
+ <string name="touchscreen_subcat_title">Tactile</string>
+ <string name="touchscreen_sensitivity_title_head">Sensibilité</string>
+ <string name="touchscreen_sensitivity_summary_head">Définit la sensibilité du toucher</string>
+
+ <string name="category_sensors_title">Capteurs</string>
+ <string name="gyro_subcat_title">Gyroscope</string>
+ <string name="use_gyro_calibration_title_head">Utiliser données de calibration</string>
+ <string name="use_gyro_calibration_summary_head">Utiliser les données de calibration du gyroscope. Faites une calibration après avoir coché!</string>
+ <string name="calibrate_gyro_title_head">Calibrer</string>
+ <string name="calibrate_gyro_summary_head">Posez le téléphone à plat, puis appuyez sur ce bouton pour effecter la calibration.</string>
+ <string name="touchkey_subcat_title">Touches tactiles</string>
+ <string name="touchkey_light_title_head">Activer l\'éclairage</string>
+ <string name="touchkey_light_summary_head">Illumine les touches tactiles quand l\'écran est activé.</string>
+
+ <string name="category_radio_title">Radio</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">Activer HSDPA/HSUPA</string>
+</resources>
diff --git a/DeviceSettings/res/values-hu/arrays.xml b/DeviceSettings/res/values-hu/arrays.xml
new file mode 100644
index 0000000..ab52e04
--- /dev/null
+++ b/DeviceSettings/res/values-hu/arrays.xml
@@ -0,0 +1,51 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Kamera (Alapbeállítás)</item>
+ <item>Videó</item>
+ <item>Videó (Meleg árnyalat)</item>
+ <item>Videó (Hideg árnyalat)</item>
+ <item>Felhasználói felület</item>
+ <item>Navigáció</item>
+ <item>Galéria</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Hagyományos (Alapbeállítás)</item>
+ <item>Dinamikus</item>
+ <item>Természetes</item>
+ <item>Film</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Hagyományos</item>
+ <item>Fordított</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Kikapcsolva (Alapbeállítás)</item>
+ <item>Bekapcsolva</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Alapbeállítás)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Alapbeállítás)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="hspa_entries">
+ <item>UMTS</item>
+ <item>HSDPA</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values-hu/strings.xml b/DeviceSettings/res/values-hu/strings.xml
new file mode 100644
index 0000000..54197e0
--- /dev/null
+++ b/DeviceSettings/res/values-hu/strings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Galaxy Note Beállítások</string>
+
+ <string name="screen_colors_title">Színek</string>
+ <string name="category_mdnie_title">Kijelző</string>
+ <string name="mdnie_scenario_title_head">Megjelenítés</string>
+ <string name="mdnie_scenario_summary_head">mDNIe megjelenítési beállítások</string>
+ <string name="mdnie_mode_title_head">Üzemmód</string>
+ <string name="mdnie_mode_summary_head">mDNIe üzemmódok</string>
+ <string name="mdnie_negative_title_head">Negatív üzemmód</string>
+ <string name="mdnie_negative_summary_head">Fordított színek ki/be</string>
+ <string name="mdnie_outdoor_title_head">Szabadtéri üzemmód</string>
+ <string name="mdnie_outdoor_summary_head">Szabadtéri üzemmód ki/be</string>
+ <string name="panel_gamma_title_head">Kijelző gamma-értéke</string>
+ <string name="panel_gamma_summary_head">Kijelző gamma-érték beállítása</string>
+
+ <string name="touchscreen_subcat_title">Érintőképernyő</string>
+ <string name="touchscreen_sensitivity_title_head">Érzékenység</string>
+ <string name="touchscreen_sensitivity_summary_head">Állítsd be az érintőképernyő érzékenységét</string>
+
+ <string name="category_sensors_title">Szenzorok</string>
+ <string name="gyro_subcat_title">Giroszkóp</string>
+ <string name="use_gyro_calibration_title_head">Használd a kalibrálási értékeket</string>
+ <string name="use_gyro_calibration_summary_head">Használd a kalibrálási értékeket. Készíts kalibrációt ha ezt bepipálod!</string>
+ <string name="calibrate_gyro_title_head">Kalibrálás</string>
+ <string name="calibrate_gyro_summary_head">Tedd a telefont egy vízszintes felületre, és nyomd meg ezt a gombot a kalibráláshoz</string>
+ <string name="touchkey_subcat_title">Érintőgombok</string>
+ <string name="touchkey_light_title_head">Érintőgombok háttérvilágítása</string>
+ <string name="touchkey_light_summary_head">Bekapcsolja az érintőgombok háttérvilágítását bekapcsolt képernyőnél</string>
+
+ <string name="category_radio_title">GSM rádió</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">HSDPA/HSUPA engedélyezése</string>
+</resources>
diff --git a/DeviceSettings/res/values/arrays.xml b/DeviceSettings/res/values/arrays.xml
new file mode 100644
index 0000000..894157d
--- /dev/null
+++ b/DeviceSettings/res/values/arrays.xml
@@ -0,0 +1,99 @@
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <string-array name="mdnie_scenario_entries">
+ <item>Camera (Default)</item>
+ <item>Video</item>
+ <item>Video Warm</item>
+ <item>Video Cold</item>
+ <item>UI</item>
+ <item>Navigation</item>
+ <item>Gallery</item>
+ <item>VT</item>
+ </string-array>
+
+ <string-array name="mdnie_scenario_entries_values" translatable="false">
+ <item>4</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>0</item>
+ <item>5</item>
+ <item>6</item>
+ <item>7</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries">
+ <item>Standard (Default)</item>
+ <item>Dynamic</item>
+ <item>Natural</item>
+ <item>Movie</item>
+ </string-array>
+
+ <string-array name="mdnie_mode_entries_values" translatable="false">
+ <item>1</item>
+ <item>0</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries">
+ <item>Normal</item>
+ <item>Inverted</item>
+ </string-array>
+
+ <string-array name="mdnie_negative_entries_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries">
+ <item>Off (Default)</item>
+ <item>On</item>
+ </string-array>
+
+ <string-array name="mdnie_outdoor_entries_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries">
+ <item>2.2 (Default)</item>
+ <item>1.9</item>
+ </string-array>
+
+ <string-array name="panel_gamma_entries_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50 (Default)</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="touchscreen_sensitivity_entries_values" translatable="false">
+ <item>10</item>
+ <item>20</item>
+ <item>30</item>
+ <item>50</item>
+ <item>70</item>
+ <item>100</item>
+ </string-array>
+
+ <string-array name="hspa_entries">
+ <item>UMTS Only</item>
+ <item>HSDPA Only</item>
+ <item>HSDPA + HSUPA</item>
+ </string-array>
+
+ <string-array name="hspa_entries_values" translatable="false">
+ <item>21</item>
+ <item>22</item>
+ <item>23</item>
+ </string-array>
+
+</resources>
diff --git a/DeviceSettings/res/values/strings.xml b/DeviceSettings/res/values/strings.xml
new file mode 100644
index 0000000..6259102
--- /dev/null
+++ b/DeviceSettings/res/values/strings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">Galaxy Note Settings</string>
+
+ <string name="screen_colors_title">Colors</string>
+ <string name="category_mdnie_title">Screen</string>
+ <string name="mdnie_scenario_title_head">Scenario</string>
+ <string name="mdnie_scenario_summary_head">Set the mDNIe Scenario</string>
+ <string name="mdnie_mode_title_head">Mode</string>
+ <string name="mdnie_mode_summary_head">Set the mDNIe Mode</string>
+ <string name="mdnie_negative_title_head">Negative Mode</string>
+ <string name="mdnie_negative_summary_head">Enable/Disable inverted colors</string>
+ <string name="mdnie_outdoor_title_head">Outdoor Mode</string>
+ <string name="mdnie_outdoor_summary_head">Enable/Disable outdoor mode</string>
+ <string name="panel_gamma_title_head">Screen Gamma</string>
+ <string name="panel_gamma_summary_head">Set screen gamma value</string>
+
+ <string name="touchscreen_subcat_title">Touchscreen</string>
+ <string name="touchscreen_sensitivity_title_head">Touch sensitivity</string>
+ <string name="touchscreen_sensitivity_summary_head">Set touch panel sensitivity</string>
+
+ <string name="category_sensors_title">Sensors</string>
+ <string name="gyro_subcat_title">Gyroscope</string>
+ <string name="use_gyro_calibration_title_head">Use calibration data</string>
+ <string name="use_gyro_calibration_summary_head">Use the gyroscope calibration values. Do a calibration after checking this!</string>
+ <string name="calibrate_gyro_title_head">Calibrate</string>
+ <string name="calibrate_gyro_summary_head">Put your phone on a flat surface, and press this to calibrate</string>
+ <string name="touchkey_subcat_title">Touch key</string>
+ <string name="touchkey_light_title_head">Enable keys backlight</string>
+ <string name="touchkey_light_summary_head">Light up touch keys when screen is on</string>
+
+ <string name="category_radio_title">Radio</string>
+ <string name="hspa_title_head">HSPA</string>
+ <string name="hspa_summary_head">Enable HSDPA/HSUPA</string>
+</resources>
diff --git a/DeviceSettings/res/xml/mdnie_preferences.xml b/DeviceSettings/res/xml/mdnie_preferences.xml
new file mode 100644
index 0000000..f433418
--- /dev/null
+++ b/DeviceSettings/res/xml/mdnie_preferences.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+ android:title="@string/app_name">
+
+ <PreferenceCategory
+ android:title="@string/screen_colors_title">
+
+ <!-- mDNIe Scenario modes -->
+ <com.cyanogenmod.settings.device.mDNIeScenario
+ android:key="mdnie_scenario"
+ android:title="@string/mdnie_scenario_title_head"
+ android:summary="@string/mdnie_scenario_summary_head"
+ android:entries="@array/mdnie_scenario_entries"
+ android:entryValues="@array/mdnie_scenario_entries_values"
+ android:defaultValue="0" />
+
+ <!-- mDNIe Mode -->
+ <com.cyanogenmod.settings.device.mDNIeMode
+ android:key="mdnie_mode"
+ android:title="@string/mdnie_mode_title_head"
+ android:summary="@string/mdnie_mode_summary_head"
+ android:entries="@array/mdnie_mode_entries"
+ android:entryValues="@array/mdnie_mode_entries_values"
+ android:defaultValue="1" />
+
+ <!-- mDNIe Negative mode -->
+ <com.cyanogenmod.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"
+ android:defaultValue="0" />
+
+ <!-- mDNIe Outdoor mode -->
+ <com.cyanogenmod.settings.device.mDNIeOutdoor
+ android:key="mdnie_outdoor"
+ android:title="@string/mdnie_outdoor_title_head"
+ android:summary="@string/mdnie_outdoor_summary_head"
+ android:entries="@array/mdnie_outdoor_entries"
+ android:entryValues="@array/mdnie_outdoor_entries_values"
+ android:defaultValue="0" />
+
+ <!-- Panel gamma -->
+ <com.cyanogenmod.settings.device.PanelGamma
+ android:key="panel_gamma"
+ android:title="@string/panel_gamma_title_head"
+ android:summary="@string/panel_gamma_summary_head"
+ android:entries="@array/panel_gamma_entries"
+ android:entryValues="@array/panel_gamma_entries_values"
+ android:defaultValue="0" />
+
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:title="@string/touchscreen_subcat_title">
+ <com.cyanogenmod.settings.device.TouchscreenSensitivity
+ android:key="touchscreen_sensitivity"
+ android:title="@string/touchscreen_sensitivity_title_head"
+ android:summary="@string/touchscreen_sensitivity_summary_head"
+ android:entries="@array/touchscreen_sensitivity_entries"
+ android:entryValues="@array/touchscreen_sensitivity_entries_values"
+ android:defaultValue="50" />
+ </PreferenceCategory>
+</PreferenceScreen>
diff --git a/DeviceSettings/res/xml/radio_preferences.xml b/DeviceSettings/res/xml/radio_preferences.xml
new file mode 100644
index 0000000..b78ecde
--- /dev/null
+++ b/DeviceSettings/res/xml/radio_preferences.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Hspa modes -->
+ <com.cyanogenmod.settings.device.Hspa
+ android:key="hspa"
+ android:title="@string/hspa_title_head"
+ android:summary="@string/hspa_summary_head"
+ android:entries="@array/hspa_entries"
+ android:entryValues="@array/hspa_entries_values"
+ android:defaultValue="0" />
+
+</PreferenceScreen>
diff --git a/DeviceSettings/res/xml/sensors_preferences.xml b/DeviceSettings/res/xml/sensors_preferences.xml
new file mode 100644
index 0000000..9029a62
--- /dev/null
+++ b/DeviceSettings/res/xml/sensors_preferences.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <PreferenceCategory
+ android:title="@string/gyro_subcat_title">
+ <!-- Use sensor calibration -->
+ <CheckBoxPreference
+ android:key="use_gyro_calibration"
+ android:title="@string/use_gyro_calibration_title_head"
+ android:summary="@string/use_gyro_calibration_summary_head"
+ />
+
+ <!-- Do gyro calibration -->
+ <Preference
+ android:key="calibrate_gyro"
+ android:title="@string/calibrate_gyro_title_head"
+ android:summary="@string/calibrate_gyro_summary_head"
+ />
+ </PreferenceCategory>
+
+ <PreferenceCategory
+ android:title="@string/touchkey_subcat_title">
+ <!-- Touchkey backlight -->
+ <CheckBoxPreference
+ android:key="touchkey_light"
+ android:title="@string/touchkey_light_title_head"
+ android:summary="@string/touchkey_light_summary_head"
+ />
+ </PreferenceCategory>
+</PreferenceScreen>
+
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java
new file mode 100644
index 0000000..4bd1810
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentTransaction;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.app.FragmentActivity;
+import android.support.v13.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+
+import com.cyanogenmod.settings.device.R;
+
+import java.util.ArrayList;
+
+public class DeviceSettings extends FragmentActivity {
+
+ public static final String SHARED_PREFERENCES_BASENAME = "com.cyanogenmod.settings.device";
+ public static final String ACTION_UPDATE_PREFERENCES = "com.cyanogenmod.settings.device.UPDATE";
+ public static final String KEY_MDNIE_SCENARIO = "mdnie_scenario";
+ public static final String KEY_MDNIE_MODE = "mdnie_mode";
+ public static final String KEY_MDNIE_NEGATIVE = "mdnie_negative";
+ public static final String KEY_MDNIE_OUTDOOR = "mdnie_outdoor";
+ public static final String KEY_PANEL_GAMMA = "panel_gamma";
+ public static final String KEY_HSPA = "hspa";
+ public static final String KEY_USE_GYRO_CALIBRATION = "use_gyro_calibration";
+ public static final String KEY_CALIBRATE_GYRO = "calibrate_gyro";
+ public static final String KEY_TOUCHSCREEN_SENSITIVITY = "touchscreen_sensitivity";
+ public static final String KEY_TOUCHKEY_LIGHT = "touchkey_light";
+
+ ViewPager mViewPager;
+ TabsAdapter mTabsAdapter;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ mViewPager = new ViewPager(this);
+ mViewPager.setId(R.id.viewPager);
+ setContentView(mViewPager);
+
+ final ActionBar bar = getActionBar();
+ bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+ bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
+ bar.setTitle(R.string.app_name);
+
+ mTabsAdapter = new TabsAdapter(this, mViewPager);
+ mTabsAdapter.addTab(bar.newTab().setText(R.string.category_radio_title),
+ RadioFragmentActivity.class, null);
+ mTabsAdapter.addTab(bar.newTab().setText(R.string.category_mdnie_title),
+ mDNIeFragmentActivity.class, null);
+ mTabsAdapter.addTab(bar.newTab().setText(R.string.category_sensors_title),
+ SensorsFragmentActivity.class, null);
+
+ if (savedInstanceState != null) {
+ bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
+ }
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt("tab", getActionBar().getSelectedNavigationIndex());
+ }
+
+ public static class TabsAdapter extends FragmentPagerAdapter
+ implements ActionBar.TabListener, ViewPager.OnPageChangeListener {
+ private final Context mContext;
+ private final ActionBar mActionBar;
+ private final ViewPager mViewPager;
+ private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
+
+ static final class TabInfo {
+ private final Class<?> clss;
+ private final Bundle args;
+
+ TabInfo(Class<?> _class, Bundle _args) {
+ clss = _class;
+ args = _args;
+ }
+ }
+
+ public TabsAdapter(Activity activity, ViewPager pager) {
+ super(activity.getFragmentManager());
+ mContext = activity;
+ mActionBar = activity.getActionBar();
+ mViewPager = pager;
+ mViewPager.setAdapter(this);
+ mViewPager.setOnPageChangeListener(this);
+ }
+
+ public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
+ TabInfo info = new TabInfo(clss, args);
+ tab.setTag(info);
+ tab.setTabListener(this);
+ mTabs.add(info);
+ mActionBar.addTab(tab);
+ notifyDataSetChanged();
+ }
+
+ @Override
+ public int getCount() {
+ return mTabs.size();
+ }
+
+ @Override
+ public Fragment getItem(int position) {
+ TabInfo info = mTabs.get(position);
+ return Fragment.instantiate(mContext, info.clss.getName(), info.args);
+ }
+
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+ }
+
+ public void onPageSelected(int position) {
+ mActionBar.setSelectedNavigationItem(position);
+ }
+
+ public void onPageScrollStateChanged(int state) {
+ }
+
+ public void onTabSelected(Tab tab, FragmentTransaction ft) {
+ Object tag = tab.getTag();
+ for (int i=0; i<mTabs.size(); i++) {
+ if (mTabs.get(i) == tag) {
+ mViewPager.setCurrentItem(i);
+ }
+ }
+ }
+
+ public void onTabUnselected(Tab tab, FragmentTransaction ft) {
+ }
+
+ public void onTabReselected(Tab tab, FragmentTransaction ft) {
+ }
+ }
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/Hspa.java b/DeviceSettings/src/com/cyanogenmod/settings/device/Hspa.java
new file mode 100644
index 0000000..f19eff7
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Hspa.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.util.AttributeSet;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class Hspa extends ListPreference implements OnPreferenceChangeListener {
+
+ private static final String FILE = "/system/app/SamsungServiceMode.apk";
+ private Context mCtx;
+
+ public Hspa(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ mCtx = context;
+ }
+
+ public static boolean isSupported() {
+ return Utils.fileExists(FILE);
+ }
+
+ /**
+ * Restore hspa setting from SharedPreferences. (Write to kernel.)
+ * @param context The context to read the SharedPreferences from
+ */
+ public static void restore(Context context) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ sendIntent(context, sharedPrefs.getString(DeviceSettings.KEY_HSPA, "23"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ sendIntent(mCtx, (String) newValue);
+ return true;
+ }
+
+ private static void sendIntent(Context context, String value) {
+ Intent i = new Intent("com.cyanogenmod.SamsungServiceMode.EXECUTE");
+ i.putExtra("sub_type", 20); // HSPA Setting
+ i.putExtra("data", value);
+ context.sendBroadcast(i);
+ }
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/PanelGamma.java b/DeviceSettings/src/com/cyanogenmod/settings/device/PanelGamma.java
new file mode 100644
index 0000000..81544a6
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/PanelGamma.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.util.Log;
+import android.content.SharedPreferences;
+import android.util.AttributeSet;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class PanelGamma extends ListPreference implements OnPreferenceChangeListener {
+
+ public PanelGamma(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/lcd/panel/gamma_mode";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(FILE);
+ }
+
+ /**
+ * Restore panel gamma setting from SharedPreferences. (Write to kernel.)
+ * @param context The context to read the SharedPreferences from
+ */
+ public static void restore(Context context) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_PANEL_GAMMA, "0"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Log.d("SGS2","Writing " + ((String)newValue) + " to " + FILE);
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java
new file mode 100644
index 0000000..d909a57
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+
+import com.cyanogenmod.settings.device.R;
+
+public class RadioFragmentActivity extends PreferenceFragment {
+
+ private static final String PREF_ENABLED = "1";
+ private static final String TAG = "GalaxyNoteParts_General";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.radio_preferences);
+
+ PreferenceScreen prefSet = getPreferenceScreen();
+
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+
+ String boxValue;
+ String key = preference.getKey();
+
+ Log.w(TAG, "key: " + key);
+
+ return true;
+ }
+
+ public static boolean isSupported(String FILE) {
+ return Utils.fileExists(FILE);
+ }
+
+ public static void restore(Context context) {
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ }
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/SensorsFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/SensorsFragmentActivity.java
new file mode 100644
index 0000000..015dd7b
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/SensorsFragmentActivity.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+
+import com.cyanogenmod.settings.device.R;
+
+public class SensorsFragmentActivity extends PreferenceFragment {
+
+ private static final String PREF_ENABLED = "1";
+ private static final String TAG = "GalaxyNoteParts_General";
+
+ private static final String FILE_USE_GYRO_CALIB = "/sys/class/sec/gsensorcal/calibration";
+ private static final String FILE_TOUCHKEY_LIGHT = "/data/.disable_touchlight";
+ private static final String FILE_TOUCHKEY_TOGGLE = "/sys/class/sec/sec_touchkey/brightness";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.sensors_preferences);
+
+ PreferenceScreen prefSet = getPreferenceScreen();
+
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+
+ String boxValue;
+ String key = preference.getKey();
+
+ Log.w(TAG, "key: " + key);
+
+ if (key.compareTo(DeviceSettings.KEY_USE_GYRO_CALIBRATION) == 0) {
+ boxValue = (((CheckBoxPreference)preference).isChecked() ? "1" : "0");
+ Utils.writeValue(FILE_USE_GYRO_CALIB, boxValue);
+ } else if (key.compareTo(DeviceSettings.KEY_CALIBRATE_GYRO) == 0) {
+ // when calibration data utilization is disablen and enabled back,
+ // calibration is done at the same time by driver
+ Utils.writeValue(FILE_USE_GYRO_CALIB, "0");
+ Utils.writeValue(FILE_USE_GYRO_CALIB, "1");
+ Utils.showDialog((Context)getActivity(), "Calibration done", "The gyroscope has been successfully calibrated!");
+ } else if (key.compareTo(DeviceSettings.KEY_TOUCHKEY_LIGHT) == 0) {
+ Utils.writeValue(FILE_TOUCHKEY_LIGHT, ((CheckBoxPreference)preference).isChecked() ? "1" : "0");
+ Utils.writeValue(FILE_TOUCHKEY_TOGGLE, ((CheckBoxPreference)preference).isChecked() ? "1" : "2");
+ }
+
+ return true;
+ }
+
+ public static boolean isSupported(String FILE) {
+ return Utils.fileExists(FILE);
+ }
+
+ public static void restore(Context context) {
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ String gyroCalib = sharedPrefs.getString(DeviceSettings.KEY_USE_GYRO_CALIBRATION, "1");
+
+ // When use gyro calibration value is set to 1, calibration is done at the same time, which
+ // means it is reset at each boot, providing wrong calibration most of the time at each reboot.
+ // So we only set it to "0" if user wants it, as it defaults to 1 at boot
+ if (gyroCalib.compareTo("1") != 0)
+ Utils.writeValue(FILE_USE_GYRO_CALIB, gyroCalib);
+
+ Utils.writeValue(FILE_TOUCHKEY_LIGHT, sharedPrefs.getString(DeviceSettings.KEY_TOUCHKEY_LIGHT, "1"));
+ }
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java b/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java
new file mode 100644
index 0000000..6951f26
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class Startup extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(final Context context, final Intent bootintent) {
+ mDNIeScenario.restore(context);
+ mDNIeMode.restore(context);
+ mDNIeNegative.restore(context);
+ mDNIeOutdoor.restore(context);
+ RadioFragmentActivity.restore(context);
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/TouchscreenSensitivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/TouchscreenSensitivity.java
new file mode 100644
index 0000000..e066556
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/TouchscreenSensitivity.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import java.io.IOException;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.content.SharedPreferences;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class TouchscreenSensitivity extends ListPreference implements OnPreferenceChangeListener {
+
+ public TouchscreenSensitivity(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/sec/sec_touchscreen/tsp_threshold";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(FILE);
+ }
+
+ /**
+ * Restore touchscreen sensitivity setting from SharedPreferences. (Write to kernel.)
+ * @param context The context to read the SharedPreferences from
+ */
+ public static void restore(Context context) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_TOUCHSCREEN_SENSITIVITY, "50"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java b/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java
new file mode 100644
index 0000000..9d4176c
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.Context;
+
+public class Utils {
+
+ /**
+ * Write a string value to the specified file.
+ * @param filename The filename
+ * @param value The value
+ */
+ public static void writeValue(String filename, String value) {
+ try {
+ FileOutputStream fos = new FileOutputStream(new File(filename));
+ fos.write(value.getBytes());
+ fos.flush();
+ fos.getFD().sync();
+ fos.close();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Write the "color value" to the specified file. The value is scaled from
+ * an integer to an unsigned integer by multiplying by 2.
+ * @param filename The filename
+ * @param value The value of max value Integer.MAX
+ */
+ public static void writeColor(String filename, int value) {
+ writeValue(filename, String.valueOf((long) value * 2));
+ }
+
+ /**
+ * Check if the specified file exists.
+ * @param filename The filename
+ * @return Whether the file exists or not
+ */
+ public static boolean fileExists(String filename) {
+ return new File(filename).exists();
+ }
+
+
+ public static void showDialog(Context ctx, String title, String message) {
+ final AlertDialog alertDialog = new AlertDialog.Builder(ctx).create();
+ alertDialog.setTitle(title);
+ alertDialog.setMessage(message);
+ alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ alertDialog.dismiss();
+ }
+ });
+ alertDialog.show();
+ }
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeFragmentActivity.java
new file mode 100755
index 0000000..f14f666
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeFragmentActivity.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+import com.cyanogenmod.settings.device.R;
+
+public class mDNIeFragmentActivity extends PreferenceFragment {
+
+ private mDNIeScenario mmDNIeScenario;
+ private mDNIeMode mmDNIeMode;
+ private mDNIeNegative mmDNIeNegative;
+ private mDNIeOutdoor mmDNIeOutdoor;
+ private PanelGamma mPanelGamma;
+ private TouchscreenSensitivity mTouchscreenSensitivity;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.mdnie_preferences);
+
+ mmDNIeScenario = (mDNIeScenario) findPreference(DeviceSettings.KEY_MDNIE_SCENARIO);
+ mmDNIeScenario.setEnabled(mDNIeScenario.isSupported());
+
+ mmDNIeMode = (mDNIeMode) findPreference(DeviceSettings.KEY_MDNIE_MODE);
+ mmDNIeMode.setEnabled(mDNIeMode.isSupported());
+
+ mmDNIeNegative = (mDNIeNegative) findPreference(DeviceSettings.KEY_MDNIE_NEGATIVE);
+ mmDNIeNegative.setEnabled(mDNIeNegative.isSupported());
+
+ mmDNIeOutdoor = (mDNIeOutdoor) findPreference(DeviceSettings.KEY_MDNIE_OUTDOOR);
+ mmDNIeOutdoor.setEnabled(mDNIeOutdoor.isSupported());
+
+ mPanelGamma = (PanelGamma) findPreference(DeviceSettings.KEY_PANEL_GAMMA);
+ mPanelGamma.setEnabled(mPanelGamma.isSupported());
+
+ mTouchscreenSensitivity = (TouchscreenSensitivity) findPreference(DeviceSettings.KEY_TOUCHSCREEN_SENSITIVITY);
+ mTouchscreenSensitivity.setEnabled(mTouchscreenSensitivity.isSupported());
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java
new file mode 100644
index 0000000..c7fc94b
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+
+import android.content.SharedPreferences;
+import android.util.AttributeSet;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class mDNIeMode extends ListPreference implements OnPreferenceChangeListener {
+
+ public mDNIeMode(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/mdnie/mdnie/mode";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(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) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_MDNIE_MODE, "1"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java
new file mode 100644
index 0000000..c2ccc7b
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import java.io.IOException;
+import android.content.Context;
+import android.util.AttributeSet;
+import android.content.SharedPreferences;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class mDNIeNegative extends ListPreference implements OnPreferenceChangeListener {
+
+ public mDNIeNegative(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/mdnie/mdnie/negative";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(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) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_MDNIE_NEGATIVE, "0"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeOutdoor.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeOutdoor.java
new file mode 100644
index 0000000..7fcdacd
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeOutdoor.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.content.SharedPreferences;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class mDNIeOutdoor extends ListPreference implements OnPreferenceChangeListener {
+
+ public mDNIeOutdoor(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/mdnie/mdnie/outdoor";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(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) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_MDNIE_OUTDOOR, "0"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java
new file mode 100644
index 0000000..0557ba3
--- /dev/null
+++ b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device;
+
+import android.content.Context;
+
+import android.content.SharedPreferences;
+import android.util.AttributeSet;
+import android.preference.Preference;
+import android.preference.ListPreference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceManager;
+
+public class mDNIeScenario extends ListPreference implements OnPreferenceChangeListener {
+
+ public mDNIeScenario(Context context, AttributeSet attrs) {
+ super(context,attrs);
+ this.setOnPreferenceChangeListener(this);
+ }
+
+ private static final String FILE = "/sys/class/mdnie/mdnie/scenario";
+
+ public static boolean isSupported() {
+ return Utils.fileExists(FILE);
+ }
+
+ /**
+ * Restore mdnie "camera" setting from SharedPreferences. (Write to kernel.)
+ * @param context The context to read the SharedPreferences from
+ */
+ public static void restore(Context context) {
+ if (!isSupported()) {
+ return;
+ }
+
+ SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_MDNIE_SCENARIO, "4"));
+ }
+
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ Utils.writeValue(FILE, (String) newValue);
+ return true;
+ }
+
+}