diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-25 17:27:47 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-10-25 17:51:46 +0100 |
commit | de1305cf7aa11fda1f8cb395eeb11bdbefdbb5aa (patch) | |
tree | 0e449f53131cb70147f534c5336e112379b220e1 /AdvancedDisplay | |
parent | a364082a351800e8b7c1dc2133016b4c7bf6c72a (diff) | |
download | device_samsung_smdk4412-common-de1305cf7aa11fda1f8cb395eeb11bdbefdbb5aa.tar.gz device_samsung_smdk4412-common-de1305cf7aa11fda1f8cb395eeb11bdbefdbb5aa.tar.bz2 device_samsung_smdk4412-common-de1305cf7aa11fda1f8cb395eeb11bdbefdbb5aa.zip |
smdk4412: add AdvancedDisplay
This partially reverts commit 006c95d4f0c75b9bdf3827856dc694d973464520,
we want to reuse some of it
Change-Id: I84dd929e4cd895d4c4d0d6a81d476eaa1bcc4a0b
Diffstat (limited to 'AdvancedDisplay')
33 files changed, 1492 insertions, 0 deletions
diff --git a/AdvancedDisplay/Android.mk b/AdvancedDisplay/Android.mk new file mode 100644 index 0000000..f848efe --- /dev/null +++ b/AdvancedDisplay/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 := AdvancedDisplay +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/AdvancedDisplay/AndroidManifest.xml b/AdvancedDisplay/AndroidManifest.xml new file mode 100644 index 0000000..bd470fa --- /dev/null +++ b/AdvancedDisplay/AndroidManifest.xml @@ -0,0 +1,33 @@ +<?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.DisplaySettings" + android:launchMode="singleTop" + android:icon="@drawable/ic_launcher_cmdevicesettings" + android:hardwareAccelerated="true" + android:configChanges="orientation|keyboardHidden|screenSize" + android:label="@string/app_name" + android:excludeFromRecents="true" > + <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=".ScreenFragmentActivity" /> + + </application> +</manifest> diff --git a/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png b/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png Binary files differnew file mode 100755 index 0000000..9bfdd78 --- /dev/null +++ b/AdvancedDisplay/res/drawable/ic_launcher_cmdevicesettings.png diff --git a/AdvancedDisplay/res/layout/top.xml b/AdvancedDisplay/res/layout/top.xml new file mode 100755 index 0000000..744b568 --- /dev/null +++ b/AdvancedDisplay/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/AdvancedDisplay/res/values-de/arrays.xml b/AdvancedDisplay/res/values-de/arrays.xml new file mode 100644 index 0000000..d3faa6a --- /dev/null +++ b/AdvancedDisplay/res/values-de/arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (Standard)</item> + <item>UI</item> + <item>Video</item> + <item>Video warm</item> + <item>Video kalt</item> + <item>Kamera</item> + <item>Navigation</item> + <item>Gallerie</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Dynamisch (Standard)</item> + <item>Standard</item> + <item>Natürlich</item> + <item>Film</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Normal</item> + <item>Invertiert</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-de/strings.xml b/AdvancedDisplay/res/values-de/strings.xml new file mode 100644 index 0000000..419f05c --- /dev/null +++ b/AdvancedDisplay/res/values-de/strings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="defaults_button">Zurücksetzen</string> + + <string name="category_screen_title">Display</string> + <string name="screen_colors_title">Farben</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">Invertiere Farben</string> + +</resources> diff --git a/AdvancedDisplay/res/values-es/arrays.xml b/AdvancedDisplay/res/values-es/arrays.xml new file mode 100644 index 0000000..94c10b9 --- /dev/null +++ b/AdvancedDisplay/res/values-es/arrays.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (por defecto)</item> + <item>UI</item> + <item>Vídeo</item> + <item>Vídeo cálido</item> + <item>Vídeo frío</item> + <item>Camara</item> + <item>Navegación</item> + <item>Galería</item> + <item>VT</item> + </string-array> + <string-array name="mdnie_mode_entries"> + <item>Estándar (por defecto)</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> +</resources> diff --git a/AdvancedDisplay/res/values-es/strings.xml b/AdvancedDisplay/res/values-es/strings.xml new file mode 100644 index 0000000..e7c1594 --- /dev/null +++ b/AdvancedDisplay/res/values-es/strings.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="defaults_button">Restablecer</string> + <string name="category_screen_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 escenario mDNIe</string> + <string name="mdnie_mode_title_head">Modo</string> + <string name="mdnie_mode_summary_head">Establecer modo mDNIe</string> + <string name="mdnie_negative_title_head">Modo Negativo</string> + <string name="mdnie_negative_summary_head">Habilitar/deshabilitar colores invertidos</string> +</resources> diff --git a/AdvancedDisplay/res/values-fr/arrays.xml b/AdvancedDisplay/res/values-fr/arrays.xml new file mode 100644 index 0000000..6983df7 --- /dev/null +++ b/AdvancedDisplay/res/values-fr/arrays.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (Défaut)</item> + <item>UI</item> + <item>Vidéo</item> + <item>Vidéo chaude</item> + <item>Vidéo froide</item> + <item>Caméra</item> + <item>Navigation</item> + <item>Galerie</item> + <item>VT</item> + </string-array> + <string-array name="mdnie_mode_entries"> + <item>Dynamique (Défaut)</item> + <item>Standard</item> + <item>Naturel</item> + <item>Vidéo</item> + </string-array> + <string-array name="mdnie_negative_entries"> + <item>Normal</item> + <item>Inversé</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-fr/strings.xml b/AdvancedDisplay/res/values-fr/strings.xml new file mode 100644 index 0000000..4e5e67c --- /dev/null +++ b/AdvancedDisplay/res/values-fr/strings.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="defaults_button">Réinitialiser</string> + <string name="category_screen_title">Écran</string> + <string name="screen_colors_title">Couleurs</string> + <string name="mdnie_scenario_title_head">Scénario</string> + <string name="mdnie_scenario_summary_head">Définir le scénario mDNIe</string> + <string name="mdnie_mode_title_head">Mode</string> + <string name="mdnie_mode_summary_head">Définir le mode mDNIe</string> + <string name="mdnie_negative_title_head">Mode négatif</string> + <string name="mdnie_negative_summary_head">Activer/désactiver les couleurs inversées</string> +</resources> diff --git a/AdvancedDisplay/res/values-hu/arrays.xml b/AdvancedDisplay/res/values-hu/arrays.xml new file mode 100644 index 0000000..dae3a4c --- /dev/null +++ b/AdvancedDisplay/res/values-hu/arrays.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (Alapbeállítás)</item> + <item>Felhasználói felület</item> + <item>Videó</item> + <item>Videó (Meleg árnyalat)</item> + <item>Videó (Hideg árnyalat)</item> + <item>Kamera</item> + <item>Navigáció</item> + <item>Galéria</item> + <item>VT</item> + </string-array> + <string-array name="mdnie_mode_entries"> + <item>Dinamikus (Alapbeállítás)</item> + <item>Hagyományos</item> + <item>Természetes</item> + <item>Film</item> + </string-array> + <string-array name="mdnie_negative_entries"> + <item>Normál</item> + <item>Fordított</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-hu/strings.xml b/AdvancedDisplay/res/values-hu/strings.xml new file mode 100644 index 0000000..b8fcba6 --- /dev/null +++ b/AdvancedDisplay/res/values-hu/strings.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="defaults_button">Beállítások visszaállítása alaphelyzetbe</string> + <string name="category_screen_title">Kijelző</string> + <string name="screen_colors_title">Színek</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> +</resources> diff --git a/AdvancedDisplay/res/values-nl/arrays.xml b/AdvancedDisplay/res/values-nl/arrays.xml new file mode 100644 index 0000000..d0baeed --- /dev/null +++ b/AdvancedDisplay/res/values-nl/arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (standaard)</item> + <item>Uiterlijk</item> + <item>Video</item> + <item>Video (warm)</item> + <item>Video (koud)</item> + <item>Camera</item> + <item>Navigatie</item> + <item>Galerij</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Dynamisch (standaard)</item> + <item>Standaard</item> + <item>Natuurlijk</item> + <item>Film</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Normaal</item> + <item>Omgedraaid</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-nl/strings.xml b/AdvancedDisplay/res/values-nl/strings.xml new file mode 100644 index 0000000..eafc3a5 --- /dev/null +++ b/AdvancedDisplay/res/values-nl/strings.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="defaults_button">Standaardwaarden</string> + + <string name="category_screen_title">Scherm</string> + <string name="screen_colors_title">Kleuren</string> + + <string name="mdnie_scenario_title_head">Scenario</string> + <string name="mdnie_scenario_summary_head">mDNIe-scenario instellen</string> + <string name="mdnie_mode_title_head">Modus</string> + <string name="mdnie_mode_summary_head">mDNIe-modus instellen</string> + <string name="mdnie_negative_title_head">Negatieve modus</string> + <string name="mdnie_negative_summary_head">Negatieve kleuren in-/uitschakelen</string> +</resources> diff --git a/AdvancedDisplay/res/values-pl/arrays.xml b/AdvancedDisplay/res/values-pl/arrays.xml new file mode 100644 index 0000000..30274f2 --- /dev/null +++ b/AdvancedDisplay/res/values-pl/arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (domyślnie)</item> + <item>UI</item> + <item>Wideo</item> + <item>Ciepły film</item> + <item>Zimny film</item> + <item>Kamera</item> + <item>Nawigacja</item> + <item>Galeria</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Dynamicznie (domyślnie)</item> + <item>Standardowo</item> + <item>Naturalnie</item> + <item>Film</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Normalnie</item> + <item>Odwrócony</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-pl/strings.xml b/AdvancedDisplay/res/values-pl/strings.xml new file mode 100644 index 0000000..06ad53b --- /dev/null +++ b/AdvancedDisplay/res/values-pl/strings.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="category_screen_title">Ekran</string> + <string name="screen_colors_title">Kolory</string> + <string name="mdnie_scenario_title_head">Technologia mDNIe</string> + <string name="mdnie_scenario_summary_head">Ustaw scenariusz mDNIe</string> + <string name="mdnie_mode_title_head">Tryb</string> + <string name="mdnie_mode_summary_head">Ustaw tryb mDNIe</string> + <string name="mdnie_negative_title_head">Tryb negatywu</string> + <string name="mdnie_negative_summary_head">Włącz/wyłącz odwrócone kolory</string> +</resources> diff --git a/AdvancedDisplay/res/values-pt-rBR/arrays.xml b/AdvancedDisplay/res/values-pt-rBR/arrays.xml new file mode 100644 index 0000000..77a51d2 --- /dev/null +++ b/AdvancedDisplay/res/values-pt-rBR/arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (Padrão)</item> + <item>IU</item> + <item>Vídeo</item> + <item>Vídeo Quente</item> + <item>Vídeo Frio</item> + <item>Câmera</item> + <item>Navegação</item> + <item>Galeria</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Padrão</item> + <item>Dinâmico</item> + <item>Natural</item> + <item>Filme</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Normal</item> + <item>Invertido</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-pt-rBR/strings.xml b/AdvancedDisplay/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000..76487b3 --- /dev/null +++ b/AdvancedDisplay/res/values-pt-rBR/strings.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="category_screen_title">Tela</string> + <string name="screen_colors_title">Cores</string> + <string name="mdnie_scenario_title_head">Cenário</string> + <string name="mdnie_scenario_summary_head">Define o Cenário mDNIe</string> + <string name="mdnie_mode_title_head">Modo</string> + <string name="mdnie_mode_summary_head">Define o Modo mDNIe</string> + <string name="mdnie_negative_title_head">Modo Negativo</string> + <string name="mdnie_negative_summary_head">Ativar/Desativar cores invertidas</string> +</resources> diff --git a/AdvancedDisplay/res/values-ru/arrays.xml b/AdvancedDisplay/res/values-ru/arrays.xml new file mode 100644 index 0000000..a32bc26 --- /dev/null +++ b/AdvancedDisplay/res/values-ru/arrays.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (По умолч.)</item> + <item>Видео</item> + <item>Видео (тёпл.)</item> + <item>Видео (хол.)</item> + <item>Камера</item> + <item>Навигация</item> + <item>Галерея</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Динамический (По умолч.)</item> + <item>Стандартный</item> + <item>Натуральный</item> + <item>Кино</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Нормально</item> + <item>Инверсия</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-ru/strings.xml b/AdvancedDisplay/res/values-ru/strings.xml new file mode 100644 index 0000000..9cabd97 --- /dev/null +++ b/AdvancedDisplay/res/values-ru/strings.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="category_screen_title">Экран</string> + <string name="screen_colors_title">Цвета</string> + <string name="mdnie_scenario_title_head">Сценарий</string> + <string name="mdnie_scenario_summary_head">Установка сценария mDNIe</string> + <string name="mdnie_mode_title_head">Режим</string> + <string name="mdnie_mode_summary_head">Установка режима mDNIe</string> + <string name="mdnie_negative_title_head">Негатив</string> + <string name="mdnie_negative_summary_head">Вкл./выкл. инверсии цветов</string> +</resources> diff --git a/AdvancedDisplay/res/values-zh-rCN/arrays.xml b/AdvancedDisplay/res/values-zh-rCN/arrays.xml new file mode 100644 index 0000000..8b295c4 --- /dev/null +++ b/AdvancedDisplay/res/values-zh-rCN/arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (默认)</item> + <item>界面</item> + <item>影片</item> + <item>影片 (温)</item> + <item>影片 (冷)</item> + <item>相机</item> + <item>导航</item> + <item>图库</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>动态 (默认)</item> + <item>标准</item> + <item>自然</item> + <item>电影</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>正常</item> + <item>反色</item> + </string-array> +</resources> diff --git a/AdvancedDisplay/res/values-zh-rCN/strings.xml b/AdvancedDisplay/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000..b5ee6f6 --- /dev/null +++ b/AdvancedDisplay/res/values-zh-rCN/strings.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="category_screen_title">屏幕</string> + <string name="screen_colors_title">颜色</string> + <string name="mdnie_scenario_title_head">场景</string> + <string name="mdnie_scenario_summary_head">设置 mDNIe 场景</string> + <string name="mdnie_mode_title_head">模式</string> + <string name="mdnie_mode_summary_head">设置 mDNIe 模式</string> + <string name="mdnie_negative_title_head">负极模式</string> + <string name="mdnie_negative_summary_head">启用/禁用反色</string> +</resources> diff --git a/AdvancedDisplay/res/values/arrays.xml b/AdvancedDisplay/res/values/arrays.xml new file mode 100644 index 0000000..cff1afa --- /dev/null +++ b/AdvancedDisplay/res/values/arrays.xml @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (Default)</item> + <item>UI</item> + <item>Video</item> + <item>Video Warm</item> + <item>Video Cold</item> + <item>Camera</item> + <item>Navigation</item> + <item>Gallery</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_scenario_entries_values" translatable="false"> + <item>0</item> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + <item>5</item> + <item>6</item> + <item>7</item> + <item>8</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Dynamic (Default)</item> + <item>Standard</item> + <item>Natural</item> + <item>Movie</item> + </string-array> + + <string-array name="mdnie_mode_entries_values" translatable="false"> + <item>0</item> + <item>1</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="touchkey_timeout_entries"> + <item>Never</item> + <item>1 second</item> + <item>2 seconds</item> + <item>3 seconds (Default)</item> + <item>4 seconds</item> + <item>5 seconds</item> + <item>6 seconds</item> + </string-array> + + <string-array name="touchkey_timeout_entries_values" translatable="false"> + <item>0</item> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + <item>5</item> + <item>6</item> + </string-array> + + <string-array name="led_fade_entries"> + <item>Blinking</item> + <item>Fading</item> + </string-array> + + <string-array name="led_fade_entries_values" translatable="false"> + <item>0</item> + <item>1</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/AdvancedDisplay/res/values/config.xml b/AdvancedDisplay/res/values/config.xml new file mode 100644 index 0000000..5e4be8f --- /dev/null +++ b/AdvancedDisplay/res/values/config.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<!-- These resources are around just to allow their values to be customized + for different hardware and product builds. --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- Vibrator Tuning --> + <bool name="has_vibrator_tuning">true</bool> + <string name="vibrator_sysfs_file" translatable="false">"/sys/vibrator/pwm_val"</string> + <string name="intensity_max_value" translatable="false">100</string> + <string name="intensity_warning_threshold" translatable="false">75</string> + <string name="intensity_default_value" translatable="false">50</string> + <string name="intensity_min_value" translatable="false">0</string> + + <!-- S-Pen --> + <string name="spen_sysfs_file" translatable="false">"/sys/class/sec/sec_epen"</string> + <string name="spen_powersaving_sysfs_file" translatable="false">"/sys/class/sec/sec_epen/epen_saving_mode"</string> + + <!-- Audio Tuning --> + <bool name="has_incall_audio_tuning">false</bool> + <bool name="has_output_audio_tuning">false</bool> + + <string name="incall_max_value" translatable="false">10</string> + <string name="incall_warning_threshold" translatable="false">9</string> + <string name="incall_default_value" translatable="false">5</string> + <string name="incall_min_value" translatable="false">1</string> + <string name="audioout_max_value" translatable="false">63</string> + <string name="audioout_warning_threshold" translatable="false">60</string> + <string name="audioout_default_value" translatable="false">50</string> + <string name="audioout_min_value" translatable="false">0</string> + + <!-- HSPA --> + <bool name="has_hspa">true</bool> + + <!-- Touchkey --> + <bool name="has_touchkey">true</bool> + + <!-- MDNIE --> + <string name="mdnie_cabc_sysfs_file" translatable="false">"/sys/class/lcd/panel/power_reduce"</string> + <string name="mdnie_scenario_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/scenario"</string> + <string name="mdnie_mode_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/mode"</string> + <string name="mdnie_negative_sysfs_file" translatable="false">"/sys/class/mdnie/mdnie/negative"</string> + +</resources> diff --git a/AdvancedDisplay/res/values/strings.xml b/AdvancedDisplay/res/values/strings.xml new file mode 100644 index 0000000..d7438f4 --- /dev/null +++ b/AdvancedDisplay/res/values/strings.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012-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. + --> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Advanced Display</string> + + <string name="defaults_button">Reset to default</string> + + <!-- Screen Preference --> + <string name="category_screen_title">Screen</string> + <string name="screen_colors_title">Colors</string> + + <!-- mDNIe --> + <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> + +</resources> diff --git a/AdvancedDisplay/res/xml/screen_preferences.xml b/AdvancedDisplay/res/xml/screen_preferences.xml new file mode 100644 index 0000000..56e536c --- /dev/null +++ b/AdvancedDisplay/res/xml/screen_preferences.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + + <!-- Screen --> + <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="0" /> + + <!-- 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" /> + </PreferenceCategory> + +</PreferenceScreen> diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java new file mode 100644 index 0000000..d838c31 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/DisplaySettings.java @@ -0,0 +1,162 @@ +/* + * 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 DisplaySettings 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_USE_DOCK_AUDIO = "dock_audio"; + public static final String KEY_CATEGORY_SPEN = "category_spen"; + public static final String KEY_SPEN_POWER_SAVING_MODE = "spen_power_saving"; + + 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.setTitle(R.string.app_name); + bar.setDisplayHomeAsUpEnabled(true); + + mTabsAdapter = new TabsAdapter(this, mViewPager); + mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), + ScreenFragmentActivity.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) { + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + DisplaySettings.this.onBackPressed(); + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java new file mode 100644 index 0000000..7b64a4f --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.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 android.content.Context; +import android.content.res.Resources; +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.PreferenceCategory; +import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.PreferenceScreen; +import android.util.Log; + +import com.cyanogenmod.settings.device.R; + +public class ScreenFragmentActivity extends PreferenceFragment { + + private static final String PREF_ENABLED = "1"; + private static final String TAG = "DisplaySettings_Screen"; + private mDNIeScenario mmDNIeScenario; + private mDNIeMode mmDNIeMode; + private mDNIeNegative mmDNIeNegative; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.screen_preferences); + PreferenceScreen preferenceScreen = getPreferenceScreen(); + Resources res = getResources(); + + /* mDNIe */ + mmDNIeScenario = (mDNIeScenario) findPreference(DisplaySettings.KEY_MDNIE_SCENARIO); + mmDNIeScenario.setEnabled(mDNIeScenario.isSupported(res.getString(R.string.mdnie_scenario_sysfs_file))); + + mmDNIeMode = (mDNIeMode) findPreference(DisplaySettings.KEY_MDNIE_MODE); + mmDNIeMode.setEnabled(mDNIeMode.isSupported(res.getString(R.string.mdnie_mode_sysfs_file))); + + mmDNIeNegative = (mDNIeNegative) findPreference(DisplaySettings.KEY_MDNIE_NEGATIVE); + mmDNIeNegative.setEnabled(mDNIeNegative.isSupported(res.getString(R.string.mdnie_negative_sysfs_file))); + + } + + @Override + public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { + + 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/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java new file mode 100644 index 0000000..2bada88 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Startup.java @@ -0,0 +1,32 @@ +/* + * 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); + ScreenFragmentActivity.restore(context); + } +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java new file mode 100644 index 0000000..4ca2e9e --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/Utils.java @@ -0,0 +1,163 @@ +/* + * 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.util.Log; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.SyncFailedException; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Context; + +public class Utils { + + private static final String TAG = "DeviceSettings_Utils"; + private static final String TAG_READ = "DeviceSettings_Utils_Read"; + private static final String TAG_WRITE = "DeviceSettings_Utils_Write"; + + // Read value from sysfs interface + public static String readOneLine(String sFile) { + BufferedReader brBuffer; + String sLine = null; + + try { + brBuffer = new BufferedReader(new FileReader(sFile), 512); + try { + sLine = brBuffer.readLine(); + } finally { + Log.w(TAG_READ, "file " + sFile + ": " + sLine); + brBuffer.close(); + } + } catch (Exception e) { + Log.e(TAG_READ, "IO Exception when reading /sys/ file", e); + } + return sLine; + } + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, String value) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(new File(filename), false); + fos.write(value.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + + } + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, Boolean value) { + FileOutputStream fos = null; + String sEnvia; + try { + fos = new FileOutputStream(new File(filename), false); + if (value) + sEnvia = "1"; + else + sEnvia = "0"; + fos.write(sEnvia.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + } + + /** + * 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/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java new file mode 100644 index 0000000..c777d72 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeMode.java @@ -0,0 +1,61 @@ +/* + * 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 { + + private static String FILE = null; + + public mDNIeMode(Context context, AttributeSet attrs) { + super(context, attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_mode_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_MODE, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java new file mode 100644 index 0000000..bde9946 --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeNegative.java @@ -0,0 +1,61 @@ +/* + * 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 { + + private static String FILE = null; + + public mDNIeNegative(Context context, AttributeSet attrs) { + super(context, attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie user mode setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_negative_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_NEGATIVE, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} diff --git a/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java new file mode 100644 index 0000000..cbab69d --- /dev/null +++ b/AdvancedDisplay/src/com/cyanogenmod/settings/device/mDNIeScenario.java @@ -0,0 +1,61 @@ +/* + * 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 { + + private static String FILE = null; + + public mDNIeScenario(Context context, AttributeSet attrs) { + super(context,attrs); + this.setOnPreferenceChangeListener(this); + FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); + } + + public static boolean isSupported(String filePath) { + return Utils.fileExists(filePath); + } + + /** + * Restore mdnie "camera" setting from SharedPreferences. (Write to kernel.) + * @param context The context to read the SharedPreferences from + */ + public static void restore(Context context) { + FILE = context.getResources().getString(R.string.mdnie_scenario_sysfs_file); + if (!isSupported(FILE)) { + return; + } + + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + Utils.writeValue(FILE, sharedPrefs.getString(DisplaySettings.KEY_MDNIE_SCENARIO, "0")); + } + + public boolean onPreferenceChange(Preference preference, Object newValue) { + Utils.writeValue(FILE, (String) newValue); + return true; + } + +} |