From 7926cd6ab83e1d8d02c13b4d65edd73f9f5866cb Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Sun, 9 Jun 2013 11:52:24 +0200 Subject: smdk4412-common: move advanced settings from i9300 Change-Id: I17832eedbb503b7483b2e0fd99b942317a39cc78 --- DeviceSettings/Android.mk | 15 ++ DeviceSettings/AndroidManifest.xml | 31 +++ .../res/drawable/ic_launcher_cmdevicesettings.png | Bin 0 -> 8207 bytes .../layout/preference_dialog_vibrator_tuning.xml | 59 ++++++ DeviceSettings/res/layout/top.xml | 5 + DeviceSettings/res/values-de/arrays.xml | 48 +++++ DeviceSettings/res/values-de/strings.xml | 44 +++++ DeviceSettings/res/values-es/arrays.xml | 41 ++++ DeviceSettings/res/values-es/strings.xml | 33 ++++ DeviceSettings/res/values-fr/arrays.xml | 56 ++++++ DeviceSettings/res/values-fr/strings.xml | 47 +++++ DeviceSettings/res/values-hu/arrays.xml | 48 +++++ DeviceSettings/res/values-hu/strings.xml | 34 ++++ DeviceSettings/res/values-pl/arrays.xml | 48 +++++ DeviceSettings/res/values-pl/strings.xml | 34 ++++ DeviceSettings/res/values-pt-rBR/arrays.xml | 48 +++++ DeviceSettings/res/values-pt-rBR/strings.xml | 33 ++++ DeviceSettings/res/values-ru/arrays.xml | 46 +++++ DeviceSettings/res/values-ru/strings.xml | 42 ++++ DeviceSettings/res/values-zh-rCN/arrays.xml | 64 ++++++ DeviceSettings/res/values-zh-rCN/strings.xml | 48 +++++ DeviceSettings/res/values/arrays.xml | 93 +++++++++ DeviceSettings/res/values/config.xml | 29 +++ DeviceSettings/res/values/strings.xml | 56 ++++++ DeviceSettings/res/xml/dock_preferences.xml | 26 +++ DeviceSettings/res/xml/haptic_preferences.xml | 10 + DeviceSettings/res/xml/radio_preferences.xml | 12 ++ DeviceSettings/res/xml/screen_preferences.xml | 74 +++++++ .../src/com/cyanogenmod/settings/device/CABC.java | 58 ++++++ .../settings/device/DeviceSettings.java | 169 ++++++++++++++++ .../settings/device/DockFragmentActivity.java | 72 +++++++ .../settings/device/HapticFragmentActivity.java | 72 +++++++ .../src/com/cyanogenmod/settings/device/Hspa.java | 67 +++++++ .../com/cyanogenmod/settings/device/LedFade.java | 59 ++++++ .../settings/device/RadioFragmentActivity.java | 66 +++++++ .../settings/device/ScreenFragmentActivity.java | 106 ++++++++++ .../com/cyanogenmod/settings/device/Startup.java | 40 ++++ .../settings/device/TouchkeyTimeout.java | 59 ++++++ .../src/com/cyanogenmod/settings/device/Utils.java | 163 +++++++++++++++ .../settings/device/VibratorTuningPreference.java | 219 +++++++++++++++++++++ .../com/cyanogenmod/settings/device/mDNIeMode.java | 59 ++++++ .../cyanogenmod/settings/device/mDNIeNegative.java | 59 ++++++ .../cyanogenmod/settings/device/mDNIeScenario.java | 59 ++++++ 43 files changed, 2451 insertions(+) create mode 100644 DeviceSettings/Android.mk create mode 100644 DeviceSettings/AndroidManifest.xml create mode 100755 DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png create mode 100644 DeviceSettings/res/layout/preference_dialog_vibrator_tuning.xml create mode 100755 DeviceSettings/res/layout/top.xml create mode 100644 DeviceSettings/res/values-de/arrays.xml create mode 100644 DeviceSettings/res/values-de/strings.xml create mode 100644 DeviceSettings/res/values-es/arrays.xml create mode 100644 DeviceSettings/res/values-es/strings.xml create mode 100644 DeviceSettings/res/values-fr/arrays.xml create mode 100644 DeviceSettings/res/values-fr/strings.xml create mode 100644 DeviceSettings/res/values-hu/arrays.xml create mode 100644 DeviceSettings/res/values-hu/strings.xml create mode 100644 DeviceSettings/res/values-pl/arrays.xml create mode 100644 DeviceSettings/res/values-pl/strings.xml create mode 100644 DeviceSettings/res/values-pt-rBR/arrays.xml create mode 100644 DeviceSettings/res/values-pt-rBR/strings.xml create mode 100644 DeviceSettings/res/values-ru/arrays.xml create mode 100644 DeviceSettings/res/values-ru/strings.xml create mode 100644 DeviceSettings/res/values-zh-rCN/arrays.xml create mode 100644 DeviceSettings/res/values-zh-rCN/strings.xml create mode 100644 DeviceSettings/res/values/arrays.xml create mode 100644 DeviceSettings/res/values/config.xml create mode 100644 DeviceSettings/res/values/strings.xml create mode 100644 DeviceSettings/res/xml/dock_preferences.xml create mode 100644 DeviceSettings/res/xml/haptic_preferences.xml create mode 100644 DeviceSettings/res/xml/radio_preferences.xml create mode 100644 DeviceSettings/res/xml/screen_preferences.xml create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/DockFragmentActivity.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/HapticFragmentActivity.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/Hspa.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/LedFade.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/TouchkeyTimeout.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/VibratorTuningPreference.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeMode.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeNegative.java create mode 100644 DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java diff --git a/DeviceSettings/Android.mk b/DeviceSettings/Android.mk new file mode 100644 index 0000000..6605185 --- /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 := DeviceSettings +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..d373ded --- /dev/null +++ b/DeviceSettings/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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 Binary files /dev/null and b/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png differ diff --git a/DeviceSettings/res/layout/preference_dialog_vibrator_tuning.xml b/DeviceSettings/res/layout/preference_dialog_vibrator_tuning.xml new file mode 100644 index 0000000..1cf116b --- /dev/null +++ b/DeviceSettings/res/layout/preference_dialog_vibrator_tuning.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + 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 @@ + + diff --git a/DeviceSettings/res/values-de/arrays.xml b/DeviceSettings/res/values-de/arrays.xml new file mode 100644 index 0000000..04b2538 --- /dev/null +++ b/DeviceSettings/res/values-de/arrays.xml @@ -0,0 +1,48 @@ + + + + CyanogenMod (Standard) + UI + Video + Video warm + Video kalt + Kamera + Navigation + Gallerie + VT + + + + Dynamisch (Standard) + Standard + Natürlich + Film + + + + Normal + Invertiert + + + + Blinken + Verblassen + + + + Niemals + 1 Sekunde + 2 Sekunden + 3 Sekunden (Standard) + 4 Sekunden + 5 Sekunden + 6 Sekunden + + + + Nur UMTS + Nur HSDPA + HSDPA + HSUPA + + + diff --git a/DeviceSettings/res/values-de/strings.xml b/DeviceSettings/res/values-de/strings.xml new file mode 100644 index 0000000..65ce91e --- /dev/null +++ b/DeviceSettings/res/values-de/strings.xml @@ -0,0 +1,44 @@ + + + Erweiterte Einstellungen + + Zurücksetzen + + Display + Farben + Szenario + Wähle das mDNIe Szenario + Modus + Wähle den mDNIe Modus + Negativ Modus + Invertiere Farben + + Benachrichtigungslicht + Modus + Wähle zwischen sanftem Verblassen und Blinken + + Touchkeys + Beleuchtung + Aktiviere Beleuchtung + Deaktiviere Beleuchtung + Zeitabschaltung der Beleuchtung + Setze Zeit für automatische Abschaltung + + + Haptik + + + Vibrator + Vibrationsstärke + Stärke des Vibrationseffektes einstellen + Vorsicht: Höhere Werte als %1$d werden nicht empfohlen + + Mobilfunk + HSPA + Aktiviere HSDPA/HSUPA + + Dock + Audio + USB-Dock Audio + Passive Audio-Ausgabe des USB-Docks verwenden + diff --git a/DeviceSettings/res/values-es/arrays.xml b/DeviceSettings/res/values-es/arrays.xml new file mode 100644 index 0000000..c7d02c5 --- /dev/null +++ b/DeviceSettings/res/values-es/arrays.xml @@ -0,0 +1,41 @@ + + + Sólo UMTS + Sólo HSDPA + HSDPA + HSUPA + + + CyanogenMod (por defecto) + UI + Vídeo + Vídeo cálido + Vídeo frío + Camara + Navegación + Galería + VT + + + Estándar (por defecto) + Dinámico + Natural + Película + + + Normal + Invertido + + + Parpadeo + Fundido + + + Nunca + 1 segundo + 2 segundos + 3 segundos (por defecto) + 4 segundos + 5 segundos + 6 segundos + + diff --git a/DeviceSettings/res/values-es/strings.xml b/DeviceSettings/res/values-es/strings.xml new file mode 100644 index 0000000..f615d4b --- /dev/null +++ b/DeviceSettings/res/values-es/strings.xml @@ -0,0 +1,33 @@ + + + Ajustes avanzados + Base + Sonido + Usar sonido USB + Utilizar la salida de audio de la base + Háptica + Vibración + Intensidad de vibración + Establecer la intensidad de vibración + No son recomendables valores mayores de %1$d + Radio + HSPA + Habilitar HSDPA/HSUPA + Pantalla + Colores + Escenario + Establecer escenario mDNIe + Modo + Establecer modo mDNIe + Modo Negativo + Habilitar/deshabilitar colores invertidos + Notificación LED + Fundido LED + Habilitar fundido suave en vez de parpadeo intenso + Teclas táctiles + Retroiluminación + Habilitar retroiluminación + Deshabilitar retroiluminación + Tiempo de espera de retroiluminación + Tiempo tras pulsar una tecla antes de apagar la retroiluminación + diff --git a/DeviceSettings/res/values-fr/arrays.xml b/DeviceSettings/res/values-fr/arrays.xml new file mode 100644 index 0000000..11b706d --- /dev/null +++ b/DeviceSettings/res/values-fr/arrays.xml @@ -0,0 +1,56 @@ + + + + + UMTS seulement + HSDPA seulement + HSDPA + HSUPA + + + CyanogenMod (Défaut) + UI + Vidéo + Vidéo chaude + Vidéo froide + Caméra + Navigation + Galerie + VT + + + Dynamique (Défaut) + Standard + Naturel + Vidéo + + + Normal + Inversé + + + Clignotante + Progressive + + + Désactivé + 1 seconde + 2 secondes + 3 secondes (Défaut) + 4 secondes + 5 secondes + 6 secondes + + diff --git a/DeviceSettings/res/values-fr/strings.xml b/DeviceSettings/res/values-fr/strings.xml new file mode 100644 index 0000000..5556d24 --- /dev/null +++ b/DeviceSettings/res/values-fr/strings.xml @@ -0,0 +1,47 @@ + + + + Paramètres avancés + Station d\'accueil + Audio + Sortie audio + Utiliser la sortie audio de la station d\'accueil + Haptique + Vibreur + Intensité du vibreur + Définir l\'intensité du vibreur + Les valeurs supérieurs à %1$d ne sont pas recommandées + Radio + HSPA + Activer HSDPA/HSUPA + Écran + Couleurs + Scénario + Définir le scénario mDNIe + Mode + Définir le mode mDNIe + Mode négatif + Activer/désactiver les couleurs inversées + LED de notification + LED progressive + Préférer l\'éclairage progressif au clignotement + Touches tactiles + Rétroéclairage + Activer le rétroéclairage des touches tactiles lorsque l\'écran est activé + Désactiver le rétroéclairage des touches tactiles lorsque l\'écran est activé + Délai avant extinction + Définir le délai avant l\'extinction des touches + diff --git a/DeviceSettings/res/values-hu/arrays.xml b/DeviceSettings/res/values-hu/arrays.xml new file mode 100644 index 0000000..82074a2 --- /dev/null +++ b/DeviceSettings/res/values-hu/arrays.xml @@ -0,0 +1,48 @@ + + + + UMTS + HSDPA + HSDPA + HSUPA + + + + CyanogenMod (Alapbeállítás) + Felhasználói felület + Videó + Videó (Meleg árnyalat) + Videó (Hideg árnyalat) + Kamera + Navigáció + Galéria + VT + + + + Dinamikus (Alapbeállítás) + Hagyományos + Természetes + Film + + + + Normál + Fordított + + + + Villogás + Elhalványulás + + + + Soha + 1 másodperc + 2 másodperc + 3 másodperc (Alapbeállítás) + 4 másodperc + 5 másodperc + 6 másodperc + + + diff --git a/DeviceSettings/res/values-hu/strings.xml b/DeviceSettings/res/values-hu/strings.xml new file mode 100644 index 0000000..f5f1411 --- /dev/null +++ b/DeviceSettings/res/values-hu/strings.xml @@ -0,0 +1,34 @@ + + + Advanced settings + + Dokkoló + Dokkoló hangszórók + Dokkoló hangszóróinak használata + Használja a dokkoló passzív hangkimenetét + + GSM Rádió + HSPA + HSDPA/HSUPA engedélyezése + + Kijelző + Színek + Megjelenítés + mDNIe megjelenítési beállítások + Üzemmód + mDNIe üzemmódok + Negatív üzemmód + Fordított színek ki/be + + LED értesítés + LED halványítás + LED elhalványítása villogtatás helyett + + Érintőgombok + Háttérvilágítás + Háttérvilágítás engedélyezése + Háttérvilágítás tiltása + Háttérvilágítás időkorlátja + Háttérvilágítás késleltetése + + diff --git a/DeviceSettings/res/values-pl/arrays.xml b/DeviceSettings/res/values-pl/arrays.xml new file mode 100644 index 0000000..f9de456 --- /dev/null +++ b/DeviceSettings/res/values-pl/arrays.xml @@ -0,0 +1,48 @@ + + + + Tylko UMTS + Tylko HSDPA + HSDPA + HSUPA + + + + CyanogenMod (domyślnie) + UI + Wideo + Ciepły film + Zimny film + Kamera + Nawigacja + Galeria + VT + + + + Dynamicznie (domyślnie) + Standardowo + Naturalnie + Film + + + + Normalnie + Odwrócony + + + + Miganie + Zanikanie + + + + Nigdy + 1 sekunda + 2 sekundy + 3 sekundy (domyślnie) + 4 sekundy + 5 sekund + 6 sekund + + + diff --git a/DeviceSettings/res/values-pl/strings.xml b/DeviceSettings/res/values-pl/strings.xml new file mode 100644 index 0000000..20da92d --- /dev/null +++ b/DeviceSettings/res/values-pl/strings.xml @@ -0,0 +1,34 @@ + + + Advanced settings + + Stacja dokująca + Dźwięk w stacji dokującej + Użyj stacji dokującej + Użyj pasywnego wyjścia audio w stacji dokującej + + Radio + HSPA + Aktywuj HSDPA/HSUPA + + Ekran + Kolory + Technologia mDNIe + Ustaw scenariusz mDNIe + Tryb + Ustaw tryb mDNIe + Tryb negatywu + Włącz/wyłącz odwrócone kolory + + Lampka LED + Zanikanie lampki LED + Aktywuj delikatne zanikanie lampki LED zamiast migania. + + Przyciski dotykowe + Podświetlenie + Włącz podświetlenie + Wyłącz podświetlenie + Opóźnienie podświetlenia + Ustaw opóźnienie dla podświetlenia + + diff --git a/DeviceSettings/res/values-pt-rBR/arrays.xml b/DeviceSettings/res/values-pt-rBR/arrays.xml new file mode 100644 index 0000000..983e35a --- /dev/null +++ b/DeviceSettings/res/values-pt-rBR/arrays.xml @@ -0,0 +1,48 @@ + + + + + Somente UMTS + Somente HSDPA + HSDPA + HSUPA + + + + CyanogenMod (Padrão) + IU + Vídeo + Vídeo Quente + Vídeo Frio + Câmera + Navegação + Galeria + VT + + + + Padrão + Dinâmico + Natural + Filme + + + + Normal + Invertido + + + + Piscando + Desvanecimento + + + + Nunca + 1 segundo + 2 segundos + 3 segundos (Padrão) + 4 segundos + 5 segundos + 6 segundos + + diff --git a/DeviceSettings/res/values-pt-rBR/strings.xml b/DeviceSettings/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000..5813d7e --- /dev/null +++ b/DeviceSettings/res/values-pt-rBR/strings.xml @@ -0,0 +1,33 @@ + + + Configurações avançadas + Resposta tátil + Vibração + Intensidade da vibração + Ajusar a intensidade da resposta por vibração + Valores maiores que %1$d não são recomendados + Rádio + Ativar HSDPA/HSUPA + Tela + Cores + Cenário + Define o Cenário mDNIe + Modo + Define o Modo mDNIe + Modo Negativo + Ativar/Desativar cores invertidas + Notificação com LED + Desvanecimento LED + Ativar desvanecimento suave do LED em vez de piscar. + Teclas sensíveis ao toque + Luz de fundo + Ativar luz de fundo + Desativar luz de fundo + Tempo limite da luz de fundo + Define o tempo limite para a luz de fundo + HSPA + Dock + Áudio do dock + Usar áudio USB do dock + Usar a saída de áudio passiva no dock + \ No newline at end of file diff --git a/DeviceSettings/res/values-ru/arrays.xml b/DeviceSettings/res/values-ru/arrays.xml new file mode 100644 index 0000000..a83b7b4 --- /dev/null +++ b/DeviceSettings/res/values-ru/arrays.xml @@ -0,0 +1,46 @@ + + + + Только UMTS + Только HSDPA + HSDPA + HSUPA + + + + CyanogenMod (По умолч.) + Видео + Видео (тёпл.) + Видео (хол.) + Камера + Навигация + Галерея + VT + + + + Динамический (По умолч.) + Стандартный + Натуральный + Кино + + + + Нормально + Инверсия + + + + Мигание + Затухание + + + + Никогда + 1 секунда + 2 секунды + 3 секунды (По умолч.) + 4 секунды + 5 секунд + 6 секунд + + diff --git a/DeviceSettings/res/values-ru/strings.xml b/DeviceSettings/res/values-ru/strings.xml new file mode 100644 index 0000000..c7b287a --- /dev/null +++ b/DeviceSettings/res/values-ru/strings.xml @@ -0,0 +1,42 @@ + + + Advanced settings + + Экран + Цвета + Сценарий + Установка сценария mDNIe + Режим + Установка режима mDNIe + Негатив + Вкл./выкл. инверсии цветов + + Индикатор событий + Режим + Плавное затухание или резкое мигание + + Сенсорные клавиши + Подсветка + Подсветка включена + Подсветка выключена + Тайм-аут подсветки + Установка тайм-аута подсветки + + + Отклик + + + Вибрация + Интенсивность вибрации + Установка интенсивности вибрации + Не рекомендуется установка значения выше %1$d + + Модем + HSPA + Включить HSDPA/HSUPA + + Док-станция + Аудио + USB аудио док-станция + Использовать пассивный режим аудио док-станции + diff --git a/DeviceSettings/res/values-zh-rCN/arrays.xml b/DeviceSettings/res/values-zh-rCN/arrays.xml new file mode 100644 index 0000000..373d649 --- /dev/null +++ b/DeviceSettings/res/values-zh-rCN/arrays.xml @@ -0,0 +1,64 @@ + + + + + + 仅使用 UMTS + 仅使用 HSDPA + 使用 HSDPA + HSUPA + + + + CyanogenMod (默认) + 界面 + 影片 + 影片 (温) + 影片 (冷) + 相机 + 导航 + 图库 + VT + + + + 动态 (默认) + 标准 + 自然 + 电影 + + + + 正常 + 反色 + + + + 闪烁 + 淡出 + + + + 从不 + 1 秒 + 2 秒 + 3 秒 (默认) + 4 秒 + 5 秒 + 6 秒 + + + diff --git a/DeviceSettings/res/values-zh-rCN/strings.xml b/DeviceSettings/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000..f4158b9 --- /dev/null +++ b/DeviceSettings/res/values-zh-rCN/strings.xml @@ -0,0 +1,48 @@ + + + + 高级设置 + + 无线电 + HSPA + 启用 HSDPA/HSUPA + + 屏幕 + 颜色 + 场景 + 设置 mDNIe 场景 + 模式 + 设置 mDNIe 模式 + 负极模式 + 启用/禁用反色 + + LED 指示灯 + LED 淡出 + 启用后 LED 指示灯将会产生淡出效果而替代闪烁效果。 + + 触摸键 + 背光灯 + 启用背光灯 + 禁用背光灯 + 背光灯超时 + 设置背光灯超时时间 + + 基座 + 音频 + 使用基座的 USB 音频 + 使用基座上的被动音频输出 + diff --git a/DeviceSettings/res/values/arrays.xml b/DeviceSettings/res/values/arrays.xml new file mode 100644 index 0000000..8e99c95 --- /dev/null +++ b/DeviceSettings/res/values/arrays.xml @@ -0,0 +1,93 @@ + + + + CyanogenMod (Default) + UI + Video + Video Warm + Video Cold + Camera + Navigation + Gallery + VT + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + + + Dynamic (Default) + Standard + Natural + Movie + + + + 0 + 1 + 2 + 3 + + + + Normal + Inverted + + + + 0 + 1 + + + + Never + 1 second + 2 seconds + 3 seconds (Default) + 4 seconds + 5 seconds + 6 seconds + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + + + Blinking + Fading + + + + 0 + 1 + + + + UMTS Only + HSDPA Only + HSDPA + HSUPA + + + + 21 + 22 + 23 + + + diff --git a/DeviceSettings/res/values/config.xml b/DeviceSettings/res/values/config.xml new file mode 100644 index 0000000..5667f97 --- /dev/null +++ b/DeviceSettings/res/values/config.xml @@ -0,0 +1,29 @@ + + + + + + + + true + "/sys/vibrator/pwm_val" + 100 + 75 + 50 + 0 + + diff --git a/DeviceSettings/res/values/strings.xml b/DeviceSettings/res/values/strings.xml new file mode 100644 index 0000000..155e9c2 --- /dev/null +++ b/DeviceSettings/res/values/strings.xml @@ -0,0 +1,56 @@ + + + Advanced settings + + Reset to default + + + Screen + Colors + + + CABC + Enable content adaptive backlight control + + + Scenario + Set the mDNIe Scenario + Mode + Set the mDNIe Mode + Negative Mode + Enable/Disable inverted colors + + + Notification LED + LED Fading + Enable LED smooth fading instead of sharp blinking. + + + Touchkeys + Backlight + Enable backlight + Disable backlight + Backlight timeout + Set timeout for the backlight + + + Haptic + + + Vibrator + Vibration strength + Adjust the strength of the vibration feedback + Values higher than %1$d are not recommended + + + Radio + HSPA + Enable HSDPA/HSUPA + + + Dock + Audio + Use Dock USB Audio + Use the passive audio out on the dock + + diff --git a/DeviceSettings/res/xml/dock_preferences.xml b/DeviceSettings/res/xml/dock_preferences.xml new file mode 100644 index 0000000..62c962c --- /dev/null +++ b/DeviceSettings/res/xml/dock_preferences.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/DeviceSettings/res/xml/haptic_preferences.xml b/DeviceSettings/res/xml/haptic_preferences.xml new file mode 100644 index 0000000..31070ed --- /dev/null +++ b/DeviceSettings/res/xml/haptic_preferences.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/DeviceSettings/res/xml/radio_preferences.xml b/DeviceSettings/res/xml/radio_preferences.xml new file mode 100644 index 0000000..c173db7 --- /dev/null +++ b/DeviceSettings/res/xml/radio_preferences.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/DeviceSettings/res/xml/screen_preferences.xml b/DeviceSettings/res/xml/screen_preferences.xml new file mode 100644 index 0000000..57d1761 --- /dev/null +++ b/DeviceSettings/res/xml/screen_preferences.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java b/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java new file mode 100644 index 0000000..af247d8 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/CABC.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2013 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.preference.CheckBoxPreference; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceManager; +import android.util.AttributeSet; + +public class CABC extends CheckBoxPreference implements OnPreferenceChangeListener { + + public CABC(Context context, AttributeSet attrs) { + super(context, attrs); + this.setOnPreferenceChangeListener(this); + } + + private static final String FILE = "/sys/class/lcd/panel/power_reduce"; + + public static boolean isSupported() { + return Utils.fileExists(FILE); + } + + /** + * Restore cabc 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.getBoolean(DeviceSettings.KEY_CABC, true) ? "1" : "0"); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (Boolean)newValue ? "1" : "0"); + return true; + } + +} 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..486fe79 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -0,0 +1,169 @@ +/* + * 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 android.view.MenuItem; + +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_CABC = "cabc"; + 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_LED_FADE = "led_fade"; + public static final String KEY_TOUCHKEY_LIGHT = "touchkey_light"; + public static final String KEY_TOUCHKEY_TIMEOUT = "touchkey_timeout"; + public static final String KEY_HSPA = "hspa"; + public static final String KEY_VIBRATOR_INTENSITY = "vibrator_intensity"; + public static final String KEY_USE_DOCK_AUDIO = "dock_audio"; + + 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); + bar.setDisplayHomeAsUpEnabled(true); + + 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_screen_title), + ScreenFragmentActivity.class, null); + mTabsAdapter.addTab(bar.newTab().setText(R.string.category_haptic_title), + HapticFragmentActivity.class, null); + mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), + DockFragmentActivity.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 mTabs = new ArrayList(); + + 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= strengthToPercent(WARNING_THRESHOLD); + if (mProgressDrawable != null) { + mProgressDrawable.setColorFilter(shouldWarn ? mRedFilter : null); + } + if (mProgressThumb != null) { + mProgressThumb.setColorFilter(shouldWarn ? mRedFilter : null); + } + Utils.writeValue(FILE_PATH, String.valueOf(percentToStrength(progress))); + mValue.setText(String.format("%d%%", progress)); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + // Do nothing + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + Vibrator vib = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); + vib.vibrate(200); + } + + /** + * Convert vibrator strength to percent + */ + public static int strengthToPercent(int strength) { + double maxValue = MAX_VALUE; + double minValue = MIN_VALUE; + + double percent = (strength - minValue) * (100 / (maxValue - minValue)); + + if (percent > 100) + percent = 100; + else if (percent < 0) + percent = 0; + + return (int) percent; + } + + /** + * Convert percent to vibrator strength + */ + public static int percentToStrength(int percent) { + int strength = Math.round((((MAX_VALUE - MIN_VALUE) * percent) / 100) + MIN_VALUE); + + if (strength > MAX_VALUE) + strength = MAX_VALUE; + else if (strength < MIN_VALUE) + strength = MIN_VALUE; + + return strength; + } +} 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..7969637 --- /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, "0")); + } + + 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/mDNIeScenario.java b/DeviceSettings/src/com/cyanogenmod/settings/device/mDNIeScenario.java new file mode 100644 index 0000000..a9c935a --- /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, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} -- cgit v1.1